From 97122aff1047cc276e45cdc01db80bdb09d54607 Mon Sep 17 00:00:00 2001 From: novalisdenahi Date: Thu, 20 Feb 2025 17:41:51 +0100 Subject: [PATCH 1/3] Update GENERATE.md to fix additional properties checks --- GENERATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GENERATE.md b/GENERATE.md index 81f88a2..86a9af1 100644 --- a/GENERATE.md +++ b/GENERATE.md @@ -1,8 +1,8 @@ 1. Regenerate public api Linux: - ```docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v7.7.0 generate -i https://api.configcat.com/docs/v1/swagger.json -g java -o /local --additional-properties=modelPackage=com.configcat.publicapi.java.client.model,apiPackage=com.configcat.publicapi.java.client.api,invokerPackage=com.configcat.publicapi.java.client,groupId=com.configcat,artifactId=configcat-publicapi-java-client,dateLibrary=java8,useRuntimeException=true``` + ```docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v7.7.0 generate -i https://api.configcat.com/docs/v1/swagger.json -g java -o /local --additional-properties=modelPackage=com.configcat.publicapi.java.client.model,apiPackage=com.configcat.publicapi.java.client.api,invokerPackage=com.configcat.publicapi.java.client,groupId=com.configcat,artifactId=configcat-publicapi-java-client,dateLibrary=java8,useRuntimeException=true,disallowAdditionalPropertiesIfNotPresent=false``` Windows: - ```docker run --rm -v %CD%:/local openapitools/openapi-generator-cli:v7.7.0 generate -i https://api.configcat.com/docs/v1/swagger.json -g java -o /local --additional-properties=modelPackage=com.configcat.publicapi.java.client.model,apiPackage=com.configcat.publicapi.java.client.api,invokerPackage=com.configcat.publicapi.java.client,groupId=com.configcat,artifactId=configcat-publicapi-java-client,dateLibrary=java8,useRuntimeException=true``` + ```docker run --rm -v %CD%:/local openapitools/openapi-generator-cli:v7.7.0 generate -i https://api.configcat.com/docs/v1/swagger.json -g java -o /local --additional-properties=modelPackage=com.configcat.publicapi.java.client.model,apiPackage=com.configcat.publicapi.java.client.api,invokerPackage=com.configcat.publicapi.java.client,groupId=com.configcat,artifactId=configcat-publicapi-java-client,dateLibrary=java8,useRuntimeException=true,disallowAdditionalPropertiesIfNotPresent=false``` From d96ee9376bd16069bf45896686c9453487e34850 Mon Sep 17 00:00:00 2001 From: novalisdenahi Date: Thu, 20 Feb 2025 17:56:20 +0100 Subject: [PATCH 2/3] Regenerate --- README.md | 2 +- api/openapi.yaml | 118 +- docs/AuditLogType.md | 22 + docs/AuditLogsApi.md | 4 +- docs/CreateTagModel.md | 2 +- docs/SettingModel.md | 1 + docs/UpdateTagModel.md | 2 +- .../publicapi/java/client/ApiCallback.java | 6 +- .../publicapi/java/client/ApiClient.java | 479 ++-- .../publicapi/java/client/ApiException.java | 77 +- .../publicapi/java/client/ApiResponse.java | 26 +- .../publicapi/java/client/Configuration.java | 16 +- .../java/client/GzipRequestInterceptor.java | 21 +- .../configcat/publicapi/java/client/JSON.java | 444 ++-- .../configcat/publicapi/java/client/Pair.java | 10 +- .../java/client/ProgressRequestBody.java | 11 +- .../java/client/ProgressResponseBody.java | 11 +- .../java/client/ServerConfiguration.java | 28 +- .../publicapi/java/client/ServerVariable.java | 13 +- .../publicapi/java/client/StringUtil.java | 120 +- .../java/client/api/AuditLogsApi.java | 626 ++---- .../java/client/api/CodeReferencesApi.java | 445 ++-- .../publicapi/java/client/api/ConfigsApi.java | 770 +++---- .../java/client/api/EnvironmentsApi.java | 824 +++---- .../api/FeatureFlagSettingValuesApi.java | 1233 +++------- ...eatureFlagSettingValuesUsingSdkKeyApi.java | 777 ++----- ...tureFlagSettingValuesUsingSdkKeyV2Api.java | 825 ++----- .../api/FeatureFlagSettingValuesV2Api.java | 1258 +++-------- .../client/api/FeatureFlagsSettingsApi.java | 1027 ++++----- .../java/client/api/IntegrationLinksApi.java | 910 +++----- .../java/client/api/IntegrationsApi.java | 883 +++----- .../publicapi/java/client/api/MeApi.java | 106 +- .../publicapi/java/client/api/MembersApi.java | 1576 +++++-------- .../java/client/api/OrganizationsApi.java | 121 +- .../java/client/api/PermissionGroupsApi.java | 817 +++---- .../java/client/api/ProductsApi.java | 1056 ++++----- .../publicapi/java/client/api/SdkKeysApi.java | 165 +- .../java/client/api/SegmentsApi.java | 771 +++---- .../publicapi/java/client/api/TagsApi.java | 851 +++---- .../java/client/api/WebhooksApi.java | 1164 ++++------ .../java/client/auth/ApiKeyAuth.java | 108 +- .../java/client/auth/Authentication.java | 18 +- .../java/client/auth/HttpBasicAuth.java | 29 +- .../java/client/auth/HttpBearerAuth.java | 103 +- .../client/model/AbstractOpenApiSchema.java | 45 +- .../java/client/model/AccessType.java | 86 +- .../AddOrUpdateIntegrationLinkModel.java | 469 ++-- .../AddOrUpdateJiraIntegrationLinkModel.java | 657 +++--- .../java/client/model/AuditLogItemModel.java | 1145 +++++----- .../java/client/model/AuditLogType.java | 420 ++-- .../java/client/model/CodeReferenceModel.java | 947 ++++---- .../client/model/CodeReferenceRequest.java | 991 ++++---- .../model/ComparisonValueListModel.java | 478 ++-- .../client/model/ComparisonValueModel.java | 592 ++--- .../java/client/model/ConditionModel.java | 543 +++-- .../java/client/model/ConfigModel.java | 834 +++---- .../model/ConfigSettingFormulaModel.java | 1259 ++++++----- .../model/ConfigSettingFormulasModel.java | 726 +++--- .../client/model/ConfigSettingValueModel.java | 1126 +++++----- .../model/ConfigSettingValuesModel.java | 724 +++--- .../java/client/model/ConnectRequest.java | 453 ++-- .../client/model/CreateConfigRequest.java | 638 +++--- .../client/model/CreateEnvironmentModel.java | 637 +++--- .../client/model/CreateIntegrationModel.java | 737 +++--- .../CreateOrUpdateEnvironmentAccessModel.java | 456 ++-- .../model/CreatePermissionGroupRequest.java | 1912 ++++++++-------- .../client/model/CreateProductRequest.java | 573 ++--- .../java/client/model/CreateSegmentModel.java | 711 +++--- .../model/CreateSettingInitialValues.java | 900 ++++---- .../java/client/model/CreateTagModel.java | 476 ++-- .../model/DeleteIntegrationLinkModel.java | 381 ++-- .../model/DeleteRepositoryReportsRequest.java | 647 +++--- .../client/model/EnvironmentAccessModel.java | 834 +++---- .../client/model/EnvironmentAccessType.java | 86 +- .../java/client/model/EnvironmentModel.java | 823 +++---- .../java/client/model/EvaluationVersion.java | 83 +- .../client/model/FeatureFlagLimitations.java | 763 ++++--- .../java/client/model/FlagReference.java | 470 ++-- .../java/client/model/InitialValue.java | 453 ++-- .../client/model/IntegrationLinkDetail.java | 742 +++--- .../model/IntegrationLinkDetailsModel.java | 477 ++-- .../client/model/IntegrationLinkModel.java | 635 +++--- .../client/model/IntegrationLinkType.java | 86 +- .../java/client/model/IntegrationModel.java | 897 ++++---- .../java/client/model/IntegrationType.java | 108 +- .../java/client/model/IntegrationsModel.java | 443 ++-- .../java/client/model/InvitationModel.java | 670 +++--- .../client/model/InviteMembersRequest.java | 470 ++-- .../java/client/model/JsonPatchOperation.java | 632 +++--- .../java/client/model/KeyGenerationMode.java | 104 +- .../publicapi/java/client/model/MeModel.java | 449 ++-- .../java/client/model/MemberModel.java | 689 +++--- .../model/ModifyIntegrationRequest.java | 678 +++--- .../java/client/model/OperationType.java | 112 +- .../client/model/OrganizationAdminModel.java | 622 ++--- .../model/OrganizationInvitationModel.java | 880 ++++---- .../client/model/OrganizationMemberModel.java | 721 +++--- .../model/OrganizationMembersModel.java | 665 +++--- .../java/client/model/OrganizationModel.java | 465 ++-- .../OrganizationPermissionGroupModel.java | 461 ++-- .../model/OrganizationPermissionModel.java | 440 ++-- .../model/OrganizationProductModel.java | 466 ++-- .../client/model/PercentageOptionModel.java | 439 ++-- .../client/model/PermissionGroupModel.java | 1993 ++++++++--------- .../java/client/model/PreferencesModel.java | 717 +++--- .../client/model/PrerequisiteComparator.java | 84 +- .../model/PrerequisiteFlagConditionModel.java | 553 +++-- .../java/client/model/ProductModel.java | 740 +++--- .../model/ReasonRequiredEnvironmentModel.java | 568 ++--- .../java/client/model/ReferenceLine.java | 466 ++-- .../java/client/model/ReferenceLines.java | 774 ++++--- .../client/model/ReplaceSettingModel.java | 656 +++--- .../model/RolloutPercentageItemModel.java | 458 ++-- .../client/model/RolloutRuleComparator.java | 155 +- .../java/client/model/RolloutRuleModel.java | 760 ++++--- .../java/client/model/SdkKeysModel.java | 462 ++-- .../java/client/model/SegmentComparator.java | 84 +- .../client/model/SegmentConditionModel.java | 451 ++-- .../java/client/model/SegmentListModel.java | 1083 ++++----- .../java/client/model/SegmentModel.java | 1224 +++++----- .../java/client/model/SettingDataModel.java | 1001 +++++---- .../client/model/SettingFormulaModel.java | 1503 ++++++------- .../java/client/model/SettingModel.java | 1012 +++++---- .../java/client/model/SettingTagModel.java | 611 ++--- .../java/client/model/SettingType.java | 90 +- .../java/client/model/SettingValueModel.java | 1371 ++++++------ .../publicapi/java/client/model/TagModel.java | 619 ++--- .../java/client/model/TargetingRuleModel.java | 634 +++--- .../client/model/UpdateConfigRequest.java | 559 +++-- .../client/model/UpdateEnvironmentModel.java | 623 +++--- .../model/UpdateEvaluationFormulaModel.java | 628 +++--- .../UpdateEvaluationFormulaWithIdModel.java | 686 +++--- .../model/UpdateEvaluationFormulasModel.java | 452 ++-- .../model/UpdateMemberPermissionsRequest.java | 629 +++--- .../model/UpdatePermissionGroupRequest.java | 1898 ++++++++-------- .../model/UpdatePreferencesRequest.java | 720 +++--- .../client/model/UpdateProductRequest.java | 559 +++-- .../UpdateReasonRequiredEnvironmentModel.java | 442 ++-- .../java/client/model/UpdateSegmentModel.java | 698 +++--- .../client/model/UpdateSettingValueModel.java | 626 +++--- .../UpdateSettingValueWithSettingIdModel.java | 688 +++--- .../model/UpdateSettingValuesWithIdModel.java | 452 ++-- .../java/client/model/UpdateTagModel.java | 462 ++-- .../java/client/model/UserComparator.java | 227 +- .../java/client/model/UserConditionModel.java | 550 +++-- .../java/client/model/UserModel.java | 621 ++--- .../java/client/model/ValueModel.java | 597 ++--- .../java/client/model/WebHookHttpMethod.java | 84 +- .../java/client/model/WebHookRequest.java | 678 +++--- .../java/client/model/WebhookConfig.java | 464 ++-- .../java/client/model/WebhookEnvironment.java | 465 ++-- .../java/client/model/WebhookHeaderModel.java | 545 +++-- .../java/client/model/WebhookModel.java | 864 +++---- .../client/model/WebhookSigningKeysModel.java | 464 ++-- 154 files changed, 44032 insertions(+), 43020 deletions(-) diff --git a/README.md b/README.md index 9af2ad5..ad273c8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ConfigCat Public Management API - API version: v1 - - Build date: 2024-10-09T12:38:06.739118192Z[Etc/UTC] + - Build date: 2025-02-20T16:55:24.304297906Z[Etc/UTC] - Generator version: 7.7.0 The purpose of this API is to access the ConfigCat platform programmatically. diff --git a/api/openapi.yaml b/api/openapi.yaml index bffa46f..55c4491 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -5714,7 +5714,6 @@ components: - custom type: string AddOrUpdateIntegrationLinkModel: - additionalProperties: false example: description: description url: url @@ -5729,7 +5728,6 @@ components: type: string type: object AddOrUpdateJiraIntegrationLinkModel: - additionalProperties: false example: jiraJwtToken: jiraJwtToken clientKey: clientKey @@ -5759,7 +5757,6 @@ components: - jiraJwtToken type: object AuditLogItemModel: - additionalProperties: false example: auditLogTypeEnum: productCreated auditLogDateTime: 2000-01-23T04:56:07.000+00:00 @@ -5877,6 +5874,7 @@ components: - samlIdpConfigurationAdded - samlIdpConfigurationRemoved - samlIdpConfigurationUpdated + - autoProvisioningEnabledChanged - organizationMemberJoined - organizationMemberProductJoinRequested - organizationMemberProductJoinRequestRejected @@ -5890,9 +5888,18 @@ components: - segmentDeleted - webhookSigningKeyDeleted - webhookSigningKeyCreated + - userProvisioningConfigurationChanged + - syncGroupProvisioningRuleChanged + - syncGroupsReordered + - syncUserProvisioningEnabled + - syncUserProvisioningDisabled + - userEmailChanged + - userFullNameChanged + - userDisabled + - awsConnected + - awsDisconnected type: string CodeReferenceModel: - additionalProperties: false example: codeReferenceId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 references: @@ -5970,7 +5977,6 @@ components: type: string type: object CodeReferenceRequest: - additionalProperties: false example: flagReferences: - references: @@ -6101,7 +6107,6 @@ components: - repository type: object ComparisonValueListModel: - additionalProperties: false example: hint: hint value: value @@ -6120,7 +6125,6 @@ components: - value type: object ComparisonValueModel: - additionalProperties: false description: The value that the user object's attribute is compared to. example: listValue: @@ -6148,7 +6152,6 @@ components: type: array type: object ConditionModel: - additionalProperties: false example: segmentCondition: comparator: isIn @@ -6181,7 +6184,6 @@ components: $ref: '#/components/schemas/PrerequisiteFlagConditionModel' type: object ConfigModel: - additionalProperties: false description: Details of the Config. example: product: @@ -6226,7 +6228,6 @@ components: $ref: '#/components/schemas/EvaluationVersion' type: object ConfigSettingFormulaModel: - additionalProperties: false example: lastVersionId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 targetingRules: @@ -6452,7 +6453,6 @@ components: type: array type: object ConfigSettingFormulasModel: - additionalProperties: false example: environment: product: @@ -6851,7 +6851,6 @@ components: $ref: '#/components/schemas/FeatureFlagLimitations' type: object ConfigSettingValueModel: - additionalProperties: false example: rolloutRules: - comparator: isOneOf @@ -6950,7 +6949,6 @@ components: type: array type: object ConfigSettingValuesModel: - additionalProperties: false example: environment: product: @@ -7112,7 +7110,6 @@ components: $ref: '#/components/schemas/FeatureFlagLimitations' type: object ConnectRequest: - additionalProperties: false example: jiraJwtToken: jiraJwtToken clientKey: clientKey @@ -7130,7 +7127,6 @@ components: - jiraJwtToken type: object CreateConfigRequest: - additionalProperties: false example: name: name description: description @@ -7160,7 +7156,6 @@ components: - name type: object CreateEnvironmentModel: - additionalProperties: false example: color: color name: name @@ -7194,7 +7189,6 @@ components: - name type: object CreateIntegrationModel: - additionalProperties: false example: integrationType: dataDog environmentIds: @@ -7241,7 +7235,6 @@ components: - parameters type: object CreateOrUpdateEnvironmentAccessModel: - additionalProperties: false example: environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 environmentAccessType: null @@ -7254,7 +7247,6 @@ components: $ref: '#/components/schemas/EnvironmentAccessType' type: object CreatePermissionGroupRequest: - additionalProperties: false example: canViewProductStatistics: true canDeleteTag: true @@ -7369,7 +7361,6 @@ components: - name type: object CreateProductRequest: - additionalProperties: false example: name: name description: description @@ -7396,7 +7387,6 @@ components: - name type: object CreateSegmentModel: - additionalProperties: false example: comparator: isOneOf comparisonValue: comparisonValue @@ -7434,7 +7424,6 @@ components: - name type: object CreateSettingInitialValues: - additionalProperties: false example: initialValues: - environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -7495,7 +7484,6 @@ components: - settingType type: object CreateTagModel: - additionalProperties: false example: color: color name: name @@ -7506,7 +7494,8 @@ components: minLength: 1 type: string color: - description: Color of the Tag. + description: "Color of the Tag. Possible values: `panther`, `whale`, `salmon`,\ + \ `lizard`, `canary`, `koala`, or any HTML color code." maxLength: 255 minLength: 0 nullable: true @@ -7515,7 +7504,6 @@ components: - name type: object DeleteIntegrationLinkModel: - additionalProperties: false example: hasRemainingIntegrationLink: true properties: @@ -7523,7 +7511,6 @@ components: type: boolean type: object DeleteRepositoryReportsRequest: - additionalProperties: false example: configId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 repository: repository @@ -7557,7 +7544,6 @@ components: - repository type: object EnvironmentAccessModel: - additionalProperties: false example: environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 color: color @@ -7602,7 +7588,6 @@ components: - none type: string EnvironmentModel: - additionalProperties: false description: Details of the Environment. example: product: @@ -7656,7 +7641,6 @@ components: - v2 type: string FeatureFlagLimitations: - additionalProperties: false description: Subscription limitations regarding Feature flag or Setting values and targeting. example: @@ -7701,7 +7685,6 @@ components: type: integer type: object FlagReference: - additionalProperties: false example: references: - file: file @@ -7751,7 +7734,6 @@ components: - settingId type: object InitialValue: - additionalProperties: false example: environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 value: "" @@ -7766,7 +7748,6 @@ components: nullable: true type: object IntegrationLinkDetail: - additionalProperties: false example: product: productId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -7838,7 +7819,6 @@ components: type: string type: object IntegrationLinkDetailsModel: - additionalProperties: false example: allIntegrationLinkCount: 1 details: @@ -7962,7 +7942,6 @@ components: type: integer type: object IntegrationLinkModel: - additionalProperties: false example: integrationLinkType: trello description: description @@ -7988,7 +7967,6 @@ components: - monday type: string IntegrationModel: - additionalProperties: false description: Details of the Integration. example: product: @@ -8058,7 +8036,6 @@ components: - pubNub type: string IntegrationsModel: - additionalProperties: false example: integrations: - product: @@ -8110,7 +8087,6 @@ components: type: array type: object InvitationModel: - additionalProperties: false example: permissionGroupId: 0 createdAt: 2000-01-23T04:56:07.000+00:00 @@ -8140,7 +8116,6 @@ components: type: boolean type: object InviteMembersRequest: - additionalProperties: false example: emails: - emails @@ -8162,7 +8137,6 @@ components: - permissionGroupId type: object JsonPatchOperation: - additionalProperties: false example: op: unknown path: path @@ -8196,7 +8170,6 @@ components: - kebabCase type: string MeModel: - additionalProperties: false example: fullName: fullName email: email @@ -8211,7 +8184,6 @@ components: type: string type: object MemberModel: - additionalProperties: false example: permissionGroupId: 0 productId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -8241,7 +8213,6 @@ components: type: string type: object ModifyIntegrationRequest: - additionalProperties: false example: environmentIds: - 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -8294,7 +8265,6 @@ components: - test type: string OrganizationAdminModel: - additionalProperties: false description: Describes an Organization Admin. example: twoFactorEnabled: true @@ -8319,7 +8289,6 @@ components: type: boolean type: object OrganizationInvitationModel: - additionalProperties: false example: permissionGroupId: 0 createdAt: 2000-01-23T04:56:07.000+00:00 @@ -8364,7 +8333,6 @@ components: type: string type: object OrganizationMemberModel: - additionalProperties: false description: Describes an Organization Member. example: twoFactorEnabled: true @@ -8408,7 +8376,6 @@ components: type: array type: object OrganizationMembersModel: - additionalProperties: false example: billingManagers: - twoFactorEnabled: true @@ -8484,7 +8451,6 @@ components: type: array type: object OrganizationModel: - additionalProperties: false description: Details of the Organization. example: organizationId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -8500,7 +8466,6 @@ components: type: string type: object OrganizationPermissionGroupModel: - additionalProperties: false description: Describes the Member's Permission Group within a Product. example: permissionGroupId: 0 @@ -8516,7 +8481,6 @@ components: type: string type: object OrganizationPermissionModel: - additionalProperties: false description: Describes the Member's permission. example: product: @@ -8532,7 +8496,6 @@ components: $ref: '#/components/schemas/OrganizationPermissionGroupModel' type: object OrganizationProductModel: - additionalProperties: false description: Describes the Member's Product. example: productId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -8548,7 +8511,6 @@ components: type: string type: object PercentageOptionModel: - additionalProperties: false example: percentage: 5 value: @@ -8569,7 +8531,6 @@ components: - value type: object PermissionGroupModel: - additionalProperties: false example: canViewProductStatistics: true canDeleteTag: true @@ -8707,7 +8668,6 @@ components: $ref: '#/components/schemas/ProductModel' type: object PreferencesModel: - additionalProperties: false example: keyGenerationMode: camelCase showVariationId: true @@ -8749,7 +8709,6 @@ components: - doesNotEqual type: string PrerequisiteFlagConditionModel: - additionalProperties: false description: Describes a condition that is based on a prerequisite flag. example: comparator: equals @@ -8774,7 +8733,6 @@ components: - prerequisiteSettingId type: object ProductModel: - additionalProperties: false description: Details of the Product. example: productId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -8811,7 +8769,6 @@ components: type: boolean type: object ReasonRequiredEnvironmentModel: - additionalProperties: false example: environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 environmentName: environmentName @@ -8831,7 +8788,6 @@ components: type: string type: object ReferenceLine: - additionalProperties: false description: Determines a code reference line. example: lineText: lineText @@ -8851,7 +8807,6 @@ components: - lineNumber type: object ReferenceLines: - additionalProperties: false example: file: file referenceLine: @@ -8901,7 +8856,6 @@ components: - referenceLine type: object ReplaceSettingModel: - additionalProperties: false example: hint: hint name: name @@ -8939,7 +8893,6 @@ components: - name type: object RolloutPercentageItemModel: - additionalProperties: false example: percentage: 0 value: "" @@ -8979,7 +8932,6 @@ components: - sensitiveIsNotOneOf type: string RolloutRuleModel: - additionalProperties: false example: comparator: isOneOf comparisonValue: comparisonValue @@ -9013,7 +8965,6 @@ components: type: string type: object SdkKeysModel: - additionalProperties: false example: secondary: secondary primary: primary @@ -9034,7 +8985,6 @@ components: - isNotIn type: string SegmentConditionModel: - additionalProperties: false description: Describes a condition that is based on a segment. example: comparator: isIn @@ -9051,7 +9001,6 @@ components: - segmentId type: object SegmentListModel: - additionalProperties: false example: createdAt: 2000-01-23T04:56:07.000+00:00 product: @@ -9118,7 +9067,6 @@ components: type: integer type: object SegmentModel: - additionalProperties: false example: product: productId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -9193,7 +9141,6 @@ components: type: string type: object SettingDataModel: - additionalProperties: false description: Metadata of a Feature Flag or Setting. example: createdAt: 2000-01-23T04:56:07.000+00:00 @@ -9247,7 +9194,6 @@ components: type: boolean type: object SettingFormulaModel: - additionalProperties: false example: targetingRules: - percentageOptions: @@ -9522,10 +9468,10 @@ components: $ref: '#/components/schemas/FeatureFlagLimitations' type: object SettingModel: - additionalProperties: false description: Metadata of a Feature Flag or Setting. example: configName: configName + createdAt: 2000-01-23T04:56:07.000+00:00 configId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 hint: hint name: name @@ -9590,6 +9536,11 @@ components: description: Name of the Feature Flag's Config. nullable: true type: string + createdAt: + description: The creation time of the Feature Flag or Setting. + format: date-time + nullable: true + type: string tags: description: The tags attached to the Feature Flag or Setting. items: @@ -9598,7 +9549,6 @@ components: type: array type: object SettingTagModel: - additionalProperties: false example: color: color tagId: 1 @@ -9627,7 +9577,6 @@ components: - double type: string SettingValueModel: - additionalProperties: false example: rolloutRules: - comparator: isOneOf @@ -9775,7 +9724,6 @@ components: type: boolean type: object TagModel: - additionalProperties: false example: product: productId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -9806,7 +9754,6 @@ components: type: string type: object TargetingRuleModel: - additionalProperties: false example: percentageOptions: - percentage: 5 @@ -9891,7 +9838,6 @@ components: $ref: '#/components/schemas/ValueModel' type: object UpdateConfigRequest: - additionalProperties: false example: name: name description: description @@ -9917,7 +9863,6 @@ components: type: integer type: object UpdateEnvironmentModel: - additionalProperties: false example: color: color name: name @@ -9950,7 +9895,6 @@ components: type: integer type: object UpdateEvaluationFormulaModel: - additionalProperties: false example: targetingRules: - percentageOptions: @@ -10104,7 +10048,6 @@ components: - defaultValue type: object UpdateEvaluationFormulaWithIdModel: - additionalProperties: false example: targetingRules: - percentageOptions: @@ -10263,7 +10206,6 @@ components: - defaultValue type: object UpdateEvaluationFormulasModel: - additionalProperties: false example: updateFormulas: - targetingRules: @@ -10543,7 +10485,6 @@ components: type: array type: object UpdateMemberPermissionsRequest: - additionalProperties: false example: removeFromPermissionGroupsWhereIdNotSet: true isBillingManager: true @@ -10574,7 +10515,6 @@ components: type: boolean type: object UpdatePermissionGroupRequest: - additionalProperties: false example: canViewProductStatistics: true canDeleteTag: true @@ -10709,7 +10649,6 @@ components: type: array type: object UpdatePreferencesRequest: - additionalProperties: false example: keyGenerationMode: camelCase showVariationId: true @@ -10746,7 +10685,6 @@ components: type: array type: object UpdateProductRequest: - additionalProperties: false example: name: name description: description @@ -10772,7 +10710,6 @@ components: type: integer type: object UpdateReasonRequiredEnvironmentModel: - additionalProperties: false example: environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 reasonRequired: true @@ -10787,7 +10724,6 @@ components: type: boolean type: object UpdateSegmentModel: - additionalProperties: false example: comparator: isOneOf comparisonValue: comparisonValue @@ -10817,7 +10753,6 @@ components: type: string type: object UpdateSettingValueModel: - additionalProperties: false example: rolloutRules: - comparator: isOneOf @@ -10856,7 +10791,6 @@ components: nullable: true type: object UpdateSettingValueWithSettingIdModel: - additionalProperties: false example: rolloutRules: - comparator: isOneOf @@ -10900,7 +10834,6 @@ components: type: integer type: object UpdateSettingValuesWithIdModel: - additionalProperties: false example: settingValues: - rolloutRules: @@ -10952,7 +10885,6 @@ components: type: array type: object UpdateTagModel: - additionalProperties: false example: color: color name: name @@ -10964,7 +10896,8 @@ components: nullable: true type: string color: - description: Color of the Tag. + description: "Color of the Tag. Possible values: `panther`, `whale`, `salmon`,\ + \ `lizard`, `canary`, `koala`, or any HTML color code." maxLength: 255 minLength: 0 nullable: true @@ -11012,7 +10945,6 @@ components: - arrayDoesNotContainAnyOf type: string UserConditionModel: - additionalProperties: false description: Describes a condition that is based on user attributes. example: comparator: isOneOf @@ -11042,7 +10974,6 @@ components: - comparisonValue type: object UserModel: - additionalProperties: false example: twoFactorEnabled: true fullName: fullName @@ -11066,7 +10997,6 @@ components: type: boolean type: object ValueModel: - additionalProperties: false description: Represents the value of a Feature Flag or Setting. example: stringValue: stringValue @@ -11099,7 +11029,6 @@ components: - post type: string WebHookRequest: - additionalProperties: false example: webHookHeaders: - isSecure: true @@ -11135,7 +11064,6 @@ components: - url type: object WebhookConfig: - additionalProperties: false description: The Config where the applied changes will invoke the Webhook. example: configId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -11151,7 +11079,6 @@ components: type: string type: object WebhookEnvironment: - additionalProperties: false description: The Environment where the applied changes will invoke the Webhook. example: environmentId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 @@ -11167,7 +11094,6 @@ components: type: string type: object WebhookHeaderModel: - additionalProperties: false example: isSecure: true value: value @@ -11191,7 +11117,6 @@ components: - value type: object WebhookModel: - additionalProperties: false example: webHookHeaders: - isSecure: true @@ -11237,7 +11162,6 @@ components: $ref: '#/components/schemas/WebhookEnvironment' type: object WebhookSigningKeysModel: - additionalProperties: false example: key1: key1 key2: key2 diff --git a/docs/AuditLogType.md b/docs/AuditLogType.md index ffebdc6..0c205d6 100644 --- a/docs/AuditLogType.md +++ b/docs/AuditLogType.md @@ -135,6 +135,8 @@ * `SAML_IDP_CONFIGURATION_UPDATED` (value: `"samlIdpConfigurationUpdated"`) +* `AUTO_PROVISIONING_ENABLED_CHANGED` (value: `"autoProvisioningEnabledChanged"`) + * `ORGANIZATION_MEMBER_JOINED` (value: `"organizationMemberJoined"`) * `ORGANIZATION_MEMBER_PRODUCT_JOIN_REQUESTED` (value: `"organizationMemberProductJoinRequested"`) @@ -161,5 +163,25 @@ * `WEBHOOK_SIGNING_KEY_CREATED` (value: `"webhookSigningKeyCreated"`) +* `USER_PROVISIONING_CONFIGURATION_CHANGED` (value: `"userProvisioningConfigurationChanged"`) + +* `SYNC_GROUP_PROVISIONING_RULE_CHANGED` (value: `"syncGroupProvisioningRuleChanged"`) + +* `SYNC_GROUPS_REORDERED` (value: `"syncGroupsReordered"`) + +* `SYNC_USER_PROVISIONING_ENABLED` (value: `"syncUserProvisioningEnabled"`) + +* `SYNC_USER_PROVISIONING_DISABLED` (value: `"syncUserProvisioningDisabled"`) + +* `USER_EMAIL_CHANGED` (value: `"userEmailChanged"`) + +* `USER_FULL_NAME_CHANGED` (value: `"userFullNameChanged"`) + +* `USER_DISABLED` (value: `"userDisabled"`) + +* `AWS_CONNECTED` (value: `"awsConnected"`) + +* `AWS_DISCONNECTED` (value: `"awsDisconnected"`) + diff --git a/docs/AuditLogsApi.md b/docs/AuditLogsApi.md index 7993fa4..0b61b06 100644 --- a/docs/AuditLogsApi.md +++ b/docs/AuditLogsApi.md @@ -65,7 +65,7 @@ public class Example { | **productId** | **UUID**| The identifier of the Product. | | | **configId** | **UUID**| The identifier of the Config. | [optional] | | **environmentId** | **UUID**| The identifier of the Environment. | [optional] | -| **auditLogType** | [**AuditLogType**](.md)| Filter Audit logs by Audit log type. | [optional] [enum: productCreated, productChanged, productOwnershipTransferred, productDeleted, productsReordered, teamMemberInvited, teamMemberInvitationRevoked, teamMemberJoined, teamMemberPermissionGroupChanged, teamMemberRemoved, teamMemberLeft, teamMemberInvitationChanged, teamMemberInvitationResent, teamMemberInvitationRejected, configCreated, configChanged, configDeleted, configsReordered, environmentCreated, environmentChanged, environmentDeleted, environmentsReordered, settingCreated, settingChanged, settingDeleted, settingsReordered, settingValueChanged, webHookCreated, webHookChanged, webHookDeleted, permissionGroupCreated, permissionGroupChanged, permissionGroupDeleted, permissionGroupDefault, apiKeyAdded, apiKeyRemoved, integrationAdded, integrationChanged, integrationRemoved, apiKeyConnected, integrationLinkAdded, integrationLinkRemoved, organizationAdded, organizationRemoved, organizationChanged, organizationSubscriptionTypeChanged, organizationAdminChanged, organizationAdminLeft, twoFactorDisabledForMember, tagAdded, tagChanged, tagRemoved, settingTagAdded, settingTagRemoved, publicApiAccessTokenAdded, publicApiAccessTokenRemoved, domainAdded, domainVerified, domainRemoved, domainSamlConfigured, domainSamlDeleted, autoProvisioningConfigurationChanged, samlIdpConfigurationAdded, samlIdpConfigurationRemoved, samlIdpConfigurationUpdated, organizationMemberJoined, organizationMemberProductJoinRequested, organizationMemberProductJoinRequestRejected, organizationMemberProductJoinRequestApproved, organizationMemberRemoved, codeReferencesUploaded, codeReferenceDeleted, codeReferenceStaleBranchDeleted, segmentCreated, segmentChanged, segmentDeleted, webhookSigningKeyDeleted, webhookSigningKeyCreated] | +| **auditLogType** | [**AuditLogType**](.md)| Filter Audit logs by Audit log type. | [optional] [enum: productCreated, productChanged, productOwnershipTransferred, productDeleted, productsReordered, teamMemberInvited, teamMemberInvitationRevoked, teamMemberJoined, teamMemberPermissionGroupChanged, teamMemberRemoved, teamMemberLeft, teamMemberInvitationChanged, teamMemberInvitationResent, teamMemberInvitationRejected, configCreated, configChanged, configDeleted, configsReordered, environmentCreated, environmentChanged, environmentDeleted, environmentsReordered, settingCreated, settingChanged, settingDeleted, settingsReordered, settingValueChanged, webHookCreated, webHookChanged, webHookDeleted, permissionGroupCreated, permissionGroupChanged, permissionGroupDeleted, permissionGroupDefault, apiKeyAdded, apiKeyRemoved, integrationAdded, integrationChanged, integrationRemoved, apiKeyConnected, integrationLinkAdded, integrationLinkRemoved, organizationAdded, organizationRemoved, organizationChanged, organizationSubscriptionTypeChanged, organizationAdminChanged, organizationAdminLeft, twoFactorDisabledForMember, tagAdded, tagChanged, tagRemoved, settingTagAdded, settingTagRemoved, publicApiAccessTokenAdded, publicApiAccessTokenRemoved, domainAdded, domainVerified, domainRemoved, domainSamlConfigured, domainSamlDeleted, autoProvisioningConfigurationChanged, samlIdpConfigurationAdded, samlIdpConfigurationRemoved, samlIdpConfigurationUpdated, autoProvisioningEnabledChanged, organizationMemberJoined, organizationMemberProductJoinRequested, organizationMemberProductJoinRequestRejected, organizationMemberProductJoinRequestApproved, organizationMemberRemoved, codeReferencesUploaded, codeReferenceDeleted, codeReferenceStaleBranchDeleted, segmentCreated, segmentChanged, segmentDeleted, webhookSigningKeyDeleted, webhookSigningKeyCreated, userProvisioningConfigurationChanged, syncGroupProvisioningRuleChanged, syncGroupsReordered, syncUserProvisioningEnabled, syncUserProvisioningDisabled, userEmailChanged, userFullNameChanged, userDisabled, awsConnected, awsDisconnected] | | **fromUtcDateTime** | **OffsetDateTime**| Filter Audit logs by starting UTC date. | [optional] | | **toUtcDateTime** | **OffsetDateTime**| Filter Audit logs by ending UTC date. | [optional] | @@ -219,7 +219,7 @@ public class Example { | **productId** | **UUID**| The identifier of the Product. | [optional] | | **configId** | **UUID**| The identifier of the Config. | [optional] | | **environmentId** | **UUID**| The identifier of the Environment. | [optional] | -| **auditLogType** | [**AuditLogType**](.md)| Filter Audit logs by Audit log type. | [optional] [enum: productCreated, productChanged, productOwnershipTransferred, productDeleted, productsReordered, teamMemberInvited, teamMemberInvitationRevoked, teamMemberJoined, teamMemberPermissionGroupChanged, teamMemberRemoved, teamMemberLeft, teamMemberInvitationChanged, teamMemberInvitationResent, teamMemberInvitationRejected, configCreated, configChanged, configDeleted, configsReordered, environmentCreated, environmentChanged, environmentDeleted, environmentsReordered, settingCreated, settingChanged, settingDeleted, settingsReordered, settingValueChanged, webHookCreated, webHookChanged, webHookDeleted, permissionGroupCreated, permissionGroupChanged, permissionGroupDeleted, permissionGroupDefault, apiKeyAdded, apiKeyRemoved, integrationAdded, integrationChanged, integrationRemoved, apiKeyConnected, integrationLinkAdded, integrationLinkRemoved, organizationAdded, organizationRemoved, organizationChanged, organizationSubscriptionTypeChanged, organizationAdminChanged, organizationAdminLeft, twoFactorDisabledForMember, tagAdded, tagChanged, tagRemoved, settingTagAdded, settingTagRemoved, publicApiAccessTokenAdded, publicApiAccessTokenRemoved, domainAdded, domainVerified, domainRemoved, domainSamlConfigured, domainSamlDeleted, autoProvisioningConfigurationChanged, samlIdpConfigurationAdded, samlIdpConfigurationRemoved, samlIdpConfigurationUpdated, organizationMemberJoined, organizationMemberProductJoinRequested, organizationMemberProductJoinRequestRejected, organizationMemberProductJoinRequestApproved, organizationMemberRemoved, codeReferencesUploaded, codeReferenceDeleted, codeReferenceStaleBranchDeleted, segmentCreated, segmentChanged, segmentDeleted, webhookSigningKeyDeleted, webhookSigningKeyCreated] | +| **auditLogType** | [**AuditLogType**](.md)| Filter Audit logs by Audit log type. | [optional] [enum: productCreated, productChanged, productOwnershipTransferred, productDeleted, productsReordered, teamMemberInvited, teamMemberInvitationRevoked, teamMemberJoined, teamMemberPermissionGroupChanged, teamMemberRemoved, teamMemberLeft, teamMemberInvitationChanged, teamMemberInvitationResent, teamMemberInvitationRejected, configCreated, configChanged, configDeleted, configsReordered, environmentCreated, environmentChanged, environmentDeleted, environmentsReordered, settingCreated, settingChanged, settingDeleted, settingsReordered, settingValueChanged, webHookCreated, webHookChanged, webHookDeleted, permissionGroupCreated, permissionGroupChanged, permissionGroupDeleted, permissionGroupDefault, apiKeyAdded, apiKeyRemoved, integrationAdded, integrationChanged, integrationRemoved, apiKeyConnected, integrationLinkAdded, integrationLinkRemoved, organizationAdded, organizationRemoved, organizationChanged, organizationSubscriptionTypeChanged, organizationAdminChanged, organizationAdminLeft, twoFactorDisabledForMember, tagAdded, tagChanged, tagRemoved, settingTagAdded, settingTagRemoved, publicApiAccessTokenAdded, publicApiAccessTokenRemoved, domainAdded, domainVerified, domainRemoved, domainSamlConfigured, domainSamlDeleted, autoProvisioningConfigurationChanged, samlIdpConfigurationAdded, samlIdpConfigurationRemoved, samlIdpConfigurationUpdated, autoProvisioningEnabledChanged, organizationMemberJoined, organizationMemberProductJoinRequested, organizationMemberProductJoinRequestRejected, organizationMemberProductJoinRequestApproved, organizationMemberRemoved, codeReferencesUploaded, codeReferenceDeleted, codeReferenceStaleBranchDeleted, segmentCreated, segmentChanged, segmentDeleted, webhookSigningKeyDeleted, webhookSigningKeyCreated, userProvisioningConfigurationChanged, syncGroupProvisioningRuleChanged, syncGroupsReordered, syncUserProvisioningEnabled, syncUserProvisioningDisabled, userEmailChanged, userFullNameChanged, userDisabled, awsConnected, awsDisconnected] | | **fromUtcDateTime** | **OffsetDateTime**| Filter Audit logs by starting UTC date. | [optional] | | **toUtcDateTime** | **OffsetDateTime**| Filter Audit logs by ending UTC date. | [optional] | diff --git a/docs/CreateTagModel.md b/docs/CreateTagModel.md index 207eb70..dbe3d41 100644 --- a/docs/CreateTagModel.md +++ b/docs/CreateTagModel.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**name** | **String** | Name of the Tag. | | -|**color** | **String** | Color of the Tag. | [optional] | +|**color** | **String** | Color of the Tag. Possible values: `panther`, `whale`, `salmon`, `lizard`, `canary`, `koala`, or any HTML color code. | [optional] | diff --git a/docs/SettingModel.md b/docs/SettingModel.md index 4cfff67..664391a 100644 --- a/docs/SettingModel.md +++ b/docs/SettingModel.md @@ -16,6 +16,7 @@ Metadata of a Feature Flag or Setting. |**settingType** | **SettingType** | | [optional] | |**configId** | **UUID** | Identifier of the Feature Flag's Config. | [optional] | |**configName** | **String** | Name of the Feature Flag's Config. | [optional] | +|**createdAt** | **OffsetDateTime** | The creation time of the Feature Flag or Setting. | [optional] | |**tags** | [**List<TagModel>**](TagModel.md) | The tags attached to the Feature Flag or Setting. | [optional] | diff --git a/docs/UpdateTagModel.md b/docs/UpdateTagModel.md index 51223d1..cdecff6 100644 --- a/docs/UpdateTagModel.md +++ b/docs/UpdateTagModel.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**name** | **String** | Name of the Tag. | [optional] | -|**color** | **String** | Color of the Tag. | [optional] | +|**color** | **String** | Color of the Tag. Possible values: `panther`, `whale`, `salmon`, `lizard`, `canary`, `koala`, or any HTML color code. | [optional] | diff --git a/src/main/java/com/configcat/publicapi/java/client/ApiCallback.java b/src/main/java/com/configcat/publicapi/java/client/ApiCallback.java index 626200d..244fd5b 100644 --- a/src/main/java/com/configcat/publicapi/java/client/ApiCallback.java +++ b/src/main/java/com/configcat/publicapi/java/client/ApiCallback.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,11 +10,13 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client; +import java.io.IOException; -import java.util.List; import java.util.Map; +import java.util.List; /** * Callback for asynchronous API call. diff --git a/src/main/java/com/configcat/publicapi/java/client/ApiClient.java b/src/main/java/com/configcat/publicapi/java/client/ApiClient.java index dd412c0..d5fee4b 100644 --- a/src/main/java/com/configcat/publicapi/java/client/ApiClient.java +++ b/src/main/java/com/configcat/publicapi/java/client/ApiClient.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,12 +10,19 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client; +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; -import com.configcat.publicapi.java.client.auth.ApiKeyAuth; -import com.configcat.publicapi.java.client.auth.Authentication; -import com.configcat.publicapi.java.client.auth.HttpBasicAuth; +import javax.net.ssl.*; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -32,6 +39,7 @@ import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; import java.text.DateFormat; import java.time.LocalDate; import java.time.OffsetDateTime; @@ -39,29 +47,28 @@ import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.net.ssl.*; -import okhttp3.*; -import okhttp3.internal.http.HttpMethod; -import okhttp3.internal.tls.OkHostnameVerifier; -import okhttp3.logging.HttpLoggingInterceptor; -import okhttp3.logging.HttpLoggingInterceptor.Level; -import okio.Buffer; -import okio.BufferedSink; -import okio.Okio; -/** ApiClient class. */ +import com.configcat.publicapi.java.client.auth.Authentication; +import com.configcat.publicapi.java.client.auth.HttpBasicAuth; +import com.configcat.publicapi.java.client.auth.HttpBearerAuth; +import com.configcat.publicapi.java.client.auth.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ public class ApiClient { private String basePath = "https://api.configcat.com"; - protected List servers = - new ArrayList( - Arrays.asList( - new ServerConfiguration( - "https://api.configcat.com", - "No description provided", - new HashMap()))); + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "https://api.configcat.com", + "No description provided", + new HashMap() + ) + )); protected Integer serverIndex = 0; protected Map serverVariables = null; private boolean debugging = false; @@ -85,7 +92,9 @@ public class ApiClient { private HttpLoggingInterceptor loggingInterceptor; - /** Basic constructor for ApiClient */ + /** + * Basic constructor for ApiClient + */ public ApiClient() { init(); initHttpClient(); @@ -119,7 +128,7 @@ private void initHttpClient() { private void initHttpClient(List interceptors) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.addNetworkInterceptor(getProgressInterceptor()); - for (Interceptor interceptor : interceptors) { + for (Interceptor interceptor: interceptors) { builder.addInterceptor(interceptor); } @@ -236,9 +245,9 @@ public boolean isVerifyingSsl() { } /** - * Configure whether to verify certificate and hostname when making https requests. Default to - * true. NOTE: Do NOT set to false in production code, otherwise you would face multiple types - * of cryptographic attacks. + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. * * @param verifyingSsl True to verify TLS/SSL connection * @return ApiClient @@ -259,8 +268,8 @@ public InputStream getSslCaCert() { } /** - * Configure the CA certificate to be trusted when making https requests. Use null to reset to - * default. + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. * * @param sslCaCert input stream for SSL CA cert * @return ApiClient @@ -272,7 +281,7 @@ public ApiClient setSslCaCert(InputStream sslCaCert) { } /** - * Getter for the field keyManagers. + *

Getter for the field keyManagers.

* * @return an array of {@link javax.net.ssl.KeyManager} objects */ @@ -281,8 +290,8 @@ public KeyManager[] getKeyManagers() { } /** - * Configure client keys to use for authorization in an SSL session. Use null to reset to - * default. + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. * * @param managers The KeyManagers to use * @return ApiClient @@ -294,7 +303,7 @@ public ApiClient setKeyManagers(KeyManager[] managers) { } /** - * Getter for the field dateFormat. + *

Getter for the field dateFormat.

* * @return a {@link java.text.DateFormat} object */ @@ -303,7 +312,7 @@ public DateFormat getDateFormat() { } /** - * Setter for the field dateFormat. + *

Setter for the field dateFormat.

* * @param dateFormat a {@link java.text.DateFormat} object * @return a {@link com.configcat.publicapi.java.client.ApiClient} object @@ -314,7 +323,7 @@ public ApiClient setDateFormat(DateFormat dateFormat) { } /** - * Set SqlDateFormat. + *

Set SqlDateFormat.

* * @param dateFormat a {@link java.text.DateFormat} object * @return a {@link com.configcat.publicapi.java.client.ApiClient} object @@ -325,7 +334,7 @@ public ApiClient setSqlDateFormat(DateFormat dateFormat) { } /** - * Set OffsetDateTimeFormat. + *

Set OffsetDateTimeFormat.

* * @param dateFormat a {@link java.time.format.DateTimeFormatter} object * @return a {@link com.configcat.publicapi.java.client.ApiClient} object @@ -336,7 +345,7 @@ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { } /** - * Set LocalDateFormat. + *

Set LocalDateFormat.

* * @param dateFormat a {@link java.time.format.DateTimeFormatter} object * @return a {@link com.configcat.publicapi.java.client.ApiClient} object @@ -347,7 +356,7 @@ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { } /** - * Set LenientOnJson. + *

Set LenientOnJson.

* * @param lenientOnJson a boolean * @return a {@link com.configcat.publicapi.java.client.ApiClient} object @@ -376,6 +385,7 @@ public Authentication getAuthentication(String authName) { return authentications.get(authName); } + /** * Helper method to set username for the first HTTP basic authentication. * @@ -453,8 +463,7 @@ public void setAccessToken(String accessToken) { * @param region Region * @param service Service to access to */ - public void setAWS4Configuration( - String accessKey, String secretKey, String region, String service) { + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { throw new RuntimeException("No AWS4 authentication configured!"); } @@ -467,12 +476,7 @@ public void setAWS4Configuration( * @param region Region * @param service Service to access to */ - public void setAWS4Configuration( - String accessKey, - String secretKey, - String sessionToken, - String region, - String service) { + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { throw new RuntimeException("No AWS4 authentication configured!"); } @@ -544,12 +548,11 @@ public ApiClient setDebugging(boolean debugging) { } /** - * The path of temporary folder used to store downloaded files from endpoints with file - * response. The default value is null, i.e. using the system's default temporary - * folder. + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. * - * @see createTempFile + * @see createTempFile * @return Temporary folder path */ public String getTempFolderPath() { @@ -577,18 +580,15 @@ public int getConnectTimeout() { } /** - * Sets the connect timeout (in milliseconds). A value of 0 means no timeout, otherwise values - * must be between 1 and {@link java.lang.Integer#MAX_VALUE}. + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds * @return Api client */ public ApiClient setConnectTimeout(int connectionTimeout) { - httpClient = - httpClient - .newBuilder() - .connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS) - .build(); + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -602,15 +602,15 @@ public int getReadTimeout() { } /** - * Sets the read timeout (in milliseconds). A value of 0 means no timeout, otherwise values must - * be between 1 and {@link java.lang.Integer#MAX_VALUE}. + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds * @return Api client */ public ApiClient setReadTimeout(int readTimeout) { - httpClient = - httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); return this; } @@ -624,18 +624,19 @@ public int getWriteTimeout() { } /** - * Sets the write timeout (in milliseconds). A value of 0 means no timeout, otherwise values - * must be between 1 and {@link java.lang.Integer#MAX_VALUE}. + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds * @return Api client */ public ApiClient setWriteTimeout(int writeTimeout) { - httpClient = - httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); return this; } + /** * Format the given parameter object into string. * @@ -645,10 +646,8 @@ public ApiClient setWriteTimeout(int writeTimeout) { public String parameterToString(Object param) { if (param == null) { return ""; - } else if (param instanceof Date - || param instanceof OffsetDateTime - || param instanceof LocalDate) { - // Serialize to json string and remove the " enclosing characters + } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { + //Serialize to json string and remove the " enclosing characters String jsonStr = JSON.serialize(param); return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { @@ -668,7 +667,7 @@ public String parameterToString(Object param) { /** * Formats the specified query parameter to a list containing a single {@code Pair} object. * - *

Note that {@code value} must not be a collection. + * Note that {@code value} must not be a collection. * * @param name The name of the parameter. * @param value The value of the parameter. @@ -689,7 +688,7 @@ public List parameterToPair(String name, Object value) { /** * Formats the specified collection query parameters to a list of {@code Pair} objects. * - *

Note that the values of each of the returned Pair objects are percent-encoded. + * Note that the values of each of the returned Pair objects are percent-encoded. * * @param collectionFormat The collection format of the parameter. * @param name The name of the parameter. @@ -761,7 +760,7 @@ public String collectionPathParameterToString(String collectionFormat, Collectio delimiter = "|"; } - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder() ; for (Object item : value) { sb.append(delimiter); sb.append(parameterToString(item)); @@ -771,7 +770,8 @@ public String collectionPathParameterToString(String collectionFormat, Collectio } /** - * Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif * * @param filename The filename to be sanitized * @return The sanitized filename @@ -781,10 +781,13 @@ public String sanitizeFilename(String filename) { } /** - * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json - * application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json "* / *" is also - * default to JSON - * + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON * @param mime MIME (Multipurpose Internet Mail Extensions) * @return True if the given MIME is JSON, false otherwise. */ @@ -794,12 +797,13 @@ public boolean isJsonMime(String mime) { } /** - * Select the Accept header's value from the given accepts array: if JSON exists in the given - * array, use it; otherwise use all of them (joining into a string) + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) * * @param accepts The accepts array to select from - * @return The Accept header to use. If the given array is empty, null will be returned (not to - * set the Accept header explicitly). + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). */ public String selectHeaderAccept(String[] accepts) { if (accepts.length == 0) { @@ -814,12 +818,13 @@ public String selectHeaderAccept(String[] accepts) { } /** - * Select the Content-Type header's value from the given array: if JSON exists in the given - * array, use it; otherwise use the first one of the array. + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. * * @param contentTypes The Content-Type array to select from - * @return The Content-Type header to use. If the given array is empty, returns null. If it - * matches "any", JSON will be used. + * @return The Content-Type header to use. If the given array is empty, + * returns null. If it matches "any", JSON will be used. */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0) { @@ -854,16 +859,15 @@ public String escapeString(String str) { } /** - * Deserialize response body to Java object, according to the return type and the Content-Type - * response header. + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. * * @param Type * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws com.configcat.publicapi.java.client.ApiException If fail to deserialize response - * body, i.e. cannot read response body or the Content-Type of the response is not - * supported. + * @throws com.configcat.publicapi.java.client.ApiException If fail to deserialize response body, i.e. cannot read response body + * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") public T deserialize(Response response, Type returnType) throws ApiException { @@ -885,8 +889,10 @@ public T deserialize(Response response, Type returnType) throws ApiException String respBody; try { - if (response.body() != null) respBody = response.body().string(); - else respBody = null; + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; } catch (IOException e) { throw new ApiException(e); } @@ -915,14 +921,13 @@ public T deserialize(Response response, Type returnType) throws ApiException } /** - * Serialize the given Java object into request body according to the object's class and the - * request Content-Type. + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. * * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws com.configcat.publicapi.java.client.ApiException If fail to serialize the given - * object + * @throws com.configcat.publicapi.java.client.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { @@ -952,8 +957,7 @@ public RequestBody serialize(Object obj, String contentType) throws ApiException * Download file from the given response. * * @param response An instance of the Response object - * @throws com.configcat.publicapi.java.client.ApiException If fail to read file content from - * response and write to disk + * @throws com.configcat.publicapi.java.client.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -1001,11 +1005,14 @@ public File prepareDownloadFile(Response response) throws IOException { suffix = filename.substring(pos); } // Files.createTempFile requires the prefix to be at least three characters long - if (prefix.length() < 3) prefix = "download-"; + if (prefix.length() < 3) + prefix = "download-"; } - if (tempFolderPath == null) return Files.createTempFile(prefix, suffix).toFile(); - else return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); } /** @@ -1026,8 +1033,9 @@ public ApiResponse execute(Call call) throws ApiException { * @param returnType The return type used to deserialize HTTP response body * @param The return type corresponding to (same with) returnType * @param call Call - * @return ApiResponse object containing response status, headers and data, which is a Java - * object deserialized from response body and would be null when returnType is null. + * @return ApiResponse object containing response status, headers and + * data, which is a Java object deserialized from response body and would be null + * when returnType is null. * @throws com.configcat.publicapi.java.client.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { @@ -1062,32 +1070,27 @@ public void executeAsync(Call call, ApiCallback callback) { */ @SuppressWarnings("unchecked") public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { - call.enqueue( - new Callback() { - @Override - public void onFailure(Call call, IOException e) { - callback.onFailure(new ApiException(e), 0, null); - } + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } - @Override - public void onResponse(Call call, Response response) throws IOException { - T result; - try { - result = (T) handleResponse(response, returnType); - } catch (ApiException e) { - callback.onFailure(e, response.code(), response.headers().toMultimap()); - return; - } catch (Exception e) { - callback.onFailure( - new ApiException(e), - response.code(), - response.headers().toMultimap()); - return; - } - callback.onSuccess( - result, response.code(), response.headers().toMultimap()); - } - }); + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); } /** @@ -1097,8 +1100,8 @@ public void onResponse(Call call, Response response) throws IOException { * @param response Response * @param returnType Return type * @return Type - * @throws com.configcat.publicapi.java.client.ApiException If the response has an unsuccessful - * status code or fail to deserialize the response body + * @throws com.configcat.publicapi.java.client.ApiException If the response has an unsuccessful status code or + * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { if (response.isSuccessful()) { @@ -1109,11 +1112,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept try { response.body().close(); } catch (Exception e) { - throw new ApiException( - response.message(), - e, - response.code(), - response.headers().toMultimap()); + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); } } return null; @@ -1126,15 +1125,10 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept try { respBody = response.body().string(); } catch (IOException e) { - throw new ApiException( - response.message(), - e, - response.code(), - response.headers().toMultimap()); + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); } } - throw new ApiException( - response.message(), response.code(), response.headers().toMultimap(), respBody); + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); } } @@ -1143,8 +1137,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * * @param baseUrl The base URL * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and - * "DELETE" + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters * @param collectionQueryParams The collection query parameters * @param body The request body object @@ -1154,35 +1147,10 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws com.configcat.publicapi.java.client.ApiException If fail to serialize the request - * body object - */ - public Call buildCall( - String baseUrl, - String path, - String method, - List queryParams, - List collectionQueryParams, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String[] authNames, - ApiCallback callback) - throws ApiException { - Request request = - buildRequest( - baseUrl, - path, - method, - queryParams, - collectionQueryParams, - body, - headerParams, - cookieParams, - formParams, - authNames, - callback); + * @throws com.configcat.publicapi.java.client.ApiException If fail to serialize the request body object + */ + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); return httpClient.newCall(request); } @@ -1192,8 +1160,7 @@ public Call buildCall( * * @param baseUrl The base URL * @param path The sub-path of the HTTP URL - * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and - * "DELETE" + * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters * @param collectionQueryParams The collection query parameters * @param body The request body object @@ -1203,22 +1170,9 @@ public Call buildCall( * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP request - * @throws com.configcat.publicapi.java.client.ApiException If fail to serialize the request - * body object - */ - public Request buildRequest( - String baseUrl, - String path, - String method, - List queryParams, - List collectionQueryParams, - Object body, - Map headerParams, - Map cookieParams, - Map formParams, - String[] authNames, - ApiCallback callback) - throws ApiException { + * @throws com.configcat.publicapi.java.client.ApiException If fail to serialize the request body object + */ + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { // aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams List allQueryParams = new ArrayList(queryParams); allQueryParams.addAll(collectionQueryParams); @@ -1244,23 +1198,14 @@ public Request buildRequest( reqBody = null; } else { // use an empty request body (for POST, PUT and PATCH) - reqBody = - RequestBody.create( - "", contentType == null ? null : MediaType.parse(contentType)); + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); } } else { reqBody = serialize(body, contentType); } // update parameters with authentication settings - updateParamsForAuth( - authNames, - allQueryParams, - headerParams, - cookieParams, - requestBodyToString(reqBody), - method, - URI.create(url)); + updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); final Request.Builder reqBuilder = new Request.Builder().url(url); processHeaderParams(headerParams, reqBuilder); @@ -1291,8 +1236,7 @@ public Request buildRequest( * @param collectionQueryParams The collection query parameters * @return The full URL */ - public String buildUrl( - String baseUrl, String path, List queryParams, List collectionQueryParams) { + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { final StringBuilder url = new StringBuilder(); if (baseUrl != null) { url.append(baseUrl).append(path); @@ -1300,11 +1244,9 @@ public String buildUrl( String baseURL; if (serverIndex != null) { if (serverIndex < 0 || serverIndex >= servers.size()) { - throw new ArrayIndexOutOfBoundsException( - String.format( - "Invalid index %d when selecting the host settings. Must be" - + " less than %d", - serverIndex, servers.size())); + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); } baseURL = servers.get(serverIndex).URL(serverVariables); } else { @@ -1325,9 +1267,7 @@ public String buildUrl( url.append("&"); } String value = parameterToString(param.getValue()); - url.append(escapeString(param.getName())) - .append("=") - .append(escapeString(value)); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); } } } @@ -1377,13 +1317,11 @@ public void processHeaderParams(Map headerParams, Request.Builde */ public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { for (Entry param : cookieParams.entrySet()) { - reqBuilder.addHeader( - "Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); } for (Entry param : defaultCookieMap.entrySet()) { if (!cookieParams.containsKey(param.getKey())) { - reqBuilder.addHeader( - "Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); } } } @@ -1400,15 +1338,8 @@ public void processCookieParams(Map cookieParams, Request.Builde * @param uri URI * @throws com.configcat.publicapi.java.client.ApiException If fails to update the parameters */ - public void updateParamsForAuth( - String[] authNames, - List queryParams, - Map headerParams, - Map cookieParams, - String payload, - String method, - URI uri) - throws ApiException { + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { for (String authName : authNames) { Authentication auth = authentications.get(authName); if (auth == null) { @@ -1433,8 +1364,8 @@ public RequestBody buildRequestBodyFormEncoding(Map formParams) } /** - * Build a multipart (file uploading) request body with the given form parameters, which could - * contain text fields and file fields. + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. * * @param formParams Form parameters in the form of Map * @return RequestBody @@ -1447,7 +1378,7 @@ public RequestBody buildRequestBodyMultipart(Map formParams) { addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); } else if (param.getValue() instanceof List) { List list = (List) param.getValue(); - for (Object item : list) { + for (Object item: list) { if (item instanceof File) { addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); } else { @@ -1479,29 +1410,24 @@ public String guessContentTypeFromFile(File file) { /** * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. * - * @param mpBuilder MultipartBody.Builder + * @param mpBuilder MultipartBody.Builder * @param key The key of the Header element * @param file The file to add to the Header - */ + */ private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { - Headers partHeaders = - Headers.of( - "Content-Disposition", - "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); } /** - * Add a Content-Disposition Header for the given key and complex object to the MultipartBody - * Builder. + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. * * @param mpBuilder MultipartBody.Builder * @param key The key of the Header element * @param obj The complex object to add to the Header */ - private void addPartToMultiPartBuilder( - MultipartBody.Builder mpBuilder, String key, Object obj) { + private void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { RequestBody requestBody; if (obj instanceof String) { requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); @@ -1520,8 +1446,8 @@ private void addPartToMultiPartBuilder( } /** - * Get network interceptor to add it to the httpClient to track download progress for async - * requests. + * Get network interceptor to add it to the httpClient to track download progress for + * async requests. */ private Interceptor getProgressInterceptor() { return new Interceptor() { @@ -1531,10 +1457,9 @@ public Response intercept(Interceptor.Chain chain) throws IOException { final Response originalResponse = chain.proceed(request); if (request.tag() instanceof ApiCallback) { final ApiCallback callback = (ApiCallback) request.tag(); - return originalResponse - .newBuilder() - .body(new ProgressResponseBody(originalResponse.body(), callback)) - .build(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); } return originalResponse; } @@ -1542,54 +1467,47 @@ public Response intercept(Interceptor.Chain chain) throws IOException { } /** - * Apply SSL related settings to httpClient according to the current values of verifyingSsl and - * sslCaCert. + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. */ private void applySslSettings() { try { TrustManager[] trustManagers; HostnameVerifier hostnameVerifier; if (!verifyingSsl) { - trustManagers = - new TrustManager[] { - new X509TrustManager() { - @Override - public void checkClientTrusted( - java.security.cert.X509Certificate[] chain, String authType) - throws CertificateException {} - - @Override - public void checkServerTrusted( - java.security.cert.X509Certificate[] chain, String authType) - throws CertificateException {} - - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[] {}; - } + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { } - }; - hostnameVerifier = - new HostnameVerifier() { + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + @Override - public boolean verify(String hostname, SSLSession session) { - return true; + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; } - }; + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; } else { - TrustManagerFactory trustManagerFactory = - TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); if (sslCaCert == null) { trustManagerFactory.init((KeyStore) null); } else { char[] password = null; // Any password will work. CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = - certificateFactory.generateCertificates(sslCaCert); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); if (certificates.isEmpty()) { - throw new IllegalArgumentException( - "expected non-empty set of trusted certificates"); + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); } KeyStore caKeyStore = newEmptyKeyStore(password); int index = 0; @@ -1605,12 +1523,8 @@ public boolean verify(String hostname, SSLSession session) { SSLContext sslContext = SSLContext.getInstance("TLS"); sslContext.init(keyManagers, trustManagers, new SecureRandom()); - httpClient = - httpClient - .newBuilder() - .sslSocketFactory( - sslContext.getSocketFactory(), - (X509TrustManager) trustManagers[0]) + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) .hostnameVerifier(hostnameVerifier) .build(); } catch (GeneralSecurityException e) { @@ -1633,8 +1547,7 @@ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcepti * * @param requestBody The HTTP request object * @return The string representation of the HTTP request body - * @throws com.configcat.publicapi.java.client.ApiException If fail to serialize the request - * body object into a string + * @throws com.configcat.publicapi.java.client.ApiException If fail to serialize the request body object into a string */ private String requestBodyToString(RequestBody requestBody) throws ApiException { if (requestBody != null) { diff --git a/src/main/java/com/configcat/publicapi/java/client/ApiException.java b/src/main/java/com/configcat/publicapi/java/client/ApiException.java index 4b7b478..3ea6ea1 100644 --- a/src/main/java/com/configcat/publicapi/java/client/ApiException.java +++ b/src/main/java/com/configcat/publicapi/java/client/ApiException.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,18 +10,18 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client; +package com.configcat.publicapi.java.client; -import java.util.List; import java.util.Map; +import java.util.List; -/** ApiException class. */ + +/** + *

ApiException class.

+ */ @SuppressWarnings("serial") -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class ApiException extends RuntimeException { private static final long serialVersionUID = 1L; @@ -29,11 +29,13 @@ public class ApiException extends RuntimeException { private Map> responseHeaders = null; private String responseBody = null; - /** Constructor for ApiException. */ + /** + *

Constructor for ApiException.

+ */ public ApiException() {} /** - * Constructor for ApiException. + *

Constructor for ApiException.

* * @param throwable a {@link java.lang.Throwable} object */ @@ -42,7 +44,7 @@ public ApiException(Throwable throwable) { } /** - * Constructor for ApiException. + *

Constructor for ApiException.

* * @param message the error message */ @@ -51,7 +53,7 @@ public ApiException(String message) { } /** - * Constructor for ApiException. + *

Constructor for ApiException.

* * @param message the error message * @param throwable a {@link java.lang.Throwable} object @@ -59,12 +61,7 @@ public ApiException(String message) { * @param responseHeaders a {@link java.util.Map} of HTTP response headers * @param responseBody the response body */ - public ApiException( - String message, - Throwable throwable, - int code, - Map> responseHeaders, - String responseBody) { + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { super(message, throwable); this.code = code; this.responseHeaders = responseHeaders; @@ -72,55 +69,42 @@ public ApiException( } /** - * Constructor for ApiException. + *

Constructor for ApiException.

* * @param message the error message * @param code HTTP status code * @param responseHeaders a {@link java.util.Map} of HTTP response headers * @param responseBody the response body */ - public ApiException( - String message, - int code, - Map> responseHeaders, - String responseBody) { + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } /** - * Constructor for ApiException. + *

Constructor for ApiException.

* * @param message the error message * @param throwable a {@link java.lang.Throwable} object * @param code HTTP status code * @param responseHeaders a {@link java.util.Map} of HTTP response headers */ - public ApiException( - String message, - Throwable throwable, - int code, - Map> responseHeaders) { + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } /** - * Constructor for ApiException. + *

Constructor for ApiException.

* * @param code HTTP status code * @param responseHeaders a {@link java.util.Map} of HTTP response headers * @param responseBody the response body */ public ApiException(int code, Map> responseHeaders, String responseBody) { - this( - "Response Code: " + code + " Response Body: " + responseBody, - (Throwable) null, - code, - responseHeaders, - responseBody); + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); } /** - * Constructor for ApiException. + *

Constructor for ApiException.

* * @param code HTTP status code * @param message a {@link java.lang.String} object @@ -131,18 +115,14 @@ public ApiException(int code, String message) { } /** - * Constructor for ApiException. + *

Constructor for ApiException.

* * @param code HTTP status code * @param message the error message * @param responseHeaders a {@link java.util.Map} of HTTP response headers * @param responseBody the response body */ - public ApiException( - int code, - String message, - Map> responseHeaders, - String responseBody) { + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { this(code, message); this.responseHeaders = responseHeaders; this.responseBody = responseBody; @@ -181,12 +161,7 @@ public String getResponseBody() { * @return The exception message */ public String getMessage() { - return String.format( - "Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response" - + " headers: %s", - super.getMessage(), - this.getCode(), - this.getResponseBody(), - this.getResponseHeaders()); + return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); } } diff --git a/src/main/java/com/configcat/publicapi/java/client/ApiResponse.java b/src/main/java/com/configcat/publicapi/java/client/ApiResponse.java index 3044d2e..47d753e 100644 --- a/src/main/java/com/configcat/publicapi/java/client/ApiResponse.java +++ b/src/main/java/com/configcat/publicapi/java/client/ApiResponse.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,20 +10,22 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client; +package com.configcat.publicapi.java.client; import java.util.List; import java.util.Map; -/** API response returned by API call. */ +/** + * API response returned by API call. + */ public class ApiResponse { - private final int statusCode; - private final Map> headers; - private final T data; + final private int statusCode; + final private Map> headers; + final private T data; /** - * Constructor for ApiResponse. + *

Constructor for ApiResponse.

* * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response @@ -33,7 +35,7 @@ public ApiResponse(int statusCode, Map> headers) { } /** - * Constructor for ApiResponse. + *

Constructor for ApiResponse.

* * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response @@ -46,7 +48,7 @@ public ApiResponse(int statusCode, Map> headers, T data) { } /** - * Get the status code. + *

Get the status code.

* * @return the status code */ @@ -55,16 +57,16 @@ public int getStatusCode() { } /** - * Get the headers. + *

Get the headers.

* - * @return a {@link java.util.Map} of headers + * @return a {@link java.util.Map} of headers */ public Map> getHeaders() { return headers; } /** - * Get the data. + *

Get the data.

* * @return the data */ diff --git a/src/main/java/com/configcat/publicapi/java/client/Configuration.java b/src/main/java/com/configcat/publicapi/java/client/Configuration.java index aacf3a5..c6baed3 100644 --- a/src/main/java/com/configcat/publicapi/java/client/Configuration.java +++ b/src/main/java/com/configcat/publicapi/java/client/Configuration.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,20 +10,18 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client; -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class Configuration { public static final String VERSION = "v1"; private static ApiClient defaultApiClient = new ApiClient(); /** - * Get the default API client, which would be used when creating API instances without providing - * an API client. + * Get the default API client, which would be used when creating API + * instances without providing an API client. * * @return Default API client */ @@ -32,8 +30,8 @@ public static ApiClient getDefaultApiClient() { } /** - * Set the default API client, which would be used when creating API instances without providing - * an API client. + * Set the default API client, which would be used when creating API + * instances without providing an API client. * * @param apiClient API client */ diff --git a/src/main/java/com/configcat/publicapi/java/client/GzipRequestInterceptor.java b/src/main/java/com/configcat/publicapi/java/client/GzipRequestInterceptor.java index 8364f64..1d17be4 100644 --- a/src/main/java/com/configcat/publicapi/java/client/GzipRequestInterceptor.java +++ b/src/main/java/com/configcat/publicapi/java/client/GzipRequestInterceptor.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,20 +10,21 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client; +package com.configcat.publicapi.java.client; -import java.io.IOException; import okhttp3.*; import okio.Buffer; import okio.BufferedSink; import okio.GzipSink; import okio.Okio; +import java.io.IOException; + /** * Encodes request bodies using gzip. * - *

Taken from https://github.com/square/okhttp/issues/350 + * Taken from https://github.com/square/okhttp/issues/350 */ class GzipRequestInterceptor implements Interceptor { @Override @@ -33,14 +34,10 @@ public Response intercept(Chain chain) throws IOException { return chain.proceed(originalRequest); } - Request compressedRequest = - originalRequest - .newBuilder() - .header("Content-Encoding", "gzip") - .method( - originalRequest.method(), - forceContentLength(gzip(originalRequest.body()))) - .build(); + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); return chain.proceed(compressedRequest); } diff --git a/src/main/java/com/configcat/publicapi/java/client/JSON.java b/src/main/java/com/configcat/publicapi/java/client/JSON.java index f16bf59..3892933 100644 --- a/src/main/java/com/configcat/publicapi/java/client/JSON.java +++ b/src/main/java/com/configcat/publicapi/java/client/JSON.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,18 +10,22 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client; +package com.configcat.publicapi.java.client; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.internal.bind.util.ISO8601Utils; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; +import io.gsonfire.TypeSelector; + +import okio.ByteString; + import java.io.IOException; import java.io.StringReader; import java.lang.reflect.Type; @@ -32,8 +36,9 @@ import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.Date; +import java.util.Locale; import java.util.Map; -import okio.ByteString; +import java.util.HashMap; /* * A JSON utility class @@ -46,42 +51,37 @@ public class JSON { private static boolean isLenientOnJson = false; private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = - new OffsetDateTimeTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); @SuppressWarnings("unchecked") public static GsonBuilder createGson() { - GsonFireBuilder fireBuilder = new GsonFireBuilder(); + GsonFireBuilder fireBuilder = new GsonFireBuilder() + ; GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; } - private static String getDiscriminatorValue( - JsonElement readElement, String discriminatorField) { + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { JsonElement element = readElement.getAsJsonObject().get(discriminatorField); if (null == element) { - throw new IllegalArgumentException( - "missing discriminator field: <" + discriminatorField + ">"); + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); } return element.getAsString(); } /** - * Returns the Java class that implements the OpenAPI schema for the specified discriminator - * value. + * Returns the Java class that implements the OpenAPI schema for the specified discriminator value. * * @param classByDiscriminatorValue The map of discriminator values to Java classes. * @param discriminatorValue The value of the OpenAPI discriminator in the input data. * @return The Java class that implements the OpenAPI schema */ - private static Class getClassByDiscriminator( - Map classByDiscriminatorValue, String discriminatorValue) { + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue); if (null == clazz) { - throw new IllegalArgumentException( - "cannot determine model class of name: <" + discriminatorValue + ">"); + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } return clazz; } @@ -93,288 +93,101 @@ private static Class getClassByDiscriminator( gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.AddOrUpdateIntegrationLinkModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.AddOrUpdateJiraIntegrationLinkModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.AuditLogItemModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CodeReferenceModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CodeReferenceRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ComparisonValueListModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ComparisonValueModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ConditionModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ConfigModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ConfigSettingFormulaModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ConfigSettingFormulasModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ConfigSettingValueModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ConfigSettingValuesModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ConnectRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreateConfigRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreateEnvironmentModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreateIntegrationModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreateOrUpdateEnvironmentAccessModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreatePermissionGroupRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreateProductRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreateSegmentModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreateSettingInitialValues - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.CreateTagModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.DeleteIntegrationLinkModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.DeleteRepositoryReportsRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.EnvironmentAccessModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.EnvironmentModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.FeatureFlagLimitations - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.FlagReference - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.InitialValue - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.IntegrationLinkDetail - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.IntegrationLinkDetailsModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.IntegrationLinkModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.IntegrationModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.IntegrationsModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.InvitationModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.InviteMembersRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.JsonPatchOperation - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.MeModel.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.MemberModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ModifyIntegrationRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.OrganizationAdminModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.OrganizationInvitationModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.OrganizationMemberModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.OrganizationMembersModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.OrganizationModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.OrganizationPermissionGroupModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.OrganizationPermissionModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.OrganizationProductModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.PercentageOptionModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.PermissionGroupModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.PreferencesModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.PrerequisiteFlagConditionModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ProductModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ReasonRequiredEnvironmentModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ReferenceLine - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ReferenceLines - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ReplaceSettingModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.RolloutPercentageItemModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.RolloutRuleModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SdkKeysModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SegmentConditionModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SegmentListModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SegmentModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SettingDataModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SettingFormulaModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SettingModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SettingTagModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.SettingValueModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.TagModel.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.TargetingRuleModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateConfigRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateEnvironmentModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateEvaluationFormulaModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateEvaluationFormulaWithIdModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateEvaluationFormulasModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateMemberPermissionsRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdatePermissionGroupRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdatePreferencesRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateProductRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateReasonRequiredEnvironmentModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateSegmentModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateSettingValueModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateSettingValueWithSettingIdModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateSettingValuesWithIdModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UpdateTagModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UserConditionModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.UserModel.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.ValueModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.WebHookRequest - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.WebhookConfig - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.WebhookEnvironment - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.WebhookHeaderModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.WebhookModel - .CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory( - new com.configcat.publicapi.java.client.model.WebhookSigningKeysModel - .CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.AddOrUpdateIntegrationLinkModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.AddOrUpdateJiraIntegrationLinkModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.AuditLogItemModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CodeReferenceModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CodeReferenceRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ComparisonValueListModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ComparisonValueModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ConditionModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ConfigModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ConfigSettingFormulaModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ConfigSettingFormulasModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ConfigSettingValueModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ConfigSettingValuesModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ConnectRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreateConfigRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreateEnvironmentModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreateIntegrationModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreateOrUpdateEnvironmentAccessModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreatePermissionGroupRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreateProductRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreateSegmentModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreateSettingInitialValues.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.CreateTagModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.DeleteIntegrationLinkModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.DeleteRepositoryReportsRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.EnvironmentAccessModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.EnvironmentModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.FeatureFlagLimitations.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.FlagReference.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.InitialValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.IntegrationLinkDetail.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.IntegrationLinkDetailsModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.IntegrationLinkModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.IntegrationModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.IntegrationsModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.InvitationModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.InviteMembersRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.JsonPatchOperation.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.MeModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.MemberModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ModifyIntegrationRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.OrganizationAdminModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.OrganizationInvitationModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.OrganizationMemberModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.OrganizationMembersModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.OrganizationModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.OrganizationPermissionGroupModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.OrganizationPermissionModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.OrganizationProductModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.PercentageOptionModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.PermissionGroupModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.PreferencesModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.PrerequisiteFlagConditionModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ProductModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ReasonRequiredEnvironmentModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ReferenceLine.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ReferenceLines.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ReplaceSettingModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.RolloutPercentageItemModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.RolloutRuleModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SdkKeysModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SegmentConditionModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SegmentListModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SegmentModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SettingDataModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SettingFormulaModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SettingModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SettingTagModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.SettingValueModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.TagModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.TargetingRuleModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateConfigRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateEnvironmentModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateEvaluationFormulaModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateEvaluationFormulaWithIdModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateEvaluationFormulasModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateMemberPermissionsRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdatePermissionGroupRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdatePreferencesRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateProductRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateReasonRequiredEnvironmentModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateSegmentModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateSettingValueModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateSettingValueWithSettingIdModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateSettingValuesWithIdModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UpdateTagModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UserConditionModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.UserModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.ValueModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.WebHookRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.WebhookConfig.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.WebhookEnvironment.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.WebhookHeaderModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.WebhookModel.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.configcat.publicapi.java.client.model.WebhookSigningKeysModel.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } @@ -413,8 +226,8 @@ public static String serialize(Object obj) { /** * Deserialize the given JSON string to Java object. * - * @param Type - * @param body The JSON string + * @param Type + * @param body The JSON string * @param returnType The type to deserialize into * @return The deserialized Java object */ @@ -423,8 +236,7 @@ public static T deserialize(String body, Type returnType) { try { if (isLenientOnJson) { JsonReader jsonReader = new JsonReader(new StringReader(body)); - // see - // https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) jsonReader.setLenient(true); return gson.fromJson(jsonReader, returnType); } else { @@ -441,7 +253,9 @@ public static T deserialize(String body, Type returnType) { } } - /** Gson TypeAdapter for Byte Array type */ + /** + * Gson TypeAdapter for Byte Array type + */ public static class ByteArrayAdapter extends TypeAdapter { @Override @@ -467,7 +281,9 @@ public byte[] read(JsonReader in) throws IOException { } } - /** Gson TypeAdapter for JSR310 OffsetDateTime type */ + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ public static class OffsetDateTimeTypeAdapter extends TypeAdapter { private DateTimeFormatter formatter; @@ -502,14 +318,16 @@ public OffsetDateTime read(JsonReader in) throws IOException { default: String date = in.nextString(); if (date.endsWith("+0000")) { - date = date.substring(0, date.length() - 5) + "Z"; + date = date.substring(0, date.length()-5) + "Z"; } return OffsetDateTime.parse(date, formatter); } } } - /** Gson TypeAdapter for JSR310 LocalDate type */ + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ public static class LocalDateTypeAdapter extends TypeAdapter { private DateTimeFormatter formatter; @@ -557,8 +375,9 @@ public static void setLocalDateFormat(DateTimeFormatter dateFormat) { } /** - * Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple "yyyy-MM-dd" - * format will be used (more efficient than SimpleDateFormat). + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). */ public static class SqlDateTypeAdapter extends TypeAdapter { @@ -601,8 +420,7 @@ public java.sql.Date read(JsonReader in) throws IOException { if (dateFormat != null) { return new java.sql.Date(dateFormat.parse(date).getTime()); } - return new java.sql.Date( - ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); + return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime()); } catch (ParseException e) { throw new JsonParseException(e); } @@ -611,8 +429,8 @@ public java.sql.Date read(JsonReader in) throws IOException { } /** - * Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils will be - * used. + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. */ public static class DateTypeAdapter extends TypeAdapter { diff --git a/src/main/java/com/configcat/publicapi/java/client/Pair.java b/src/main/java/com/configcat/publicapi/java/client/Pair.java index fda1580..8a854a2 100644 --- a/src/main/java/com/configcat/publicapi/java/client/Pair.java +++ b/src/main/java/com/configcat/publicapi/java/client/Pair.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,17 +10,15 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client; -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class Pair { private String name = ""; private String value = ""; - public Pair(String name, String value) { + public Pair (String name, String value) { setName(name); setValue(value); } diff --git a/src/main/java/com/configcat/publicapi/java/client/ProgressRequestBody.java b/src/main/java/com/configcat/publicapi/java/client/ProgressRequestBody.java index 13d182d..fa0316d 100644 --- a/src/main/java/com/configcat/publicapi/java/client/ProgressRequestBody.java +++ b/src/main/java/com/configcat/publicapi/java/client/ProgressRequestBody.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,12 +10,14 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client; +package com.configcat.publicapi.java.client; -import java.io.IOException; import okhttp3.MediaType; import okhttp3.RequestBody; + +import java.io.IOException; + import okio.Buffer; import okio.BufferedSink; import okio.ForwardingSink; @@ -64,8 +66,7 @@ public void write(Buffer source, long byteCount) throws IOException { } bytesWritten += byteCount; - callback.onUploadProgress( - bytesWritten, contentLength, bytesWritten == contentLength); + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); } }; } diff --git a/src/main/java/com/configcat/publicapi/java/client/ProgressResponseBody.java b/src/main/java/com/configcat/publicapi/java/client/ProgressResponseBody.java index 8a45337..6fb85b3 100644 --- a/src/main/java/com/configcat/publicapi/java/client/ProgressResponseBody.java +++ b/src/main/java/com/configcat/publicapi/java/client/ProgressResponseBody.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,12 +10,14 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client; +package com.configcat.publicapi.java.client; -import java.io.IOException; import okhttp3.MediaType; import okhttp3.ResponseBody; + +import java.io.IOException; + import okio.Buffer; import okio.BufferedSource; import okio.ForwardingSource; @@ -60,8 +62,7 @@ public long read(Buffer sink, long byteCount) throws IOException { long bytesRead = super.read(sink, byteCount); // read() returns the number of bytes read, or -1 if this source is exhausted. totalBytesRead += bytesRead != -1 ? bytesRead : 0; - callback.onDownloadProgress( - totalBytesRead, responseBody.contentLength(), bytesRead == -1); + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); return bytesRead; } }; diff --git a/src/main/java/com/configcat/publicapi/java/client/ServerConfiguration.java b/src/main/java/com/configcat/publicapi/java/client/ServerConfiguration.java index a039961..935cc91 100644 --- a/src/main/java/com/configcat/publicapi/java/client/ServerConfiguration.java +++ b/src/main/java/com/configcat/publicapi/java/client/ServerConfiguration.java @@ -1,13 +1,11 @@ package com.configcat.publicapi.java.client; - import java.util.Map; -/** Representing a Server configuration. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class ServerConfiguration { public String URL; public String description; @@ -16,11 +14,9 @@ public class ServerConfiguration { /** * @param URL A URL to the target host. * @param description A description of the host designated by the URL. - * @param variables A map between a variable name and its value. The value is used for - * substitution in the server's URL template. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ - public ServerConfiguration( - String URL, String description, Map variables) { + public ServerConfiguration(String URL, String description, Map variables) { this.URL = URL; this.description = description; this.variables = variables; @@ -36,21 +32,15 @@ public String URL(Map variables) { String url = this.URL; // go through variables and replace placeholders - for (Map.Entry variable : this.variables.entrySet()) { + for (Map.Entry variable: this.variables.entrySet()) { String name = variable.getKey(); ServerVariable serverVariable = variable.getValue(); String value = serverVariable.defaultValue; if (variables != null && variables.containsKey(name)) { value = variables.get(name); - if (serverVariable.enumValues.size() > 0 - && !serverVariable.enumValues.contains(value)) { - throw new IllegalArgumentException( - "The variable " - + name - + " in the server URL has invalid value " - + value - + "."); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); } } url = url.replace("{" + name + "}", value); diff --git a/src/main/java/com/configcat/publicapi/java/client/ServerVariable.java b/src/main/java/com/configcat/publicapi/java/client/ServerVariable.java index a878bf2..642d8ea 100644 --- a/src/main/java/com/configcat/publicapi/java/client/ServerVariable.java +++ b/src/main/java/com/configcat/publicapi/java/client/ServerVariable.java @@ -1,13 +1,11 @@ package com.configcat.publicapi.java.client; - import java.util.HashSet; -/** Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class ServerVariable { public String description; public String defaultValue; @@ -16,8 +14,7 @@ public class ServerVariable { /** * @param description A description for the server variable. * @param defaultValue The default value to use for substitution. - * @param enumValues An enumeration of string values to be used if the substitution options are - * from a limited set. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. */ public ServerVariable(String description, String defaultValue, HashSet enumValues) { this.description = description; diff --git a/src/main/java/com/configcat/publicapi/java/client/StringUtil.java b/src/main/java/com/configcat/publicapi/java/client/StringUtil.java index e2e7861..0662de4 100644 --- a/src/main/java/com/configcat/publicapi/java/client/StringUtil.java +++ b/src/main/java/com/configcat/publicapi/java/client/StringUtil.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,76 +10,74 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client; +package com.configcat.publicapi.java.client; import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class StringUtil { - /** - * Check if the given array contains the given value (with case-insensitive comparison). - * - * @param array The array - * @param value The value to search - * @return true if the array contains the value - */ - public static boolean containsIgnoreCase(String[] array, String value) { - for (String str : array) { - if (value == null && str == null) { - return true; - } - if (value != null && value.equalsIgnoreCase(str)) { - return true; - } - } - return false; + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } + return false; + } - /** - * Join an array of strings with the given separator. - * - *

Note: This might be replaced by utility method from commons-lang or guava someday if one - * of those libraries is added as dependency. - * - * @param array The array of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(String[] array, String separator) { - int len = array.length; - if (len == 0) { - return ""; - } + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } - StringBuilder out = new StringBuilder(); - out.append(array[0]); - for (int i = 1; i < len; i++) { - out.append(separator).append(array[i]); - } - return out.toString(); + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); } + return out.toString(); + } - /** - * Join a list of strings with the given separator. - * - * @param list The list of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(Collection list, String separator) { - Iterator iterator = list.iterator(); - StringBuilder out = new StringBuilder(); - if (iterator.hasNext()) { - out.append(iterator.next()); - } - while (iterator.hasNext()) { - out.append(separator).append(iterator.next()); - } - return out.toString(); + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); } + return out.toString(); + } } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/AuditLogsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/AuditLogsApi.java index 8cfb707..2d303c9 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/AuditLogsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/AuditLogsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,17 +19,25 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.AuditLogItemModel; import com.configcat.publicapi.java.client.model.AuditLogType; +import java.time.OffsetDateTime; import com.configcat.publicapi.java.client.model.SettingModel; -import com.google.gson.reflect.TypeToken; +import java.util.UUID; + import java.lang.reflect.Type; -import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class AuditLogsApi { private ApiClient localVarApiClient; @@ -70,7 +78,6 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getAuditlogs - * * @param productId The identifier of the Product. (required) * @param configId The identifier of the Config. (optional) * @param environmentId The identifier of the Environment. (optional) @@ -81,31 +88,23 @@ public void setCustomBaseUrl(String customBaseUrl) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getAuditlogsCall( - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getAuditlogsCall(UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -114,11 +113,8 @@ public okhttp3.Call getAuditlogsCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/auditlogs" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/auditlogs" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -131,83 +127,54 @@ public okhttp3.Call getAuditlogsCall( } if (environmentId != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("environmentId", environmentId)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("environmentId", environmentId)); } if (auditLogType != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("auditLogType", auditLogType)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("auditLogType", auditLogType)); } if (fromUtcDateTime != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("fromUtcDateTime", fromUtcDateTime)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fromUtcDateTime", fromUtcDateTime)); } if (toUtcDateTime != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("toUtcDateTime", toUtcDateTime)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("toUtcDateTime", toUtcDateTime)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getAuditlogsValidateBeforeCall( - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getAuditlogsValidateBeforeCall(UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling getAuditlogs(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getAuditlogs(Async)"); } - return getAuditlogsCall( - productId, - configId, - environmentId, - auditLogType, - fromUtcDateTime, - toUtcDateTime, - _callback); + return getAuditlogsCall(productId, configId, environmentId, auditLogType, fromUtcDateTime, toUtcDateTime, _callback); + } /** - * List Audit log items for Product This endpoint returns the list of Audit log items for a - * given Product and the result can be optionally filtered by Config and/or Environment. - * + * List Audit log items for Product + * This endpoint returns the list of Audit log items for a given Product and the result can be optionally filtered by Config and/or Environment. * @param productId The identifier of the Product. (required) * @param configId The identifier of the Config. (optional) * @param environmentId The identifier of the Environment. (optional) @@ -215,40 +182,24 @@ private okhttp3.Call getAuditlogsValidateBeforeCall( * @param fromUtcDateTime Filter Audit logs by starting UTC date. (optional) * @param toUtcDateTime Filter Audit logs by ending UTC date. (optional) * @return List<AuditLogItemModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public List getAuditlogs( - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime) - throws ApiException { - ApiResponse> localVarResp = - getAuditlogsWithHttpInfo( - productId, - configId, - environmentId, - auditLogType, - fromUtcDateTime, - toUtcDateTime); + public List getAuditlogs(UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime) throws ApiException { + ApiResponse> localVarResp = getAuditlogsWithHttpInfo(productId, configId, environmentId, auditLogType, fromUtcDateTime, toUtcDateTime); return localVarResp.getData(); } /** - * List Audit log items for Product This endpoint returns the list of Audit log items for a - * given Product and the result can be optionally filtered by Config and/or Environment. - * + * List Audit log items for Product + * This endpoint returns the list of Audit log items for a given Product and the result can be optionally filtered by Config and/or Environment. * @param productId The identifier of the Product. (required) * @param configId The identifier of the Config. (optional) * @param environmentId The identifier of the Environment. (optional) @@ -256,43 +207,25 @@ public List getAuditlogs( * @param fromUtcDateTime Filter Audit logs by starting UTC date. (optional) * @param toUtcDateTime Filter Audit logs by ending UTC date. (optional) * @return ApiResponse<List<AuditLogItemModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getAuditlogsWithHttpInfo( - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime) - throws ApiException { - okhttp3.Call localVarCall = - getAuditlogsValidateBeforeCall( - productId, - configId, - environmentId, - auditLogType, - fromUtcDateTime, - toUtcDateTime, - null); - Type localVarReturnType = new TypeToken>() {}.getType(); + public ApiResponse> getAuditlogsWithHttpInfo(UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime) throws ApiException { + okhttp3.Call localVarCall = getAuditlogsValidateBeforeCall(productId, configId, environmentId, auditLogType, fromUtcDateTime, toUtcDateTime, null); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Audit log items for Product (asynchronously) This endpoint returns the list of Audit log - * items for a given Product and the result can be optionally filtered by Config and/or - * Environment. - * + * List Audit log items for Product (asynchronously) + * This endpoint returns the list of Audit log items for a given Product and the result can be optionally filtered by Config and/or Environment. * @param productId The identifier of the Product. (required) * @param configId The identifier of the Config. (optional) * @param environmentId The identifier of the Environment. (optional) @@ -301,66 +234,47 @@ public ApiResponse> getAuditlogsWithHttpInfo( * @param toUtcDateTime Filter Audit logs by ending UTC date. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getAuditlogsAsync( - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime, - final ApiCallback> _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getAuditlogsValidateBeforeCall( - productId, - configId, - environmentId, - auditLogType, - fromUtcDateTime, - toUtcDateTime, - _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + public okhttp3.Call getAuditlogsAsync(UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getAuditlogsValidateBeforeCall(productId, configId, environmentId, auditLogType, fromUtcDateTime, toUtcDateTime, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getDeletedSettings - * * @param configId The identifier of the Config. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getDeletedSettingsCall(UUID configId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getDeletedSettingsCall(UUID configId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -369,11 +283,8 @@ public okhttp3.Call getDeletedSettingsCall(UUID configId, final ApiCallback _cal Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/configs/{configId}/deleted-settings" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())); + String localVarPath = "/v1/configs/{configId}/deleted-settings" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -381,63 +292,50 @@ public okhttp3.Call getDeletedSettingsCall(UUID configId, final ApiCallback _cal Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDeletedSettingsValidateBeforeCall( - UUID configId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getDeletedSettingsValidateBeforeCall(UUID configId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling" - + " getDeletedSettings(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling getDeletedSettings(Async)"); } return getDeletedSettingsCall(configId, _callback); + } /** - * List Deleted Settings This endpoint returns the list of Feature Flags and Settings that were - * deleted from the given Config. - * + * List Deleted Settings + * This endpoint returns the list of Feature Flags and Settings that were deleted from the given Config. * @param configId The identifier of the Config. (required) * @return List<SettingModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getDeletedSettings(UUID configId) throws ApiException { ApiResponse> localVarResp = getDeletedSettingsWithHttpInfo(configId); @@ -445,58 +343,51 @@ public List getDeletedSettings(UUID configId) throws ApiException } /** - * List Deleted Settings This endpoint returns the list of Feature Flags and Settings that were - * deleted from the given Config. - * + * List Deleted Settings + * This endpoint returns the list of Feature Flags and Settings that were deleted from the given Config. * @param configId The identifier of the Config. (required) * @return ApiResponse<List<SettingModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getDeletedSettingsWithHttpInfo(UUID configId) - throws ApiException { + public ApiResponse> getDeletedSettingsWithHttpInfo(UUID configId) throws ApiException { okhttp3.Call localVarCall = getDeletedSettingsValidateBeforeCall(configId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Deleted Settings (asynchronously) This endpoint returns the list of Feature Flags and - * Settings that were deleted from the given Config. - * + * List Deleted Settings (asynchronously) + * This endpoint returns the list of Feature Flags and Settings that were deleted from the given Config. * @param configId The identifier of the Config. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getDeletedSettingsAsync( - UUID configId, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getDeletedSettingsAsync(UUID configId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getDeletedSettingsValidateBeforeCall(configId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getOrganizationAuditlogs - * * @param organizationId The identifier of the Organization. (required) * @param productId The identifier of the Product. (optional) * @param configId The identifier of the Config. (optional) @@ -508,32 +399,23 @@ public okhttp3.Call getDeletedSettingsAsync( * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getOrganizationAuditlogsCall( - UUID organizationId, - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getOrganizationAuditlogsCall(UUID organizationId, UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -542,11 +424,8 @@ public okhttp3.Call getOrganizationAuditlogsCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/organizations/{organizationId}/auditlogs" - .replace( - "{" + "organizationId" + "}", - localVarApiClient.escapeString(organizationId.toString())); + String localVarPath = "/v1/organizations/{organizationId}/auditlogs" + .replace("{" + "organizationId" + "}", localVarApiClient.escapeString(organizationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -563,87 +442,54 @@ public okhttp3.Call getOrganizationAuditlogsCall( } if (environmentId != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("environmentId", environmentId)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("environmentId", environmentId)); } if (auditLogType != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("auditLogType", auditLogType)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("auditLogType", auditLogType)); } if (fromUtcDateTime != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("fromUtcDateTime", fromUtcDateTime)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fromUtcDateTime", fromUtcDateTime)); } if (toUtcDateTime != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("toUtcDateTime", toUtcDateTime)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("toUtcDateTime", toUtcDateTime)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getOrganizationAuditlogsValidateBeforeCall( - UUID organizationId, - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getOrganizationAuditlogsValidateBeforeCall(UUID organizationId, UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime, final ApiCallback _callback) throws ApiException { // verify the required parameter 'organizationId' is set if (organizationId == null) { - throw new ApiException( - "Missing the required parameter 'organizationId' when calling" - + " getOrganizationAuditlogs(Async)"); + throw new ApiException("Missing the required parameter 'organizationId' when calling getOrganizationAuditlogs(Async)"); } - return getOrganizationAuditlogsCall( - organizationId, - productId, - configId, - environmentId, - auditLogType, - fromUtcDateTime, - toUtcDateTime, - _callback); + return getOrganizationAuditlogsCall(organizationId, productId, configId, environmentId, auditLogType, fromUtcDateTime, toUtcDateTime, _callback); + } /** - * List Audit log items for Organization This endpoint returns the list of Audit log items for a - * given Organization and the result can be optionally filtered by Product and/or Config and/or - * Environment. - * + * List Audit log items for Organization + * This endpoint returns the list of Audit log items for a given Organization and the result can be optionally filtered by Product and/or Config and/or Environment. * @param organizationId The identifier of the Organization. (required) * @param productId The identifier of the Product. (optional) * @param configId The identifier of the Config. (optional) @@ -652,43 +498,24 @@ private okhttp3.Call getOrganizationAuditlogsValidateBeforeCall( * @param fromUtcDateTime Filter Audit logs by starting UTC date. (optional) * @param toUtcDateTime Filter Audit logs by ending UTC date. (optional) * @return List<AuditLogItemModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public List getOrganizationAuditlogs( - UUID organizationId, - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime) - throws ApiException { - ApiResponse> localVarResp = - getOrganizationAuditlogsWithHttpInfo( - organizationId, - productId, - configId, - environmentId, - auditLogType, - fromUtcDateTime, - toUtcDateTime); + public List getOrganizationAuditlogs(UUID organizationId, UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime) throws ApiException { + ApiResponse> localVarResp = getOrganizationAuditlogsWithHttpInfo(organizationId, productId, configId, environmentId, auditLogType, fromUtcDateTime, toUtcDateTime); return localVarResp.getData(); } /** - * List Audit log items for Organization This endpoint returns the list of Audit log items for a - * given Organization and the result can be optionally filtered by Product and/or Config and/or - * Environment. - * + * List Audit log items for Organization + * This endpoint returns the list of Audit log items for a given Organization and the result can be optionally filtered by Product and/or Config and/or Environment. * @param organizationId The identifier of the Organization. (required) * @param productId The identifier of the Product. (optional) * @param configId The identifier of the Config. (optional) @@ -697,45 +524,25 @@ public List getOrganizationAuditlogs( * @param fromUtcDateTime Filter Audit logs by starting UTC date. (optional) * @param toUtcDateTime Filter Audit logs by ending UTC date. (optional) * @return ApiResponse<List<AuditLogItemModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getOrganizationAuditlogsWithHttpInfo( - UUID organizationId, - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime) - throws ApiException { - okhttp3.Call localVarCall = - getOrganizationAuditlogsValidateBeforeCall( - organizationId, - productId, - configId, - environmentId, - auditLogType, - fromUtcDateTime, - toUtcDateTime, - null); - Type localVarReturnType = new TypeToken>() {}.getType(); + public ApiResponse> getOrganizationAuditlogsWithHttpInfo(UUID organizationId, UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime) throws ApiException { + okhttp3.Call localVarCall = getOrganizationAuditlogsValidateBeforeCall(organizationId, productId, configId, environmentId, auditLogType, fromUtcDateTime, toUtcDateTime, null); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Audit log items for Organization (asynchronously) This endpoint returns the list of - * Audit log items for a given Organization and the result can be optionally filtered by Product - * and/or Config and/or Environment. - * + * List Audit log items for Organization (asynchronously) + * This endpoint returns the list of Audit log items for a given Organization and the result can be optionally filtered by Product and/or Config and/or Environment. * @param organizationId The identifier of the Organization. (required) * @param productId The identifier of the Product. (optional) * @param configId The identifier of the Config. (optional) @@ -745,39 +552,20 @@ public ApiResponse> getOrganizationAuditlogsWithHttpInfo * @param toUtcDateTime Filter Audit logs by ending UTC date. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getOrganizationAuditlogsAsync( - UUID organizationId, - UUID productId, - UUID configId, - UUID environmentId, - AuditLogType auditLogType, - OffsetDateTime fromUtcDateTime, - OffsetDateTime toUtcDateTime, - final ApiCallback> _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getOrganizationAuditlogsValidateBeforeCall( - organizationId, - productId, - configId, - environmentId, - auditLogType, - fromUtcDateTime, - toUtcDateTime, - _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + public okhttp3.Call getOrganizationAuditlogsAsync(UUID organizationId, UUID productId, UUID configId, UUID environmentId, AuditLogType auditLogType, OffsetDateTime fromUtcDateTime, OffsetDateTime toUtcDateTime, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getOrganizationAuditlogsValidateBeforeCall(organizationId, productId, configId, environmentId, auditLogType, fromUtcDateTime, toUtcDateTime, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/CodeReferencesApi.java b/src/main/java/com/configcat/publicapi/java/client/api/CodeReferencesApi.java index b477637..22e4524 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/CodeReferencesApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/CodeReferencesApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,10 +19,18 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.CodeReferenceModel; import com.configcat.publicapi.java.client.model.CodeReferenceRequest; import com.configcat.publicapi.java.client.model.DeleteRepositoryReportsRequest; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; @@ -68,32 +76,28 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for v1CodeReferencesDeleteReportsPost - * - * @param deleteRepositoryReportsRequest (required) + * @param deleteRepositoryReportsRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call v1CodeReferencesDeleteReportsPostCall( - DeleteRepositoryReportsRequest deleteRepositoryReportsRequest, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call v1CodeReferencesDeleteReportsPostCall(DeleteRepositoryReportsRequest deleteRepositoryReportsRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -110,150 +114,122 @@ public okhttp3.Call v1CodeReferencesDeleteReportsPostCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call v1CodeReferencesDeleteReportsPostValidateBeforeCall( - DeleteRepositoryReportsRequest deleteRepositoryReportsRequest, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call v1CodeReferencesDeleteReportsPostValidateBeforeCall(DeleteRepositoryReportsRequest deleteRepositoryReportsRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'deleteRepositoryReportsRequest' is set if (deleteRepositoryReportsRequest == null) { - throw new ApiException( - "Missing the required parameter 'deleteRepositoryReportsRequest' when calling" - + " v1CodeReferencesDeleteReportsPost(Async)"); + throw new ApiException("Missing the required parameter 'deleteRepositoryReportsRequest' when calling v1CodeReferencesDeleteReportsPost(Async)"); } return v1CodeReferencesDeleteReportsPostCall(deleteRepositoryReportsRequest, _callback); + } /** * Delete Reference reports - * - * @param deleteRepositoryReportsRequest (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * + * @param deleteRepositoryReportsRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public void v1CodeReferencesDeleteReportsPost( - DeleteRepositoryReportsRequest deleteRepositoryReportsRequest) throws ApiException { + public void v1CodeReferencesDeleteReportsPost(DeleteRepositoryReportsRequest deleteRepositoryReportsRequest) throws ApiException { v1CodeReferencesDeleteReportsPostWithHttpInfo(deleteRepositoryReportsRequest); } /** * Delete Reference reports - * - * @param deleteRepositoryReportsRequest (required) + * + * @param deleteRepositoryReportsRequest (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse v1CodeReferencesDeleteReportsPostWithHttpInfo( - DeleteRepositoryReportsRequest deleteRepositoryReportsRequest) throws ApiException { - okhttp3.Call localVarCall = - v1CodeReferencesDeleteReportsPostValidateBeforeCall( - deleteRepositoryReportsRequest, null); + public ApiResponse v1CodeReferencesDeleteReportsPostWithHttpInfo(DeleteRepositoryReportsRequest deleteRepositoryReportsRequest) throws ApiException { + okhttp3.Call localVarCall = v1CodeReferencesDeleteReportsPostValidateBeforeCall(deleteRepositoryReportsRequest, null); return localVarApiClient.execute(localVarCall); } /** * Delete Reference reports (asynchronously) - * - * @param deleteRepositoryReportsRequest (required) + * + * @param deleteRepositoryReportsRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call v1CodeReferencesDeleteReportsPostAsync( - DeleteRepositoryReportsRequest deleteRepositoryReportsRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - v1CodeReferencesDeleteReportsPostValidateBeforeCall( - deleteRepositoryReportsRequest, _callback); + public okhttp3.Call v1CodeReferencesDeleteReportsPostAsync(DeleteRepositoryReportsRequest deleteRepositoryReportsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = v1CodeReferencesDeleteReportsPostValidateBeforeCall(deleteRepositoryReportsRequest, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for v1CodeReferencesPost - * - * @param codeReferenceRequest (required) + * @param codeReferenceRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call v1CodeReferencesPostCall( - CodeReferenceRequest codeReferenceRequest, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call v1CodeReferencesPostCall(CodeReferenceRequest codeReferenceRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -270,145 +246,122 @@ public okhttp3.Call v1CodeReferencesPostCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call v1CodeReferencesPostValidateBeforeCall( - CodeReferenceRequest codeReferenceRequest, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call v1CodeReferencesPostValidateBeforeCall(CodeReferenceRequest codeReferenceRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'codeReferenceRequest' is set if (codeReferenceRequest == null) { - throw new ApiException( - "Missing the required parameter 'codeReferenceRequest' when calling" - + " v1CodeReferencesPost(Async)"); + throw new ApiException("Missing the required parameter 'codeReferenceRequest' when calling v1CodeReferencesPost(Async)"); } return v1CodeReferencesPostCall(codeReferenceRequest, _callback); + } /** * Upload References - * - * @param codeReferenceRequest (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * + * @param codeReferenceRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public void v1CodeReferencesPost(CodeReferenceRequest codeReferenceRequest) - throws ApiException { + public void v1CodeReferencesPost(CodeReferenceRequest codeReferenceRequest) throws ApiException { v1CodeReferencesPostWithHttpInfo(codeReferenceRequest); } /** * Upload References - * - * @param codeReferenceRequest (required) + * + * @param codeReferenceRequest (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse v1CodeReferencesPostWithHttpInfo( - CodeReferenceRequest codeReferenceRequest) throws ApiException { - okhttp3.Call localVarCall = - v1CodeReferencesPostValidateBeforeCall(codeReferenceRequest, null); + public ApiResponse v1CodeReferencesPostWithHttpInfo(CodeReferenceRequest codeReferenceRequest) throws ApiException { + okhttp3.Call localVarCall = v1CodeReferencesPostValidateBeforeCall(codeReferenceRequest, null); return localVarApiClient.execute(localVarCall); } /** * Upload References (asynchronously) - * - * @param codeReferenceRequest (required) + * + * @param codeReferenceRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call v1CodeReferencesPostAsync( - CodeReferenceRequest codeReferenceRequest, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call v1CodeReferencesPostAsync(CodeReferenceRequest codeReferenceRequest, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - v1CodeReferencesPostValidateBeforeCall(codeReferenceRequest, _callback); + okhttp3.Call localVarCall = v1CodeReferencesPostValidateBeforeCall(codeReferenceRequest, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for v1SettingsSettingIdCodeReferencesGet - * * @param settingId The identifier of the Feature Flag or Setting. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call v1SettingsSettingIdCodeReferencesGetCall( - Integer settingId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call v1SettingsSettingIdCodeReferencesGetCall(Integer settingId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -417,11 +370,8 @@ public okhttp3.Call v1SettingsSettingIdCodeReferencesGetCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/settings/{settingId}/code-references" - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v1/settings/{settingId}/code-references" + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -429,118 +379,97 @@ public okhttp3.Call v1SettingsSettingIdCodeReferencesGetCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call v1SettingsSettingIdCodeReferencesGetValidateBeforeCall( - Integer settingId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call v1SettingsSettingIdCodeReferencesGetValidateBeforeCall(Integer settingId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " v1SettingsSettingIdCodeReferencesGet(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling v1SettingsSettingIdCodeReferencesGet(Async)"); } return v1SettingsSettingIdCodeReferencesGetCall(settingId, _callback); + } /** * Get References for Feature Flag or Setting - * + * * @param settingId The identifier of the Feature Flag or Setting. (required) * @return List<CodeReferenceModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public List v1SettingsSettingIdCodeReferencesGet(Integer settingId) - throws ApiException { - ApiResponse> localVarResp = - v1SettingsSettingIdCodeReferencesGetWithHttpInfo(settingId); + public List v1SettingsSettingIdCodeReferencesGet(Integer settingId) throws ApiException { + ApiResponse> localVarResp = v1SettingsSettingIdCodeReferencesGetWithHttpInfo(settingId); return localVarResp.getData(); } /** * Get References for Feature Flag or Setting - * + * * @param settingId The identifier of the Feature Flag or Setting. (required) * @return ApiResponse<List<CodeReferenceModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> v1SettingsSettingIdCodeReferencesGetWithHttpInfo( - Integer settingId) throws ApiException { - okhttp3.Call localVarCall = - v1SettingsSettingIdCodeReferencesGetValidateBeforeCall(settingId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + public ApiResponse> v1SettingsSettingIdCodeReferencesGetWithHttpInfo(Integer settingId) throws ApiException { + okhttp3.Call localVarCall = v1SettingsSettingIdCodeReferencesGetValidateBeforeCall(settingId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get References for Feature Flag or Setting (asynchronously) - * + * * @param settingId The identifier of the Feature Flag or Setting. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call v1SettingsSettingIdCodeReferencesGetAsync( - Integer settingId, final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call v1SettingsSettingIdCodeReferencesGetAsync(Integer settingId, final ApiCallback> _callback) throws ApiException { - okhttp3.Call localVarCall = - v1SettingsSettingIdCodeReferencesGetValidateBeforeCall(settingId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + okhttp3.Call localVarCall = v1SettingsSettingIdCodeReferencesGetValidateBeforeCall(settingId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/ConfigsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/ConfigsApi.java index 64a1e4a..d664bcb 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/ConfigsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/ConfigsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,16 +19,24 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.ConfigModel; import com.configcat.publicapi.java.client.model.CreateConfigRequest; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdateConfigRequest; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class ConfigsApi { private ApiClient localVarApiClient; @@ -69,32 +77,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createConfig - * * @param productId The identifier of the Product. (required) - * @param createConfigRequest (required) + * @param createConfigRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createConfigCall( - UUID productId, CreateConfigRequest createConfigRequest, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createConfigCall(UUID productId, CreateConfigRequest createConfigRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -103,11 +108,8 @@ public okhttp3.Call createConfigCall( Object localVarPostBody = createConfigRequest; // create path and map variables - String localVarPath = - "/v1/products/{productId}/configs" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/configs" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -115,167 +117,135 @@ public okhttp3.Call createConfigCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createConfigValidateBeforeCall( - UUID productId, CreateConfigRequest createConfigRequest, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createConfigValidateBeforeCall(UUID productId, CreateConfigRequest createConfigRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling createConfig(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling createConfig(Async)"); } // verify the required parameter 'createConfigRequest' is set if (createConfigRequest == null) { - throw new ApiException( - "Missing the required parameter 'createConfigRequest' when calling" - + " createConfig(Async)"); + throw new ApiException("Missing the required parameter 'createConfigRequest' when calling createConfig(Async)"); } return createConfigCall(productId, createConfigRequest, _callback); + } /** - * Create Config This endpoint creates a new Config in a specified Product identified by the - * `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Config + * This endpoint creates a new Config in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createConfigRequest (required) + * @param createConfigRequest (required) * @return ConfigModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ConfigModel createConfig(UUID productId, CreateConfigRequest createConfigRequest) - throws ApiException { - ApiResponse localVarResp = - createConfigWithHttpInfo(productId, createConfigRequest); + public ConfigModel createConfig(UUID productId, CreateConfigRequest createConfigRequest) throws ApiException { + ApiResponse localVarResp = createConfigWithHttpInfo(productId, createConfigRequest); return localVarResp.getData(); } /** - * Create Config This endpoint creates a new Config in a specified Product identified by the - * `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Config + * This endpoint creates a new Config in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createConfigRequest (required) + * @param createConfigRequest (required) * @return ApiResponse<ConfigModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createConfigWithHttpInfo( - UUID productId, CreateConfigRequest createConfigRequest) throws ApiException { - okhttp3.Call localVarCall = - createConfigValidateBeforeCall(productId, createConfigRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse createConfigWithHttpInfo(UUID productId, CreateConfigRequest createConfigRequest) throws ApiException { + okhttp3.Call localVarCall = createConfigValidateBeforeCall(productId, createConfigRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Config (asynchronously) This endpoint creates a new Config in a specified Product - * identified by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Config (asynchronously) + * This endpoint creates a new Config in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createConfigRequest (required) + * @param createConfigRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createConfigAsync( - UUID productId, - CreateConfigRequest createConfigRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createConfigValidateBeforeCall(productId, createConfigRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call createConfigAsync(UUID productId, CreateConfigRequest createConfigRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createConfigValidateBeforeCall(productId, createConfigRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteConfig - * * @param configId The identifier of the Config. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteConfigCall(UUID configId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteConfigCall(UUID configId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -284,11 +254,8 @@ public okhttp3.Call deleteConfigCall(UUID configId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/configs/{configId}" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())); + String localVarPath = "/v1/configs/{configId}" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -296,82 +263,67 @@ public okhttp3.Call deleteConfigCall(UUID configId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteConfigValidateBeforeCall(UUID configId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call deleteConfigValidateBeforeCall(UUID configId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling deleteConfig(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling deleteConfig(Async)"); } return deleteConfigCall(configId, _callback); + } /** - * Delete Config This endpoint removes a Config identified by the `configId` - * parameter. - * + * Delete Config + * This endpoint removes a Config identified by the `configId` parameter. * @param configId The identifier of the Config. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteConfig(UUID configId) throws ApiException { deleteConfigWithHttpInfo(configId); } /** - * Delete Config This endpoint removes a Config identified by the `configId` - * parameter. - * + * Delete Config + * This endpoint removes a Config identified by the `configId` parameter. * @param configId The identifier of the Config. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse deleteConfigWithHttpInfo(UUID configId) throws ApiException { okhttp3.Call localVarCall = deleteConfigValidateBeforeCall(configId, null); @@ -379,25 +331,22 @@ public ApiResponse deleteConfigWithHttpInfo(UUID configId) throws ApiExcep } /** - * Delete Config (asynchronously) This endpoint removes a Config identified by the - * `configId` parameter. - * + * Delete Config (asynchronously) + * This endpoint removes a Config identified by the `configId` parameter. * @param configId The identifier of the Config. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteConfigAsync(UUID configId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteConfigAsync(UUID configId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteConfigValidateBeforeCall(configId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -405,30 +354,28 @@ public okhttp3.Call deleteConfigAsync(UUID configId, final ApiCallback _ca } /** * Build call for getConfig - * * @param configId The identifier of the Config. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getConfigCall(UUID configId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getConfigCall(UUID configId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -437,11 +384,8 @@ public okhttp3.Call getConfigCall(UUID configId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/configs/{configId}" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())); + String localVarPath = "/v1/configs/{configId}" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -449,62 +393,50 @@ public okhttp3.Call getConfigCall(UUID configId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getConfigValidateBeforeCall(UUID configId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getConfigValidateBeforeCall(UUID configId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling getConfig(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling getConfig(Async)"); } return getConfigCall(configId, _callback); + } /** - * Get Config This endpoint returns the metadata of a Config identified by the - * `configId`. - * + * Get Config + * This endpoint returns the metadata of a Config identified by the `configId`. * @param configId The identifier of the Config. (required) * @return ConfigModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ConfigModel getConfig(UUID configId) throws ApiException { ApiResponse localVarResp = getConfigWithHttpInfo(configId); @@ -512,80 +444,73 @@ public ConfigModel getConfig(UUID configId) throws ApiException { } /** - * Get Config This endpoint returns the metadata of a Config identified by the - * `configId`. - * + * Get Config + * This endpoint returns the metadata of a Config identified by the `configId`. * @param configId The identifier of the Config. (required) * @return ApiResponse<ConfigModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse getConfigWithHttpInfo(UUID configId) throws ApiException { okhttp3.Call localVarCall = getConfigValidateBeforeCall(configId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Config (asynchronously) This endpoint returns the metadata of a Config identified by the - * `configId`. - * + * Get Config (asynchronously) + * This endpoint returns the metadata of a Config identified by the `configId`. * @param configId The identifier of the Config. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getConfigAsync(UUID configId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getConfigAsync(UUID configId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getConfigValidateBeforeCall(configId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getConfigs - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getConfigsCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getConfigsCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -594,11 +519,8 @@ public okhttp3.Call getConfigsCall(UUID productId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/configs" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/configs" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -606,63 +528,50 @@ public okhttp3.Call getConfigsCall(UUID productId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getConfigsValidateBeforeCall(UUID productId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getConfigsValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling getConfigs(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getConfigs(Async)"); } return getConfigsCall(productId, _callback); + } /** - * List Configs This endpoint returns the list of the Configs that belongs to the given Product - * identified by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * List Configs + * This endpoint returns the list of the Configs that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return List<ConfigModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getConfigs(UUID productId) throws ApiException { ApiResponse> localVarResp = getConfigsWithHttpInfo(productId); @@ -670,85 +579,74 @@ public List getConfigs(UUID productId) throws ApiException { } /** - * List Configs This endpoint returns the list of the Configs that belongs to the given Product - * identified by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * List Configs + * This endpoint returns the list of the Configs that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return ApiResponse<List<ConfigModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getConfigsWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse> getConfigsWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getConfigsValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Configs (asynchronously) This endpoint returns the list of the Configs that belongs to - * the given Product identified by the `productId` parameter, which can be obtained - * from the [List Products](#operation/get-products) endpoint. - * + * List Configs (asynchronously) + * This endpoint returns the list of the Configs that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getConfigsAsync( - UUID productId, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getConfigsAsync(UUID productId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getConfigsValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateConfig - * * @param configId The identifier of the Config. (required) - * @param updateConfigRequest (required) + * @param updateConfigRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateConfigCall( - UUID configId, UpdateConfigRequest updateConfigRequest, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateConfigCall(UUID configId, UpdateConfigRequest updateConfigRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -757,11 +655,8 @@ public okhttp3.Call updateConfigCall( Object localVarPostBody = updateConfigRequest; // create path and map variables - String localVarPath = - "/v1/configs/{configId}" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())); + String localVarPath = "/v1/configs/{configId}" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -769,135 +664,108 @@ public okhttp3.Call updateConfigCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateConfigValidateBeforeCall( - UUID configId, UpdateConfigRequest updateConfigRequest, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateConfigValidateBeforeCall(UUID configId, UpdateConfigRequest updateConfigRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling updateConfig(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling updateConfig(Async)"); } // verify the required parameter 'updateConfigRequest' is set if (updateConfigRequest == null) { - throw new ApiException( - "Missing the required parameter 'updateConfigRequest' when calling" - + " updateConfig(Async)"); + throw new ApiException("Missing the required parameter 'updateConfigRequest' when calling updateConfig(Async)"); } return updateConfigCall(configId, updateConfigRequest, _callback); + } /** - * Update Config This endpoint updates a Config identified by the `configId` - * parameter. - * + * Update Config + * This endpoint updates a Config identified by the `configId` parameter. * @param configId The identifier of the Config. (required) - * @param updateConfigRequest (required) + * @param updateConfigRequest (required) * @return ConfigModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ConfigModel updateConfig(UUID configId, UpdateConfigRequest updateConfigRequest) - throws ApiException { - ApiResponse localVarResp = - updateConfigWithHttpInfo(configId, updateConfigRequest); + public ConfigModel updateConfig(UUID configId, UpdateConfigRequest updateConfigRequest) throws ApiException { + ApiResponse localVarResp = updateConfigWithHttpInfo(configId, updateConfigRequest); return localVarResp.getData(); } /** - * Update Config This endpoint updates a Config identified by the `configId` - * parameter. - * + * Update Config + * This endpoint updates a Config identified by the `configId` parameter. * @param configId The identifier of the Config. (required) - * @param updateConfigRequest (required) + * @param updateConfigRequest (required) * @return ApiResponse<ConfigModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateConfigWithHttpInfo( - UUID configId, UpdateConfigRequest updateConfigRequest) throws ApiException { - okhttp3.Call localVarCall = - updateConfigValidateBeforeCall(configId, updateConfigRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateConfigWithHttpInfo(UUID configId, UpdateConfigRequest updateConfigRequest) throws ApiException { + okhttp3.Call localVarCall = updateConfigValidateBeforeCall(configId, updateConfigRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Config (asynchronously) This endpoint updates a Config identified by the - * `configId` parameter. - * + * Update Config (asynchronously) + * This endpoint updates a Config identified by the `configId` parameter. * @param configId The identifier of the Config. (required) - * @param updateConfigRequest (required) + * @param updateConfigRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateConfigAsync( - UUID configId, - UpdateConfigRequest updateConfigRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateConfigValidateBeforeCall(configId, updateConfigRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateConfigAsync(UUID configId, UpdateConfigRequest updateConfigRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateConfigValidateBeforeCall(configId, updateConfigRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/EnvironmentsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/EnvironmentsApi.java index 184ddc1..0ef5b52 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/EnvironmentsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/EnvironmentsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,16 +19,24 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.CreateEnvironmentModel; import com.configcat.publicapi.java.client.model.EnvironmentModel; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdateEnvironmentModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class EnvironmentsApi { private ApiClient localVarApiClient; @@ -69,34 +77,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createEnvironment - * * @param productId The identifier of the Product. (required) - * @param createEnvironmentModel (required) + * @param createEnvironmentModel (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createEnvironmentCall( - UUID productId, - CreateEnvironmentModel createEnvironmentModel, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createEnvironmentCall(UUID productId, CreateEnvironmentModel createEnvironmentModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -105,11 +108,8 @@ public okhttp3.Call createEnvironmentCall( Object localVarPostBody = createEnvironmentModel; // create path and map variables - String localVarPath = - "/v1/products/{productId}/environments" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/environments" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -117,173 +117,136 @@ public okhttp3.Call createEnvironmentCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createEnvironmentValidateBeforeCall( - UUID productId, - CreateEnvironmentModel createEnvironmentModel, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createEnvironmentValidateBeforeCall(UUID productId, CreateEnvironmentModel createEnvironmentModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " createEnvironment(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling createEnvironment(Async)"); } // verify the required parameter 'createEnvironmentModel' is set if (createEnvironmentModel == null) { - throw new ApiException( - "Missing the required parameter 'createEnvironmentModel' when calling" - + " createEnvironment(Async)"); + throw new ApiException("Missing the required parameter 'createEnvironmentModel' when calling createEnvironment(Async)"); } return createEnvironmentCall(productId, createEnvironmentModel, _callback); + } /** - * Create Environment This endpoint creates a new Environment in a specified Product identified - * by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Environment + * This endpoint creates a new Environment in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createEnvironmentModel (required) + * @param createEnvironmentModel (required) * @return EnvironmentModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public EnvironmentModel createEnvironment( - UUID productId, CreateEnvironmentModel createEnvironmentModel) throws ApiException { - ApiResponse localVarResp = - createEnvironmentWithHttpInfo(productId, createEnvironmentModel); + public EnvironmentModel createEnvironment(UUID productId, CreateEnvironmentModel createEnvironmentModel) throws ApiException { + ApiResponse localVarResp = createEnvironmentWithHttpInfo(productId, createEnvironmentModel); return localVarResp.getData(); } /** - * Create Environment This endpoint creates a new Environment in a specified Product identified - * by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Environment + * This endpoint creates a new Environment in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createEnvironmentModel (required) + * @param createEnvironmentModel (required) * @return ApiResponse<EnvironmentModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createEnvironmentWithHttpInfo( - UUID productId, CreateEnvironmentModel createEnvironmentModel) throws ApiException { - okhttp3.Call localVarCall = - createEnvironmentValidateBeforeCall(productId, createEnvironmentModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse createEnvironmentWithHttpInfo(UUID productId, CreateEnvironmentModel createEnvironmentModel) throws ApiException { + okhttp3.Call localVarCall = createEnvironmentValidateBeforeCall(productId, createEnvironmentModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Environment (asynchronously) This endpoint creates a new Environment in a specified - * Product identified by the `productId` parameter, which can be obtained from the - * [List Products](#operation/get-products) endpoint. - * + * Create Environment (asynchronously) + * This endpoint creates a new Environment in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createEnvironmentModel (required) + * @param createEnvironmentModel (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createEnvironmentAsync( - UUID productId, - CreateEnvironmentModel createEnvironmentModel, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createEnvironmentValidateBeforeCall(productId, createEnvironmentModel, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call createEnvironmentAsync(UUID productId, CreateEnvironmentModel createEnvironmentModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createEnvironmentValidateBeforeCall(productId, createEnvironmentModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteEnvironment - * * @param environmentId The identifier of the Environment. (required) - * @param cleanupAuditLogs An optional flag which indicates whether the audit log records - * related to the environment should be deleted or not. (optional) + * @param cleanupAuditLogs An optional flag which indicates whether the audit log records related to the environment should be deleted or not. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteEnvironmentCall( - UUID environmentId, Boolean cleanupAuditLogs, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteEnvironmentCall(UUID environmentId, Boolean cleanupAuditLogs, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -292,11 +255,8 @@ public okhttp3.Call deleteEnvironmentCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/environments/{environmentId}" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v1/environments/{environmentId}" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -305,162 +265,125 @@ public okhttp3.Call deleteEnvironmentCall( Map localVarFormParams = new HashMap(); if (cleanupAuditLogs != null) { - localVarQueryParams.addAll( - localVarApiClient.parameterToPair("cleanupAuditLogs", cleanupAuditLogs)); + localVarQueryParams.addAll(localVarApiClient.parameterToPair("cleanupAuditLogs", cleanupAuditLogs)); } - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteEnvironmentValidateBeforeCall( - UUID environmentId, Boolean cleanupAuditLogs, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call deleteEnvironmentValidateBeforeCall(UUID environmentId, Boolean cleanupAuditLogs, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " deleteEnvironment(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling deleteEnvironment(Async)"); } return deleteEnvironmentCall(environmentId, cleanupAuditLogs, _callback); + } /** - * Delete Environment This endpoint removes an Environment identified by the - * `environmentId` parameter. If the `cleanupAuditLogs` flag is set to true, - * it also deletes the audit log records related to the environment (except for the - * `Created a new environment` and `Deleted an environment` records). - * + * Delete Environment + * This endpoint removes an Environment identified by the `environmentId` parameter. If the `cleanupAuditLogs` flag is set to true, it also deletes the audit log records related to the environment (except for the `Created a new environment` and `Deleted an environment` records). * @param environmentId The identifier of the Environment. (required) - * @param cleanupAuditLogs An optional flag which indicates whether the audit log records - * related to the environment should be deleted or not. (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @param cleanupAuditLogs An optional flag which indicates whether the audit log records related to the environment should be deleted or not. (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public void deleteEnvironment(UUID environmentId, Boolean cleanupAuditLogs) - throws ApiException { + public void deleteEnvironment(UUID environmentId, Boolean cleanupAuditLogs) throws ApiException { deleteEnvironmentWithHttpInfo(environmentId, cleanupAuditLogs); } /** - * Delete Environment This endpoint removes an Environment identified by the - * `environmentId` parameter. If the `cleanupAuditLogs` flag is set to true, - * it also deletes the audit log records related to the environment (except for the - * `Created a new environment` and `Deleted an environment` records). - * + * Delete Environment + * This endpoint removes an Environment identified by the `environmentId` parameter. If the `cleanupAuditLogs` flag is set to true, it also deletes the audit log records related to the environment (except for the `Created a new environment` and `Deleted an environment` records). * @param environmentId The identifier of the Environment. (required) - * @param cleanupAuditLogs An optional flag which indicates whether the audit log records - * related to the environment should be deleted or not. (optional) + * @param cleanupAuditLogs An optional flag which indicates whether the audit log records related to the environment should be deleted or not. (optional) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse deleteEnvironmentWithHttpInfo( - UUID environmentId, Boolean cleanupAuditLogs) throws ApiException { - okhttp3.Call localVarCall = - deleteEnvironmentValidateBeforeCall(environmentId, cleanupAuditLogs, null); + public ApiResponse deleteEnvironmentWithHttpInfo(UUID environmentId, Boolean cleanupAuditLogs) throws ApiException { + okhttp3.Call localVarCall = deleteEnvironmentValidateBeforeCall(environmentId, cleanupAuditLogs, null); return localVarApiClient.execute(localVarCall); } /** - * Delete Environment (asynchronously) This endpoint removes an Environment identified by the - * `environmentId` parameter. If the `cleanupAuditLogs` flag is set to true, - * it also deletes the audit log records related to the environment (except for the - * `Created a new environment` and `Deleted an environment` records). - * + * Delete Environment (asynchronously) + * This endpoint removes an Environment identified by the `environmentId` parameter. If the `cleanupAuditLogs` flag is set to true, it also deletes the audit log records related to the environment (except for the `Created a new environment` and `Deleted an environment` records). * @param environmentId The identifier of the Environment. (required) - * @param cleanupAuditLogs An optional flag which indicates whether the audit log records - * related to the environment should be deleted or not. (optional) + * @param cleanupAuditLogs An optional flag which indicates whether the audit log records related to the environment should be deleted or not. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteEnvironmentAsync( - UUID environmentId, Boolean cleanupAuditLogs, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteEnvironmentAsync(UUID environmentId, Boolean cleanupAuditLogs, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - deleteEnvironmentValidateBeforeCall(environmentId, cleanupAuditLogs, _callback); + okhttp3.Call localVarCall = deleteEnvironmentValidateBeforeCall(environmentId, cleanupAuditLogs, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for getEnvironment - * * @param environmentId The identifier of the Environment. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the environment data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the environment data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getEnvironmentCall(UUID environmentId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getEnvironmentCall(UUID environmentId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -469,11 +392,8 @@ public okhttp3.Call getEnvironmentCall(UUID environmentId, final ApiCallback _ca Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/environments/{environmentId}" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v1/environments/{environmentId}" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -481,63 +401,50 @@ public okhttp3.Call getEnvironmentCall(UUID environmentId, final ApiCallback _ca Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getEnvironmentValidateBeforeCall( - UUID environmentId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getEnvironmentValidateBeforeCall(UUID environmentId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " getEnvironment(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling getEnvironment(Async)"); } return getEnvironmentCall(environmentId, _callback); + } /** - * Get Environment This endpoint returns the metadata of an Environment identified by the - * `environmentId`. - * + * Get Environment + * This endpoint returns the metadata of an Environment identified by the `environmentId`. * @param environmentId The identifier of the Environment. (required) * @return EnvironmentModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the environment data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the environment data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public EnvironmentModel getEnvironment(UUID environmentId) throws ApiException { ApiResponse localVarResp = getEnvironmentWithHttpInfo(environmentId); @@ -545,81 +452,73 @@ public EnvironmentModel getEnvironment(UUID environmentId) throws ApiException { } /** - * Get Environment This endpoint returns the metadata of an Environment identified by the - * `environmentId`. - * + * Get Environment + * This endpoint returns the metadata of an Environment identified by the `environmentId`. * @param environmentId The identifier of the Environment. (required) * @return ApiResponse<EnvironmentModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the environment data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the environment data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getEnvironmentWithHttpInfo(UUID environmentId) - throws ApiException { + public ApiResponse getEnvironmentWithHttpInfo(UUID environmentId) throws ApiException { okhttp3.Call localVarCall = getEnvironmentValidateBeforeCall(environmentId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Environment (asynchronously) This endpoint returns the metadata of an Environment - * identified by the `environmentId`. - * + * Get Environment (asynchronously) + * This endpoint returns the metadata of an Environment identified by the `environmentId`. * @param environmentId The identifier of the Environment. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the environment data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the environment data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getEnvironmentAsync( - UUID environmentId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getEnvironmentAsync(UUID environmentId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getEnvironmentValidateBeforeCall(environmentId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getEnvironments - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getEnvironmentsCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getEnvironmentsCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -628,11 +527,8 @@ public okhttp3.Call getEnvironmentsCall(UUID productId, final ApiCallback _callb Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/environments" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/environments" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -640,64 +536,50 @@ public okhttp3.Call getEnvironmentsCall(UUID productId, final ApiCallback _callb Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getEnvironmentsValidateBeforeCall( - UUID productId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getEnvironmentsValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " getEnvironments(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getEnvironments(Async)"); } return getEnvironmentsCall(productId, _callback); + } /** - * List Environments This endpoint returns the list of the Environments that belongs to the - * given Product identified by the `productId` parameter, which can be obtained from - * the [List Products](#operation/get-products) endpoint. - * + * List Environments + * This endpoint returns the list of the Environments that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return List<EnvironmentModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getEnvironments(UUID productId) throws ApiException { ApiResponse> localVarResp = getEnvironmentsWithHttpInfo(productId); @@ -705,88 +587,74 @@ public List getEnvironments(UUID productId) throws ApiExceptio } /** - * List Environments This endpoint returns the list of the Environments that belongs to the - * given Product identified by the `productId` parameter, which can be obtained from - * the [List Products](#operation/get-products) endpoint. - * + * List Environments + * This endpoint returns the list of the Environments that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return ApiResponse<List<EnvironmentModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getEnvironmentsWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse> getEnvironmentsWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getEnvironmentsValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Environments (asynchronously) This endpoint returns the list of the Environments that - * belongs to the given Product identified by the `productId` parameter, which can be - * obtained from the [List Products](#operation/get-products) endpoint. - * + * List Environments (asynchronously) + * This endpoint returns the list of the Environments that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getEnvironmentsAsync( - UUID productId, final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call getEnvironmentsAsync(UUID productId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getEnvironmentsValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateEnvironment - * * @param environmentId The identifier of the Environment. (required) - * @param updateEnvironmentModel (required) + * @param updateEnvironmentModel (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateEnvironmentCall( - UUID environmentId, - UpdateEnvironmentModel updateEnvironmentModel, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateEnvironmentCall(UUID environmentId, UpdateEnvironmentModel updateEnvironmentModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -795,11 +663,8 @@ public okhttp3.Call updateEnvironmentCall( Object localVarPostBody = updateEnvironmentModel; // create path and map variables - String localVarPath = - "/v1/environments/{environmentId}" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v1/environments/{environmentId}" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -807,139 +672,108 @@ public okhttp3.Call updateEnvironmentCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateEnvironmentValidateBeforeCall( - UUID environmentId, - UpdateEnvironmentModel updateEnvironmentModel, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateEnvironmentValidateBeforeCall(UUID environmentId, UpdateEnvironmentModel updateEnvironmentModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " updateEnvironment(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling updateEnvironment(Async)"); } // verify the required parameter 'updateEnvironmentModel' is set if (updateEnvironmentModel == null) { - throw new ApiException( - "Missing the required parameter 'updateEnvironmentModel' when calling" - + " updateEnvironment(Async)"); + throw new ApiException("Missing the required parameter 'updateEnvironmentModel' when calling updateEnvironment(Async)"); } return updateEnvironmentCall(environmentId, updateEnvironmentModel, _callback); + } /** - * Update Environment This endpoint updates an Environment identified by the - * `environmentId` parameter. - * + * Update Environment + * This endpoint updates an Environment identified by the `environmentId` parameter. * @param environmentId The identifier of the Environment. (required) - * @param updateEnvironmentModel (required) + * @param updateEnvironmentModel (required) * @return EnvironmentModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public EnvironmentModel updateEnvironment( - UUID environmentId, UpdateEnvironmentModel updateEnvironmentModel) throws ApiException { - ApiResponse localVarResp = - updateEnvironmentWithHttpInfo(environmentId, updateEnvironmentModel); + public EnvironmentModel updateEnvironment(UUID environmentId, UpdateEnvironmentModel updateEnvironmentModel) throws ApiException { + ApiResponse localVarResp = updateEnvironmentWithHttpInfo(environmentId, updateEnvironmentModel); return localVarResp.getData(); } /** - * Update Environment This endpoint updates an Environment identified by the - * `environmentId` parameter. - * + * Update Environment + * This endpoint updates an Environment identified by the `environmentId` parameter. * @param environmentId The identifier of the Environment. (required) - * @param updateEnvironmentModel (required) + * @param updateEnvironmentModel (required) * @return ApiResponse<EnvironmentModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateEnvironmentWithHttpInfo( - UUID environmentId, UpdateEnvironmentModel updateEnvironmentModel) throws ApiException { - okhttp3.Call localVarCall = - updateEnvironmentValidateBeforeCall(environmentId, updateEnvironmentModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateEnvironmentWithHttpInfo(UUID environmentId, UpdateEnvironmentModel updateEnvironmentModel) throws ApiException { + okhttp3.Call localVarCall = updateEnvironmentValidateBeforeCall(environmentId, updateEnvironmentModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Environment (asynchronously) This endpoint updates an Environment identified by the - * `environmentId` parameter. - * + * Update Environment (asynchronously) + * This endpoint updates an Environment identified by the `environmentId` parameter. * @param environmentId The identifier of the Environment. (required) - * @param updateEnvironmentModel (required) + * @param updateEnvironmentModel (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateEnvironmentAsync( - UUID environmentId, - UpdateEnvironmentModel updateEnvironmentModel, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateEnvironmentValidateBeforeCall( - environmentId, updateEnvironmentModel, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateEnvironmentAsync(UUID environmentId, UpdateEnvironmentModel updateEnvironmentModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateEnvironmentValidateBeforeCall(environmentId, updateEnvironmentModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesApi.java b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesApi.java index 18ff10a..d44dd5a 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,18 +19,26 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.ConfigSettingValuesModel; import com.configcat.publicapi.java.client.model.JsonPatchOperation; import com.configcat.publicapi.java.client.model.SettingValueModel; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdateSettingValueModel; import com.configcat.publicapi.java.client.model.UpdateSettingValuesWithIdModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class FeatureFlagSettingValuesApi { private ApiClient localVarApiClient; @@ -71,32 +79,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getSettingValue - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValueCall( - UUID environmentId, Integer settingId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingValueCall(UUID environmentId, Integer settingId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -105,14 +110,9 @@ public okhttp3.Call getSettingValueCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/environments/{environmentId}/settings/{settingId}/value" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v1/environments/{environmentId}/settings/{settingId}/value" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -120,189 +120,133 @@ public okhttp3.Call getSettingValueCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingValueValidateBeforeCall( - UUID environmentId, Integer settingId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getSettingValueValidateBeforeCall(UUID environmentId, Integer settingId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " getSettingValue(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling getSettingValue(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " getSettingValue(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling getSettingValue(Async)"); } return getSettingValueCall(environmentId, settingId, _callback); + } /** - * Get value This endpoint returns the value of a Feature Flag or Setting in a specified - * Environment identified by the `environmentId` parameter. The most important - * attributes in the response are the `value`, `rolloutRules` and - * `percentageRules`. The `value` represents what the clients will get when - * the evaluation requests of our SDKs are not matching to any of the defined Targeting or - * Percentage Rules, or when there are no additional rules to evaluate. The - * `rolloutRules` and `percentageRules` attributes are representing the - * current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in - * an **ordered** collection, which means the order of the returned rules is matching to the - * evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview). - * + * Get value + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the `environmentId` parameter. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview). * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @return SettingValueModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingValueModel getSettingValue(UUID environmentId, Integer settingId) - throws ApiException { - ApiResponse localVarResp = - getSettingValueWithHttpInfo(environmentId, settingId); + public SettingValueModel getSettingValue(UUID environmentId, Integer settingId) throws ApiException { + ApiResponse localVarResp = getSettingValueWithHttpInfo(environmentId, settingId); return localVarResp.getData(); } /** - * Get value This endpoint returns the value of a Feature Flag or Setting in a specified - * Environment identified by the `environmentId` parameter. The most important - * attributes in the response are the `value`, `rolloutRules` and - * `percentageRules`. The `value` represents what the clients will get when - * the evaluation requests of our SDKs are not matching to any of the defined Targeting or - * Percentage Rules, or when there are no additional rules to evaluate. The - * `rolloutRules` and `percentageRules` attributes are representing the - * current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in - * an **ordered** collection, which means the order of the returned rules is matching to the - * evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview). - * + * Get value + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the `environmentId` parameter. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview). * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @return ApiResponse<SettingValueModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getSettingValueWithHttpInfo( - UUID environmentId, Integer settingId) throws ApiException { - okhttp3.Call localVarCall = - getSettingValueValidateBeforeCall(environmentId, settingId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse getSettingValueWithHttpInfo(UUID environmentId, Integer settingId) throws ApiException { + okhttp3.Call localVarCall = getSettingValueValidateBeforeCall(environmentId, settingId, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get value (asynchronously) This endpoint returns the value of a Feature Flag or Setting in a - * specified Environment identified by the `environmentId` parameter. The most - * important attributes in the response are the `value`, `rolloutRules` and - * `percentageRules`. The `value` represents what the clients will get when - * the evaluation requests of our SDKs are not matching to any of the defined Targeting or - * Percentage Rules, or when there are no additional rules to evaluate. The - * `rolloutRules` and `percentageRules` attributes are representing the - * current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in - * an **ordered** collection, which means the order of the returned rules is matching to the - * evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview). - * + * Get value (asynchronously) + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the `environmentId` parameter. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview). * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValueAsync( - UUID environmentId, Integer settingId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingValueAsync(UUID environmentId, Integer settingId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - getSettingValueValidateBeforeCall(environmentId, settingId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = getSettingValueValidateBeforeCall(environmentId, settingId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getSettingValues - * * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValuesCall( - UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSettingValuesCall(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -311,14 +255,9 @@ public okhttp3.Call getSettingValuesCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/configs/{configId}/environments/{environmentId}/values" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())) - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v1/configs/{configId}/environments/{environmentId}/values" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())) + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -326,199 +265,135 @@ public okhttp3.Call getSettingValuesCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingValuesValidateBeforeCall( - UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getSettingValuesValidateBeforeCall(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling" - + " getSettingValues(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling getSettingValues(Async)"); } // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " getSettingValues(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling getSettingValues(Async)"); } return getSettingValuesCall(configId, environmentId, _callback); + } /** - * Get values This endpoint returns the value of a specified Config's Feature Flags or - * Settings identified by the `configId` parameter in a specified Environment - * identified by the `environmentId` parameter. The most important attributes in the - * response are the `value`, `rolloutRules` and `percentageRules`. - * The `value` represents what the clients will get when the evaluation requests of - * our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there - * are no additional rules to evaluate. The `rolloutRules` and - * `percentageRules` attributes are representing the current Targeting and Percentage - * Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which - * means the order of the returned rules is matching to the evaluation order. You can read more - * about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). - * + * Get values + * This endpoint returns the value of a specified Config's Feature Flags or Settings identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @return ConfigSettingValuesModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ConfigSettingValuesModel getSettingValues(UUID configId, UUID environmentId) - throws ApiException { - ApiResponse localVarResp = - getSettingValuesWithHttpInfo(configId, environmentId); + public ConfigSettingValuesModel getSettingValues(UUID configId, UUID environmentId) throws ApiException { + ApiResponse localVarResp = getSettingValuesWithHttpInfo(configId, environmentId); return localVarResp.getData(); } /** - * Get values This endpoint returns the value of a specified Config's Feature Flags or - * Settings identified by the `configId` parameter in a specified Environment - * identified by the `environmentId` parameter. The most important attributes in the - * response are the `value`, `rolloutRules` and `percentageRules`. - * The `value` represents what the clients will get when the evaluation requests of - * our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there - * are no additional rules to evaluate. The `rolloutRules` and - * `percentageRules` attributes are representing the current Targeting and Percentage - * Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which - * means the order of the returned rules is matching to the evaluation order. You can read more - * about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). - * + * Get values + * This endpoint returns the value of a specified Config's Feature Flags or Settings identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @return ApiResponse<ConfigSettingValuesModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getSettingValuesWithHttpInfo( - UUID configId, UUID environmentId) throws ApiException { - okhttp3.Call localVarCall = - getSettingValuesValidateBeforeCall(configId, environmentId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse getSettingValuesWithHttpInfo(UUID configId, UUID environmentId) throws ApiException { + okhttp3.Call localVarCall = getSettingValuesValidateBeforeCall(configId, environmentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get values (asynchronously) This endpoint returns the value of a specified Config's - * Feature Flags or Settings identified by the `configId` parameter in a specified - * Environment identified by the `environmentId` parameter. The most important - * attributes in the response are the `value`, `rolloutRules` and - * `percentageRules`. The `value` represents what the clients will get when - * the evaluation requests of our SDKs are not matching to any of the defined Targeting or - * Percentage Rules, or when there are no additional rules to evaluate. The - * `rolloutRules` and `percentageRules` attributes are representing the - * current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in - * an **ordered** collection, which means the order of the returned rules is matching to the - * evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). - * + * Get values (asynchronously) + * This endpoint returns the value of a specified Config's Feature Flags or Settings identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValuesAsync( - UUID configId, - UUID environmentId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getSettingValuesValidateBeforeCall(configId, environmentId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call getSettingValuesAsync(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSettingValuesValidateBeforeCall(configId, environmentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for postSettingValues - * * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param updateSettingValuesWithIdModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateSettingValuesWithIdModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call postSettingValuesCall( - UUID configId, - UUID environmentId, - UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, - String reason, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call postSettingValuesCall(UUID configId, UUID environmentId, UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, String reason, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -527,14 +402,9 @@ public okhttp3.Call postSettingValuesCall( Object localVarPostBody = updateSettingValuesWithIdModel; // create path and map variables - String localVarPath = - "/v1/configs/{configId}/environments/{environmentId}/values" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())) - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v1/configs/{configId}/environments/{environmentId}/values" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())) + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -546,271 +416,149 @@ public okhttp3.Call postSettingValuesCall( localVarQueryParams.addAll(localVarApiClient.parameterToPair("reason", reason)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call postSettingValuesValidateBeforeCall( - UUID configId, - UUID environmentId, - UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, - String reason, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call postSettingValuesValidateBeforeCall(UUID configId, UUID environmentId, UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, String reason, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling" - + " postSettingValues(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling postSettingValues(Async)"); } // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " postSettingValues(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling postSettingValues(Async)"); } // verify the required parameter 'updateSettingValuesWithIdModel' is set if (updateSettingValuesWithIdModel == null) { - throw new ApiException( - "Missing the required parameter 'updateSettingValuesWithIdModel' when calling" - + " postSettingValues(Async)"); + throw new ApiException("Missing the required parameter 'updateSettingValuesWithIdModel' when calling postSettingValues(Async)"); } - return postSettingValuesCall( - configId, environmentId, updateSettingValuesWithIdModel, reason, _callback); + return postSettingValuesCall(configId, environmentId, updateSettingValuesWithIdModel, reason, _callback); + } /** - * Post values This endpoint replaces the values of a specified Config's Feature Flags or - * Settings identified by the `configId` parameter in a specified Environment - * identified by the `environmentId` parameter. Only the `value`, - * `rolloutRules` and `percentageRules` attributes are modifiable by this - * endpoint. **Important:** As this endpoint is doing a complete replace, it's important to - * set every other attribute that you don't want to change in its original state. Not - * listing one means it will reset. For example: We have the following resource. - * ```json { \"settingValues\": [ { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false, \"settingId\": 1 } ] } - * ``` If we send a replace request body as below: ```json { - * \"settingValues\": [ { \"value\": true, \"settingId\": 1 } ] } - * ``` Then besides that the default value is set to `true`, all the - * Percentage Rules are deleted. So we get a response like this: ```json { - * \"settingValues\": [ { \"rolloutPercentageItems\": [], - * \"rolloutRules\": [], \"value\": true, \"setting\": { - * \"settingId\": 1 } } ] } ``` The `rolloutRules` property - * describes two types of rules: - **Targeting rules**: When you want to add or update a - * targeting rule, the `comparator`, `comparisonAttribute`, and - * `comparisonValue` members are required. - **Segment rules**: When you want to add - * add or update a segment rule, the `segmentId` which identifies the desired segment - * and the `segmentComparator` members are required. - * + * Post values + * This endpoint replaces the values of a specified Config's Feature Flags or Settings identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"settingValues\": [ { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false, \"settingId\": 1 } ] } ``` If we send a replace request body as below: ```json { \"settingValues\": [ { \"value\": true, \"settingId\": 1 } ] } ``` Then besides that the default value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"settingValues\": [ { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true, \"setting\": { \"settingId\": 1 } } ] } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param updateSettingValuesWithIdModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateSettingValuesWithIdModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return ConfigSettingValuesModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ConfigSettingValuesModel postSettingValues( - UUID configId, - UUID environmentId, - UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, - String reason) - throws ApiException { - ApiResponse localVarResp = - postSettingValuesWithHttpInfo( - configId, environmentId, updateSettingValuesWithIdModel, reason); + public ConfigSettingValuesModel postSettingValues(UUID configId, UUID environmentId, UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, String reason) throws ApiException { + ApiResponse localVarResp = postSettingValuesWithHttpInfo(configId, environmentId, updateSettingValuesWithIdModel, reason); return localVarResp.getData(); } /** - * Post values This endpoint replaces the values of a specified Config's Feature Flags or - * Settings identified by the `configId` parameter in a specified Environment - * identified by the `environmentId` parameter. Only the `value`, - * `rolloutRules` and `percentageRules` attributes are modifiable by this - * endpoint. **Important:** As this endpoint is doing a complete replace, it's important to - * set every other attribute that you don't want to change in its original state. Not - * listing one means it will reset. For example: We have the following resource. - * ```json { \"settingValues\": [ { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false, \"settingId\": 1 } ] } - * ``` If we send a replace request body as below: ```json { - * \"settingValues\": [ { \"value\": true, \"settingId\": 1 } ] } - * ``` Then besides that the default value is set to `true`, all the - * Percentage Rules are deleted. So we get a response like this: ```json { - * \"settingValues\": [ { \"rolloutPercentageItems\": [], - * \"rolloutRules\": [], \"value\": true, \"setting\": { - * \"settingId\": 1 } } ] } ``` The `rolloutRules` property - * describes two types of rules: - **Targeting rules**: When you want to add or update a - * targeting rule, the `comparator`, `comparisonAttribute`, and - * `comparisonValue` members are required. - **Segment rules**: When you want to add - * add or update a segment rule, the `segmentId` which identifies the desired segment - * and the `segmentComparator` members are required. - * + * Post values + * This endpoint replaces the values of a specified Config's Feature Flags or Settings identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"settingValues\": [ { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false, \"settingId\": 1 } ] } ``` If we send a replace request body as below: ```json { \"settingValues\": [ { \"value\": true, \"settingId\": 1 } ] } ``` Then besides that the default value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"settingValues\": [ { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true, \"setting\": { \"settingId\": 1 } } ] } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param updateSettingValuesWithIdModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateSettingValuesWithIdModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return ApiResponse<ConfigSettingValuesModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse postSettingValuesWithHttpInfo( - UUID configId, - UUID environmentId, - UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, - String reason) - throws ApiException { - okhttp3.Call localVarCall = - postSettingValuesValidateBeforeCall( - configId, environmentId, updateSettingValuesWithIdModel, reason, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse postSettingValuesWithHttpInfo(UUID configId, UUID environmentId, UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, String reason) throws ApiException { + okhttp3.Call localVarCall = postSettingValuesValidateBeforeCall(configId, environmentId, updateSettingValuesWithIdModel, reason, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Post values (asynchronously) This endpoint replaces the values of a specified Config's - * Feature Flags or Settings identified by the `configId` parameter in a specified - * Environment identified by the `environmentId` parameter. Only the - * `value`, `rolloutRules` and `percentageRules` attributes are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other attribute that you don't want to change in its - * original state. Not listing one means it will reset. For example: We have the following - * resource. ```json { \"settingValues\": [ { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false, \"settingId\": 1 } ] } - * ``` If we send a replace request body as below: ```json { - * \"settingValues\": [ { \"value\": true, \"settingId\": 1 } ] } - * ``` Then besides that the default value is set to `true`, all the - * Percentage Rules are deleted. So we get a response like this: ```json { - * \"settingValues\": [ { \"rolloutPercentageItems\": [], - * \"rolloutRules\": [], \"value\": true, \"setting\": { - * \"settingId\": 1 } } ] } ``` The `rolloutRules` property - * describes two types of rules: - **Targeting rules**: When you want to add or update a - * targeting rule, the `comparator`, `comparisonAttribute`, and - * `comparisonValue` members are required. - **Segment rules**: When you want to add - * add or update a segment rule, the `segmentId` which identifies the desired segment - * and the `segmentComparator` members are required. - * + * Post values (asynchronously) + * This endpoint replaces the values of a specified Config's Feature Flags or Settings identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"settingValues\": [ { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false, \"settingId\": 1 } ] } ``` If we send a replace request body as below: ```json { \"settingValues\": [ { \"value\": true, \"settingId\": 1 } ] } ``` Then besides that the default value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"settingValues\": [ { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true, \"setting\": { \"settingId\": 1 } } ] } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param updateSettingValuesWithIdModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateSettingValuesWithIdModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call postSettingValuesAsync( - UUID configId, - UUID environmentId, - UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, - String reason, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - postSettingValuesValidateBeforeCall( - configId, environmentId, updateSettingValuesWithIdModel, reason, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call postSettingValuesAsync(UUID configId, UUID environmentId, UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel, String reason, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postSettingValuesValidateBeforeCall(configId, environmentId, updateSettingValuesWithIdModel, reason, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for replaceSettingValue - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param updateSettingValueModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateSettingValueModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingValueCall( - UUID environmentId, - Integer settingId, - UpdateSettingValueModel updateSettingValueModel, - String reason, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call replaceSettingValueCall(UUID environmentId, Integer settingId, UpdateSettingValueModel updateSettingValueModel, String reason, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -819,14 +567,9 @@ public okhttp3.Call replaceSettingValueCall( Object localVarPostBody = updateSettingValueModel; // create path and map variables - String localVarPath = - "/v1/environments/{environmentId}/settings/{settingId}/value" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v1/environments/{environmentId}/settings/{settingId}/value" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -838,260 +581,150 @@ public okhttp3.Call replaceSettingValueCall( localVarQueryParams.addAll(localVarApiClient.parameterToPair("reason", reason)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceSettingValueValidateBeforeCall( - UUID environmentId, - Integer settingId, - UpdateSettingValueModel updateSettingValueModel, - String reason, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call replaceSettingValueValidateBeforeCall(UUID environmentId, Integer settingId, UpdateSettingValueModel updateSettingValueModel, String reason, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " replaceSettingValue(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling replaceSettingValue(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " replaceSettingValue(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling replaceSettingValue(Async)"); } // verify the required parameter 'updateSettingValueModel' is set if (updateSettingValueModel == null) { - throw new ApiException( - "Missing the required parameter 'updateSettingValueModel' when calling" - + " replaceSettingValue(Async)"); + throw new ApiException("Missing the required parameter 'updateSettingValueModel' when calling replaceSettingValue(Async)"); } - return replaceSettingValueCall( - environmentId, settingId, updateSettingValueModel, reason, _callback); + return replaceSettingValueCall(environmentId, settingId, updateSettingValueModel, reason, _callback); + } /** - * Replace value This endpoint replaces the whole value of a Feature Flag or Setting in a - * specified Environment. Only the `value`, `rolloutRules` and - * `percentageRules` attributes are modifiable by this endpoint. **Important:** As - * this endpoint is doing a complete replace, it's important to set every other attribute - * that you don't want to change in its original state. Not listing one means it will reset. - * For example: We have the following resource. ```json { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false } ``` If we send a - * replace request body as below: ```json { \"value\": true } - * ``` Then besides that the default value is set to `true`, all the - * Percentage Rules are deleted. So we get a response like this: ```json { - * \"rolloutPercentageItems\": [], \"rolloutRules\": [], - * \"value\": true } ``` The `rolloutRules` property - * describes two types of rules: - **Targeting rules**: When you want to add or update a - * targeting rule, the `comparator`, `comparisonAttribute`, and - * `comparisonValue` members are required. - **Segment rules**: When you want to add - * add or update a segment rule, the `segmentId` which identifies the desired segment - * and the `segmentComparator` members are required. - * + * Replace value + * This endpoint replaces the whole value of a Feature Flag or Setting in a specified Environment. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send a replace request body as below: ```json { \"value\": true } ``` Then besides that the default value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param updateSettingValueModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateSettingValueModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return SettingValueModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingValueModel replaceSettingValue( - UUID environmentId, - Integer settingId, - UpdateSettingValueModel updateSettingValueModel, - String reason) - throws ApiException { - ApiResponse localVarResp = - replaceSettingValueWithHttpInfo( - environmentId, settingId, updateSettingValueModel, reason); + public SettingValueModel replaceSettingValue(UUID environmentId, Integer settingId, UpdateSettingValueModel updateSettingValueModel, String reason) throws ApiException { + ApiResponse localVarResp = replaceSettingValueWithHttpInfo(environmentId, settingId, updateSettingValueModel, reason); return localVarResp.getData(); } /** - * Replace value This endpoint replaces the whole value of a Feature Flag or Setting in a - * specified Environment. Only the `value`, `rolloutRules` and - * `percentageRules` attributes are modifiable by this endpoint. **Important:** As - * this endpoint is doing a complete replace, it's important to set every other attribute - * that you don't want to change in its original state. Not listing one means it will reset. - * For example: We have the following resource. ```json { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false } ``` If we send a - * replace request body as below: ```json { \"value\": true } - * ``` Then besides that the default value is set to `true`, all the - * Percentage Rules are deleted. So we get a response like this: ```json { - * \"rolloutPercentageItems\": [], \"rolloutRules\": [], - * \"value\": true } ``` The `rolloutRules` property - * describes two types of rules: - **Targeting rules**: When you want to add or update a - * targeting rule, the `comparator`, `comparisonAttribute`, and - * `comparisonValue` members are required. - **Segment rules**: When you want to add - * add or update a segment rule, the `segmentId` which identifies the desired segment - * and the `segmentComparator` members are required. - * + * Replace value + * This endpoint replaces the whole value of a Feature Flag or Setting in a specified Environment. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send a replace request body as below: ```json { \"value\": true } ``` Then besides that the default value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param updateSettingValueModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateSettingValueModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return ApiResponse<SettingValueModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse replaceSettingValueWithHttpInfo( - UUID environmentId, - Integer settingId, - UpdateSettingValueModel updateSettingValueModel, - String reason) - throws ApiException { - okhttp3.Call localVarCall = - replaceSettingValueValidateBeforeCall( - environmentId, settingId, updateSettingValueModel, reason, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse replaceSettingValueWithHttpInfo(UUID environmentId, Integer settingId, UpdateSettingValueModel updateSettingValueModel, String reason) throws ApiException { + okhttp3.Call localVarCall = replaceSettingValueValidateBeforeCall(environmentId, settingId, updateSettingValueModel, reason, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace value (asynchronously) This endpoint replaces the whole value of a Feature Flag or - * Setting in a specified Environment. Only the `value`, `rolloutRules` and - * `percentageRules` attributes are modifiable by this endpoint. **Important:** As - * this endpoint is doing a complete replace, it's important to set every other attribute - * that you don't want to change in its original state. Not listing one means it will reset. - * For example: We have the following resource. ```json { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false } ``` If we send a - * replace request body as below: ```json { \"value\": true } - * ``` Then besides that the default value is set to `true`, all the - * Percentage Rules are deleted. So we get a response like this: ```json { - * \"rolloutPercentageItems\": [], \"rolloutRules\": [], - * \"value\": true } ``` The `rolloutRules` property - * describes two types of rules: - **Targeting rules**: When you want to add or update a - * targeting rule, the `comparator`, `comparisonAttribute`, and - * `comparisonValue` members are required. - **Segment rules**: When you want to add - * add or update a segment rule, the `segmentId` which identifies the desired segment - * and the `segmentComparator` members are required. - * + * Replace value (asynchronously) + * This endpoint replaces the whole value of a Feature Flag or Setting in a specified Environment. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send a replace request body as below: ```json { \"value\": true } ``` Then besides that the default value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param updateSettingValueModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateSettingValueModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingValueAsync( - UUID environmentId, - Integer settingId, - UpdateSettingValueModel updateSettingValueModel, - String reason, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - replaceSettingValueValidateBeforeCall( - environmentId, settingId, updateSettingValueModel, reason, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call replaceSettingValueAsync(UUID environmentId, Integer settingId, UpdateSettingValueModel updateSettingValueModel, String reason, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = replaceSettingValueValidateBeforeCall(environmentId, settingId, updateSettingValueModel, reason, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateSettingValue - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingValueCall( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateSettingValueCall(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1100,14 +733,9 @@ public okhttp3.Call updateSettingValueCall( Object localVarPostBody = jsonPatchOperation; // create path and map variables - String localVarPath = - "/v1/environments/{environmentId}/settings/{settingId}/value" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v1/environments/{environmentId}/settings/{settingId}/value" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1119,237 +747,122 @@ public okhttp3.Call updateSettingValueCall( localVarQueryParams.addAll(localVarApiClient.parameterToPair("reason", reason)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PATCH", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSettingValueValidateBeforeCall( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateSettingValueValidateBeforeCall(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " updateSettingValue(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling updateSettingValue(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " updateSettingValue(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling updateSettingValue(Async)"); } // verify the required parameter 'jsonPatchOperation' is set if (jsonPatchOperation == null) { - throw new ApiException( - "Missing the required parameter 'jsonPatchOperation' when calling" - + " updateSettingValue(Async)"); + throw new ApiException("Missing the required parameter 'jsonPatchOperation' when calling updateSettingValue(Async)"); } - return updateSettingValueCall( - environmentId, settingId, jsonPatchOperation, reason, _callback); + return updateSettingValueCall(environmentId, settingId, jsonPatchOperation, reason, _callback); + } /** - * Update value This endpoint updates the value of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the - * `value`, `rolloutRules` and `percentageRules` attributes are - * modifiable by this endpoint. The advantage of using JSON Patch is that you can describe - * individual update operations on a resource without touching attributes that you don't - * want to change. It supports collection reordering, so it also can be used for reordering the - * targeting rules of a Feature Flag or Setting. For example: We have the following resource. - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": false } ``` If we send - * an update request body as below: ```json [ { \"op\": - * \"replace\", \"path\": \"/value\", \"value\": true } - * ] ``` Only the default value is going to be set to `true` and all - * the Percentage Rules are remaining unchanged. So we get a response like this: - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": true } ``` The - * `rolloutRules` property describes two types of rules: - **Targeting rules**: When - * you want to add or update a targeting rule, the `comparator`, - * `comparisonAttribute`, and `comparisonValue` members are required. - - * **Segment rules**: When you want to add add or update a segment rule, the - * `segmentId` which identifies the desired segment and the - * `segmentComparator` members are required. - * + * Update value + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/value\", \"value\": true } ] ``` Only the default value is going to be set to `true` and all the Percentage Rules are remaining unchanged. So we get a response like this: ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": true } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return SettingValueModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingValueModel updateSettingValue( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason) - throws ApiException { - ApiResponse localVarResp = - updateSettingValueWithHttpInfo( - environmentId, settingId, jsonPatchOperation, reason); + public SettingValueModel updateSettingValue(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason) throws ApiException { + ApiResponse localVarResp = updateSettingValueWithHttpInfo(environmentId, settingId, jsonPatchOperation, reason); return localVarResp.getData(); } /** - * Update value This endpoint updates the value of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the - * `value`, `rolloutRules` and `percentageRules` attributes are - * modifiable by this endpoint. The advantage of using JSON Patch is that you can describe - * individual update operations on a resource without touching attributes that you don't - * want to change. It supports collection reordering, so it also can be used for reordering the - * targeting rules of a Feature Flag or Setting. For example: We have the following resource. - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": false } ``` If we send - * an update request body as below: ```json [ { \"op\": - * \"replace\", \"path\": \"/value\", \"value\": true } - * ] ``` Only the default value is going to be set to `true` and all - * the Percentage Rules are remaining unchanged. So we get a response like this: - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": true } ``` The - * `rolloutRules` property describes two types of rules: - **Targeting rules**: When - * you want to add or update a targeting rule, the `comparator`, - * `comparisonAttribute`, and `comparisonValue` members are required. - - * **Segment rules**: When you want to add add or update a segment rule, the - * `segmentId` which identifies the desired segment and the - * `segmentComparator` members are required. - * + * Update value + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/value\", \"value\": true } ] ``` Only the default value is going to be set to `true` and all the Percentage Rules are remaining unchanged. So we get a response like this: ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": true } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return ApiResponse<SettingValueModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateSettingValueWithHttpInfo( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason) - throws ApiException { - okhttp3.Call localVarCall = - updateSettingValueValidateBeforeCall( - environmentId, settingId, jsonPatchOperation, reason, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateSettingValueWithHttpInfo(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason) throws ApiException { + okhttp3.Call localVarCall = updateSettingValueValidateBeforeCall(environmentId, settingId, jsonPatchOperation, reason, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update value (asynchronously) This endpoint updates the value of a Feature Flag or Setting - * with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified - * Environment. Only the `value`, `rolloutRules` and - * `percentageRules` attributes are modifiable by this endpoint. The advantage of - * using JSON Patch is that you can describe individual update operations on a resource without - * touching attributes that you don't want to change. It supports collection reordering, so - * it also can be used for reordering the targeting rules of a Feature Flag or Setting. For - * example: We have the following resource. ```json { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false } ``` If we send an - * update request body as below: ```json [ { \"op\": - * \"replace\", \"path\": \"/value\", \"value\": true } - * ] ``` Only the default value is going to be set to `true` and all - * the Percentage Rules are remaining unchanged. So we get a response like this: - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": true } ``` The - * `rolloutRules` property describes two types of rules: - **Targeting rules**: When - * you want to add or update a targeting rule, the `comparator`, - * `comparisonAttribute`, and `comparisonValue` members are required. - - * **Segment rules**: When you want to add add or update a segment rule, the - * `segmentId` which identifies the desired segment and the - * `segmentComparator` members are required. - * + * Update value (asynchronously) + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/value\", \"value\": true } ] ``` Only the default value is going to be set to `true` and all the Percentage Rules are remaining unchanged. So we get a response like this: ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": true } ``` The `rolloutRules` property describes two types of rules: - **Targeting rules**: When you want to add or update a targeting rule, the `comparator`, `comparisonAttribute`, and `comparisonValue` members are required. - **Segment rules**: When you want to add add or update a segment rule, the `segmentId` which identifies the desired segment and the `segmentComparator` members are required. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingValueAsync( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateSettingValueValidateBeforeCall( - environmentId, settingId, jsonPatchOperation, reason, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateSettingValueAsync(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSettingValueValidateBeforeCall(environmentId, settingId, jsonPatchOperation, reason, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesUsingSdkKeyApi.java b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesUsingSdkKeyApi.java index a111aa8..d77443d 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesUsingSdkKeyApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesUsingSdkKeyApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,10 +19,18 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.JsonPatchOperation; import com.configcat.publicapi.java.client.model.SettingValueModel; import com.configcat.publicapi.java.client.model.UpdateSettingValueModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; @@ -68,33 +76,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getSettingValueBySdkkey - * * @param settingKeyOrId The key or id of the Setting. (required) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValueBySdkkeyCall( - String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingValueBySdkkeyCall(String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -103,11 +107,8 @@ public okhttp3.Call getSettingValueBySdkkeyCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/settings/{settingKeyOrId}/value" - .replace( - "{" + "settingKeyOrId" + "}", - localVarApiClient.escapeString(settingKeyOrId.toString())); + String localVarPath = "/v1/settings/{settingKeyOrId}/value" + .replace("{" + "settingKeyOrId" + "}", localVarApiClient.escapeString(settingKeyOrId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -116,207 +117,133 @@ public okhttp3.Call getSettingValueBySdkkeyCall( Map localVarFormParams = new HashMap(); if (X_CONFIGCAT_SDKKEY != null) { - localVarHeaderParams.put( - "X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); + localVarHeaderParams.put("X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingValueBySdkkeyValidateBeforeCall( - String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getSettingValueBySdkkeyValidateBeforeCall(String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingKeyOrId' is set if (settingKeyOrId == null) { - throw new ApiException( - "Missing the required parameter 'settingKeyOrId' when calling" - + " getSettingValueBySdkkey(Async)"); + throw new ApiException("Missing the required parameter 'settingKeyOrId' when calling getSettingValueBySdkkey(Async)"); } return getSettingValueBySdkkeyCall(settingKeyOrId, X_CONFIGCAT_SDKKEY, _callback); + } /** - * Get value This endpoint returns the value of a Feature Flag or Setting in a specified - * Environment identified by the <a target=\"_blank\" rel=\"noopener - * noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK - * key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important - * attributes in the response are the `value`, `rolloutRules` and - * `percentageRules`. The `value` represents what the clients will get when - * the evaluation requests of our SDKs are not matching to any of the defined Targeting or - * Percentage Rules, or when there are no additional rules to evaluate. The - * `rolloutRules` and `percentageRules` attributes are representing the - * current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in - * an **ordered** collection, which means the order of the returned rules is matching to the - * evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). - * + * Get value + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). * @param settingKeyOrId The key or id of the Setting. (required) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return SettingValueModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingValueModel getSettingValueBySdkkey( - String settingKeyOrId, String X_CONFIGCAT_SDKKEY) throws ApiException { - ApiResponse localVarResp = - getSettingValueBySdkkeyWithHttpInfo(settingKeyOrId, X_CONFIGCAT_SDKKEY); + public SettingValueModel getSettingValueBySdkkey(String settingKeyOrId, String X_CONFIGCAT_SDKKEY) throws ApiException { + ApiResponse localVarResp = getSettingValueBySdkkeyWithHttpInfo(settingKeyOrId, X_CONFIGCAT_SDKKEY); return localVarResp.getData(); } /** - * Get value This endpoint returns the value of a Feature Flag or Setting in a specified - * Environment identified by the <a target=\"_blank\" rel=\"noopener - * noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK - * key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important - * attributes in the response are the `value`, `rolloutRules` and - * `percentageRules`. The `value` represents what the clients will get when - * the evaluation requests of our SDKs are not matching to any of the defined Targeting or - * Percentage Rules, or when there are no additional rules to evaluate. The - * `rolloutRules` and `percentageRules` attributes are representing the - * current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in - * an **ordered** collection, which means the order of the returned rules is matching to the - * evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). - * + * Get value + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). * @param settingKeyOrId The key or id of the Setting. (required) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return ApiResponse<SettingValueModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getSettingValueBySdkkeyWithHttpInfo( - String settingKeyOrId, String X_CONFIGCAT_SDKKEY) throws ApiException { - okhttp3.Call localVarCall = - getSettingValueBySdkkeyValidateBeforeCall(settingKeyOrId, X_CONFIGCAT_SDKKEY, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse getSettingValueBySdkkeyWithHttpInfo(String settingKeyOrId, String X_CONFIGCAT_SDKKEY) throws ApiException { + okhttp3.Call localVarCall = getSettingValueBySdkkeyValidateBeforeCall(settingKeyOrId, X_CONFIGCAT_SDKKEY, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get value (asynchronously) This endpoint returns the value of a Feature Flag or Setting in a - * specified Environment identified by the <a target=\"_blank\" - * rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. The most important attributes in the response are the - * `value`, `rolloutRules` and `percentageRules`. The - * `value` represents what the clients will get when the evaluation requests of our - * SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are - * no additional rules to evaluate. The `rolloutRules` and `percentageRules` - * attributes are representing the current Targeting and Percentage Rules configuration of the - * actual Feature Flag or Setting in an **ordered** collection, which means the order of the - * returned rules is matching to the evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). - * + * Get value (asynchronously) + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important attributes in the response are the `value`, `rolloutRules` and `percentageRules`. The `value` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting or Percentage Rules, or when there are no additional rules to evaluate. The `rolloutRules` and `percentageRules` attributes are representing the current Targeting and Percentage Rules configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). * @param settingKeyOrId The key or id of the Setting. (required) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValueBySdkkeyAsync( - String settingKeyOrId, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getSettingValueBySdkkeyValidateBeforeCall( - settingKeyOrId, X_CONFIGCAT_SDKKEY, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call getSettingValueBySdkkeyAsync(String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSettingValueBySdkkeyValidateBeforeCall(settingKeyOrId, X_CONFIGCAT_SDKKEY, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for replaceSettingValueBySdkkey - * * @param settingKeyOrId The key or id of the Setting. (required) - * @param updateSettingValueModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param updateSettingValueModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingValueBySdkkeyCall( - String settingKeyOrId, - UpdateSettingValueModel updateSettingValueModel, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call replaceSettingValueBySdkkeyCall(String settingKeyOrId, UpdateSettingValueModel updateSettingValueModel, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -325,11 +252,8 @@ public okhttp3.Call replaceSettingValueBySdkkeyCall( Object localVarPostBody = updateSettingValueModel; // create path and map variables - String localVarPath = - "/v1/settings/{settingKeyOrId}/value" - .replace( - "{" + "settingKeyOrId" + "}", - localVarApiClient.escapeString(settingKeyOrId.toString())); + String localVarPath = "/v1/settings/{settingKeyOrId}/value" + .replace("{" + "settingKeyOrId" + "}", localVarApiClient.escapeString(settingKeyOrId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -342,257 +266,148 @@ public okhttp3.Call replaceSettingValueBySdkkeyCall( } if (X_CONFIGCAT_SDKKEY != null) { - localVarHeaderParams.put( - "X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); + localVarHeaderParams.put("X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceSettingValueBySdkkeyValidateBeforeCall( - String settingKeyOrId, - UpdateSettingValueModel updateSettingValueModel, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call replaceSettingValueBySdkkeyValidateBeforeCall(String settingKeyOrId, UpdateSettingValueModel updateSettingValueModel, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingKeyOrId' is set if (settingKeyOrId == null) { - throw new ApiException( - "Missing the required parameter 'settingKeyOrId' when calling" - + " replaceSettingValueBySdkkey(Async)"); + throw new ApiException("Missing the required parameter 'settingKeyOrId' when calling replaceSettingValueBySdkkey(Async)"); } // verify the required parameter 'updateSettingValueModel' is set if (updateSettingValueModel == null) { - throw new ApiException( - "Missing the required parameter 'updateSettingValueModel' when calling" - + " replaceSettingValueBySdkkey(Async)"); + throw new ApiException("Missing the required parameter 'updateSettingValueModel' when calling replaceSettingValueBySdkkey(Async)"); } - return replaceSettingValueBySdkkeyCall( - settingKeyOrId, updateSettingValueModel, reason, X_CONFIGCAT_SDKKEY, _callback); + return replaceSettingValueBySdkkeyCall(settingKeyOrId, updateSettingValueModel, reason, X_CONFIGCAT_SDKKEY, _callback); + } /** - * Replace value This endpoint replaces the value of a Feature Flag or Setting in a specified - * Environment identified by the <a target=\"_blank\" rel=\"noopener - * noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK - * key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the - * `value`, `rolloutRules` and `percentageRules` attributes are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other attribute that you don't want to change to its - * original state. Not listing one means it will reset. For example: We have the following - * resource. ```json { \"rolloutPercentageItems\": [ { - * \"percentage\": 30, \"value\": true }, { \"percentage\": 70, - * \"value\": false } ], \"rolloutRules\": [], \"value\": false } - * ``` If we send a replace request body as below: ```json { - * \"value\": true } ``` Then besides that the default served value is - * set to `true`, all the Percentage Rules are deleted. So we get a response like - * this: ```json { \"rolloutPercentageItems\": [], - * \"rolloutRules\": [], \"value\": true } ``` - * + * Replace value + * This endpoint replaces the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send a replace request body as below: ```json { \"value\": true } ``` Then besides that the default served value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param updateSettingValueModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param updateSettingValueModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return SettingValueModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingValueModel replaceSettingValueBySdkkey( - String settingKeyOrId, - UpdateSettingValueModel updateSettingValueModel, - String reason, - String X_CONFIGCAT_SDKKEY) - throws ApiException { - ApiResponse localVarResp = - replaceSettingValueBySdkkeyWithHttpInfo( - settingKeyOrId, updateSettingValueModel, reason, X_CONFIGCAT_SDKKEY); + public SettingValueModel replaceSettingValueBySdkkey(String settingKeyOrId, UpdateSettingValueModel updateSettingValueModel, String reason, String X_CONFIGCAT_SDKKEY) throws ApiException { + ApiResponse localVarResp = replaceSettingValueBySdkkeyWithHttpInfo(settingKeyOrId, updateSettingValueModel, reason, X_CONFIGCAT_SDKKEY); return localVarResp.getData(); } /** - * Replace value This endpoint replaces the value of a Feature Flag or Setting in a specified - * Environment identified by the <a target=\"_blank\" rel=\"noopener - * noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK - * key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the - * `value`, `rolloutRules` and `percentageRules` attributes are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other attribute that you don't want to change to its - * original state. Not listing one means it will reset. For example: We have the following - * resource. ```json { \"rolloutPercentageItems\": [ { - * \"percentage\": 30, \"value\": true }, { \"percentage\": 70, - * \"value\": false } ], \"rolloutRules\": [], \"value\": false } - * ``` If we send a replace request body as below: ```json { - * \"value\": true } ``` Then besides that the default served value is - * set to `true`, all the Percentage Rules are deleted. So we get a response like - * this: ```json { \"rolloutPercentageItems\": [], - * \"rolloutRules\": [], \"value\": true } ``` - * + * Replace value + * This endpoint replaces the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send a replace request body as below: ```json { \"value\": true } ``` Then besides that the default served value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param updateSettingValueModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param updateSettingValueModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return ApiResponse<SettingValueModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse replaceSettingValueBySdkkeyWithHttpInfo( - String settingKeyOrId, - UpdateSettingValueModel updateSettingValueModel, - String reason, - String X_CONFIGCAT_SDKKEY) - throws ApiException { - okhttp3.Call localVarCall = - replaceSettingValueBySdkkeyValidateBeforeCall( - settingKeyOrId, updateSettingValueModel, reason, X_CONFIGCAT_SDKKEY, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse replaceSettingValueBySdkkeyWithHttpInfo(String settingKeyOrId, UpdateSettingValueModel updateSettingValueModel, String reason, String X_CONFIGCAT_SDKKEY) throws ApiException { + okhttp3.Call localVarCall = replaceSettingValueBySdkkeyValidateBeforeCall(settingKeyOrId, updateSettingValueModel, reason, X_CONFIGCAT_SDKKEY, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace value (asynchronously) This endpoint replaces the value of a Feature Flag or Setting - * in a specified Environment identified by the <a target=\"_blank\" - * rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` - * and `percentageRules` attributes are modifiable by this endpoint. **Important:** As - * this endpoint is doing a complete replace, it's important to set every other attribute - * that you don't want to change to its original state. Not listing one means it will reset. - * For example: We have the following resource. ```json { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false } ``` If we send a - * replace request body as below: ```json { \"value\": true } - * ``` Then besides that the default served value is set to `true`, all - * the Percentage Rules are deleted. So we get a response like this: ```json { - * \"rolloutPercentageItems\": [], \"rolloutRules\": [], - * \"value\": true } ``` - * + * Replace value (asynchronously) + * This endpoint replaces the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send a replace request body as below: ```json { \"value\": true } ``` Then besides that the default served value is set to `true`, all the Percentage Rules are deleted. So we get a response like this: ```json { \"rolloutPercentageItems\": [], \"rolloutRules\": [], \"value\": true } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param updateSettingValueModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param updateSettingValueModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingValueBySdkkeyAsync( - String settingKeyOrId, - UpdateSettingValueModel updateSettingValueModel, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - replaceSettingValueBySdkkeyValidateBeforeCall( - settingKeyOrId, - updateSettingValueModel, - reason, - X_CONFIGCAT_SDKKEY, - _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call replaceSettingValueBySdkkeyAsync(String settingKeyOrId, UpdateSettingValueModel updateSettingValueModel, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = replaceSettingValueBySdkkeyValidateBeforeCall(settingKeyOrId, updateSettingValueModel, reason, X_CONFIGCAT_SDKKEY, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateSettingValueBySdkkey - * * @param settingKeyOrId The key or id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingValueBySdkkeyCall( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateSettingValueBySdkkeyCall(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -601,11 +416,8 @@ public okhttp3.Call updateSettingValueBySdkkeyCall( Object localVarPostBody = jsonPatchOperation; // create path and map variables - String localVarPath = - "/v1/settings/{settingKeyOrId}/value" - .replace( - "{" + "settingKeyOrId" + "}", - localVarApiClient.escapeString(settingKeyOrId.toString())); + String localVarPath = "/v1/settings/{settingKeyOrId}/value" + .replace("{" + "settingKeyOrId" + "}", localVarApiClient.escapeString(settingKeyOrId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -618,227 +430,120 @@ public okhttp3.Call updateSettingValueBySdkkeyCall( } if (X_CONFIGCAT_SDKKEY != null) { - localVarHeaderParams.put( - "X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); + localVarHeaderParams.put("X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PATCH", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSettingValueBySdkkeyValidateBeforeCall( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateSettingValueBySdkkeyValidateBeforeCall(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingKeyOrId' is set if (settingKeyOrId == null) { - throw new ApiException( - "Missing the required parameter 'settingKeyOrId' when calling" - + " updateSettingValueBySdkkey(Async)"); + throw new ApiException("Missing the required parameter 'settingKeyOrId' when calling updateSettingValueBySdkkey(Async)"); } // verify the required parameter 'jsonPatchOperation' is set if (jsonPatchOperation == null) { - throw new ApiException( - "Missing the required parameter 'jsonPatchOperation' when calling" - + " updateSettingValueBySdkkey(Async)"); + throw new ApiException("Missing the required parameter 'jsonPatchOperation' when calling updateSettingValueBySdkkey(Async)"); } - return updateSettingValueBySdkkeyCall( - settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, _callback); + return updateSettingValueBySdkkeyCall(settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, _callback); + } /** - * Update value This endpoint updates the value of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Environment identified by - * the <a target=\"_blank\" rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` - * and `percentageRules` attributes are modifiable by this endpoint. The advantage of - * using JSON Patch is that you can describe individual update operations on a resource without - * touching attributes that you don't want to change. It supports collection reordering, so - * it also can be used for reordering the targeting rules of a Feature Flag or Setting. For - * example: We have the following resource. ```json { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false } ``` If we send an - * update request body as below: ```json [ { \"op\": - * \"replace\", \"path\": \"/value\", \"value\": true } - * ] ``` Only the default served value is going to be set to `true` and - * all the Percentage Rules are remaining unchanged. So we get a response like this: - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": true } ``` - * + * Update value + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/value\", \"value\": true } ] ``` Only the default served value is going to be set to `true` and all the Percentage Rules are remaining unchanged. So we get a response like this: ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": true } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return SettingValueModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingValueModel updateSettingValueBySdkkey( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY) - throws ApiException { - ApiResponse localVarResp = - updateSettingValueBySdkkeyWithHttpInfo( - settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY); + public SettingValueModel updateSettingValueBySdkkey(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY) throws ApiException { + ApiResponse localVarResp = updateSettingValueBySdkkeyWithHttpInfo(settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY); return localVarResp.getData(); } /** - * Update value This endpoint updates the value of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Environment identified by - * the <a target=\"_blank\" rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` - * and `percentageRules` attributes are modifiable by this endpoint. The advantage of - * using JSON Patch is that you can describe individual update operations on a resource without - * touching attributes that you don't want to change. It supports collection reordering, so - * it also can be used for reordering the targeting rules of a Feature Flag or Setting. For - * example: We have the following resource. ```json { - * \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": - * true }, { \"percentage\": 70, \"value\": false } ], - * \"rolloutRules\": [], \"value\": false } ``` If we send an - * update request body as below: ```json [ { \"op\": - * \"replace\", \"path\": \"/value\", \"value\": true } - * ] ``` Only the default served value is going to be set to `true` and - * all the Percentage Rules are remaining unchanged. So we get a response like this: - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": true } ``` - * + * Update value + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/value\", \"value\": true } ] ``` Only the default served value is going to be set to `true` and all the Percentage Rules are remaining unchanged. So we get a response like this: ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": true } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return ApiResponse<SettingValueModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateSettingValueBySdkkeyWithHttpInfo( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY) - throws ApiException { - okhttp3.Call localVarCall = - updateSettingValueBySdkkeyValidateBeforeCall( - settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateSettingValueBySdkkeyWithHttpInfo(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY) throws ApiException { + okhttp3.Call localVarCall = updateSettingValueBySdkkeyValidateBeforeCall(settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update value (asynchronously) This endpoint updates the value of a Feature Flag or Setting - * with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified - * Environment identified by the <a target=\"_blank\" rel=\"noopener - * noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK - * key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the - * `value`, `rolloutRules` and `percentageRules` attributes are - * modifiable by this endpoint. The advantage of using JSON Patch is that you can describe - * individual update operations on a resource without touching attributes that you don't - * want to change. It supports collection reordering, so it also can be used for reordering the - * targeting rules of a Feature Flag or Setting. For example: We have the following resource. - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": false } ``` If we send - * an update request body as below: ```json [ { \"op\": - * \"replace\", \"path\": \"/value\", \"value\": true } - * ] ``` Only the default served value is going to be set to `true` and - * all the Percentage Rules are remaining unchanged. So we get a response like this: - * ```json { \"rolloutPercentageItems\": [ { \"percentage\": - * 30, \"value\": true }, { \"percentage\": 70, \"value\": false } - * ], \"rolloutRules\": [], \"value\": true } ``` - * + * Update value (asynchronously) + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `value`, `rolloutRules` and `percentageRules` attributes are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource. ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": false } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/value\", \"value\": true } ] ``` Only the default served value is going to be set to `true` and all the Percentage Rules are remaining unchanged. So we get a response like this: ```json { \"rolloutPercentageItems\": [ { \"percentage\": 30, \"value\": true }, { \"percentage\": 70, \"value\": false } ], \"rolloutRules\": [], \"value\": true } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingValueBySdkkeyAsync( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateSettingValueBySdkkeyValidateBeforeCall( - settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateSettingValueBySdkkeyAsync(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSettingValueBySdkkeyValidateBeforeCall(settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesUsingSdkKeyV2Api.java b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesUsingSdkKeyV2Api.java index 93c0ed5..85149f8 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesUsingSdkKeyV2Api.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesUsingSdkKeyV2Api.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,10 +19,18 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.JsonPatchOperation; import com.configcat.publicapi.java.client.model.SettingFormulaModel; import com.configcat.publicapi.java.client.model.UpdateEvaluationFormulaModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; @@ -68,33 +76,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getSettingValueBySdkkeyV2 - * * @param settingKeyOrId The key or id of the Setting. (required) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValueBySdkkeyV2Call( - String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingValueBySdkkeyV2Call(String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -103,11 +107,8 @@ public okhttp3.Call getSettingValueBySdkkeyV2Call( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v2/settings/{settingKeyOrId}/value" - .replace( - "{" + "settingKeyOrId" + "}", - localVarApiClient.escapeString(settingKeyOrId.toString())); + String localVarPath = "/v2/settings/{settingKeyOrId}/value" + .replace("{" + "settingKeyOrId" + "}", localVarApiClient.escapeString(settingKeyOrId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -116,218 +117,133 @@ public okhttp3.Call getSettingValueBySdkkeyV2Call( Map localVarFormParams = new HashMap(); if (X_CONFIGCAT_SDKKEY != null) { - localVarHeaderParams.put( - "X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); + localVarHeaderParams.put("X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingValueBySdkkeyV2ValidateBeforeCall( - String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getSettingValueBySdkkeyV2ValidateBeforeCall(String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingKeyOrId' is set if (settingKeyOrId == null) { - throw new ApiException( - "Missing the required parameter 'settingKeyOrId' when calling" - + " getSettingValueBySdkkeyV2(Async)"); + throw new ApiException("Missing the required parameter 'settingKeyOrId' when calling getSettingValueBySdkkeyV2(Async)"); } return getSettingValueBySdkkeyV2Call(settingKeyOrId, X_CONFIGCAT_SDKKEY, _callback); + } /** - * Get value This endpoint returns the value of a Feature Flag or Setting in a specified - * Environment identified by the <a target=\"_blank\" rel=\"noopener - * noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK - * key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important fields - * in the response are the `defaultValue`, `targetingRules`. The - * `defaultValue` represents what the clients will get when the evaluation requests of - * our SDKs are not matching to any of the defined Targeting Rules, or when there are no - * additional rules to evaluate. The `targetingRules` represents the current Targeting - * Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which - * means the order of the returned rules is matching to the evaluation order. You can read more - * about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used at the - * [percentage - * evaluation](https://configcat.com/docs/advanced/targeting/#anatomy-of-the-percentage-based-targeting) - * of the Feature Flag or Setting. - * + * Get value + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important fields in the response are the `defaultValue`, `targetingRules`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used at the [percentage evaluation](https://configcat.com/docs/advanced/targeting/#anatomy-of-the-percentage-based-targeting) of the Feature Flag or Setting. * @param settingKeyOrId The key or id of the Setting. (required) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return SettingFormulaModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingFormulaModel getSettingValueBySdkkeyV2( - String settingKeyOrId, String X_CONFIGCAT_SDKKEY) throws ApiException { - ApiResponse localVarResp = - getSettingValueBySdkkeyV2WithHttpInfo(settingKeyOrId, X_CONFIGCAT_SDKKEY); + public SettingFormulaModel getSettingValueBySdkkeyV2(String settingKeyOrId, String X_CONFIGCAT_SDKKEY) throws ApiException { + ApiResponse localVarResp = getSettingValueBySdkkeyV2WithHttpInfo(settingKeyOrId, X_CONFIGCAT_SDKKEY); return localVarResp.getData(); } /** - * Get value This endpoint returns the value of a Feature Flag or Setting in a specified - * Environment identified by the <a target=\"_blank\" rel=\"noopener - * noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK - * key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important fields - * in the response are the `defaultValue`, `targetingRules`. The - * `defaultValue` represents what the clients will get when the evaluation requests of - * our SDKs are not matching to any of the defined Targeting Rules, or when there are no - * additional rules to evaluate. The `targetingRules` represents the current Targeting - * Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which - * means the order of the returned rules is matching to the evaluation order. You can read more - * about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used at the - * [percentage - * evaluation](https://configcat.com/docs/advanced/targeting/#anatomy-of-the-percentage-based-targeting) - * of the Feature Flag or Setting. - * + * Get value + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important fields in the response are the `defaultValue`, `targetingRules`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used at the [percentage evaluation](https://configcat.com/docs/advanced/targeting/#anatomy-of-the-percentage-based-targeting) of the Feature Flag or Setting. * @param settingKeyOrId The key or id of the Setting. (required) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return ApiResponse<SettingFormulaModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getSettingValueBySdkkeyV2WithHttpInfo( - String settingKeyOrId, String X_CONFIGCAT_SDKKEY) throws ApiException { - okhttp3.Call localVarCall = - getSettingValueBySdkkeyV2ValidateBeforeCall( - settingKeyOrId, X_CONFIGCAT_SDKKEY, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse getSettingValueBySdkkeyV2WithHttpInfo(String settingKeyOrId, String X_CONFIGCAT_SDKKEY) throws ApiException { + okhttp3.Call localVarCall = getSettingValueBySdkkeyV2ValidateBeforeCall(settingKeyOrId, X_CONFIGCAT_SDKKEY, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get value (asynchronously) This endpoint returns the value of a Feature Flag or Setting in a - * specified Environment identified by the <a target=\"_blank\" - * rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. The most important fields in the response are the - * `defaultValue`, `targetingRules`. The `defaultValue` represents - * what the clients will get when the evaluation requests of our SDKs are not matching to any of - * the defined Targeting Rules, or when there are no additional rules to evaluate. The - * `targetingRules` represents the current Targeting Rule configuration of the actual - * Feature Flag or Setting in an **ordered** collection, which means the order of the returned - * rules is matching to the evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used at the - * [percentage - * evaluation](https://configcat.com/docs/advanced/targeting/#anatomy-of-the-percentage-based-targeting) - * of the Feature Flag or Setting. - * + * Get value (asynchronously) + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. The most important fields in the response are the `defaultValue`, `targetingRules`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used at the [percentage evaluation](https://configcat.com/docs/advanced/targeting/#anatomy-of-the-percentage-based-targeting) of the Feature Flag or Setting. * @param settingKeyOrId The key or id of the Setting. (required) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValueBySdkkeyV2Async( - String settingKeyOrId, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getSettingValueBySdkkeyV2ValidateBeforeCall( - settingKeyOrId, X_CONFIGCAT_SDKKEY, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call getSettingValueBySdkkeyV2Async(String settingKeyOrId, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSettingValueBySdkkeyV2ValidateBeforeCall(settingKeyOrId, X_CONFIGCAT_SDKKEY, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for replaceSettingValueBySdkkeyV2 - * * @param settingKeyOrId The key or id of the Setting. (required) - * @param updateEvaluationFormulaModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param updateEvaluationFormulaModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingValueBySdkkeyV2Call( - String settingKeyOrId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call replaceSettingValueBySdkkeyV2Call(String settingKeyOrId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -336,11 +252,8 @@ public okhttp3.Call replaceSettingValueBySdkkeyV2Call( Object localVarPostBody = updateEvaluationFormulaModel; // create path and map variables - String localVarPath = - "/v2/settings/{settingKeyOrId}/value" - .replace( - "{" + "settingKeyOrId" + "}", - localVarApiClient.escapeString(settingKeyOrId.toString())); + String localVarPath = "/v2/settings/{settingKeyOrId}/value" + .replace("{" + "settingKeyOrId" + "}", localVarApiClient.escapeString(settingKeyOrId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -353,276 +266,148 @@ public okhttp3.Call replaceSettingValueBySdkkeyV2Call( } if (X_CONFIGCAT_SDKKEY != null) { - localVarHeaderParams.put( - "X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); + localVarHeaderParams.put("X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceSettingValueBySdkkeyV2ValidateBeforeCall( - String settingKeyOrId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call replaceSettingValueBySdkkeyV2ValidateBeforeCall(String settingKeyOrId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingKeyOrId' is set if (settingKeyOrId == null) { - throw new ApiException( - "Missing the required parameter 'settingKeyOrId' when calling" - + " replaceSettingValueBySdkkeyV2(Async)"); + throw new ApiException("Missing the required parameter 'settingKeyOrId' when calling replaceSettingValueBySdkkeyV2(Async)"); } // verify the required parameter 'updateEvaluationFormulaModel' is set if (updateEvaluationFormulaModel == null) { - throw new ApiException( - "Missing the required parameter 'updateEvaluationFormulaModel' when calling" - + " replaceSettingValueBySdkkeyV2(Async)"); + throw new ApiException("Missing the required parameter 'updateEvaluationFormulaModel' when calling replaceSettingValueBySdkkeyV2(Async)"); } - return replaceSettingValueBySdkkeyV2Call( - settingKeyOrId, - updateEvaluationFormulaModel, - reason, - X_CONFIGCAT_SDKKEY, - _callback); + return replaceSettingValueBySdkkeyV2Call(settingKeyOrId, updateEvaluationFormulaModel, reason, X_CONFIGCAT_SDKKEY, _callback); + } /** - * Replace value This endpoint replaces the value and the Targeting Rules of a Feature Flag or - * Setting in a specified Environment identified by the <a target=\"_blank\" - * rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, - * `targetingRules`, and `percentageEvaluationAttribute` fields are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other field that you don't want to change to its original - * state. Not listing one means it will reset. For example: We have the following resource of a - * Feature Flag. ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send a replace request body as below: ```json { - * \"defaultValue\": { \"boolValue\": true } } ``` Then - * besides that the default served value is set to `true`, all the Targeting Rules are - * deleted. So we get a response like this: ```json { \"defaultValue\": - * { \"boolValue\": true }, \"targetingRules\": [] } ``` - * + * Replace value + * This endpoint replaces the value and the Targeting Rules of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other field that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send a replace request body as below: ```json { \"defaultValue\": { \"boolValue\": true } } ``` Then besides that the default served value is set to `true`, all the Targeting Rules are deleted. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": true }, \"targetingRules\": [] } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param updateEvaluationFormulaModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param updateEvaluationFormulaModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return SettingFormulaModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingFormulaModel replaceSettingValueBySdkkeyV2( - String settingKeyOrId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason, - String X_CONFIGCAT_SDKKEY) - throws ApiException { - ApiResponse localVarResp = - replaceSettingValueBySdkkeyV2WithHttpInfo( - settingKeyOrId, updateEvaluationFormulaModel, reason, X_CONFIGCAT_SDKKEY); + public SettingFormulaModel replaceSettingValueBySdkkeyV2(String settingKeyOrId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason, String X_CONFIGCAT_SDKKEY) throws ApiException { + ApiResponse localVarResp = replaceSettingValueBySdkkeyV2WithHttpInfo(settingKeyOrId, updateEvaluationFormulaModel, reason, X_CONFIGCAT_SDKKEY); return localVarResp.getData(); } /** - * Replace value This endpoint replaces the value and the Targeting Rules of a Feature Flag or - * Setting in a specified Environment identified by the <a target=\"_blank\" - * rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, - * `targetingRules`, and `percentageEvaluationAttribute` fields are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other field that you don't want to change to its original - * state. Not listing one means it will reset. For example: We have the following resource of a - * Feature Flag. ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send a replace request body as below: ```json { - * \"defaultValue\": { \"boolValue\": true } } ``` Then - * besides that the default served value is set to `true`, all the Targeting Rules are - * deleted. So we get a response like this: ```json { \"defaultValue\": - * { \"boolValue\": true }, \"targetingRules\": [] } ``` - * + * Replace value + * This endpoint replaces the value and the Targeting Rules of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other field that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send a replace request body as below: ```json { \"defaultValue\": { \"boolValue\": true } } ``` Then besides that the default served value is set to `true`, all the Targeting Rules are deleted. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": true }, \"targetingRules\": [] } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param updateEvaluationFormulaModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param updateEvaluationFormulaModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return ApiResponse<SettingFormulaModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse replaceSettingValueBySdkkeyV2WithHttpInfo( - String settingKeyOrId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason, - String X_CONFIGCAT_SDKKEY) - throws ApiException { - okhttp3.Call localVarCall = - replaceSettingValueBySdkkeyV2ValidateBeforeCall( - settingKeyOrId, - updateEvaluationFormulaModel, - reason, - X_CONFIGCAT_SDKKEY, - null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse replaceSettingValueBySdkkeyV2WithHttpInfo(String settingKeyOrId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason, String X_CONFIGCAT_SDKKEY) throws ApiException { + okhttp3.Call localVarCall = replaceSettingValueBySdkkeyV2ValidateBeforeCall(settingKeyOrId, updateEvaluationFormulaModel, reason, X_CONFIGCAT_SDKKEY, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace value (asynchronously) This endpoint replaces the value and the Targeting Rules of a - * Feature Flag or Setting in a specified Environment identified by the <a - * target=\"_blank\" rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, - * `targetingRules`, and `percentageEvaluationAttribute` fields are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other field that you don't want to change to its original - * state. Not listing one means it will reset. For example: We have the following resource of a - * Feature Flag. ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send a replace request body as below: ```json { - * \"defaultValue\": { \"boolValue\": true } } ``` Then - * besides that the default served value is set to `true`, all the Targeting Rules are - * deleted. So we get a response like this: ```json { \"defaultValue\": - * { \"boolValue\": true }, \"targetingRules\": [] } ``` - * + * Replace value (asynchronously) + * This endpoint replaces the value and the Targeting Rules of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other field that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send a replace request body as below: ```json { \"defaultValue\": { \"boolValue\": true } } ``` Then besides that the default served value is set to `true`, all the Targeting Rules are deleted. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": true }, \"targetingRules\": [] } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param updateEvaluationFormulaModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param updateEvaluationFormulaModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingValueBySdkkeyV2Async( - String settingKeyOrId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - replaceSettingValueBySdkkeyV2ValidateBeforeCall( - settingKeyOrId, - updateEvaluationFormulaModel, - reason, - X_CONFIGCAT_SDKKEY, - _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call replaceSettingValueBySdkkeyV2Async(String settingKeyOrId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = replaceSettingValueBySdkkeyV2ValidateBeforeCall(settingKeyOrId, updateEvaluationFormulaModel, reason, X_CONFIGCAT_SDKKEY, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateSettingValueBySdkkeyV2 - * * @param settingKeyOrId The key or id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingValueBySdkkeyV2Call( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateSettingValueBySdkkeyV2Call(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -631,11 +416,8 @@ public okhttp3.Call updateSettingValueBySdkkeyV2Call( Object localVarPostBody = jsonPatchOperation; // create path and map variables - String localVarPath = - "/v2/settings/{settingKeyOrId}/value" - .replace( - "{" + "settingKeyOrId" + "}", - localVarApiClient.escapeString(settingKeyOrId.toString())); + String localVarPath = "/v2/settings/{settingKeyOrId}/value" + .replace("{" + "settingKeyOrId" + "}", localVarApiClient.escapeString(settingKeyOrId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -648,245 +430,120 @@ public okhttp3.Call updateSettingValueBySdkkeyV2Call( } if (X_CONFIGCAT_SDKKEY != null) { - localVarHeaderParams.put( - "X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); + localVarHeaderParams.put("X-CONFIGCAT-SDKKEY", localVarApiClient.parameterToString(X_CONFIGCAT_SDKKEY)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PATCH", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSettingValueBySdkkeyV2ValidateBeforeCall( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateSettingValueBySdkkeyV2ValidateBeforeCall(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingKeyOrId' is set if (settingKeyOrId == null) { - throw new ApiException( - "Missing the required parameter 'settingKeyOrId' when calling" - + " updateSettingValueBySdkkeyV2(Async)"); + throw new ApiException("Missing the required parameter 'settingKeyOrId' when calling updateSettingValueBySdkkeyV2(Async)"); } // verify the required parameter 'jsonPatchOperation' is set if (jsonPatchOperation == null) { - throw new ApiException( - "Missing the required parameter 'jsonPatchOperation' when calling" - + " updateSettingValueBySdkkeyV2(Async)"); + throw new ApiException("Missing the required parameter 'jsonPatchOperation' when calling updateSettingValueBySdkkeyV2(Async)"); } - return updateSettingValueBySdkkeyV2Call( - settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, _callback); + return updateSettingValueBySdkkeyV2Call(settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, _callback); + } /** - * Update value This endpoint updates the value of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the - * `defaultValue`, `targetingRules`, and - * `percentageEvaluationAttribute` fields are modifiable by this endpoint. The - * advantage of using JSON Patch is that you can describe individual update operations on a - * resource without touching attributes that you don't want to change. It supports - * collection reordering, so it also can be used for reordering the targeting rules of a Feature - * Flag or Setting. For example: We have the following resource of a Feature Flag. - * ```json { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send an update request body as below: ```json [ { - * \"op\": \"replace\", \"path\": - * \"/targetingRules/0/value/boolValue\", \"value\": true } ] - * ``` Only the first Targeting Rule's `value` is going to be set - * to `false` and all the other fields are remaining unchanged. So we get a response - * like this: ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": false } - * } ] } ``` - * + * Update value + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/targetingRules/0/value/boolValue\", \"value\": true } ] ``` Only the first Targeting Rule's `value` is going to be set to `false` and all the other fields are remaining unchanged. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": false } } ] } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return SettingFormulaModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingFormulaModel updateSettingValueBySdkkeyV2( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY) - throws ApiException { - ApiResponse localVarResp = - updateSettingValueBySdkkeyV2WithHttpInfo( - settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY); + public SettingFormulaModel updateSettingValueBySdkkeyV2(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY) throws ApiException { + ApiResponse localVarResp = updateSettingValueBySdkkeyV2WithHttpInfo(settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY); return localVarResp.getData(); } /** - * Update value This endpoint updates the value of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the - * `defaultValue`, `targetingRules`, and - * `percentageEvaluationAttribute` fields are modifiable by this endpoint. The - * advantage of using JSON Patch is that you can describe individual update operations on a - * resource without touching attributes that you don't want to change. It supports - * collection reordering, so it also can be used for reordering the targeting rules of a Feature - * Flag or Setting. For example: We have the following resource of a Feature Flag. - * ```json { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send an update request body as below: ```json [ { - * \"op\": \"replace\", \"path\": - * \"/targetingRules/0/value/boolValue\", \"value\": true } ] - * ``` Only the first Targeting Rule's `value` is going to be set - * to `false` and all the other fields are remaining unchanged. So we get a response - * like this: ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": false } - * } ] } ``` - * + * Update value + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/targetingRules/0/value/boolValue\", \"value\": true } ] ``` Only the first Targeting Rule's `value` is going to be set to `false` and all the other fields are remaining unchanged. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": false } } ] } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @return ApiResponse<SettingFormulaModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateSettingValueBySdkkeyV2WithHttpInfo( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY) - throws ApiException { - okhttp3.Call localVarCall = - updateSettingValueBySdkkeyV2ValidateBeforeCall( - settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateSettingValueBySdkkeyV2WithHttpInfo(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY) throws ApiException { + okhttp3.Call localVarCall = updateSettingValueBySdkkeyV2ValidateBeforeCall(settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update value (asynchronously) This endpoint updates the value of a Feature Flag or Setting - * with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified - * Environment. Only the `defaultValue`, `targetingRules`, and - * `percentageEvaluationAttribute` fields are modifiable by this endpoint. The - * advantage of using JSON Patch is that you can describe individual update operations on a - * resource without touching attributes that you don't want to change. It supports - * collection reordering, so it also can be used for reordering the targeting rules of a Feature - * Flag or Setting. For example: We have the following resource of a Feature Flag. - * ```json { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send an update request body as below: ```json [ { - * \"op\": \"replace\", \"path\": - * \"/targetingRules/0/value/boolValue\", \"value\": true } ] - * ``` Only the first Targeting Rule's `value` is going to be set - * to `false` and all the other fields are remaining unchanged. So we get a response - * like this: ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": false } - * } ] } ``` - * + * Update value (asynchronously) + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/targetingRules/0/value/boolValue\", \"value\": true } ] ``` Only the first Targeting Rule's `value` is going to be set to `false` and all the other fields are remaining unchanged. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": false } } ] } ``` * @param settingKeyOrId The key or id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) - * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) - * (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) + * @param X_CONFIGCAT_SDKKEY The ConfigCat SDK Key. (https://app.configcat.com/sdkkey) (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingValueBySdkkeyV2Async( - String settingKeyOrId, - List jsonPatchOperation, - String reason, - String X_CONFIGCAT_SDKKEY, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateSettingValueBySdkkeyV2ValidateBeforeCall( - settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateSettingValueBySdkkeyV2Async(String settingKeyOrId, List jsonPatchOperation, String reason, String X_CONFIGCAT_SDKKEY, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSettingValueBySdkkeyV2ValidateBeforeCall(settingKeyOrId, jsonPatchOperation, reason, X_CONFIGCAT_SDKKEY, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesV2Api.java b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesV2Api.java index 1a50ab9..9009b3d 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesV2Api.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagSettingValuesV2Api.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,18 +19,26 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.ConfigSettingFormulasModel; import com.configcat.publicapi.java.client.model.JsonPatchOperation; import com.configcat.publicapi.java.client.model.SettingFormulaModel; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdateEvaluationFormulaModel; import com.configcat.publicapi.java.client.model.UpdateEvaluationFormulasModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class FeatureFlagSettingValuesV2Api { private ApiClient localVarApiClient; @@ -71,32 +79,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getSettingValueV2 - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValueV2Call( - UUID environmentId, Integer settingId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingValueV2Call(UUID environmentId, Integer settingId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -105,14 +110,9 @@ public okhttp3.Call getSettingValueV2Call( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v2/environments/{environmentId}/settings/{settingId}/value" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v2/environments/{environmentId}/settings/{settingId}/value" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -120,198 +120,133 @@ public okhttp3.Call getSettingValueV2Call( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingValueV2ValidateBeforeCall( - UUID environmentId, Integer settingId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getSettingValueV2ValidateBeforeCall(UUID environmentId, Integer settingId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " getSettingValueV2(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling getSettingValueV2(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " getSettingValueV2(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling getSettingValueV2(Async)"); } return getSettingValueV2Call(environmentId, settingId, _callback); + } /** - * Get value This endpoint returns the value of a Feature Flag or Setting in a specified - * Environment identified by the `environmentId` parameter. The most important fields - * in the response are the `defaultValue`, `targetingRules`, and - * `percentageEvaluationAttribute`. The `defaultValue` represents what the - * clients will get when the evaluation requests of our SDKs are not matching to any of the - * defined Targeting Rules, or when there are no additional rules to evaluate. The - * `targetingRules` represents the current Targeting Rule configuration of the actual - * Feature Flag or Setting in an **ordered** collection, which means the order of the returned - * rules is matching to the evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for - * [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the - * Feature Flag or Setting. - * + * Get value + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the `environmentId` parameter. The most important fields in the response are the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the Feature Flag or Setting. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @return SettingFormulaModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingFormulaModel getSettingValueV2(UUID environmentId, Integer settingId) - throws ApiException { - ApiResponse localVarResp = - getSettingValueV2WithHttpInfo(environmentId, settingId); + public SettingFormulaModel getSettingValueV2(UUID environmentId, Integer settingId) throws ApiException { + ApiResponse localVarResp = getSettingValueV2WithHttpInfo(environmentId, settingId); return localVarResp.getData(); } /** - * Get value This endpoint returns the value of a Feature Flag or Setting in a specified - * Environment identified by the `environmentId` parameter. The most important fields - * in the response are the `defaultValue`, `targetingRules`, and - * `percentageEvaluationAttribute`. The `defaultValue` represents what the - * clients will get when the evaluation requests of our SDKs are not matching to any of the - * defined Targeting Rules, or when there are no additional rules to evaluate. The - * `targetingRules` represents the current Targeting Rule configuration of the actual - * Feature Flag or Setting in an **ordered** collection, which means the order of the returned - * rules is matching to the evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for - * [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the - * Feature Flag or Setting. - * + * Get value + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the `environmentId` parameter. The most important fields in the response are the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the Feature Flag or Setting. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @return ApiResponse<SettingFormulaModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getSettingValueV2WithHttpInfo( - UUID environmentId, Integer settingId) throws ApiException { - okhttp3.Call localVarCall = - getSettingValueV2ValidateBeforeCall(environmentId, settingId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse getSettingValueV2WithHttpInfo(UUID environmentId, Integer settingId) throws ApiException { + okhttp3.Call localVarCall = getSettingValueV2ValidateBeforeCall(environmentId, settingId, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get value (asynchronously) This endpoint returns the value of a Feature Flag or Setting in a - * specified Environment identified by the `environmentId` parameter. The most - * important fields in the response are the `defaultValue`, - * `targetingRules`, and `percentageEvaluationAttribute`. The - * `defaultValue` represents what the clients will get when the evaluation requests of - * our SDKs are not matching to any of the defined Targeting Rules, or when there are no - * additional rules to evaluate. The `targetingRules` represents the current Targeting - * Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which - * means the order of the returned rules is matching to the evaluation order. You can read more - * about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for - * [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the - * Feature Flag or Setting. - * + * Get value (asynchronously) + * This endpoint returns the value of a Feature Flag or Setting in a specified Environment identified by the `environmentId` parameter. The most important fields in the response are the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the Feature Flag or Setting. * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting value data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValueV2Async( - UUID environmentId, Integer settingId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingValueV2Async(UUID environmentId, Integer settingId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - getSettingValueV2ValidateBeforeCall(environmentId, settingId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = getSettingValueV2ValidateBeforeCall(environmentId, settingId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getSettingValuesV2 - * * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValuesV2Call( - UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSettingValuesV2Call(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -320,14 +255,9 @@ public okhttp3.Call getSettingValuesV2Call( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v2/configs/{configId}/environments/{environmentId}/values" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())) - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v2/configs/{configId}/environments/{environmentId}/values" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())) + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -335,207 +265,135 @@ public okhttp3.Call getSettingValuesV2Call( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingValuesV2ValidateBeforeCall( - UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getSettingValuesV2ValidateBeforeCall(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling" - + " getSettingValuesV2(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling getSettingValuesV2(Async)"); } // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " getSettingValuesV2(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling getSettingValuesV2(Async)"); } return getSettingValuesV2Call(configId, environmentId, _callback); + } /** - * Get values This endpoint returns all Feature Flag and Setting values of a Config identified - * by the `configId` parameter in a specified Environment identified by the - * `environmentId` parameter. The most important fields in the response are the - * `defaultValue`, `targetingRules`. The `defaultValue` represents - * what the clients will get when the evaluation requests of our SDKs are not matching to any of - * the defined Targeting Rules, or when there are no additional rules to evaluate. The - * `targetingRules` represents the current Targeting Rule configuration of the actual - * Feature Flag or Setting in an **ordered** collection, which means the order of the returned - * rules is matching to the evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for - * [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the - * Feature Flag or Setting. - * + * Get values + * This endpoint returns all Feature Flag and Setting values of a Config identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. The most important fields in the response are the `defaultValue`, `targetingRules`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the Feature Flag or Setting. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @return ConfigSettingFormulasModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ConfigSettingFormulasModel getSettingValuesV2(UUID configId, UUID environmentId) - throws ApiException { - ApiResponse localVarResp = - getSettingValuesV2WithHttpInfo(configId, environmentId); + public ConfigSettingFormulasModel getSettingValuesV2(UUID configId, UUID environmentId) throws ApiException { + ApiResponse localVarResp = getSettingValuesV2WithHttpInfo(configId, environmentId); return localVarResp.getData(); } /** - * Get values This endpoint returns all Feature Flag and Setting values of a Config identified - * by the `configId` parameter in a specified Environment identified by the - * `environmentId` parameter. The most important fields in the response are the - * `defaultValue`, `targetingRules`. The `defaultValue` represents - * what the clients will get when the evaluation requests of our SDKs are not matching to any of - * the defined Targeting Rules, or when there are no additional rules to evaluate. The - * `targetingRules` represents the current Targeting Rule configuration of the actual - * Feature Flag or Setting in an **ordered** collection, which means the order of the returned - * rules is matching to the evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for - * [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the - * Feature Flag or Setting. - * + * Get values + * This endpoint returns all Feature Flag and Setting values of a Config identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. The most important fields in the response are the `defaultValue`, `targetingRules`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the Feature Flag or Setting. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @return ApiResponse<ConfigSettingFormulasModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getSettingValuesV2WithHttpInfo( - UUID configId, UUID environmentId) throws ApiException { - okhttp3.Call localVarCall = - getSettingValuesV2ValidateBeforeCall(configId, environmentId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse getSettingValuesV2WithHttpInfo(UUID configId, UUID environmentId) throws ApiException { + okhttp3.Call localVarCall = getSettingValuesV2ValidateBeforeCall(configId, environmentId, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get values (asynchronously) This endpoint returns all Feature Flag and Setting values of a - * Config identified by the `configId` parameter in a specified Environment identified - * by the `environmentId` parameter. The most important fields in the response are the - * `defaultValue`, `targetingRules`. The `defaultValue` represents - * what the clients will get when the evaluation requests of our SDKs are not matching to any of - * the defined Targeting Rules, or when there are no additional rules to evaluate. The - * `targetingRules` represents the current Targeting Rule configuration of the actual - * Feature Flag or Setting in an **ordered** collection, which means the order of the returned - * rules is matching to the evaluation order. You can read more about these rules - * [here](https://configcat.com/docs/targeting/targeting-overview/). The - * `percentageEvaluationAttribute` represents the custom [User - * Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for - * [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the - * Feature Flag or Setting. - * + * Get values (asynchronously) + * This endpoint returns all Feature Flag and Setting values of a Config identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. The most important fields in the response are the `defaultValue`, `targetingRules`. The `defaultValue` represents what the clients will get when the evaluation requests of our SDKs are not matching to any of the defined Targeting Rules, or when there are no additional rules to evaluate. The `targetingRules` represents the current Targeting Rule configuration of the actual Feature Flag or Setting in an **ordered** collection, which means the order of the returned rules is matching to the evaluation order. You can read more about these rules [here](https://configcat.com/docs/targeting/targeting-overview/). The `percentageEvaluationAttribute` represents the custom [User Object](https://configcat.com/docs/targeting/user-object/) attribute that must be used for [percentage evaluation](https://configcat.com/docs/targeting/percentage-options/) of the Feature Flag or Setting. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingValuesV2Async( - UUID configId, - UUID environmentId, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getSettingValuesV2ValidateBeforeCall(configId, environmentId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call getSettingValuesV2Async(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSettingValuesV2ValidateBeforeCall(configId, environmentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for postSettingValuesV2 - * * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param updateEvaluationFormulasModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateEvaluationFormulasModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call postSettingValuesV2Call( - UUID configId, - UUID environmentId, - UpdateEvaluationFormulasModel updateEvaluationFormulasModel, - String reason, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call postSettingValuesV2Call(UUID configId, UUID environmentId, UpdateEvaluationFormulasModel updateEvaluationFormulasModel, String reason, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -544,14 +402,9 @@ public okhttp3.Call postSettingValuesV2Call( Object localVarPostBody = updateEvaluationFormulasModel; // create path and map variables - String localVarPath = - "/v2/configs/{configId}/environments/{environmentId}/values" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())) - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v2/configs/{configId}/environments/{environmentId}/values" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())) + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -563,268 +416,149 @@ public okhttp3.Call postSettingValuesV2Call( localVarQueryParams.addAll(localVarApiClient.parameterToPair("reason", reason)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call postSettingValuesV2ValidateBeforeCall( - UUID configId, - UUID environmentId, - UpdateEvaluationFormulasModel updateEvaluationFormulasModel, - String reason, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call postSettingValuesV2ValidateBeforeCall(UUID configId, UUID environmentId, UpdateEvaluationFormulasModel updateEvaluationFormulasModel, String reason, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling" - + " postSettingValuesV2(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling postSettingValuesV2(Async)"); } // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " postSettingValuesV2(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling postSettingValuesV2(Async)"); } // verify the required parameter 'updateEvaluationFormulasModel' is set if (updateEvaluationFormulasModel == null) { - throw new ApiException( - "Missing the required parameter 'updateEvaluationFormulasModel' when calling" - + " postSettingValuesV2(Async)"); + throw new ApiException("Missing the required parameter 'updateEvaluationFormulasModel' when calling postSettingValuesV2(Async)"); } - return postSettingValuesV2Call( - configId, environmentId, updateEvaluationFormulasModel, reason, _callback); + return postSettingValuesV2Call(configId, environmentId, updateEvaluationFormulasModel, reason, _callback); + } /** - * Post values This endpoint batch updates the Feature Flags and Settings of a Config identified - * by the `configId` parameter in a specified Environment identified by the - * `environmentId` parameter. Only those Feature Flags and Settings are updated which - * are part of the request, all the others are left untouched. **Important:** As this endpoint - * is doing a complete replace on those Feature Flags and Settings, which are set in the - * request. It's important to set every other field that you don't want to change in its - * original state. Not listing a field means that it will reset. For example: We have the - * following resource of a Feature Flag. ```json { \"settingFormulas\": - * [ { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ], \"settingId\": 1 } ] } ``` If we send a batch replace request - * body as below: ```json { \"updateFormulas\": [ { - * \"defaultValue\": { \"boolValue\": false }, \"settingId\": 1 } - * ] } ``` Then besides that the default value is set to `true`, all - * Targeting Rules of the related Feature Flag are deleted. So we get a response like this: - * ```json { \"settingFormulas\": [ { \"defaultValue\": { - * \"boolValue\": false }, \"targetingRules\": [], \"setting\": { - * \"settingId\": 1 } } ] } ``` - * + * Post values + * This endpoint batch updates the Feature Flags and Settings of a Config identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. Only those Feature Flags and Settings are updated which are part of the request, all the others are left untouched. **Important:** As this endpoint is doing a complete replace on those Feature Flags and Settings, which are set in the request. It's important to set every other field that you don't want to change in its original state. Not listing a field means that it will reset. For example: We have the following resource of a Feature Flag. ```json { \"settingFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ], \"settingId\": 1 } ] } ``` If we send a batch replace request body as below: ```json { \"updateFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"settingId\": 1 } ] } ``` Then besides that the default value is set to `true`, all Targeting Rules of the related Feature Flag are deleted. So we get a response like this: ```json { \"settingFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [], \"setting\": { \"settingId\": 1 } } ] } ``` * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param updateEvaluationFormulasModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateEvaluationFormulasModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return ConfigSettingFormulasModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ConfigSettingFormulasModel postSettingValuesV2( - UUID configId, - UUID environmentId, - UpdateEvaluationFormulasModel updateEvaluationFormulasModel, - String reason) - throws ApiException { - ApiResponse localVarResp = - postSettingValuesV2WithHttpInfo( - configId, environmentId, updateEvaluationFormulasModel, reason); + public ConfigSettingFormulasModel postSettingValuesV2(UUID configId, UUID environmentId, UpdateEvaluationFormulasModel updateEvaluationFormulasModel, String reason) throws ApiException { + ApiResponse localVarResp = postSettingValuesV2WithHttpInfo(configId, environmentId, updateEvaluationFormulasModel, reason); return localVarResp.getData(); } /** - * Post values This endpoint batch updates the Feature Flags and Settings of a Config identified - * by the `configId` parameter in a specified Environment identified by the - * `environmentId` parameter. Only those Feature Flags and Settings are updated which - * are part of the request, all the others are left untouched. **Important:** As this endpoint - * is doing a complete replace on those Feature Flags and Settings, which are set in the - * request. It's important to set every other field that you don't want to change in its - * original state. Not listing a field means that it will reset. For example: We have the - * following resource of a Feature Flag. ```json { \"settingFormulas\": - * [ { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ], \"settingId\": 1 } ] } ``` If we send a batch replace request - * body as below: ```json { \"updateFormulas\": [ { - * \"defaultValue\": { \"boolValue\": false }, \"settingId\": 1 } - * ] } ``` Then besides that the default value is set to `true`, all - * Targeting Rules of the related Feature Flag are deleted. So we get a response like this: - * ```json { \"settingFormulas\": [ { \"defaultValue\": { - * \"boolValue\": false }, \"targetingRules\": [], \"setting\": { - * \"settingId\": 1 } } ] } ``` - * + * Post values + * This endpoint batch updates the Feature Flags and Settings of a Config identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. Only those Feature Flags and Settings are updated which are part of the request, all the others are left untouched. **Important:** As this endpoint is doing a complete replace on those Feature Flags and Settings, which are set in the request. It's important to set every other field that you don't want to change in its original state. Not listing a field means that it will reset. For example: We have the following resource of a Feature Flag. ```json { \"settingFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ], \"settingId\": 1 } ] } ``` If we send a batch replace request body as below: ```json { \"updateFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"settingId\": 1 } ] } ``` Then besides that the default value is set to `true`, all Targeting Rules of the related Feature Flag are deleted. So we get a response like this: ```json { \"settingFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [], \"setting\": { \"settingId\": 1 } } ] } ``` * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param updateEvaluationFormulasModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateEvaluationFormulasModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return ApiResponse<ConfigSettingFormulasModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse postSettingValuesV2WithHttpInfo( - UUID configId, - UUID environmentId, - UpdateEvaluationFormulasModel updateEvaluationFormulasModel, - String reason) - throws ApiException { - okhttp3.Call localVarCall = - postSettingValuesV2ValidateBeforeCall( - configId, environmentId, updateEvaluationFormulasModel, reason, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse postSettingValuesV2WithHttpInfo(UUID configId, UUID environmentId, UpdateEvaluationFormulasModel updateEvaluationFormulasModel, String reason) throws ApiException { + okhttp3.Call localVarCall = postSettingValuesV2ValidateBeforeCall(configId, environmentId, updateEvaluationFormulasModel, reason, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Post values (asynchronously) This endpoint batch updates the Feature Flags and Settings of a - * Config identified by the `configId` parameter in a specified Environment identified - * by the `environmentId` parameter. Only those Feature Flags and Settings are updated - * which are part of the request, all the others are left untouched. **Important:** As this - * endpoint is doing a complete replace on those Feature Flags and Settings, which are set in - * the request. It's important to set every other field that you don't want to change in - * its original state. Not listing a field means that it will reset. For example: We have the - * following resource of a Feature Flag. ```json { \"settingFormulas\": - * [ { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ], \"settingId\": 1 } ] } ``` If we send a batch replace request - * body as below: ```json { \"updateFormulas\": [ { - * \"defaultValue\": { \"boolValue\": false }, \"settingId\": 1 } - * ] } ``` Then besides that the default value is set to `true`, all - * Targeting Rules of the related Feature Flag are deleted. So we get a response like this: - * ```json { \"settingFormulas\": [ { \"defaultValue\": { - * \"boolValue\": false }, \"targetingRules\": [], \"setting\": { - * \"settingId\": 1 } } ] } ``` - * + * Post values (asynchronously) + * This endpoint batch updates the Feature Flags and Settings of a Config identified by the `configId` parameter in a specified Environment identified by the `environmentId` parameter. Only those Feature Flags and Settings are updated which are part of the request, all the others are left untouched. **Important:** As this endpoint is doing a complete replace on those Feature Flags and Settings, which are set in the request. It's important to set every other field that you don't want to change in its original state. Not listing a field means that it will reset. For example: We have the following resource of a Feature Flag. ```json { \"settingFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ], \"settingId\": 1 } ] } ``` If we send a batch replace request body as below: ```json { \"updateFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"settingId\": 1 } ] } ``` Then besides that the default value is set to `true`, all Targeting Rules of the related Feature Flag are deleted. So we get a response like this: ```json { \"settingFormulas\": [ { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [], \"setting\": { \"settingId\": 1 } } ] } ``` * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param updateEvaluationFormulasModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateEvaluationFormulasModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the updated setting values returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call postSettingValuesV2Async( - UUID configId, - UUID environmentId, - UpdateEvaluationFormulasModel updateEvaluationFormulasModel, - String reason, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - postSettingValuesV2ValidateBeforeCall( - configId, environmentId, updateEvaluationFormulasModel, reason, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call postSettingValuesV2Async(UUID configId, UUID environmentId, UpdateEvaluationFormulasModel updateEvaluationFormulasModel, String reason, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postSettingValuesV2ValidateBeforeCall(configId, environmentId, updateEvaluationFormulasModel, reason, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for replaceSettingValueV2 - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param updateEvaluationFormulaModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateEvaluationFormulaModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingValueV2Call( - UUID environmentId, - Integer settingId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call replaceSettingValueV2Call(UUID environmentId, Integer settingId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -833,14 +567,9 @@ public okhttp3.Call replaceSettingValueV2Call( Object localVarPostBody = updateEvaluationFormulaModel; // create path and map variables - String localVarPath = - "/v2/environments/{environmentId}/settings/{settingId}/value" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v2/environments/{environmentId}/settings/{settingId}/value" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -852,263 +581,150 @@ public okhttp3.Call replaceSettingValueV2Call( localVarQueryParams.addAll(localVarApiClient.parameterToPair("reason", reason)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceSettingValueV2ValidateBeforeCall( - UUID environmentId, - Integer settingId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call replaceSettingValueV2ValidateBeforeCall(UUID environmentId, Integer settingId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " replaceSettingValueV2(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling replaceSettingValueV2(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " replaceSettingValueV2(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling replaceSettingValueV2(Async)"); } // verify the required parameter 'updateEvaluationFormulaModel' is set if (updateEvaluationFormulaModel == null) { - throw new ApiException( - "Missing the required parameter 'updateEvaluationFormulaModel' when calling" - + " replaceSettingValueV2(Async)"); + throw new ApiException("Missing the required parameter 'updateEvaluationFormulaModel' when calling replaceSettingValueV2(Async)"); } - return replaceSettingValueV2Call( - environmentId, settingId, updateEvaluationFormulaModel, reason, _callback); + return replaceSettingValueV2Call(environmentId, settingId, updateEvaluationFormulaModel, reason, _callback); + } /** - * Replace value This endpoint replaces the value and the Targeting Rules of a Feature Flag or - * Setting in a specified Environment identified by the <a target=\"_blank\" - * rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, - * `targetingRules`, and `percentageEvaluationAttribute` fields are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other field that you don't want to change to its original - * state. Not listing one means it will reset. For example: We have the following resource of a - * Feature Flag. ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send a replace request body as below: ```json { - * \"defaultValue\": { \"boolValue\": true } } ``` Then - * besides that the default served value is set to `true`, all the Targeting Rules are - * deleted. So we get a response like this: ```json { \"defaultValue\": - * { \"boolValue\": true }, \"targetingRules\": [] } ``` - * + * Replace value + * This endpoint replaces the value and the Targeting Rules of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other field that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send a replace request body as below: ```json { \"defaultValue\": { \"boolValue\": true } } ``` Then besides that the default served value is set to `true`, all the Targeting Rules are deleted. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": true }, \"targetingRules\": [] } ``` * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param updateEvaluationFormulaModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateEvaluationFormulaModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return SettingFormulaModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingFormulaModel replaceSettingValueV2( - UUID environmentId, - Integer settingId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason) - throws ApiException { - ApiResponse localVarResp = - replaceSettingValueV2WithHttpInfo( - environmentId, settingId, updateEvaluationFormulaModel, reason); + public SettingFormulaModel replaceSettingValueV2(UUID environmentId, Integer settingId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason) throws ApiException { + ApiResponse localVarResp = replaceSettingValueV2WithHttpInfo(environmentId, settingId, updateEvaluationFormulaModel, reason); return localVarResp.getData(); } /** - * Replace value This endpoint replaces the value and the Targeting Rules of a Feature Flag or - * Setting in a specified Environment identified by the <a target=\"_blank\" - * rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, - * `targetingRules`, and `percentageEvaluationAttribute` fields are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other field that you don't want to change to its original - * state. Not listing one means it will reset. For example: We have the following resource of a - * Feature Flag. ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send a replace request body as below: ```json { - * \"defaultValue\": { \"boolValue\": true } } ``` Then - * besides that the default served value is set to `true`, all the Targeting Rules are - * deleted. So we get a response like this: ```json { \"defaultValue\": - * { \"boolValue\": true }, \"targetingRules\": [] } ``` - * + * Replace value + * This endpoint replaces the value and the Targeting Rules of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other field that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send a replace request body as below: ```json { \"defaultValue\": { \"boolValue\": true } } ``` Then besides that the default served value is set to `true`, all the Targeting Rules are deleted. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": true }, \"targetingRules\": [] } ``` * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param updateEvaluationFormulaModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateEvaluationFormulaModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return ApiResponse<SettingFormulaModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse replaceSettingValueV2WithHttpInfo( - UUID environmentId, - Integer settingId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason) - throws ApiException { - okhttp3.Call localVarCall = - replaceSettingValueV2ValidateBeforeCall( - environmentId, settingId, updateEvaluationFormulaModel, reason, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse replaceSettingValueV2WithHttpInfo(UUID environmentId, Integer settingId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason) throws ApiException { + okhttp3.Call localVarCall = replaceSettingValueV2ValidateBeforeCall(environmentId, settingId, updateEvaluationFormulaModel, reason, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace value (asynchronously) This endpoint replaces the value and the Targeting Rules of a - * Feature Flag or Setting in a specified Environment identified by the <a - * target=\"_blank\" rel=\"noopener noreferrer\" - * href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the - * `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, - * `targetingRules`, and `percentageEvaluationAttribute` fields are - * modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other field that you don't want to change to its original - * state. Not listing one means it will reset. For example: We have the following resource of a - * Feature Flag. ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send a replace request body as below: ```json { - * \"defaultValue\": { \"boolValue\": true } } ``` Then - * besides that the default served value is set to `true`, all the Targeting Rules are - * deleted. So we get a response like this: ```json { \"defaultValue\": - * { \"boolValue\": true }, \"targetingRules\": [] } ``` - * + * Replace value (asynchronously) + * This endpoint replaces the value and the Targeting Rules of a Feature Flag or Setting in a specified Environment identified by the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://app.configcat.com/sdkkey\">SDK key</a> passed in the `X-CONFIGCAT-SDKKEY` header. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. **Important:** As this endpoint is doing a complete replace, it's important to set every other field that you don't want to change to its original state. Not listing one means it will reset. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send a replace request body as below: ```json { \"defaultValue\": { \"boolValue\": true } } ``` Then besides that the default served value is set to `true`, all the Targeting Rules are deleted. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": true }, \"targetingRules\": [] } ``` * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param updateEvaluationFormulaModel (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param updateEvaluationFormulaModel (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingValueV2Async( - UUID environmentId, - Integer settingId, - UpdateEvaluationFormulaModel updateEvaluationFormulaModel, - String reason, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - replaceSettingValueV2ValidateBeforeCall( - environmentId, settingId, updateEvaluationFormulaModel, reason, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call replaceSettingValueV2Async(UUID environmentId, Integer settingId, UpdateEvaluationFormulaModel updateEvaluationFormulaModel, String reason, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = replaceSettingValueV2ValidateBeforeCall(environmentId, settingId, updateEvaluationFormulaModel, reason, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateSettingValueV2 - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingValueV2Call( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateSettingValueV2Call(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1117,14 +733,9 @@ public okhttp3.Call updateSettingValueV2Call( Object localVarPostBody = jsonPatchOperation; // create path and map variables - String localVarPath = - "/v2/environments/{environmentId}/settings/{settingId}/value" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v2/environments/{environmentId}/settings/{settingId}/value" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1136,245 +747,122 @@ public okhttp3.Call updateSettingValueV2Call( localVarQueryParams.addAll(localVarApiClient.parameterToPair("reason", reason)); } - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PATCH", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSettingValueV2ValidateBeforeCall( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateSettingValueV2ValidateBeforeCall(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " updateSettingValueV2(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling updateSettingValueV2(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " updateSettingValueV2(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling updateSettingValueV2(Async)"); } // verify the required parameter 'jsonPatchOperation' is set if (jsonPatchOperation == null) { - throw new ApiException( - "Missing the required parameter 'jsonPatchOperation' when calling" - + " updateSettingValueV2(Async)"); + throw new ApiException("Missing the required parameter 'jsonPatchOperation' when calling updateSettingValueV2(Async)"); } - return updateSettingValueV2Call( - environmentId, settingId, jsonPatchOperation, reason, _callback); + return updateSettingValueV2Call(environmentId, settingId, jsonPatchOperation, reason, _callback); + } /** - * Update value This endpoint updates the value of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the - * `defaultValue`, `targetingRules`, and - * `percentageEvaluationAttribute` fields are modifiable by this endpoint. The - * advantage of using JSON Patch is that you can describe individual update operations on a - * resource without touching attributes that you don't want to change. It supports - * collection reordering, so it also can be used for reordering the targeting rules of a Feature - * Flag or Setting. For example: We have the following resource of a Feature Flag. - * ```json { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send an update request body as below: ```json [ { - * \"op\": \"replace\", \"path\": - * \"/targetingRules/0/value/boolValue\", \"value\": true } ] - * ``` Only the first Targeting Rule's `value` is going to be set - * to `false` and all the other fields are remaining unchanged. So we get a response - * like this: ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": false } - * } ] } ``` - * + * Update value + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/targetingRules/0/value/boolValue\", \"value\": true } ] ``` Only the first Targeting Rule's `value` is going to be set to `false` and all the other fields are remaining unchanged. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": false } } ] } ``` * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return SettingFormulaModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingFormulaModel updateSettingValueV2( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason) - throws ApiException { - ApiResponse localVarResp = - updateSettingValueV2WithHttpInfo( - environmentId, settingId, jsonPatchOperation, reason); + public SettingFormulaModel updateSettingValueV2(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason) throws ApiException { + ApiResponse localVarResp = updateSettingValueV2WithHttpInfo(environmentId, settingId, jsonPatchOperation, reason); return localVarResp.getData(); } /** - * Update value This endpoint updates the value of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the - * `defaultValue`, `targetingRules`, and - * `percentageEvaluationAttribute` fields are modifiable by this endpoint. The - * advantage of using JSON Patch is that you can describe individual update operations on a - * resource without touching attributes that you don't want to change. It supports - * collection reordering, so it also can be used for reordering the targeting rules of a Feature - * Flag or Setting. For example: We have the following resource of a Feature Flag. - * ```json { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send an update request body as below: ```json [ { - * \"op\": \"replace\", \"path\": - * \"/targetingRules/0/value/boolValue\", \"value\": true } ] - * ``` Only the first Targeting Rule's `value` is going to be set - * to `false` and all the other fields are remaining unchanged. So we get a response - * like this: ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": false } - * } ] } ``` - * + * Update value + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/targetingRules/0/value/boolValue\", \"value\": true } ] ``` Only the first Targeting Rule's `value` is going to be set to `false` and all the other fields are remaining unchanged. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": false } } ] } ``` * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @return ApiResponse<SettingFormulaModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateSettingValueV2WithHttpInfo( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason) - throws ApiException { - okhttp3.Call localVarCall = - updateSettingValueV2ValidateBeforeCall( - environmentId, settingId, jsonPatchOperation, reason, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateSettingValueV2WithHttpInfo(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason) throws ApiException { + okhttp3.Call localVarCall = updateSettingValueV2ValidateBeforeCall(environmentId, settingId, jsonPatchOperation, reason, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update value (asynchronously) This endpoint updates the value of a Feature Flag or Setting - * with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified - * Environment. Only the `defaultValue`, `targetingRules`, and - * `percentageEvaluationAttribute` fields are modifiable by this endpoint. The - * advantage of using JSON Patch is that you can describe individual update operations on a - * resource without touching attributes that you don't want to change. It supports - * collection reordering, so it also can be used for reordering the targeting rules of a Feature - * Flag or Setting. For example: We have the following resource of a Feature Flag. - * ```json { \"defaultValue\": { \"boolValue\": false }, - * \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": - * { \"comparisonAttribute\": \"Email\", \"comparator\": - * \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": true } } - * ] } ``` If we send an update request body as below: ```json [ { - * \"op\": \"replace\", \"path\": - * \"/targetingRules/0/value/boolValue\", \"value\": true } ] - * ``` Only the first Targeting Rule's `value` is going to be set - * to `false` and all the other fields are remaining unchanged. So we get a response - * like this: ```json { \"defaultValue\": { \"boolValue\": - * false }, \"targetingRules\": [ { \"conditions\": [ { - * \"userCondition\": { \"comparisonAttribute\": \"Email\", - * \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { - * \"stringValue\": \"test@example.com\" } } } ], - * \"percentageOptions\": [], \"value\": { \"boolValue\": false } - * } ] } ``` - * + * Update value (asynchronously) + * This endpoint updates the value of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Environment. Only the `defaultValue`, `targetingRules`, and `percentageEvaluationAttribute` fields are modifiable by this endpoint. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting. For example: We have the following resource of a Feature Flag. ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": true } } ] } ``` If we send an update request body as below: ```json [ { \"op\": \"replace\", \"path\": \"/targetingRules/0/value/boolValue\", \"value\": true } ] ``` Only the first Targeting Rule's `value` is going to be set to `false` and all the other fields are remaining unchanged. So we get a response like this: ```json { \"defaultValue\": { \"boolValue\": false }, \"targetingRules\": [ { \"conditions\": [ { \"userCondition\": { \"comparisonAttribute\": \"Email\", \"comparator\": \"sensitiveTextEquals\", \"comparisonValue\": { \"stringValue\": \"test@example.com\" } } } ], \"percentageOptions\": [], \"value\": { \"boolValue\": false } } ] } ``` * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) - * @param jsonPatchOperation (required) - * @param reason The reason note for the Audit Log if the Product's \"Config changes - * require a reason\" preference is turned on. (optional) + * @param jsonPatchOperation (required) + * @param reason The reason note for the Audit Log if the Product's \"Config changes require a reason\" preference is turned on. (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + + +
Status Code Description Response Headers
200 When the patch was successful. -
204 When no change applied on the resource. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingValueV2Async( - UUID environmentId, - Integer settingId, - List jsonPatchOperation, - String reason, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateSettingValueV2ValidateBeforeCall( - environmentId, settingId, jsonPatchOperation, reason, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateSettingValueV2Async(UUID environmentId, Integer settingId, List jsonPatchOperation, String reason, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSettingValueV2ValidateBeforeCall(environmentId, settingId, jsonPatchOperation, reason, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagsSettingsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagsSettingsApi.java index 37d4490..1618212 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagsSettingsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/FeatureFlagsSettingsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,17 +19,25 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.CreateSettingInitialValues; import com.configcat.publicapi.java.client.model.JsonPatchOperation; import com.configcat.publicapi.java.client.model.ReplaceSettingModel; import com.configcat.publicapi.java.client.model.SettingModel; -import com.google.gson.reflect.TypeToken; +import java.util.UUID; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class FeatureFlagsSettingsApi { private ApiClient localVarApiClient; @@ -70,34 +78,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createSetting - * * @param configId The identifier of the Config. (required) - * @param createSettingInitialValues (required) + * @param createSettingInitialValues (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createSettingCall( - UUID configId, - CreateSettingInitialValues createSettingInitialValues, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createSettingCall(UUID configId, CreateSettingInitialValues createSettingInitialValues, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -106,11 +109,8 @@ public okhttp3.Call createSettingCall( Object localVarPostBody = createSettingInitialValues; // create path and map variables - String localVarPath = - "/v1/configs/{configId}/settings" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())); + String localVarPath = "/v1/configs/{configId}/settings" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -118,171 +118,135 @@ public okhttp3.Call createSettingCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createSettingValidateBeforeCall( - UUID configId, - CreateSettingInitialValues createSettingInitialValues, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createSettingValidateBeforeCall(UUID configId, CreateSettingInitialValues createSettingInitialValues, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling createSetting(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling createSetting(Async)"); } // verify the required parameter 'createSettingInitialValues' is set if (createSettingInitialValues == null) { - throw new ApiException( - "Missing the required parameter 'createSettingInitialValues' when calling" - + " createSetting(Async)"); + throw new ApiException("Missing the required parameter 'createSettingInitialValues' when calling createSetting(Async)"); } return createSettingCall(configId, createSettingInitialValues, _callback); + } /** - * Create Flag This endpoint creates a new Feature Flag or Setting in a specified Config - * identified by the `configId` parameter. **Important:** The `key` - * attribute must be unique within the given Config. - * + * Create Flag + * This endpoint creates a new Feature Flag or Setting in a specified Config identified by the `configId` parameter. **Important:** The `key` attribute must be unique within the given Config. * @param configId The identifier of the Config. (required) - * @param createSettingInitialValues (required) + * @param createSettingInitialValues (required) * @return SettingModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingModel createSetting( - UUID configId, CreateSettingInitialValues createSettingInitialValues) - throws ApiException { - ApiResponse localVarResp = - createSettingWithHttpInfo(configId, createSettingInitialValues); + public SettingModel createSetting(UUID configId, CreateSettingInitialValues createSettingInitialValues) throws ApiException { + ApiResponse localVarResp = createSettingWithHttpInfo(configId, createSettingInitialValues); return localVarResp.getData(); } /** - * Create Flag This endpoint creates a new Feature Flag or Setting in a specified Config - * identified by the `configId` parameter. **Important:** The `key` - * attribute must be unique within the given Config. - * + * Create Flag + * This endpoint creates a new Feature Flag or Setting in a specified Config identified by the `configId` parameter. **Important:** The `key` attribute must be unique within the given Config. * @param configId The identifier of the Config. (required) - * @param createSettingInitialValues (required) + * @param createSettingInitialValues (required) * @return ApiResponse<SettingModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createSettingWithHttpInfo( - UUID configId, CreateSettingInitialValues createSettingInitialValues) - throws ApiException { - okhttp3.Call localVarCall = - createSettingValidateBeforeCall(configId, createSettingInitialValues, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse createSettingWithHttpInfo(UUID configId, CreateSettingInitialValues createSettingInitialValues) throws ApiException { + okhttp3.Call localVarCall = createSettingValidateBeforeCall(configId, createSettingInitialValues, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Flag (asynchronously) This endpoint creates a new Feature Flag or Setting in a - * specified Config identified by the `configId` parameter. **Important:** The - * `key` attribute must be unique within the given Config. - * + * Create Flag (asynchronously) + * This endpoint creates a new Feature Flag or Setting in a specified Config identified by the `configId` parameter. **Important:** The `key` attribute must be unique within the given Config. * @param configId The identifier of the Config. (required) - * @param createSettingInitialValues (required) + * @param createSettingInitialValues (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createSettingAsync( - UUID configId, - CreateSettingInitialValues createSettingInitialValues, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createSettingValidateBeforeCall(configId, createSettingInitialValues, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call createSettingAsync(UUID configId, CreateSettingInitialValues createSettingInitialValues, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createSettingValidateBeforeCall(configId, createSettingInitialValues, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteSetting - * * @param settingId The identifier of the Setting. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteSettingCall(Integer settingId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteSettingCall(Integer settingId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -291,11 +255,8 @@ public okhttp3.Call deleteSettingCall(Integer settingId, final ApiCallback _call Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/settings/{settingId}" - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v1/settings/{settingId}" + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -303,82 +264,67 @@ public okhttp3.Call deleteSettingCall(Integer settingId, final ApiCallback _call Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteSettingValidateBeforeCall( - Integer settingId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deleteSettingValidateBeforeCall(Integer settingId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling deleteSetting(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling deleteSetting(Async)"); } return deleteSettingCall(settingId, _callback); + } /** - * Delete Flag This endpoint removes a Feature Flag or Setting from a specified Config, - * identified by the `configId` parameter. - * + * Delete Flag + * This endpoint removes a Feature Flag or Setting from a specified Config, identified by the `configId` parameter. * @param settingId The identifier of the Setting. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteSetting(Integer settingId) throws ApiException { deleteSettingWithHttpInfo(settingId); } /** - * Delete Flag This endpoint removes a Feature Flag or Setting from a specified Config, - * identified by the `configId` parameter. - * + * Delete Flag + * This endpoint removes a Feature Flag or Setting from a specified Config, identified by the `configId` parameter. * @param settingId The identifier of the Setting. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse deleteSettingWithHttpInfo(Integer settingId) throws ApiException { okhttp3.Call localVarCall = deleteSettingValidateBeforeCall(settingId, null); @@ -386,25 +332,22 @@ public ApiResponse deleteSettingWithHttpInfo(Integer settingId) throws Api } /** - * Delete Flag (asynchronously) This endpoint removes a Feature Flag or Setting from a specified - * Config, identified by the `configId` parameter. - * + * Delete Flag (asynchronously) + * This endpoint removes a Feature Flag or Setting from a specified Config, identified by the `configId` parameter. * @param settingId The identifier of the Setting. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteSettingAsync(Integer settingId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteSettingAsync(Integer settingId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteSettingValidateBeforeCall(settingId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -412,30 +355,28 @@ public okhttp3.Call deleteSettingAsync(Integer settingId, final ApiCallback - * Status Code Description Response Headers - * 200 When everything is ok, the setting data returned. - - * 400 Bad request. - - * 404 Not found. - - * 429 Too many requests. In case of the request rate exceeds the rate limits. - - * + + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingCall(Integer settingId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingCall(Integer settingId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -444,11 +385,8 @@ public okhttp3.Call getSettingCall(Integer settingId, final ApiCallback _callbac Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/settings/{settingId}" - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v1/settings/{settingId}" + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -456,62 +394,50 @@ public okhttp3.Call getSettingCall(Integer settingId, final ApiCallback _callbac Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingValidateBeforeCall( - Integer settingId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getSettingValidateBeforeCall(Integer settingId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling getSetting(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling getSetting(Async)"); } return getSettingCall(settingId, _callback); + } /** - * Get Flag This endpoint returns the metadata attributes of a Feature Flag or Setting - * identified by the `settingId` parameter. - * + * Get Flag + * This endpoint returns the metadata attributes of a Feature Flag or Setting identified by the `settingId` parameter. * @param settingId The identifier of the Setting. (required) * @return SettingModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public SettingModel getSetting(Integer settingId) throws ApiException { ApiResponse localVarResp = getSettingWithHttpInfo(settingId); @@ -519,80 +445,73 @@ public SettingModel getSetting(Integer settingId) throws ApiException { } /** - * Get Flag This endpoint returns the metadata attributes of a Feature Flag or Setting - * identified by the `settingId` parameter. - * + * Get Flag + * This endpoint returns the metadata attributes of a Feature Flag or Setting identified by the `settingId` parameter. * @param settingId The identifier of the Setting. (required) * @return ApiResponse<SettingModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse getSettingWithHttpInfo(Integer settingId) throws ApiException { okhttp3.Call localVarCall = getSettingValidateBeforeCall(settingId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Flag (asynchronously) This endpoint returns the metadata attributes of a Feature Flag or - * Setting identified by the `settingId` parameter. - * + * Get Flag (asynchronously) + * This endpoint returns the metadata attributes of a Feature Flag or Setting identified by the `settingId` parameter. * @param settingId The identifier of the Setting. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the setting data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the setting data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingAsync( - Integer settingId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSettingAsync(Integer settingId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getSettingValidateBeforeCall(settingId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getSettings - * * @param configId The identifier of the Config. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingsCall(UUID configId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingsCall(UUID configId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -601,11 +520,8 @@ public okhttp3.Call getSettingsCall(UUID configId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/configs/{configId}/settings" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())); + String localVarPath = "/v1/configs/{configId}/settings" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -613,62 +529,50 @@ public okhttp3.Call getSettingsCall(UUID configId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingsValidateBeforeCall(UUID configId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getSettingsValidateBeforeCall(UUID configId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling getSettings(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling getSettings(Async)"); } return getSettingsCall(configId, _callback); + } /** - * List Flags This endpoint returns the list of the Feature Flags and Settings defined in a - * specified Config, identified by the `configId` parameter. - * + * List Flags + * This endpoint returns the list of the Feature Flags and Settings defined in a specified Config, identified by the `configId` parameter. * @param configId The identifier of the Config. (required) * @return List<SettingModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getSettings(UUID configId) throws ApiException { ApiResponse> localVarResp = getSettingsWithHttpInfo(configId); @@ -676,83 +580,74 @@ public List getSettings(UUID configId) throws ApiException { } /** - * List Flags This endpoint returns the list of the Feature Flags and Settings defined in a - * specified Config, identified by the `configId` parameter. - * + * List Flags + * This endpoint returns the list of the Feature Flags and Settings defined in a specified Config, identified by the `configId` parameter. * @param configId The identifier of the Config. (required) * @return ApiResponse<List<SettingModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getSettingsWithHttpInfo(UUID configId) - throws ApiException { + public ApiResponse> getSettingsWithHttpInfo(UUID configId) throws ApiException { okhttp3.Call localVarCall = getSettingsValidateBeforeCall(configId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Flags (asynchronously) This endpoint returns the list of the Feature Flags and Settings - * defined in a specified Config, identified by the `configId` parameter. - * + * List Flags (asynchronously) + * This endpoint returns the list of the Feature Flags and Settings defined in a specified Config, identified by the `configId` parameter. * @param configId The identifier of the Config. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingsAsync( - UUID configId, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getSettingsAsync(UUID configId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getSettingsValidateBeforeCall(configId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for replaceSetting - * * @param settingId The identifier of the Setting. (required) - * @param replaceSettingModel (required) + * @param replaceSettingModel (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingCall( - Integer settingId, ReplaceSettingModel replaceSettingModel, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call replaceSettingCall(Integer settingId, ReplaceSettingModel replaceSettingModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -761,11 +656,8 @@ public okhttp3.Call replaceSettingCall( Object localVarPostBody = replaceSettingModel; // create path and map variables - String localVarPath = - "/v1/settings/{settingId}" - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v1/settings/{settingId}" + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -773,175 +665,136 @@ public okhttp3.Call replaceSettingCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceSettingValidateBeforeCall( - Integer settingId, ReplaceSettingModel replaceSettingModel, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call replaceSettingValidateBeforeCall(Integer settingId, ReplaceSettingModel replaceSettingModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " replaceSetting(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling replaceSetting(Async)"); } // verify the required parameter 'replaceSettingModel' is set if (replaceSettingModel == null) { - throw new ApiException( - "Missing the required parameter 'replaceSettingModel' when calling" - + " replaceSetting(Async)"); + throw new ApiException("Missing the required parameter 'replaceSettingModel' when calling replaceSetting(Async)"); } return replaceSettingCall(settingId, replaceSettingModel, _callback); + } /** - * Replace Flag This endpoint replaces the whole value of a Feature Flag or Setting identified - * by the `settingId` parameter. **Important:** As this endpoint is doing a complete - * replace, it's important to set every other attribute that you don't want to change in - * its original state. Not listing one means it will reset. - * + * Replace Flag + * This endpoint replaces the whole value of a Feature Flag or Setting identified by the `settingId` parameter. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. * @param settingId The identifier of the Setting. (required) - * @param replaceSettingModel (required) + * @param replaceSettingModel (required) * @return SettingModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingModel replaceSetting(Integer settingId, ReplaceSettingModel replaceSettingModel) - throws ApiException { - ApiResponse localVarResp = - replaceSettingWithHttpInfo(settingId, replaceSettingModel); + public SettingModel replaceSetting(Integer settingId, ReplaceSettingModel replaceSettingModel) throws ApiException { + ApiResponse localVarResp = replaceSettingWithHttpInfo(settingId, replaceSettingModel); return localVarResp.getData(); } /** - * Replace Flag This endpoint replaces the whole value of a Feature Flag or Setting identified - * by the `settingId` parameter. **Important:** As this endpoint is doing a complete - * replace, it's important to set every other attribute that you don't want to change in - * its original state. Not listing one means it will reset. - * + * Replace Flag + * This endpoint replaces the whole value of a Feature Flag or Setting identified by the `settingId` parameter. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. * @param settingId The identifier of the Setting. (required) - * @param replaceSettingModel (required) + * @param replaceSettingModel (required) * @return ApiResponse<SettingModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse replaceSettingWithHttpInfo( - Integer settingId, ReplaceSettingModel replaceSettingModel) throws ApiException { - okhttp3.Call localVarCall = - replaceSettingValidateBeforeCall(settingId, replaceSettingModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse replaceSettingWithHttpInfo(Integer settingId, ReplaceSettingModel replaceSettingModel) throws ApiException { + okhttp3.Call localVarCall = replaceSettingValidateBeforeCall(settingId, replaceSettingModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Flag (asynchronously) This endpoint replaces the whole value of a Feature Flag or - * Setting identified by the `settingId` parameter. **Important:** As this endpoint is - * doing a complete replace, it's important to set every other attribute that you don't - * want to change in its original state. Not listing one means it will reset. - * + * Replace Flag (asynchronously) + * This endpoint replaces the whole value of a Feature Flag or Setting identified by the `settingId` parameter. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. * @param settingId The identifier of the Setting. (required) - * @param replaceSettingModel (required) + * @param replaceSettingModel (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceSettingAsync( - Integer settingId, - ReplaceSettingModel replaceSettingModel, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - replaceSettingValidateBeforeCall(settingId, replaceSettingModel, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call replaceSettingAsync(Integer settingId, ReplaceSettingModel replaceSettingModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = replaceSettingValidateBeforeCall(settingId, replaceSettingModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateSetting - * * @param settingId The identifier of the Setting. (required) - * @param jsonPatchOperation (required) + * @param jsonPatchOperation (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingCall( - Integer settingId, - List jsonPatchOperation, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateSettingCall(Integer settingId, List jsonPatchOperation, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -950,11 +803,8 @@ public okhttp3.Call updateSettingCall( Object localVarPostBody = jsonPatchOperation; // create path and map variables - String localVarPath = - "/v1/settings/{settingId}" - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())); + String localVarPath = "/v1/settings/{settingId}" + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -962,209 +812,108 @@ public okhttp3.Call updateSettingCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PATCH", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSettingValidateBeforeCall( - Integer settingId, - List jsonPatchOperation, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateSettingValidateBeforeCall(Integer settingId, List jsonPatchOperation, final ApiCallback _callback) throws ApiException { // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling updateSetting(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling updateSetting(Async)"); } // verify the required parameter 'jsonPatchOperation' is set if (jsonPatchOperation == null) { - throw new ApiException( - "Missing the required parameter 'jsonPatchOperation' when calling" - + " updateSetting(Async)"); + throw new ApiException("Missing the required parameter 'jsonPatchOperation' when calling updateSetting(Async)"); } return updateSettingCall(settingId, jsonPatchOperation, _callback); + } /** - * Update Flag This endpoint updates the metadata of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Config. Only the - * `name`, `hint` and `tags` attributes are modifiable by this - * endpoint. The `tags` attribute is a simple collection of the [tag - * IDs](#operation/get-tags) attached to the given setting. The advantage of using JSON Patch is - * that you can describe individual update operations on a resource without touching attributes - * that you don't want to change. For example: We have the following resource. - * ```json { \"settingId\": 5345, \"key\": - * \"myGrandFeature\", \"name\": \"Tihs is a naem with soem - * typos.\", \"hint\": \"This flag controls my grandioso feature.\", - * \"settingType\": \"boolean\", \"tags\": [ { - * \"tagId\": 0, \"name\": \"sample tag\", \"color\": - * \"whale\" } ] } ``` If we send an update request body as below (it - * changes the `name` and adds the already existing tag with the id `2`): - * ```json [ { \"op\": \"replace\", \"path\": - * \"/name\", \"value\": \"This is the name without typos.\" }, { - * \"op\": \"add\", \"path\": \"/tags/-\", - * \"value\": 2 } ] ``` Only the `name` and `tags` - * are updated and all the other attributes remain unchanged. So we get a response like this: - * ```json { \"settingId\": 5345, \"key\": - * \"myGrandFeature\", \"name\": \"This is the name without - * typos.\", \"hint\": \"This flag controls my grandioso feature.\", - * \"settingType\": \"boolean\", \"tags\": [ { - * \"tagId\": 0, \"name\": \"sample tag\", \"color\": - * \"whale\" }, { \"tagId\": 2, \"name\": \"another - * tag\", \"color\": \"koala\" } ] } ``` - * + * Update Flag + * This endpoint updates the metadata of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Config. Only the `name`, `hint` and `tags` attributes are modifiable by this endpoint. The `tags` attribute is a simple collection of the [tag IDs](#operation/get-tags) attached to the given setting. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. For example: We have the following resource. ```json { \"settingId\": 5345, \"key\": \"myGrandFeature\", \"name\": \"Tihs is a naem with soem typos.\", \"hint\": \"This flag controls my grandioso feature.\", \"settingType\": \"boolean\", \"tags\": [ { \"tagId\": 0, \"name\": \"sample tag\", \"color\": \"whale\" } ] } ``` If we send an update request body as below (it changes the `name` and adds the already existing tag with the id `2`): ```json [ { \"op\": \"replace\", \"path\": \"/name\", \"value\": \"This is the name without typos.\" }, { \"op\": \"add\", \"path\": \"/tags/-\", \"value\": 2 } ] ``` Only the `name` and `tags` are updated and all the other attributes remain unchanged. So we get a response like this: ```json { \"settingId\": 5345, \"key\": \"myGrandFeature\", \"name\": \"This is the name without typos.\", \"hint\": \"This flag controls my grandioso feature.\", \"settingType\": \"boolean\", \"tags\": [ { \"tagId\": 0, \"name\": \"sample tag\", \"color\": \"whale\" }, { \"tagId\": 2, \"name\": \"another tag\", \"color\": \"koala\" } ] } ``` * @param settingId The identifier of the Setting. (required) - * @param jsonPatchOperation (required) + * @param jsonPatchOperation (required) * @return SettingModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SettingModel updateSetting( - Integer settingId, List jsonPatchOperation) throws ApiException { - ApiResponse localVarResp = - updateSettingWithHttpInfo(settingId, jsonPatchOperation); + public SettingModel updateSetting(Integer settingId, List jsonPatchOperation) throws ApiException { + ApiResponse localVarResp = updateSettingWithHttpInfo(settingId, jsonPatchOperation); return localVarResp.getData(); } /** - * Update Flag This endpoint updates the metadata of a Feature Flag or Setting with a collection - * of [JSON Patch](https://jsonpatch.com) operations in a specified Config. Only the - * `name`, `hint` and `tags` attributes are modifiable by this - * endpoint. The `tags` attribute is a simple collection of the [tag - * IDs](#operation/get-tags) attached to the given setting. The advantage of using JSON Patch is - * that you can describe individual update operations on a resource without touching attributes - * that you don't want to change. For example: We have the following resource. - * ```json { \"settingId\": 5345, \"key\": - * \"myGrandFeature\", \"name\": \"Tihs is a naem with soem - * typos.\", \"hint\": \"This flag controls my grandioso feature.\", - * \"settingType\": \"boolean\", \"tags\": [ { - * \"tagId\": 0, \"name\": \"sample tag\", \"color\": - * \"whale\" } ] } ``` If we send an update request body as below (it - * changes the `name` and adds the already existing tag with the id `2`): - * ```json [ { \"op\": \"replace\", \"path\": - * \"/name\", \"value\": \"This is the name without typos.\" }, { - * \"op\": \"add\", \"path\": \"/tags/-\", - * \"value\": 2 } ] ``` Only the `name` and `tags` - * are updated and all the other attributes remain unchanged. So we get a response like this: - * ```json { \"settingId\": 5345, \"key\": - * \"myGrandFeature\", \"name\": \"This is the name without - * typos.\", \"hint\": \"This flag controls my grandioso feature.\", - * \"settingType\": \"boolean\", \"tags\": [ { - * \"tagId\": 0, \"name\": \"sample tag\", \"color\": - * \"whale\" }, { \"tagId\": 2, \"name\": \"another - * tag\", \"color\": \"koala\" } ] } ``` - * + * Update Flag + * This endpoint updates the metadata of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Config. Only the `name`, `hint` and `tags` attributes are modifiable by this endpoint. The `tags` attribute is a simple collection of the [tag IDs](#operation/get-tags) attached to the given setting. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. For example: We have the following resource. ```json { \"settingId\": 5345, \"key\": \"myGrandFeature\", \"name\": \"Tihs is a naem with soem typos.\", \"hint\": \"This flag controls my grandioso feature.\", \"settingType\": \"boolean\", \"tags\": [ { \"tagId\": 0, \"name\": \"sample tag\", \"color\": \"whale\" } ] } ``` If we send an update request body as below (it changes the `name` and adds the already existing tag with the id `2`): ```json [ { \"op\": \"replace\", \"path\": \"/name\", \"value\": \"This is the name without typos.\" }, { \"op\": \"add\", \"path\": \"/tags/-\", \"value\": 2 } ] ``` Only the `name` and `tags` are updated and all the other attributes remain unchanged. So we get a response like this: ```json { \"settingId\": 5345, \"key\": \"myGrandFeature\", \"name\": \"This is the name without typos.\", \"hint\": \"This flag controls my grandioso feature.\", \"settingType\": \"boolean\", \"tags\": [ { \"tagId\": 0, \"name\": \"sample tag\", \"color\": \"whale\" }, { \"tagId\": 2, \"name\": \"another tag\", \"color\": \"koala\" } ] } ``` * @param settingId The identifier of the Setting. (required) - * @param jsonPatchOperation (required) + * @param jsonPatchOperation (required) * @return ApiResponse<SettingModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateSettingWithHttpInfo( - Integer settingId, List jsonPatchOperation) throws ApiException { - okhttp3.Call localVarCall = - updateSettingValidateBeforeCall(settingId, jsonPatchOperation, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateSettingWithHttpInfo(Integer settingId, List jsonPatchOperation) throws ApiException { + okhttp3.Call localVarCall = updateSettingValidateBeforeCall(settingId, jsonPatchOperation, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Flag (asynchronously) This endpoint updates the metadata of a Feature Flag or Setting - * with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Config. - * Only the `name`, `hint` and `tags` attributes are modifiable by - * this endpoint. The `tags` attribute is a simple collection of the [tag - * IDs](#operation/get-tags) attached to the given setting. The advantage of using JSON Patch is - * that you can describe individual update operations on a resource without touching attributes - * that you don't want to change. For example: We have the following resource. - * ```json { \"settingId\": 5345, \"key\": - * \"myGrandFeature\", \"name\": \"Tihs is a naem with soem - * typos.\", \"hint\": \"This flag controls my grandioso feature.\", - * \"settingType\": \"boolean\", \"tags\": [ { - * \"tagId\": 0, \"name\": \"sample tag\", \"color\": - * \"whale\" } ] } ``` If we send an update request body as below (it - * changes the `name` and adds the already existing tag with the id `2`): - * ```json [ { \"op\": \"replace\", \"path\": - * \"/name\", \"value\": \"This is the name without typos.\" }, { - * \"op\": \"add\", \"path\": \"/tags/-\", - * \"value\": 2 } ] ``` Only the `name` and `tags` - * are updated and all the other attributes remain unchanged. So we get a response like this: - * ```json { \"settingId\": 5345, \"key\": - * \"myGrandFeature\", \"name\": \"This is the name without - * typos.\", \"hint\": \"This flag controls my grandioso feature.\", - * \"settingType\": \"boolean\", \"tags\": [ { - * \"tagId\": 0, \"name\": \"sample tag\", \"color\": - * \"whale\" }, { \"tagId\": 2, \"name\": \"another - * tag\", \"color\": \"koala\" } ] } ``` - * + * Update Flag (asynchronously) + * This endpoint updates the metadata of a Feature Flag or Setting with a collection of [JSON Patch](https://jsonpatch.com) operations in a specified Config. Only the `name`, `hint` and `tags` attributes are modifiable by this endpoint. The `tags` attribute is a simple collection of the [tag IDs](#operation/get-tags) attached to the given setting. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. For example: We have the following resource. ```json { \"settingId\": 5345, \"key\": \"myGrandFeature\", \"name\": \"Tihs is a naem with soem typos.\", \"hint\": \"This flag controls my grandioso feature.\", \"settingType\": \"boolean\", \"tags\": [ { \"tagId\": 0, \"name\": \"sample tag\", \"color\": \"whale\" } ] } ``` If we send an update request body as below (it changes the `name` and adds the already existing tag with the id `2`): ```json [ { \"op\": \"replace\", \"path\": \"/name\", \"value\": \"This is the name without typos.\" }, { \"op\": \"add\", \"path\": \"/tags/-\", \"value\": 2 } ] ``` Only the `name` and `tags` are updated and all the other attributes remain unchanged. So we get a response like this: ```json { \"settingId\": 5345, \"key\": \"myGrandFeature\", \"name\": \"This is the name without typos.\", \"hint\": \"This flag controls my grandioso feature.\", \"settingType\": \"boolean\", \"tags\": [ { \"tagId\": 0, \"name\": \"sample tag\", \"color\": \"whale\" }, { \"tagId\": 2, \"name\": \"another tag\", \"color\": \"koala\" } ] } ``` * @param settingId The identifier of the Setting. (required) - * @param jsonPatchOperation (required) + * @param jsonPatchOperation (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSettingAsync( - Integer settingId, - List jsonPatchOperation, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateSettingValidateBeforeCall(settingId, jsonPatchOperation, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateSettingAsync(Integer settingId, List jsonPatchOperation, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSettingValidateBeforeCall(settingId, jsonPatchOperation, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/IntegrationLinksApi.java b/src/main/java/com/configcat/publicapi/java/client/api/IntegrationLinksApi.java index a777f32..21cff99 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/IntegrationLinksApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/IntegrationLinksApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,6 +19,14 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.AddOrUpdateIntegrationLinkModel; import com.configcat.publicapi.java.client.model.AddOrUpdateJiraIntegrationLinkModel; import com.configcat.publicapi.java.client.model.ConnectRequest; @@ -26,13 +34,13 @@ import com.configcat.publicapi.java.client.model.IntegrationLinkDetailsModel; import com.configcat.publicapi.java.client.model.IntegrationLinkModel; import com.configcat.publicapi.java.client.model.IntegrationLinkType; -import com.google.gson.reflect.TypeToken; +import java.util.UUID; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class IntegrationLinksApi { private ApiClient localVarApiClient; @@ -73,40 +81,32 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for addOrUpdateIntegrationLink - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param integrationLinkType The integration link's type. (required) * @param key The key of the integration link. (required) - * @param addOrUpdateIntegrationLinkModel (optional) + * @param addOrUpdateIntegrationLinkModel (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call addOrUpdateIntegrationLinkCall( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key, - AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call addOrUpdateIntegrationLinkCall(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key, AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -115,18 +115,11 @@ public okhttp3.Call addOrUpdateIntegrationLinkCall( Object localVarPostBody = addOrUpdateIntegrationLinkModel; // create path and map variables - String localVarPath = - "/v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key}" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())) - .replace( - "{" + "integrationLinkType" + "}", - localVarApiClient.escapeString(integrationLinkType.toString())) - .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); + String localVarPath = "/v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key}" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())) + .replace("{" + "integrationLinkType" + "}", localVarApiClient.escapeString(integrationLinkType.toString())) + .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -134,203 +127,132 @@ public okhttp3.Call addOrUpdateIntegrationLinkCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addOrUpdateIntegrationLinkValidateBeforeCall( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key, - AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call addOrUpdateIntegrationLinkValidateBeforeCall(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key, AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " addOrUpdateIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling addOrUpdateIntegrationLink(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " addOrUpdateIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling addOrUpdateIntegrationLink(Async)"); } // verify the required parameter 'integrationLinkType' is set if (integrationLinkType == null) { - throw new ApiException( - "Missing the required parameter 'integrationLinkType' when calling" - + " addOrUpdateIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'integrationLinkType' when calling addOrUpdateIntegrationLink(Async)"); } // verify the required parameter 'key' is set if (key == null) { - throw new ApiException( - "Missing the required parameter 'key' when calling" - + " addOrUpdateIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'key' when calling addOrUpdateIntegrationLink(Async)"); } - return addOrUpdateIntegrationLinkCall( - environmentId, - settingId, - integrationLinkType, - key, - addOrUpdateIntegrationLinkModel, - _callback); + return addOrUpdateIntegrationLinkCall(environmentId, settingId, integrationLinkType, key, addOrUpdateIntegrationLinkModel, _callback); + } /** * Add or update Integration link - * + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param integrationLinkType The integration link's type. (required) * @param key The key of the integration link. (required) - * @param addOrUpdateIntegrationLinkModel (optional) + * @param addOrUpdateIntegrationLinkModel (optional) * @return IntegrationLinkModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public IntegrationLinkModel addOrUpdateIntegrationLink( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key, - AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel) - throws ApiException { - ApiResponse localVarResp = - addOrUpdateIntegrationLinkWithHttpInfo( - environmentId, - settingId, - integrationLinkType, - key, - addOrUpdateIntegrationLinkModel); + public IntegrationLinkModel addOrUpdateIntegrationLink(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key, AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel) throws ApiException { + ApiResponse localVarResp = addOrUpdateIntegrationLinkWithHttpInfo(environmentId, settingId, integrationLinkType, key, addOrUpdateIntegrationLinkModel); return localVarResp.getData(); } /** * Add or update Integration link - * + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param integrationLinkType The integration link's type. (required) * @param key The key of the integration link. (required) - * @param addOrUpdateIntegrationLinkModel (optional) + * @param addOrUpdateIntegrationLinkModel (optional) * @return ApiResponse<IntegrationLinkModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse addOrUpdateIntegrationLinkWithHttpInfo( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key, - AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel) - throws ApiException { - okhttp3.Call localVarCall = - addOrUpdateIntegrationLinkValidateBeforeCall( - environmentId, - settingId, - integrationLinkType, - key, - addOrUpdateIntegrationLinkModel, - null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse addOrUpdateIntegrationLinkWithHttpInfo(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key, AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel) throws ApiException { + okhttp3.Call localVarCall = addOrUpdateIntegrationLinkValidateBeforeCall(environmentId, settingId, integrationLinkType, key, addOrUpdateIntegrationLinkModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Add or update Integration link (asynchronously) - * + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param integrationLinkType The integration link's type. (required) * @param key The key of the integration link. (required) - * @param addOrUpdateIntegrationLinkModel (optional) + * @param addOrUpdateIntegrationLinkModel (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call addOrUpdateIntegrationLinkAsync( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key, - AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - addOrUpdateIntegrationLinkValidateBeforeCall( - environmentId, - settingId, - integrationLinkType, - key, - addOrUpdateIntegrationLinkModel, - _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call addOrUpdateIntegrationLinkAsync(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key, AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addOrUpdateIntegrationLinkValidateBeforeCall(environmentId, settingId, integrationLinkType, key, addOrUpdateIntegrationLinkModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteIntegrationLink - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param integrationLinkType The integration's type. (required) @@ -339,29 +261,23 @@ public okhttp3.Call addOrUpdateIntegrationLinkAsync( * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteIntegrationLinkCall( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteIntegrationLinkCall(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -370,18 +286,11 @@ public okhttp3.Call deleteIntegrationLinkCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key}" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())) - .replace( - "{" + "integrationLinkType" + "}", - localVarApiClient.escapeString(integrationLinkType.toString())) - .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); + String localVarPath = "/v1/environments/{environmentId}/settings/{settingId}/integrationLinks/{integrationLinkType}/{key}" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())) + .replace("{" + "integrationLinkType" + "}", localVarApiClient.escapeString(integrationLinkType.toString())) + .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -389,200 +298,149 @@ public okhttp3.Call deleteIntegrationLinkCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteIntegrationLinkValidateBeforeCall( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call deleteIntegrationLinkValidateBeforeCall(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " deleteIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling deleteIntegrationLink(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " deleteIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling deleteIntegrationLink(Async)"); } // verify the required parameter 'integrationLinkType' is set if (integrationLinkType == null) { - throw new ApiException( - "Missing the required parameter 'integrationLinkType' when calling" - + " deleteIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'integrationLinkType' when calling deleteIntegrationLink(Async)"); } // verify the required parameter 'key' is set if (key == null) { - throw new ApiException( - "Missing the required parameter 'key' when calling" - + " deleteIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'key' when calling deleteIntegrationLink(Async)"); } - return deleteIntegrationLinkCall( - environmentId, settingId, integrationLinkType, key, _callback); + return deleteIntegrationLinkCall(environmentId, settingId, integrationLinkType, key, _callback); + } /** * Delete Integration link - * + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param integrationLinkType The integration's type. (required) * @param key The key of the integration link. (required) * @return DeleteIntegrationLinkModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public DeleteIntegrationLinkModel deleteIntegrationLink( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key) - throws ApiException { - ApiResponse localVarResp = - deleteIntegrationLinkWithHttpInfo( - environmentId, settingId, integrationLinkType, key); + public DeleteIntegrationLinkModel deleteIntegrationLink(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key) throws ApiException { + ApiResponse localVarResp = deleteIntegrationLinkWithHttpInfo(environmentId, settingId, integrationLinkType, key); return localVarResp.getData(); } /** * Delete Integration link - * + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param integrationLinkType The integration's type. (required) * @param key The key of the integration link. (required) * @return ApiResponse<DeleteIntegrationLinkModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse deleteIntegrationLinkWithHttpInfo( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key) - throws ApiException { - okhttp3.Call localVarCall = - deleteIntegrationLinkValidateBeforeCall( - environmentId, settingId, integrationLinkType, key, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse deleteIntegrationLinkWithHttpInfo(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key) throws ApiException { + okhttp3.Call localVarCall = deleteIntegrationLinkValidateBeforeCall(environmentId, settingId, integrationLinkType, key, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Delete Integration link (asynchronously) - * + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param integrationLinkType The integration's type. (required) * @param key The key of the integration link. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteIntegrationLinkAsync( - UUID environmentId, - Integer settingId, - IntegrationLinkType integrationLinkType, - String key, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - deleteIntegrationLinkValidateBeforeCall( - environmentId, settingId, integrationLinkType, key, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call deleteIntegrationLinkAsync(UUID environmentId, Integer settingId, IntegrationLinkType integrationLinkType, String key, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteIntegrationLinkValidateBeforeCall(environmentId, settingId, integrationLinkType, key, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getIntegrationLinkDetails - * * @param integrationLinkType The integration link's type. (required) * @param key The key of the integration link. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the details for the integration link returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the details for the integration link returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getIntegrationLinkDetailsCall( - IntegrationLinkType integrationLinkType, String key, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getIntegrationLinkDetailsCall(IntegrationLinkType integrationLinkType, String key, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -591,12 +449,9 @@ public okhttp3.Call getIntegrationLinkDetailsCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/integrationLink/{integrationLinkType}/{key}/details" - .replace( - "{" + "integrationLinkType" + "}", - localVarApiClient.escapeString(integrationLinkType.toString())) - .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); + String localVarPath = "/v1/integrationLink/{integrationLinkType}/{key}/details" + .replace("{" + "integrationLinkType" + "}", localVarApiClient.escapeString(integrationLinkType.toString())) + .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -604,168 +459,135 @@ public okhttp3.Call getIntegrationLinkDetailsCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getIntegrationLinkDetailsValidateBeforeCall( - IntegrationLinkType integrationLinkType, String key, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getIntegrationLinkDetailsValidateBeforeCall(IntegrationLinkType integrationLinkType, String key, final ApiCallback _callback) throws ApiException { // verify the required parameter 'integrationLinkType' is set if (integrationLinkType == null) { - throw new ApiException( - "Missing the required parameter 'integrationLinkType' when calling" - + " getIntegrationLinkDetails(Async)"); + throw new ApiException("Missing the required parameter 'integrationLinkType' when calling getIntegrationLinkDetails(Async)"); } // verify the required parameter 'key' is set if (key == null) { - throw new ApiException( - "Missing the required parameter 'key' when calling" - + " getIntegrationLinkDetails(Async)"); + throw new ApiException("Missing the required parameter 'key' when calling getIntegrationLinkDetails(Async)"); } return getIntegrationLinkDetailsCall(integrationLinkType, key, _callback); + } /** * Get Integration link - * + * * @param integrationLinkType The integration link's type. (required) * @param key The key of the integration link. (required) * @return IntegrationLinkDetailsModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the details for the integration link returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the details for the integration link returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public IntegrationLinkDetailsModel getIntegrationLinkDetails( - IntegrationLinkType integrationLinkType, String key) throws ApiException { - ApiResponse localVarResp = - getIntegrationLinkDetailsWithHttpInfo(integrationLinkType, key); + public IntegrationLinkDetailsModel getIntegrationLinkDetails(IntegrationLinkType integrationLinkType, String key) throws ApiException { + ApiResponse localVarResp = getIntegrationLinkDetailsWithHttpInfo(integrationLinkType, key); return localVarResp.getData(); } /** * Get Integration link - * + * * @param integrationLinkType The integration link's type. (required) * @param key The key of the integration link. (required) * @return ApiResponse<IntegrationLinkDetailsModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the details for the integration link returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the details for the integration link returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getIntegrationLinkDetailsWithHttpInfo( - IntegrationLinkType integrationLinkType, String key) throws ApiException { - okhttp3.Call localVarCall = - getIntegrationLinkDetailsValidateBeforeCall(integrationLinkType, key, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse getIntegrationLinkDetailsWithHttpInfo(IntegrationLinkType integrationLinkType, String key) throws ApiException { + okhttp3.Call localVarCall = getIntegrationLinkDetailsValidateBeforeCall(integrationLinkType, key, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get Integration link (asynchronously) - * + * * @param integrationLinkType The integration link's type. (required) * @param key The key of the integration link. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the details for the integration link returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the details for the integration link returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getIntegrationLinkDetailsAsync( - IntegrationLinkType integrationLinkType, - String key, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - getIntegrationLinkDetailsValidateBeforeCall(integrationLinkType, key, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call getIntegrationLinkDetailsAsync(IntegrationLinkType integrationLinkType, String key, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getIntegrationLinkDetailsValidateBeforeCall(integrationLinkType, key, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for jiraAddOrUpdateIntegrationLink - * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param key The key of the integration link. (required) - * @param addOrUpdateJiraIntegrationLinkModel (optional) + * @param addOrUpdateJiraIntegrationLinkModel (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call jiraAddOrUpdateIntegrationLinkCall( - UUID environmentId, - Integer settingId, - String key, - AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call jiraAddOrUpdateIntegrationLinkCall(UUID environmentId, Integer settingId, String key, AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -774,15 +596,10 @@ public okhttp3.Call jiraAddOrUpdateIntegrationLinkCall( Object localVarPostBody = addOrUpdateJiraIntegrationLinkModel; // create path and map variables - String localVarPath = - "/v1/jira/environments/{environmentId}/settings/{settingId}/integrationLinks/{key}" - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())) - .replace( - "{" + "settingId" + "}", - localVarApiClient.escapeString(settingId.toString())) - .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); + String localVarPath = "/v1/jira/environments/{environmentId}/settings/{settingId}/integrationLinks/{key}" + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())) + .replace("{" + "settingId" + "}", localVarApiClient.escapeString(settingId.toString())) + .replace("{" + "key" + "}", localVarApiClient.escapeString(key.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -790,191 +607,144 @@ public okhttp3.Call jiraAddOrUpdateIntegrationLinkCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call jiraAddOrUpdateIntegrationLinkValidateBeforeCall( - UUID environmentId, - Integer settingId, - String key, - AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call jiraAddOrUpdateIntegrationLinkValidateBeforeCall(UUID environmentId, Integer settingId, String key, AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " jiraAddOrUpdateIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling jiraAddOrUpdateIntegrationLink(Async)"); } // verify the required parameter 'settingId' is set if (settingId == null) { - throw new ApiException( - "Missing the required parameter 'settingId' when calling" - + " jiraAddOrUpdateIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'settingId' when calling jiraAddOrUpdateIntegrationLink(Async)"); } // verify the required parameter 'key' is set if (key == null) { - throw new ApiException( - "Missing the required parameter 'key' when calling" - + " jiraAddOrUpdateIntegrationLink(Async)"); + throw new ApiException("Missing the required parameter 'key' when calling jiraAddOrUpdateIntegrationLink(Async)"); } - return jiraAddOrUpdateIntegrationLinkCall( - environmentId, settingId, key, addOrUpdateJiraIntegrationLinkModel, _callback); + return jiraAddOrUpdateIntegrationLinkCall(environmentId, settingId, key, addOrUpdateJiraIntegrationLinkModel, _callback); + } /** + * + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param key The key of the integration link. (required) - * @param addOrUpdateJiraIntegrationLinkModel (optional) + * @param addOrUpdateJiraIntegrationLinkModel (optional) * @return IntegrationLinkModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public IntegrationLinkModel jiraAddOrUpdateIntegrationLink( - UUID environmentId, - Integer settingId, - String key, - AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel) - throws ApiException { - ApiResponse localVarResp = - jiraAddOrUpdateIntegrationLinkWithHttpInfo( - environmentId, settingId, key, addOrUpdateJiraIntegrationLinkModel); + public IntegrationLinkModel jiraAddOrUpdateIntegrationLink(UUID environmentId, Integer settingId, String key, AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel) throws ApiException { + ApiResponse localVarResp = jiraAddOrUpdateIntegrationLinkWithHttpInfo(environmentId, settingId, key, addOrUpdateJiraIntegrationLinkModel); return localVarResp.getData(); } /** + * + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param key The key of the integration link. (required) - * @param addOrUpdateJiraIntegrationLinkModel (optional) + * @param addOrUpdateJiraIntegrationLinkModel (optional) * @return ApiResponse<IntegrationLinkModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse jiraAddOrUpdateIntegrationLinkWithHttpInfo( - UUID environmentId, - Integer settingId, - String key, - AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel) - throws ApiException { - okhttp3.Call localVarCall = - jiraAddOrUpdateIntegrationLinkValidateBeforeCall( - environmentId, settingId, key, addOrUpdateJiraIntegrationLinkModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse jiraAddOrUpdateIntegrationLinkWithHttpInfo(UUID environmentId, Integer settingId, String key, AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel) throws ApiException { + okhttp3.Call localVarCall = jiraAddOrUpdateIntegrationLinkValidateBeforeCall(environmentId, settingId, key, addOrUpdateJiraIntegrationLinkModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * (asynchronously) - * + * (asynchronously) + * * @param environmentId The identifier of the Environment. (required) * @param settingId The id of the Setting. (required) * @param key The key of the integration link. (required) - * @param addOrUpdateJiraIntegrationLinkModel (optional) + * @param addOrUpdateJiraIntegrationLinkModel (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration link data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call jiraAddOrUpdateIntegrationLinkAsync( - UUID environmentId, - Integer settingId, - String key, - AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - jiraAddOrUpdateIntegrationLinkValidateBeforeCall( - environmentId, - settingId, - key, - addOrUpdateJiraIntegrationLinkModel, - _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call jiraAddOrUpdateIntegrationLinkAsync(UUID environmentId, Integer settingId, String key, AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = jiraAddOrUpdateIntegrationLinkValidateBeforeCall(environmentId, settingId, key, addOrUpdateJiraIntegrationLinkModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for jiraConnect - * - * @param connectRequest (optional) + * @param connectRequest (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 OK -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 OK -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call jiraConnectCall(ConnectRequest connectRequest, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call jiraConnectCall(ConnectRequest connectRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -991,92 +761,82 @@ public okhttp3.Call jiraConnectCall(ConnectRequest connectRequest, final ApiCall Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call jiraConnectValidateBeforeCall( - ConnectRequest connectRequest, final ApiCallback _callback) throws ApiException { + private okhttp3.Call jiraConnectValidateBeforeCall(ConnectRequest connectRequest, final ApiCallback _callback) throws ApiException { return jiraConnectCall(connectRequest, _callback); + } /** - * @param connectRequest (optional) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * + * + * @param connectRequest (optional) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 OK -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 OK -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void jiraConnect(ConnectRequest connectRequest) throws ApiException { jiraConnectWithHttpInfo(connectRequest); } /** - * @param connectRequest (optional) + * + * + * @param connectRequest (optional) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 OK -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 OK -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse jiraConnectWithHttpInfo(ConnectRequest connectRequest) - throws ApiException { + public ApiResponse jiraConnectWithHttpInfo(ConnectRequest connectRequest) throws ApiException { okhttp3.Call localVarCall = jiraConnectValidateBeforeCall(connectRequest, null); return localVarApiClient.execute(localVarCall); } /** - * (asynchronously) - * - * @param connectRequest (optional) + * (asynchronously) + * + * @param connectRequest (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 OK -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 OK -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call jiraConnectAsync( - ConnectRequest connectRequest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call jiraConnectAsync(ConnectRequest connectRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = jiraConnectValidateBeforeCall(connectRequest, _callback); localVarApiClient.executeAsync(localVarCall, _callback); diff --git a/src/main/java/com/configcat/publicapi/java/client/api/IntegrationsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/IntegrationsApi.java index c62f3b0..718c57b 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/IntegrationsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/IntegrationsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,17 +19,25 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.CreateIntegrationModel; import com.configcat.publicapi.java.client.model.IntegrationModel; import com.configcat.publicapi.java.client.model.IntegrationsModel; import com.configcat.publicapi.java.client.model.ModifyIntegrationRequest; -import com.google.gson.reflect.TypeToken; +import java.util.UUID; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class IntegrationsApi { private ApiClient localVarApiClient; @@ -70,34 +78,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createIntegration - * * @param productId The identifier of the Product. (required) - * @param createIntegrationModel (required) + * @param createIntegrationModel (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createIntegrationCall( - UUID productId, - CreateIntegrationModel createIntegrationModel, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createIntegrationCall(UUID productId, CreateIntegrationModel createIntegrationModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -106,11 +109,8 @@ public okhttp3.Call createIntegrationCall( Object localVarPostBody = createIntegrationModel; // create path and map variables - String localVarPath = - "/v1/products/{productId}/integrations" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/integrations" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -118,218 +118,135 @@ public okhttp3.Call createIntegrationCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createIntegrationValidateBeforeCall( - UUID productId, - CreateIntegrationModel createIntegrationModel, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createIntegrationValidateBeforeCall(UUID productId, CreateIntegrationModel createIntegrationModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " createIntegration(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling createIntegration(Async)"); } // verify the required parameter 'createIntegrationModel' is set if (createIntegrationModel == null) { - throw new ApiException( - "Missing the required parameter 'createIntegrationModel' when calling" - + " createIntegration(Async)"); + throw new ApiException("Missing the required parameter 'createIntegrationModel' when calling createIntegration(Async)"); } return createIntegrationCall(productId, createIntegrationModel, _callback); + } /** - * Create Integration This endpoint creates a new Integration in a specified Product identified - * by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. The Parameters dictionary differs for each - * IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - - * `site`: Datadog site. Available values: `Us`, `Eu`, - * `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack - * Connecting the Slack integration through the Public Management API will not post messages - * with the ConfigCat Feature Flags Slack app but with an incoming webhook. - - * `incoming_webhook.url`: Required. The [incoming webhook - * URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - - * Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: - * Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. - * Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel - * Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - - * `server`: Mixpanel Server. Available values: `StandardServer`, - * `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - - * `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio - * Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - - * PubNub (work in progress) - * + * Create Integration + * This endpoint creates a new Integration in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. The Parameters dictionary differs for each IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - `site`: Datadog site. Available values: `Us`, `Eu`, `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack Connecting the Slack integration through the Public Management API will not post messages with the ConfigCat Feature Flags Slack app but with an incoming webhook. - `incoming_webhook.url`: Required. The [incoming webhook URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - `server`: Mixpanel Server. Available values: `StandardServer`, `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - PubNub (work in progress) * @param productId The identifier of the Product. (required) - * @param createIntegrationModel (required) + * @param createIntegrationModel (required) * @return IntegrationModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public IntegrationModel createIntegration( - UUID productId, CreateIntegrationModel createIntegrationModel) throws ApiException { - ApiResponse localVarResp = - createIntegrationWithHttpInfo(productId, createIntegrationModel); + public IntegrationModel createIntegration(UUID productId, CreateIntegrationModel createIntegrationModel) throws ApiException { + ApiResponse localVarResp = createIntegrationWithHttpInfo(productId, createIntegrationModel); return localVarResp.getData(); } /** - * Create Integration This endpoint creates a new Integration in a specified Product identified - * by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. The Parameters dictionary differs for each - * IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - - * `site`: Datadog site. Available values: `Us`, `Eu`, - * `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack - * Connecting the Slack integration through the Public Management API will not post messages - * with the ConfigCat Feature Flags Slack app but with an incoming webhook. - - * `incoming_webhook.url`: Required. The [incoming webhook - * URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - - * Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: - * Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. - * Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel - * Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - - * `server`: Mixpanel Server. Available values: `StandardServer`, - * `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - - * `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio - * Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - - * PubNub (work in progress) - * + * Create Integration + * This endpoint creates a new Integration in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. The Parameters dictionary differs for each IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - `site`: Datadog site. Available values: `Us`, `Eu`, `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack Connecting the Slack integration through the Public Management API will not post messages with the ConfigCat Feature Flags Slack app but with an incoming webhook. - `incoming_webhook.url`: Required. The [incoming webhook URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - `server`: Mixpanel Server. Available values: `StandardServer`, `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - PubNub (work in progress) * @param productId The identifier of the Product. (required) - * @param createIntegrationModel (required) + * @param createIntegrationModel (required) * @return ApiResponse<IntegrationModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createIntegrationWithHttpInfo( - UUID productId, CreateIntegrationModel createIntegrationModel) throws ApiException { - okhttp3.Call localVarCall = - createIntegrationValidateBeforeCall(productId, createIntegrationModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse createIntegrationWithHttpInfo(UUID productId, CreateIntegrationModel createIntegrationModel) throws ApiException { + okhttp3.Call localVarCall = createIntegrationValidateBeforeCall(productId, createIntegrationModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Integration (asynchronously) This endpoint creates a new Integration in a specified - * Product identified by the `productId` parameter, which can be obtained from the - * [List Products](#operation/get-products) endpoint. The Parameters dictionary differs for each - * IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - - * `site`: Datadog site. Available values: `Us`, `Eu`, - * `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack - * Connecting the Slack integration through the Public Management API will not post messages - * with the ConfigCat Feature Flags Slack app but with an incoming webhook. - - * `incoming_webhook.url`: Required. The [incoming webhook - * URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - - * Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: - * Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. - * Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel - * Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - - * `server`: Mixpanel Server. Available values: `StandardServer`, - * `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - - * `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio - * Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - - * PubNub (work in progress) - * + * Create Integration (asynchronously) + * This endpoint creates a new Integration in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. The Parameters dictionary differs for each IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - `site`: Datadog site. Available values: `Us`, `Eu`, `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack Connecting the Slack integration through the Public Management API will not post messages with the ConfigCat Feature Flags Slack app but with an incoming webhook. - `incoming_webhook.url`: Required. The [incoming webhook URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - `server`: Mixpanel Server. Available values: `StandardServer`, `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - PubNub (work in progress) * @param productId The identifier of the Product. (required) - * @param createIntegrationModel (required) + * @param createIntegrationModel (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createIntegrationAsync( - UUID productId, - CreateIntegrationModel createIntegrationModel, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createIntegrationValidateBeforeCall(productId, createIntegrationModel, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call createIntegrationAsync(UUID productId, CreateIntegrationModel createIntegrationModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createIntegrationValidateBeforeCall(productId, createIntegrationModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteIntegration - * * @param integrationId The identifier of the Integration. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteIntegrationCall(UUID integrationId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteIntegrationCall(UUID integrationId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -338,11 +255,8 @@ public okhttp3.Call deleteIntegrationCall(UUID integrationId, final ApiCallback Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/integrations/{integrationId}" - .replace( - "{" + "integrationId" + "}", - localVarApiClient.escapeString(integrationId.toString())); + String localVarPath = "/v1/integrations/{integrationId}" + .replace("{" + "integrationId" + "}", localVarApiClient.escapeString(integrationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -350,83 +264,67 @@ public okhttp3.Call deleteIntegrationCall(UUID integrationId, final ApiCallback Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteIntegrationValidateBeforeCall( - UUID integrationId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deleteIntegrationValidateBeforeCall(UUID integrationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'integrationId' is set if (integrationId == null) { - throw new ApiException( - "Missing the required parameter 'integrationId' when calling" - + " deleteIntegration(Async)"); + throw new ApiException("Missing the required parameter 'integrationId' when calling deleteIntegration(Async)"); } return deleteIntegrationCall(integrationId, _callback); + } /** - * Delete Integration This endpoint removes a Integration identified by the - * `integrationId` parameter. - * + * Delete Integration + * This endpoint removes a Integration identified by the `integrationId` parameter. * @param integrationId The identifier of the Integration. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteIntegration(UUID integrationId) throws ApiException { deleteIntegrationWithHttpInfo(integrationId); } /** - * Delete Integration This endpoint removes a Integration identified by the - * `integrationId` parameter. - * + * Delete Integration + * This endpoint removes a Integration identified by the `integrationId` parameter. * @param integrationId The identifier of the Integration. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse deleteIntegrationWithHttpInfo(UUID integrationId) throws ApiException { okhttp3.Call localVarCall = deleteIntegrationValidateBeforeCall(integrationId, null); @@ -434,25 +332,22 @@ public ApiResponse deleteIntegrationWithHttpInfo(UUID integrationId) throw } /** - * Delete Integration (asynchronously) This endpoint removes a Integration identified by the - * `integrationId` parameter. - * + * Delete Integration (asynchronously) + * This endpoint removes a Integration identified by the `integrationId` parameter. * @param integrationId The identifier of the Integration. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteIntegrationAsync( - UUID integrationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteIntegrationAsync(UUID integrationId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteIntegrationValidateBeforeCall(integrationId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -460,30 +355,28 @@ public okhttp3.Call deleteIntegrationAsync( } /** * Build call for getIntegration - * * @param integrationId The identifier of the Integration. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getIntegrationCall(UUID integrationId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getIntegrationCall(UUID integrationId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -492,11 +385,8 @@ public okhttp3.Call getIntegrationCall(UUID integrationId, final ApiCallback _ca Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/integrations/{integrationId}" - .replace( - "{" + "integrationId" + "}", - localVarApiClient.escapeString(integrationId.toString())); + String localVarPath = "/v1/integrations/{integrationId}" + .replace("{" + "integrationId" + "}", localVarApiClient.escapeString(integrationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -504,63 +394,50 @@ public okhttp3.Call getIntegrationCall(UUID integrationId, final ApiCallback _ca Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getIntegrationValidateBeforeCall( - UUID integrationId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getIntegrationValidateBeforeCall(UUID integrationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'integrationId' is set if (integrationId == null) { - throw new ApiException( - "Missing the required parameter 'integrationId' when calling" - + " getIntegration(Async)"); + throw new ApiException("Missing the required parameter 'integrationId' when calling getIntegration(Async)"); } return getIntegrationCall(integrationId, _callback); + } /** - * Get Integration This endpoint returns the metadata of an Integration identified by the - * `integrationId`. - * + * Get Integration + * This endpoint returns the metadata of an Integration identified by the `integrationId`. * @param integrationId The identifier of the Integration. (required) * @return IntegrationModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public IntegrationModel getIntegration(UUID integrationId) throws ApiException { ApiResponse localVarResp = getIntegrationWithHttpInfo(integrationId); @@ -568,81 +445,73 @@ public IntegrationModel getIntegration(UUID integrationId) throws ApiException { } /** - * Get Integration This endpoint returns the metadata of an Integration identified by the - * `integrationId`. - * + * Get Integration + * This endpoint returns the metadata of an Integration identified by the `integrationId`. * @param integrationId The identifier of the Integration. (required) * @return ApiResponse<IntegrationModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getIntegrationWithHttpInfo(UUID integrationId) - throws ApiException { + public ApiResponse getIntegrationWithHttpInfo(UUID integrationId) throws ApiException { okhttp3.Call localVarCall = getIntegrationValidateBeforeCall(integrationId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Integration (asynchronously) This endpoint returns the metadata of an Integration - * identified by the `integrationId`. - * + * Get Integration (asynchronously) + * This endpoint returns the metadata of an Integration identified by the `integrationId`. * @param integrationId The identifier of the Integration. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the integration data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the integration data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getIntegrationAsync( - UUID integrationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getIntegrationAsync(UUID integrationId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getIntegrationValidateBeforeCall(integrationId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getIntegrations - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getIntegrationsCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getIntegrationsCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -651,11 +520,8 @@ public okhttp3.Call getIntegrationsCall(UUID productId, final ApiCallback _callb Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/integrations" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/integrations" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -663,64 +529,50 @@ public okhttp3.Call getIntegrationsCall(UUID productId, final ApiCallback _callb Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getIntegrationsValidateBeforeCall( - UUID productId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getIntegrationsValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " getIntegrations(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getIntegrations(Async)"); } return getIntegrationsCall(productId, _callback); + } /** - * List Integrations This endpoint returns the list of the Integrations that belongs to the - * given Product identified by the `productId` parameter, which can be obtained from - * the [List Products](#operation/get-products) endpoint. - * + * List Integrations + * This endpoint returns the list of the Integrations that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return IntegrationsModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public IntegrationsModel getIntegrations(UUID productId) throws ApiException { ApiResponse localVarResp = getIntegrationsWithHttpInfo(productId); @@ -728,87 +580,74 @@ public IntegrationsModel getIntegrations(UUID productId) throws ApiException { } /** - * List Integrations This endpoint returns the list of the Integrations that belongs to the - * given Product identified by the `productId` parameter, which can be obtained from - * the [List Products](#operation/get-products) endpoint. - * + * List Integrations + * This endpoint returns the list of the Integrations that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return ApiResponse<IntegrationsModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getIntegrationsWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse getIntegrationsWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getIntegrationsValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Integrations (asynchronously) This endpoint returns the list of the Integrations that - * belongs to the given Product identified by the `productId` parameter, which can be - * obtained from the [List Products](#operation/get-products) endpoint. - * + * List Integrations (asynchronously) + * This endpoint returns the list of the Integrations that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getIntegrationsAsync( - UUID productId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getIntegrationsAsync(UUID productId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getIntegrationsValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateIntegration - * * @param integrationId The identifier of the Integration. (required) - * @param modifyIntegrationRequest (required) + * @param modifyIntegrationRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateIntegrationCall( - UUID integrationId, - ModifyIntegrationRequest modifyIntegrationRequest, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateIntegrationCall(UUID integrationId, ModifyIntegrationRequest modifyIntegrationRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -817,11 +656,8 @@ public okhttp3.Call updateIntegrationCall( Object localVarPostBody = modifyIntegrationRequest; // create path and map variables - String localVarPath = - "/v1/integrations/{integrationId}" - .replace( - "{" + "integrationId" + "}", - localVarApiClient.escapeString(integrationId.toString())); + String localVarPath = "/v1/integrations/{integrationId}" + .replace("{" + "integrationId" + "}", localVarApiClient.escapeString(integrationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -829,187 +665,108 @@ public okhttp3.Call updateIntegrationCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateIntegrationValidateBeforeCall( - UUID integrationId, - ModifyIntegrationRequest modifyIntegrationRequest, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateIntegrationValidateBeforeCall(UUID integrationId, ModifyIntegrationRequest modifyIntegrationRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'integrationId' is set if (integrationId == null) { - throw new ApiException( - "Missing the required parameter 'integrationId' when calling" - + " updateIntegration(Async)"); + throw new ApiException("Missing the required parameter 'integrationId' when calling updateIntegration(Async)"); } // verify the required parameter 'modifyIntegrationRequest' is set if (modifyIntegrationRequest == null) { - throw new ApiException( - "Missing the required parameter 'modifyIntegrationRequest' when calling" - + " updateIntegration(Async)"); + throw new ApiException("Missing the required parameter 'modifyIntegrationRequest' when calling updateIntegration(Async)"); } return updateIntegrationCall(integrationId, modifyIntegrationRequest, _callback); + } /** - * Update Integration This endpoint updates a Config identified by the `integrationId` - * parameter. The Parameters dictionary differs for each IntegrationType: - Datadog - - * `apikey`: Required. Datadog API key. - `site`: Datadog site. Available - * values: `Us`, `Eu`, `Us1Fed`, `Us3`, `Us5`. - * Default: `Us`. - Slack Connecting the Slack integration through the Public - * Management API will not post messages with the ConfigCat Feature Flags Slack app but with an - * incoming webhook. - `incoming_webhook.url`: Required. The [incoming webhook - * URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - - * Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: - * Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. - * Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel - * Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - - * `server`: Mixpanel Server. Available values: `StandardServer`, - * `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - - * `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio - * Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - - * PubNub (work in progress) - * + * Update Integration + * This endpoint updates a Config identified by the `integrationId` parameter. The Parameters dictionary differs for each IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - `site`: Datadog site. Available values: `Us`, `Eu`, `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack Connecting the Slack integration through the Public Management API will not post messages with the ConfigCat Feature Flags Slack app but with an incoming webhook. - `incoming_webhook.url`: Required. The [incoming webhook URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - `server`: Mixpanel Server. Available values: `StandardServer`, `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - PubNub (work in progress) * @param integrationId The identifier of the Integration. (required) - * @param modifyIntegrationRequest (required) + * @param modifyIntegrationRequest (required) * @return IntegrationModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public IntegrationModel updateIntegration( - UUID integrationId, ModifyIntegrationRequest modifyIntegrationRequest) - throws ApiException { - ApiResponse localVarResp = - updateIntegrationWithHttpInfo(integrationId, modifyIntegrationRequest); + public IntegrationModel updateIntegration(UUID integrationId, ModifyIntegrationRequest modifyIntegrationRequest) throws ApiException { + ApiResponse localVarResp = updateIntegrationWithHttpInfo(integrationId, modifyIntegrationRequest); return localVarResp.getData(); } /** - * Update Integration This endpoint updates a Config identified by the `integrationId` - * parameter. The Parameters dictionary differs for each IntegrationType: - Datadog - - * `apikey`: Required. Datadog API key. - `site`: Datadog site. Available - * values: `Us`, `Eu`, `Us1Fed`, `Us3`, `Us5`. - * Default: `Us`. - Slack Connecting the Slack integration through the Public - * Management API will not post messages with the ConfigCat Feature Flags Slack app but with an - * incoming webhook. - `incoming_webhook.url`: Required. The [incoming webhook - * URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - - * Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: - * Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. - * Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel - * Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - - * `server`: Mixpanel Server. Available values: `StandardServer`, - * `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - - * `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio - * Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - - * PubNub (work in progress) - * + * Update Integration + * This endpoint updates a Config identified by the `integrationId` parameter. The Parameters dictionary differs for each IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - `site`: Datadog site. Available values: `Us`, `Eu`, `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack Connecting the Slack integration through the Public Management API will not post messages with the ConfigCat Feature Flags Slack app but with an incoming webhook. - `incoming_webhook.url`: Required. The [incoming webhook URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - `server`: Mixpanel Server. Available values: `StandardServer`, `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - PubNub (work in progress) * @param integrationId The identifier of the Integration. (required) - * @param modifyIntegrationRequest (required) + * @param modifyIntegrationRequest (required) * @return ApiResponse<IntegrationModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateIntegrationWithHttpInfo( - UUID integrationId, ModifyIntegrationRequest modifyIntegrationRequest) - throws ApiException { - okhttp3.Call localVarCall = - updateIntegrationValidateBeforeCall(integrationId, modifyIntegrationRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateIntegrationWithHttpInfo(UUID integrationId, ModifyIntegrationRequest modifyIntegrationRequest) throws ApiException { + okhttp3.Call localVarCall = updateIntegrationValidateBeforeCall(integrationId, modifyIntegrationRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Integration (asynchronously) This endpoint updates a Config identified by the - * `integrationId` parameter. The Parameters dictionary differs for each - * IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - - * `site`: Datadog site. Available values: `Us`, `Eu`, - * `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack - * Connecting the Slack integration through the Public Management API will not post messages - * with the ConfigCat Feature Flags Slack app but with an incoming webhook. - - * `incoming_webhook.url`: Required. The [incoming webhook - * URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - - * Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: - * Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. - * Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel - * Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - - * `server`: Mixpanel Server. Available values: `StandardServer`, - * `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - - * `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio - * Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - - * PubNub (work in progress) - * + * Update Integration (asynchronously) + * This endpoint updates a Config identified by the `integrationId` parameter. The Parameters dictionary differs for each IntegrationType: - Datadog - `apikey`: Required. Datadog API key. - `site`: Datadog site. Available values: `Us`, `Eu`, `Us1Fed`, `Us3`, `Us5`. Default: `Us`. - Slack Connecting the Slack integration through the Public Management API will not post messages with the ConfigCat Feature Flags Slack app but with an incoming webhook. - `incoming_webhook.url`: Required. The [incoming webhook URL](https://api.slack.com/messaging/webhooks) where the integration should post messages. - Amplitude - `apiKey`: Required. Amplitude API Key. - `secretKey`: Required. Amplitude Secret Key. - Mixpanel - `serviceAccountUserName`: Required. Mixpanel Service Account Username. - `serviceAccountSecret`: Required. Mixpanel Service Account Secret. - `projectId`: Required. Mixpanel Project ID. - `server`: Mixpanel Server. Available values: `StandardServer`, `EUResidencyServer`. Default: `StandardServer`. - Twilio Segment - `writeKey`: Required. Twilio Segment Write Key. - `server`: Twilio Segment Server. Available values: `Us`, `Eu`. Default: `Us`. - PubNub (work in progress) * @param integrationId The identifier of the Integration. (required) - * @param modifyIntegrationRequest (required) + * @param modifyIntegrationRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateIntegrationAsync( - UUID integrationId, - ModifyIntegrationRequest modifyIntegrationRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateIntegrationValidateBeforeCall( - integrationId, modifyIntegrationRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateIntegrationAsync(UUID integrationId, ModifyIntegrationRequest modifyIntegrationRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateIntegrationValidateBeforeCall(integrationId, modifyIntegrationRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/MeApi.java b/src/main/java/com/configcat/publicapi/java/client/api/MeApi.java index 1bba549..5868484 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/MeApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/MeApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,8 +19,16 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; -import com.configcat.publicapi.java.client.model.MeModel; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.configcat.publicapi.java.client.model.MeModel; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; @@ -66,26 +74,25 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getMe - * * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public okhttp3.Call getMeCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -102,51 +109,42 @@ public okhttp3.Call getMeCall(final ApiCallback _callback) throws ApiException { Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getMeValidateBeforeCall(final ApiCallback _callback) throws ApiException { return getMeCall(_callback); + } /** * Get authenticated user details - * + * * @return MeModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public MeModel getMe() throws ApiException { ApiResponse localVarResp = getMeWithHttpInfo(); @@ -155,41 +153,39 @@ public MeModel getMe() throws ApiException { /** * Get authenticated user details - * + * * @return ApiResponse<MeModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse getMeWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getMeValidateBeforeCall(null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get authenticated user details (asynchronously) - * + * * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public okhttp3.Call getMeAsync(final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getMeValidateBeforeCall(_callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/MembersApi.java b/src/main/java/com/configcat/publicapi/java/client/api/MembersApi.java index 231b52d..6121b7c 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/MembersApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/MembersApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,20 +19,28 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.InvitationModel; import com.configcat.publicapi.java.client.model.InviteMembersRequest; import com.configcat.publicapi.java.client.model.MemberModel; import com.configcat.publicapi.java.client.model.OrganizationInvitationModel; import com.configcat.publicapi.java.client.model.OrganizationMembersModel; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdateMemberPermissionsRequest; import com.configcat.publicapi.java.client.model.UserModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class MembersApi { private ApiClient localVarApiClient; @@ -73,36 +81,30 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for addMemberToGroup - * * @param organizationId The identifier of the Organization. (required) * @param userId The identifier of the Member. (required) - * @param updateMemberPermissionsRequest (required) + * @param updateMemberPermissionsRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call addMemberToGroupCall( - UUID organizationId, - String userId, - UpdateMemberPermissionsRequest updateMemberPermissionsRequest, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call addMemberToGroupCall(UUID organizationId, String userId, UpdateMemberPermissionsRequest updateMemberPermissionsRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -111,14 +113,9 @@ public okhttp3.Call addMemberToGroupCall( Object localVarPostBody = updateMemberPermissionsRequest; // create path and map variables - String localVarPath = - "/v1/organizations/{organizationId}/members/{userId}" - .replace( - "{" + "organizationId" + "}", - localVarApiClient.escapeString(organizationId.toString())) - .replace( - "{" + "userId" + "}", - localVarApiClient.escapeString(userId.toString())); + String localVarPath = "/v1/organizations/{organizationId}/members/{userId}" + .replace("{" + "organizationId" + "}", localVarApiClient.escapeString(organizationId.toString())) + .replace("{" + "userId" + "}", localVarApiClient.escapeString(userId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -126,185 +123,138 @@ public okhttp3.Call addMemberToGroupCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addMemberToGroupValidateBeforeCall( - UUID organizationId, - String userId, - UpdateMemberPermissionsRequest updateMemberPermissionsRequest, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call addMemberToGroupValidateBeforeCall(UUID organizationId, String userId, UpdateMemberPermissionsRequest updateMemberPermissionsRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'organizationId' is set if (organizationId == null) { - throw new ApiException( - "Missing the required parameter 'organizationId' when calling" - + " addMemberToGroup(Async)"); + throw new ApiException("Missing the required parameter 'organizationId' when calling addMemberToGroup(Async)"); } // verify the required parameter 'userId' is set if (userId == null) { - throw new ApiException( - "Missing the required parameter 'userId' when calling addMemberToGroup(Async)"); + throw new ApiException("Missing the required parameter 'userId' when calling addMemberToGroup(Async)"); } // verify the required parameter 'updateMemberPermissionsRequest' is set if (updateMemberPermissionsRequest == null) { - throw new ApiException( - "Missing the required parameter 'updateMemberPermissionsRequest' when calling" - + " addMemberToGroup(Async)"); + throw new ApiException("Missing the required parameter 'updateMemberPermissionsRequest' when calling addMemberToGroup(Async)"); } - return addMemberToGroupCall( - organizationId, userId, updateMemberPermissionsRequest, _callback); + return addMemberToGroupCall(organizationId, userId, updateMemberPermissionsRequest, _callback); + } /** - * Update Member Permissions This endpoint updates the permissions of a Member identified by the - * `userId`. This endpoint can also be used to move a Member between Permission Groups - * within a Product. Only a single Permission Group can be set per Product. - * + * Update Member Permissions + * This endpoint updates the permissions of a Member identified by the `userId`. This endpoint can also be used to move a Member between Permission Groups within a Product. Only a single Permission Group can be set per Product. * @param organizationId The identifier of the Organization. (required) * @param userId The identifier of the Member. (required) - * @param updateMemberPermissionsRequest (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @param updateMemberPermissionsRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public void addMemberToGroup( - UUID organizationId, - String userId, - UpdateMemberPermissionsRequest updateMemberPermissionsRequest) - throws ApiException { + public void addMemberToGroup(UUID organizationId, String userId, UpdateMemberPermissionsRequest updateMemberPermissionsRequest) throws ApiException { addMemberToGroupWithHttpInfo(organizationId, userId, updateMemberPermissionsRequest); } /** - * Update Member Permissions This endpoint updates the permissions of a Member identified by the - * `userId`. This endpoint can also be used to move a Member between Permission Groups - * within a Product. Only a single Permission Group can be set per Product. - * + * Update Member Permissions + * This endpoint updates the permissions of a Member identified by the `userId`. This endpoint can also be used to move a Member between Permission Groups within a Product. Only a single Permission Group can be set per Product. * @param organizationId The identifier of the Organization. (required) * @param userId The identifier of the Member. (required) - * @param updateMemberPermissionsRequest (required) + * @param updateMemberPermissionsRequest (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse addMemberToGroupWithHttpInfo( - UUID organizationId, - String userId, - UpdateMemberPermissionsRequest updateMemberPermissionsRequest) - throws ApiException { - okhttp3.Call localVarCall = - addMemberToGroupValidateBeforeCall( - organizationId, userId, updateMemberPermissionsRequest, null); + public ApiResponse addMemberToGroupWithHttpInfo(UUID organizationId, String userId, UpdateMemberPermissionsRequest updateMemberPermissionsRequest) throws ApiException { + okhttp3.Call localVarCall = addMemberToGroupValidateBeforeCall(organizationId, userId, updateMemberPermissionsRequest, null); return localVarApiClient.execute(localVarCall); } /** - * Update Member Permissions (asynchronously) This endpoint updates the permissions of a Member - * identified by the `userId`. This endpoint can also be used to move a Member between - * Permission Groups within a Product. Only a single Permission Group can be set per Product. - * + * Update Member Permissions (asynchronously) + * This endpoint updates the permissions of a Member identified by the `userId`. This endpoint can also be used to move a Member between Permission Groups within a Product. Only a single Permission Group can be set per Product. * @param organizationId The identifier of the Organization. (required) * @param userId The identifier of the Member. (required) - * @param updateMemberPermissionsRequest (required) + * @param updateMemberPermissionsRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call addMemberToGroupAsync( - UUID organizationId, - String userId, - UpdateMemberPermissionsRequest updateMemberPermissionsRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - addMemberToGroupValidateBeforeCall( - organizationId, userId, updateMemberPermissionsRequest, _callback); + public okhttp3.Call addMemberToGroupAsync(UUID organizationId, String userId, UpdateMemberPermissionsRequest updateMemberPermissionsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = addMemberToGroupValidateBeforeCall(organizationId, userId, updateMemberPermissionsRequest, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for deleteInvitation - * * @param invitationId The identifier of the Invitation. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteInvitationCall(UUID invitationId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteInvitationCall(UUID invitationId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -313,11 +263,8 @@ public okhttp3.Call deleteInvitationCall(UUID invitationId, final ApiCallback _c Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/invitations/{invitationId}" - .replace( - "{" + "invitationId" + "}", - localVarApiClient.escapeString(invitationId.toString())); + String localVarPath = "/v1/invitations/{invitationId}" + .replace("{" + "invitationId" + "}", localVarApiClient.escapeString(invitationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -325,83 +272,67 @@ public okhttp3.Call deleteInvitationCall(UUID invitationId, final ApiCallback _c Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteInvitationValidateBeforeCall( - UUID invitationId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deleteInvitationValidateBeforeCall(UUID invitationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'invitationId' is set if (invitationId == null) { - throw new ApiException( - "Missing the required parameter 'invitationId' when calling" - + " deleteInvitation(Async)"); + throw new ApiException("Missing the required parameter 'invitationId' when calling deleteInvitation(Async)"); } return deleteInvitationCall(invitationId, _callback); + } /** - * Delete Invitation This endpoint removes an Invitation identified by the - * `invitationId` parameter. - * + * Delete Invitation + * This endpoint removes an Invitation identified by the `invitationId` parameter. * @param invitationId The identifier of the Invitation. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteInvitation(UUID invitationId) throws ApiException { deleteInvitationWithHttpInfo(invitationId); } /** - * Delete Invitation This endpoint removes an Invitation identified by the - * `invitationId` parameter. - * + * Delete Invitation + * This endpoint removes an Invitation identified by the `invitationId` parameter. * @param invitationId The identifier of the Invitation. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse deleteInvitationWithHttpInfo(UUID invitationId) throws ApiException { okhttp3.Call localVarCall = deleteInvitationValidateBeforeCall(invitationId, null); @@ -409,25 +340,22 @@ public ApiResponse deleteInvitationWithHttpInfo(UUID invitationId) throws } /** - * Delete Invitation (asynchronously) This endpoint removes an Invitation identified by the - * `invitationId` parameter. - * + * Delete Invitation (asynchronously) + * This endpoint removes an Invitation identified by the `invitationId` parameter. * @param invitationId The identifier of the Invitation. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteInvitationAsync(UUID invitationId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteInvitationAsync(UUID invitationId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteInvitationValidateBeforeCall(invitationId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -435,31 +363,29 @@ public okhttp3.Call deleteInvitationAsync(UUID invitationId, final ApiCallback - * Status Code Description Response Headers - * 204 When the delete was successful. - - * 400 Bad request. - - * 404 Not found. - - * 429 Too many requests. In case of the request rate exceeds the rate limits. - - * + + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteOrganizationMemberCall( - UUID organizationId, String userId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteOrganizationMemberCall(UUID organizationId, String userId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -468,14 +394,9 @@ public okhttp3.Call deleteOrganizationMemberCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/organizations/{organizationId}/members/{userId}" - .replace( - "{" + "organizationId" + "}", - localVarApiClient.escapeString(organizationId.toString())) - .replace( - "{" + "userId" + "}", - localVarApiClient.escapeString(userId.toString())); + String localVarPath = "/v1/organizations/{organizationId}/members/{userId}" + .replace("{" + "organizationId" + "}", localVarApiClient.escapeString(organizationId.toString())) + .replace("{" + "userId" + "}", localVarApiClient.escapeString(userId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -483,158 +404,128 @@ public okhttp3.Call deleteOrganizationMemberCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteOrganizationMemberValidateBeforeCall( - UUID organizationId, String userId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deleteOrganizationMemberValidateBeforeCall(UUID organizationId, String userId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'organizationId' is set if (organizationId == null) { - throw new ApiException( - "Missing the required parameter 'organizationId' when calling" - + " deleteOrganizationMember(Async)"); + throw new ApiException("Missing the required parameter 'organizationId' when calling deleteOrganizationMember(Async)"); } // verify the required parameter 'userId' is set if (userId == null) { - throw new ApiException( - "Missing the required parameter 'userId' when calling" - + " deleteOrganizationMember(Async)"); + throw new ApiException("Missing the required parameter 'userId' when calling deleteOrganizationMember(Async)"); } return deleteOrganizationMemberCall(organizationId, userId, _callback); + } /** - * Delete Member from Organization This endpoint removes a Member identified by the - * `userId` from the given Organization identified by the `organizationId` - * parameter. - * + * Delete Member from Organization + * This endpoint removes a Member identified by the `userId` from the given Organization identified by the `organizationId` parameter. * @param organizationId The identifier of the Organization. (required) * @param userId The identifier of the Member. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteOrganizationMember(UUID organizationId, String userId) throws ApiException { deleteOrganizationMemberWithHttpInfo(organizationId, userId); } /** - * Delete Member from Organization This endpoint removes a Member identified by the - * `userId` from the given Organization identified by the `organizationId` - * parameter. - * + * Delete Member from Organization + * This endpoint removes a Member identified by the `userId` from the given Organization identified by the `organizationId` parameter. * @param organizationId The identifier of the Organization. (required) * @param userId The identifier of the Member. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse deleteOrganizationMemberWithHttpInfo( - UUID organizationId, String userId) throws ApiException { - okhttp3.Call localVarCall = - deleteOrganizationMemberValidateBeforeCall(organizationId, userId, null); + public ApiResponse deleteOrganizationMemberWithHttpInfo(UUID organizationId, String userId) throws ApiException { + okhttp3.Call localVarCall = deleteOrganizationMemberValidateBeforeCall(organizationId, userId, null); return localVarApiClient.execute(localVarCall); } /** - * Delete Member from Organization (asynchronously) This endpoint removes a Member identified by - * the `userId` from the given Organization identified by the - * `organizationId` parameter. - * + * Delete Member from Organization (asynchronously) + * This endpoint removes a Member identified by the `userId` from the given Organization identified by the `organizationId` parameter. * @param organizationId The identifier of the Organization. (required) * @param userId The identifier of the Member. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteOrganizationMemberAsync( - UUID organizationId, String userId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteOrganizationMemberAsync(UUID organizationId, String userId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - deleteOrganizationMemberValidateBeforeCall(organizationId, userId, _callback); + okhttp3.Call localVarCall = deleteOrganizationMemberValidateBeforeCall(organizationId, userId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for deleteProductMember - * * @param productId The identifier of the Product. (required) * @param userId The identifier of the Member. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteProductMemberCall( - UUID productId, String userId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteProductMemberCall(UUID productId, String userId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -643,14 +534,9 @@ public okhttp3.Call deleteProductMemberCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/members/{userId}" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())) - .replace( - "{" + "userId" + "}", - localVarApiClient.escapeString(userId.toString())); + String localVarPath = "/v1/products/{productId}/members/{userId}" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())) + .replace("{" + "userId" + "}", localVarApiClient.escapeString(userId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -658,155 +544,129 @@ public okhttp3.Call deleteProductMemberCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteProductMemberValidateBeforeCall( - UUID productId, String userId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deleteProductMemberValidateBeforeCall(UUID productId, String userId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " deleteProductMember(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling deleteProductMember(Async)"); } // verify the required parameter 'userId' is set if (userId == null) { - throw new ApiException( - "Missing the required parameter 'userId' when calling" - + " deleteProductMember(Async)"); + throw new ApiException("Missing the required parameter 'userId' when calling deleteProductMember(Async)"); } return deleteProductMemberCall(productId, userId, _callback); + } /** - * Delete Member from Product This endpoint removes a Member identified by the - * `userId` from the given Product identified by the `productId` parameter. - * + * Delete Member from Product + * This endpoint removes a Member identified by the `userId` from the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @param userId The identifier of the Member. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteProductMember(UUID productId, String userId) throws ApiException { deleteProductMemberWithHttpInfo(productId, userId); } /** - * Delete Member from Product This endpoint removes a Member identified by the - * `userId` from the given Product identified by the `productId` parameter. - * + * Delete Member from Product + * This endpoint removes a Member identified by the `userId` from the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @param userId The identifier of the Member. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse deleteProductMemberWithHttpInfo(UUID productId, String userId) - throws ApiException { + public ApiResponse deleteProductMemberWithHttpInfo(UUID productId, String userId) throws ApiException { okhttp3.Call localVarCall = deleteProductMemberValidateBeforeCall(productId, userId, null); return localVarApiClient.execute(localVarCall); } /** - * Delete Member from Product (asynchronously) This endpoint removes a Member identified by the - * `userId` from the given Product identified by the `productId` parameter. - * + * Delete Member from Product (asynchronously) + * This endpoint removes a Member identified by the `userId` from the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @param userId The identifier of the Member. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteProductMemberAsync( - UUID productId, String userId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deleteProductMemberAsync(UUID productId, String userId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - deleteProductMemberValidateBeforeCall(productId, userId, _callback); + okhttp3.Call localVarCall = deleteProductMemberValidateBeforeCall(productId, userId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for getOrganizationMembers - * * @param organizationId The identifier of the Organization. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
- * + + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
* @deprecated */ @Deprecated - public okhttp3.Call getOrganizationMembersCall(UUID organizationId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getOrganizationMembersCall(UUID organizationId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -815,11 +675,8 @@ public okhttp3.Call getOrganizationMembersCall(UUID organizationId, final ApiCal Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/organizations/{organizationId}/members" - .replace( - "{" + "organizationId" + "}", - localVarApiClient.escapeString(organizationId.toString())); + String localVarPath = "/v1/organizations/{organizationId}/members" + .replace("{" + "organizationId" + "}", localVarApiClient.escapeString(organizationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -827,172 +684,131 @@ public okhttp3.Call getOrganizationMembersCall(UUID organizationId, final ApiCal Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @Deprecated @SuppressWarnings("rawtypes") - private okhttp3.Call getOrganizationMembersValidateBeforeCall( - UUID organizationId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getOrganizationMembersValidateBeforeCall(UUID organizationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'organizationId' is set if (organizationId == null) { - throw new ApiException( - "Missing the required parameter 'organizationId' when calling" - + " getOrganizationMembers(Async)"); + throw new ApiException("Missing the required parameter 'organizationId' when calling getOrganizationMembers(Async)"); } return getOrganizationMembersCall(organizationId, _callback); + } /** - * List Organization Members This endpoint returns the list of Members that belongs to the given - * Organization, identified by the `organizationId` parameter. The results may vary - * based on the access level of the user who calls the endpoint: - When it's called with - * Organization Admin privileges, the result will contain each member in the Organization. - - * When it's called without Organization Admin privileges, the result will contain each - * Organization Admin along with members of those products where the caller has `Team - * members and permission groups` (`canManageMembers`) permission. - * + * List Organization Members + * This endpoint returns the list of Members that belongs to the given Organization, identified by the `organizationId` parameter. The results may vary based on the access level of the user who calls the endpoint: - When it's called with Organization Admin privileges, the result will contain each member in the Organization. - When it's called without Organization Admin privileges, the result will contain each Organization Admin along with members of those products where the caller has `Team members and permission groups` (`canManageMembers`) permission. * @param organizationId The identifier of the Organization. (required) * @return List<UserModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
- * + + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
* @deprecated */ @Deprecated public List getOrganizationMembers(UUID organizationId) throws ApiException { - ApiResponse> localVarResp = - getOrganizationMembersWithHttpInfo(organizationId); + ApiResponse> localVarResp = getOrganizationMembersWithHttpInfo(organizationId); return localVarResp.getData(); } /** - * List Organization Members This endpoint returns the list of Members that belongs to the given - * Organization, identified by the `organizationId` parameter. The results may vary - * based on the access level of the user who calls the endpoint: - When it's called with - * Organization Admin privileges, the result will contain each member in the Organization. - - * When it's called without Organization Admin privileges, the result will contain each - * Organization Admin along with members of those products where the caller has `Team - * members and permission groups` (`canManageMembers`) permission. - * + * List Organization Members + * This endpoint returns the list of Members that belongs to the given Organization, identified by the `organizationId` parameter. The results may vary based on the access level of the user who calls the endpoint: - When it's called with Organization Admin privileges, the result will contain each member in the Organization. - When it's called without Organization Admin privileges, the result will contain each Organization Admin along with members of those products where the caller has `Team members and permission groups` (`canManageMembers`) permission. * @param organizationId The identifier of the Organization. (required) * @return ApiResponse<List<UserModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
- * + + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
* @deprecated */ @Deprecated - public ApiResponse> getOrganizationMembersWithHttpInfo(UUID organizationId) - throws ApiException { + public ApiResponse> getOrganizationMembersWithHttpInfo(UUID organizationId) throws ApiException { okhttp3.Call localVarCall = getOrganizationMembersValidateBeforeCall(organizationId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Organization Members (asynchronously) This endpoint returns the list of Members that - * belongs to the given Organization, identified by the `organizationId` parameter. - * The results may vary based on the access level of the user who calls the endpoint: - When - * it's called with Organization Admin privileges, the result will contain each member in - * the Organization. - When it's called without Organization Admin privileges, the result - * will contain each Organization Admin along with members of those products where the caller - * has `Team members and permission groups` (`canManageMembers`) permission. - * + * List Organization Members (asynchronously) + * This endpoint returns the list of Members that belongs to the given Organization, identified by the `organizationId` parameter. The results may vary based on the access level of the user who calls the endpoint: - When it's called with Organization Admin privileges, the result will contain each member in the Organization. - When it's called without Organization Admin privileges, the result will contain each Organization Admin along with members of those products where the caller has `Team members and permission groups` (`canManageMembers`) permission. * @param organizationId The identifier of the Organization. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
- * + + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
* @deprecated */ @Deprecated - public okhttp3.Call getOrganizationMembersAsync( - UUID organizationId, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getOrganizationMembersAsync(UUID organizationId, final ApiCallback> _callback) throws ApiException { - okhttp3.Call localVarCall = - getOrganizationMembersValidateBeforeCall(organizationId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + okhttp3.Call localVarCall = getOrganizationMembersValidateBeforeCall(organizationId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getOrganizationMembersV2 - * * @param organizationId The identifier of the Organization. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getOrganizationMembersV2Call( - UUID organizationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getOrganizationMembersV2Call(UUID organizationId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1001,11 +817,8 @@ public okhttp3.Call getOrganizationMembersV2Call( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v2/organizations/{organizationId}/members" - .replace( - "{" + "organizationId" + "}", - localVarApiClient.escapeString(organizationId.toString())); + String localVarPath = "/v2/organizations/{organizationId}/members" + .replace("{" + "organizationId" + "}", localVarApiClient.escapeString(organizationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1013,165 +826,124 @@ public okhttp3.Call getOrganizationMembersV2Call( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getOrganizationMembersV2ValidateBeforeCall( - UUID organizationId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getOrganizationMembersV2ValidateBeforeCall(UUID organizationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'organizationId' is set if (organizationId == null) { - throw new ApiException( - "Missing the required parameter 'organizationId' when calling" - + " getOrganizationMembersV2(Async)"); + throw new ApiException("Missing the required parameter 'organizationId' when calling getOrganizationMembersV2(Async)"); } return getOrganizationMembersV2Call(organizationId, _callback); + } /** - * List Organization Members This endpoint returns the list of Members that belongs to the given - * Organization, identified by the `organizationId` parameter. The results may vary - * based on the access level of the user who calls the endpoint: - When it's called with - * Organization Admin privileges, the result will contain each member in the Organization. - - * When it's called without Organization Admin privileges, the result will contain each - * Organization Admin along with members of those products where the caller has `Team - * members and permission groups` (`canManageMembers`) permission. - * + * List Organization Members + * This endpoint returns the list of Members that belongs to the given Organization, identified by the `organizationId` parameter. The results may vary based on the access level of the user who calls the endpoint: - When it's called with Organization Admin privileges, the result will contain each member in the Organization. - When it's called without Organization Admin privileges, the result will contain each Organization Admin along with members of those products where the caller has `Team members and permission groups` (`canManageMembers`) permission. * @param organizationId The identifier of the Organization. (required) * @return OrganizationMembersModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public OrganizationMembersModel getOrganizationMembersV2(UUID organizationId) - throws ApiException { - ApiResponse localVarResp = - getOrganizationMembersV2WithHttpInfo(organizationId); + public OrganizationMembersModel getOrganizationMembersV2(UUID organizationId) throws ApiException { + ApiResponse localVarResp = getOrganizationMembersV2WithHttpInfo(organizationId); return localVarResp.getData(); } /** - * List Organization Members This endpoint returns the list of Members that belongs to the given - * Organization, identified by the `organizationId` parameter. The results may vary - * based on the access level of the user who calls the endpoint: - When it's called with - * Organization Admin privileges, the result will contain each member in the Organization. - - * When it's called without Organization Admin privileges, the result will contain each - * Organization Admin along with members of those products where the caller has `Team - * members and permission groups` (`canManageMembers`) permission. - * + * List Organization Members + * This endpoint returns the list of Members that belongs to the given Organization, identified by the `organizationId` parameter. The results may vary based on the access level of the user who calls the endpoint: - When it's called with Organization Admin privileges, the result will contain each member in the Organization. - When it's called without Organization Admin privileges, the result will contain each Organization Admin along with members of those products where the caller has `Team members and permission groups` (`canManageMembers`) permission. * @param organizationId The identifier of the Organization. (required) * @return ApiResponse<OrganizationMembersModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getOrganizationMembersV2WithHttpInfo( - UUID organizationId) throws ApiException { - okhttp3.Call localVarCall = - getOrganizationMembersV2ValidateBeforeCall(organizationId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse getOrganizationMembersV2WithHttpInfo(UUID organizationId) throws ApiException { + okhttp3.Call localVarCall = getOrganizationMembersV2ValidateBeforeCall(organizationId, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Organization Members (asynchronously) This endpoint returns the list of Members that - * belongs to the given Organization, identified by the `organizationId` parameter. - * The results may vary based on the access level of the user who calls the endpoint: - When - * it's called with Organization Admin privileges, the result will contain each member in - * the Organization. - When it's called without Organization Admin privileges, the result - * will contain each Organization Admin along with members of those products where the caller - * has `Team members and permission groups` (`canManageMembers`) permission. - * + * List Organization Members (asynchronously) + * This endpoint returns the list of Members that belongs to the given Organization, identified by the `organizationId` parameter. The results may vary based on the access level of the user who calls the endpoint: - When it's called with Organization Admin privileges, the result will contain each member in the Organization. - When it's called without Organization Admin privileges, the result will contain each Organization Admin along with members of those products where the caller has `Team members and permission groups` (`canManageMembers`) permission. * @param organizationId The identifier of the Organization. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getOrganizationMembersV2Async( - UUID organizationId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getOrganizationMembersV2Async(UUID organizationId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - getOrganizationMembersV2ValidateBeforeCall(organizationId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = getOrganizationMembersV2ValidateBeforeCall(organizationId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getPendingInvitations - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getPendingInvitationsCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getPendingInvitationsCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1180,11 +952,8 @@ public okhttp3.Call getPendingInvitationsCall(UUID productId, final ApiCallback Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/invitations" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/invitations" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1192,148 +961,124 @@ public okhttp3.Call getPendingInvitationsCall(UUID productId, final ApiCallback Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getPendingInvitationsValidateBeforeCall( - UUID productId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getPendingInvitationsValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " getPendingInvitations(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getPendingInvitations(Async)"); } return getPendingInvitationsCall(productId, _callback); + } /** - * List Pending Invitations in Product This endpoint returns the list of pending invitations - * within the given Product identified by the `productId` parameter. - * + * List Pending Invitations in Product + * This endpoint returns the list of pending invitations within the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @return List<InvitationModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getPendingInvitations(UUID productId) throws ApiException { - ApiResponse> localVarResp = - getPendingInvitationsWithHttpInfo(productId); + ApiResponse> localVarResp = getPendingInvitationsWithHttpInfo(productId); return localVarResp.getData(); } /** - * List Pending Invitations in Product This endpoint returns the list of pending invitations - * within the given Product identified by the `productId` parameter. - * + * List Pending Invitations in Product + * This endpoint returns the list of pending invitations within the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @return ApiResponse<List<InvitationModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getPendingInvitationsWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse> getPendingInvitationsWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getPendingInvitationsValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Pending Invitations in Product (asynchronously) This endpoint returns the list of - * pending invitations within the given Product identified by the `productId` - * parameter. - * + * List Pending Invitations in Product (asynchronously) + * This endpoint returns the list of pending invitations within the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getPendingInvitationsAsync( - UUID productId, final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call getPendingInvitationsAsync(UUID productId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getPendingInvitationsValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getPendingInvitationsOrg - * * @param organizationId The identifier of the Organization. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getPendingInvitationsOrgCall( - UUID organizationId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getPendingInvitationsOrgCall(UUID organizationId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1342,11 +1087,8 @@ public okhttp3.Call getPendingInvitationsOrgCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/organizations/{organizationId}/invitations" - .replace( - "{" + "organizationId" + "}", - localVarApiClient.escapeString(organizationId.toString())); + String localVarPath = "/v1/organizations/{organizationId}/invitations" + .replace("{" + "organizationId" + "}", localVarApiClient.escapeString(organizationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1354,153 +1096,124 @@ public okhttp3.Call getPendingInvitationsOrgCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getPendingInvitationsOrgValidateBeforeCall( - UUID organizationId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getPendingInvitationsOrgValidateBeforeCall(UUID organizationId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'organizationId' is set if (organizationId == null) { - throw new ApiException( - "Missing the required parameter 'organizationId' when calling" - + " getPendingInvitationsOrg(Async)"); + throw new ApiException("Missing the required parameter 'organizationId' when calling getPendingInvitationsOrg(Async)"); } return getPendingInvitationsOrgCall(organizationId, _callback); + } /** - * List Pending Invitations in Organization This endpoint returns the list of pending - * invitations within the given Organization identified by the `organizationId` - * parameter. - * + * List Pending Invitations in Organization + * This endpoint returns the list of pending invitations within the given Organization identified by the `organizationId` parameter. * @param organizationId The identifier of the Organization. (required) * @return List<OrganizationInvitationModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public List getPendingInvitationsOrg(UUID organizationId) - throws ApiException { - ApiResponse> localVarResp = - getPendingInvitationsOrgWithHttpInfo(organizationId); + public List getPendingInvitationsOrg(UUID organizationId) throws ApiException { + ApiResponse> localVarResp = getPendingInvitationsOrgWithHttpInfo(organizationId); return localVarResp.getData(); } /** - * List Pending Invitations in Organization This endpoint returns the list of pending - * invitations within the given Organization identified by the `organizationId` - * parameter. - * + * List Pending Invitations in Organization + * This endpoint returns the list of pending invitations within the given Organization identified by the `organizationId` parameter. * @param organizationId The identifier of the Organization. (required) * @return ApiResponse<List<OrganizationInvitationModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getPendingInvitationsOrgWithHttpInfo( - UUID organizationId) throws ApiException { - okhttp3.Call localVarCall = - getPendingInvitationsOrgValidateBeforeCall(organizationId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + public ApiResponse> getPendingInvitationsOrgWithHttpInfo(UUID organizationId) throws ApiException { + okhttp3.Call localVarCall = getPendingInvitationsOrgValidateBeforeCall(organizationId, null); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Pending Invitations in Organization (asynchronously) This endpoint returns the list of - * pending invitations within the given Organization identified by the - * `organizationId` parameter. - * + * List Pending Invitations in Organization (asynchronously) + * This endpoint returns the list of pending invitations within the given Organization identified by the `organizationId` parameter. * @param organizationId The identifier of the Organization. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getPendingInvitationsOrgAsync( - UUID organizationId, final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call getPendingInvitationsOrgAsync(UUID organizationId, final ApiCallback> _callback) throws ApiException { - okhttp3.Call localVarCall = - getPendingInvitationsOrgValidateBeforeCall(organizationId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + okhttp3.Call localVarCall = getPendingInvitationsOrgValidateBeforeCall(organizationId, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getProductMembers - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getProductMembersCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getProductMembersCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1509,11 +1222,8 @@ public okhttp3.Call getProductMembersCall(UUID productId, final ApiCallback _cal Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/members" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/members" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1521,63 +1231,50 @@ public okhttp3.Call getProductMembersCall(UUID productId, final ApiCallback _cal Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getProductMembersValidateBeforeCall( - UUID productId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getProductMembersValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " getProductMembers(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getProductMembers(Async)"); } return getProductMembersCall(productId, _callback); + } /** - * List Product Members This endpoint returns the list of Members that belongs to the given - * Product, identified by the `productId` parameter. - * + * List Product Members + * This endpoint returns the list of Members that belongs to the given Product, identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @return List<MemberModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getProductMembers(UUID productId) throws ApiException { ApiResponse> localVarResp = getProductMembersWithHttpInfo(productId); @@ -1585,83 +1282,74 @@ public List getProductMembers(UUID productId) throws ApiException { } /** - * List Product Members This endpoint returns the list of Members that belongs to the given - * Product, identified by the `productId` parameter. - * + * List Product Members + * This endpoint returns the list of Members that belongs to the given Product, identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @return ApiResponse<List<MemberModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getProductMembersWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse> getProductMembersWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getProductMembersValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Product Members (asynchronously) This endpoint returns the list of Members that belongs - * to the given Product, identified by the `productId` parameter. - * + * List Product Members (asynchronously) + * This endpoint returns the list of Members that belongs to the given Product, identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getProductMembersAsync( - UUID productId, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getProductMembersAsync(UUID productId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getProductMembersValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for inviteMember - * * @param productId The identifier of the Product. (required) - * @param inviteMembersRequest (required) + * @param inviteMembersRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the invite was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the invite was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call inviteMemberCall( - UUID productId, InviteMembersRequest inviteMembersRequest, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call inviteMemberCall(UUID productId, InviteMembersRequest inviteMembersRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1670,11 +1358,8 @@ public okhttp3.Call inviteMemberCall( Object localVarPostBody = inviteMembersRequest; // create path and map variables - String localVarPath = - "/v1/products/{productId}/members/invite" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/members/invite" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1682,130 +1367,103 @@ public okhttp3.Call inviteMemberCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call inviteMemberValidateBeforeCall( - UUID productId, InviteMembersRequest inviteMembersRequest, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call inviteMemberValidateBeforeCall(UUID productId, InviteMembersRequest inviteMembersRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling inviteMember(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling inviteMember(Async)"); } // verify the required parameter 'inviteMembersRequest' is set if (inviteMembersRequest == null) { - throw new ApiException( - "Missing the required parameter 'inviteMembersRequest' when calling" - + " inviteMember(Async)"); + throw new ApiException("Missing the required parameter 'inviteMembersRequest' when calling inviteMember(Async)"); } return inviteMemberCall(productId, inviteMembersRequest, _callback); + } /** - * Invite Member This endpoint invites a Member into the given Product identified by the - * `productId` parameter. - * + * Invite Member + * This endpoint invites a Member into the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param inviteMembersRequest (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @param inviteMembersRequest (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the invite was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the invite was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public void inviteMember(UUID productId, InviteMembersRequest inviteMembersRequest) - throws ApiException { + public void inviteMember(UUID productId, InviteMembersRequest inviteMembersRequest) throws ApiException { inviteMemberWithHttpInfo(productId, inviteMembersRequest); } /** - * Invite Member This endpoint invites a Member into the given Product identified by the - * `productId` parameter. - * + * Invite Member + * This endpoint invites a Member into the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param inviteMembersRequest (required) + * @param inviteMembersRequest (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the invite was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the invite was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse inviteMemberWithHttpInfo( - UUID productId, InviteMembersRequest inviteMembersRequest) throws ApiException { - okhttp3.Call localVarCall = - inviteMemberValidateBeforeCall(productId, inviteMembersRequest, null); + public ApiResponse inviteMemberWithHttpInfo(UUID productId, InviteMembersRequest inviteMembersRequest) throws ApiException { + okhttp3.Call localVarCall = inviteMemberValidateBeforeCall(productId, inviteMembersRequest, null); return localVarApiClient.execute(localVarCall); } /** - * Invite Member (asynchronously) This endpoint invites a Member into the given Product - * identified by the `productId` parameter. - * + * Invite Member (asynchronously) + * This endpoint invites a Member into the given Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param inviteMembersRequest (required) + * @param inviteMembersRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the invite was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the invite was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call inviteMemberAsync( - UUID productId, - InviteMembersRequest inviteMembersRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - inviteMemberValidateBeforeCall(productId, inviteMembersRequest, _callback); + public okhttp3.Call inviteMemberAsync(UUID productId, InviteMembersRequest inviteMembersRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = inviteMemberValidateBeforeCall(productId, inviteMembersRequest, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/OrganizationsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/OrganizationsApi.java index 0f8b8de..2db33b1 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/OrganizationsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/OrganizationsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,8 +19,16 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; -import com.configcat.publicapi.java.client.model.OrganizationModel; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.configcat.publicapi.java.client.model.OrganizationModel; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; @@ -66,26 +74,25 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getOrganizations - * * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public okhttp3.Call getOrganizationsCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -102,53 +109,42 @@ public okhttp3.Call getOrganizationsCall(final ApiCallback _callback) throws Api Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getOrganizationsValidateBeforeCall(final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getOrganizationsValidateBeforeCall(final ApiCallback _callback) throws ApiException { return getOrganizationsCall(_callback); + } /** - * List Organizations This endpoint returns the list of the Organizations that belongs to the - * user. - * + * List Organizations + * This endpoint returns the list of the Organizations that belongs to the user. * @return List<OrganizationModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getOrganizations() throws ApiException { ApiResponse> localVarResp = getOrganizationsWithHttpInfo(); @@ -156,45 +152,40 @@ public List getOrganizations() throws ApiException { } /** - * List Organizations This endpoint returns the list of the Organizations that belongs to the - * user. - * + * List Organizations + * This endpoint returns the list of the Organizations that belongs to the user. * @return ApiResponse<List<OrganizationModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse> getOrganizationsWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getOrganizationsValidateBeforeCall(null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Organizations (asynchronously) This endpoint returns the list of the Organizations that - * belongs to the user. - * + * List Organizations (asynchronously) + * This endpoint returns the list of the Organizations that belongs to the user. * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getOrganizationsAsync(final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call getOrganizationsAsync(final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getOrganizationsValidateBeforeCall(_callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/PermissionGroupsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/PermissionGroupsApi.java index 1e12a03..ac65669 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/PermissionGroupsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/PermissionGroupsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,16 +19,24 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.CreatePermissionGroupRequest; import com.configcat.publicapi.java.client.model.PermissionGroupModel; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdatePermissionGroupRequest; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class PermissionGroupsApi { private ApiClient localVarApiClient; @@ -69,34 +77,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createPermissionGroup - * * @param productId The identifier of the Product. (required) - * @param createPermissionGroupRequest (required) + * @param createPermissionGroupRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createPermissionGroupCall( - UUID productId, - CreatePermissionGroupRequest createPermissionGroupRequest, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createPermissionGroupCall(UUID productId, CreatePermissionGroupRequest createPermissionGroupRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -105,11 +108,8 @@ public okhttp3.Call createPermissionGroupCall( Object localVarPostBody = createPermissionGroupRequest; // create path and map variables - String localVarPath = - "/v1/products/{productId}/permissions" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/permissions" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -117,174 +117,135 @@ public okhttp3.Call createPermissionGroupCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createPermissionGroupValidateBeforeCall( - UUID productId, - CreatePermissionGroupRequest createPermissionGroupRequest, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createPermissionGroupValidateBeforeCall(UUID productId, CreatePermissionGroupRequest createPermissionGroupRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " createPermissionGroup(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling createPermissionGroup(Async)"); } // verify the required parameter 'createPermissionGroupRequest' is set if (createPermissionGroupRequest == null) { - throw new ApiException( - "Missing the required parameter 'createPermissionGroupRequest' when calling" - + " createPermissionGroup(Async)"); + throw new ApiException("Missing the required parameter 'createPermissionGroupRequest' when calling createPermissionGroup(Async)"); } return createPermissionGroupCall(productId, createPermissionGroupRequest, _callback); + } /** - * Create Permission Group This endpoint creates a new Permission Group in a specified Product - * identified by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Permission Group + * This endpoint creates a new Permission Group in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createPermissionGroupRequest (required) + * @param createPermissionGroupRequest (required) * @return PermissionGroupModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public PermissionGroupModel createPermissionGroup( - UUID productId, CreatePermissionGroupRequest createPermissionGroupRequest) - throws ApiException { - ApiResponse localVarResp = - createPermissionGroupWithHttpInfo(productId, createPermissionGroupRequest); + public PermissionGroupModel createPermissionGroup(UUID productId, CreatePermissionGroupRequest createPermissionGroupRequest) throws ApiException { + ApiResponse localVarResp = createPermissionGroupWithHttpInfo(productId, createPermissionGroupRequest); return localVarResp.getData(); } /** - * Create Permission Group This endpoint creates a new Permission Group in a specified Product - * identified by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Permission Group + * This endpoint creates a new Permission Group in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createPermissionGroupRequest (required) + * @param createPermissionGroupRequest (required) * @return ApiResponse<PermissionGroupModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createPermissionGroupWithHttpInfo( - UUID productId, CreatePermissionGroupRequest createPermissionGroupRequest) - throws ApiException { - okhttp3.Call localVarCall = - createPermissionGroupValidateBeforeCall( - productId, createPermissionGroupRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse createPermissionGroupWithHttpInfo(UUID productId, CreatePermissionGroupRequest createPermissionGroupRequest) throws ApiException { + okhttp3.Call localVarCall = createPermissionGroupValidateBeforeCall(productId, createPermissionGroupRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Permission Group (asynchronously) This endpoint creates a new Permission Group in a - * specified Product identified by the `productId` parameter, which can be obtained - * from the [List Products](#operation/get-products) endpoint. - * + * Create Permission Group (asynchronously) + * This endpoint creates a new Permission Group in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createPermissionGroupRequest (required) + * @param createPermissionGroupRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createPermissionGroupAsync( - UUID productId, - CreatePermissionGroupRequest createPermissionGroupRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createPermissionGroupValidateBeforeCall( - productId, createPermissionGroupRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call createPermissionGroupAsync(UUID productId, CreatePermissionGroupRequest createPermissionGroupRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createPermissionGroupValidateBeforeCall(productId, createPermissionGroupRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deletePermissionGroup - * * @param permissionGroupId The identifier of the Permission Group. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deletePermissionGroupCall( - Long permissionGroupId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deletePermissionGroupCall(Long permissionGroupId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -293,11 +254,8 @@ public okhttp3.Call deletePermissionGroupCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/permissions/{permissionGroupId}" - .replace( - "{" + "permissionGroupId" + "}", - localVarApiClient.escapeString(permissionGroupId.toString())); + String localVarPath = "/v1/permissions/{permissionGroupId}" + .replace("{" + "permissionGroupId" + "}", localVarApiClient.escapeString(permissionGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -305,143 +263,119 @@ public okhttp3.Call deletePermissionGroupCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deletePermissionGroupValidateBeforeCall( - Long permissionGroupId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deletePermissionGroupValidateBeforeCall(Long permissionGroupId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'permissionGroupId' is set if (permissionGroupId == null) { - throw new ApiException( - "Missing the required parameter 'permissionGroupId' when calling" - + " deletePermissionGroup(Async)"); + throw new ApiException("Missing the required parameter 'permissionGroupId' when calling deletePermissionGroup(Async)"); } return deletePermissionGroupCall(permissionGroupId, _callback); + } /** - * Delete Permission Group This endpoint removes a Permission Group identified by the - * `permissionGroupId` parameter. - * + * Delete Permission Group + * This endpoint removes a Permission Group identified by the `permissionGroupId` parameter. * @param permissionGroupId The identifier of the Permission Group. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deletePermissionGroup(Long permissionGroupId) throws ApiException { deletePermissionGroupWithHttpInfo(permissionGroupId); } /** - * Delete Permission Group This endpoint removes a Permission Group identified by the - * `permissionGroupId` parameter. - * + * Delete Permission Group + * This endpoint removes a Permission Group identified by the `permissionGroupId` parameter. * @param permissionGroupId The identifier of the Permission Group. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse deletePermissionGroupWithHttpInfo(Long permissionGroupId) - throws ApiException { - okhttp3.Call localVarCall = - deletePermissionGroupValidateBeforeCall(permissionGroupId, null); + public ApiResponse deletePermissionGroupWithHttpInfo(Long permissionGroupId) throws ApiException { + okhttp3.Call localVarCall = deletePermissionGroupValidateBeforeCall(permissionGroupId, null); return localVarApiClient.execute(localVarCall); } /** - * Delete Permission Group (asynchronously) This endpoint removes a Permission Group identified - * by the `permissionGroupId` parameter. - * + * Delete Permission Group (asynchronously) + * This endpoint removes a Permission Group identified by the `permissionGroupId` parameter. * @param permissionGroupId The identifier of the Permission Group. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deletePermissionGroupAsync( - Long permissionGroupId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call deletePermissionGroupAsync(Long permissionGroupId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - deletePermissionGroupValidateBeforeCall(permissionGroupId, _callback); + okhttp3.Call localVarCall = deletePermissionGroupValidateBeforeCall(permissionGroupId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for getPermissionGroup - * * @param permissionGroupId The identifier of the Permission Group. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the permission group data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the permission group data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getPermissionGroupCall(Long permissionGroupId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getPermissionGroupCall(Long permissionGroupId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -450,11 +384,8 @@ public okhttp3.Call getPermissionGroupCall(Long permissionGroupId, final ApiCall Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/permissions/{permissionGroupId}" - .replace( - "{" + "permissionGroupId" + "}", - localVarApiClient.escapeString(permissionGroupId.toString())); + String localVarPath = "/v1/permissions/{permissionGroupId}" + .replace("{" + "permissionGroupId" + "}", localVarApiClient.escapeString(permissionGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -462,148 +393,124 @@ public okhttp3.Call getPermissionGroupCall(Long permissionGroupId, final ApiCall Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getPermissionGroupValidateBeforeCall( - Long permissionGroupId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getPermissionGroupValidateBeforeCall(Long permissionGroupId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'permissionGroupId' is set if (permissionGroupId == null) { - throw new ApiException( - "Missing the required parameter 'permissionGroupId' when calling" - + " getPermissionGroup(Async)"); + throw new ApiException("Missing the required parameter 'permissionGroupId' when calling getPermissionGroup(Async)"); } return getPermissionGroupCall(permissionGroupId, _callback); + } /** - * Get Permission Group This endpoint returns the metadata of a Permission Group identified by - * the `permissionGroupId`. - * + * Get Permission Group + * This endpoint returns the metadata of a Permission Group identified by the `permissionGroupId`. * @param permissionGroupId The identifier of the Permission Group. (required) * @return PermissionGroupModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the permission group data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the permission group data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public PermissionGroupModel getPermissionGroup(Long permissionGroupId) throws ApiException { - ApiResponse localVarResp = - getPermissionGroupWithHttpInfo(permissionGroupId); + ApiResponse localVarResp = getPermissionGroupWithHttpInfo(permissionGroupId); return localVarResp.getData(); } /** - * Get Permission Group This endpoint returns the metadata of a Permission Group identified by - * the `permissionGroupId`. - * + * Get Permission Group + * This endpoint returns the metadata of a Permission Group identified by the `permissionGroupId`. * @param permissionGroupId The identifier of the Permission Group. (required) * @return ApiResponse<PermissionGroupModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the permission group data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the permission group data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getPermissionGroupWithHttpInfo(Long permissionGroupId) - throws ApiException { + public ApiResponse getPermissionGroupWithHttpInfo(Long permissionGroupId) throws ApiException { okhttp3.Call localVarCall = getPermissionGroupValidateBeforeCall(permissionGroupId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Permission Group (asynchronously) This endpoint returns the metadata of a Permission - * Group identified by the `permissionGroupId`. - * + * Get Permission Group (asynchronously) + * This endpoint returns the metadata of a Permission Group identified by the `permissionGroupId`. * @param permissionGroupId The identifier of the Permission Group. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the permission group data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the permission group data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getPermissionGroupAsync( - Long permissionGroupId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getPermissionGroupAsync(Long permissionGroupId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - getPermissionGroupValidateBeforeCall(permissionGroupId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = getPermissionGroupValidateBeforeCall(permissionGroupId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getPermissionGroups - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getPermissionGroupsCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getPermissionGroupsCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -612,11 +519,8 @@ public okhttp3.Call getPermissionGroupsCall(UUID productId, final ApiCallback _c Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/permissions" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/permissions" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -624,154 +528,125 @@ public okhttp3.Call getPermissionGroupsCall(UUID productId, final ApiCallback _c Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getPermissionGroupsValidateBeforeCall( - UUID productId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getPermissionGroupsValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " getPermissionGroups(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getPermissionGroups(Async)"); } return getPermissionGroupsCall(productId, _callback); + } /** - * List Permission Groups This endpoint returns the list of the Permission Groups that belongs - * to the given Product identified by the `productId` parameter, which can be obtained - * from the [List Products](#operation/get-products) endpoint. - * + * List Permission Groups + * This endpoint returns the list of the Permission Groups that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return List<PermissionGroupModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getPermissionGroups(UUID productId) throws ApiException { - ApiResponse> localVarResp = - getPermissionGroupsWithHttpInfo(productId); + ApiResponse> localVarResp = getPermissionGroupsWithHttpInfo(productId); return localVarResp.getData(); } /** - * List Permission Groups This endpoint returns the list of the Permission Groups that belongs - * to the given Product identified by the `productId` parameter, which can be obtained - * from the [List Products](#operation/get-products) endpoint. - * + * List Permission Groups + * This endpoint returns the list of the Permission Groups that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return ApiResponse<List<PermissionGroupModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getPermissionGroupsWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse> getPermissionGroupsWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getPermissionGroupsValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Permission Groups (asynchronously) This endpoint returns the list of the Permission - * Groups that belongs to the given Product identified by the `productId` parameter, - * which can be obtained from the [List Products](#operation/get-products) endpoint. - * + * List Permission Groups (asynchronously) + * This endpoint returns the list of the Permission Groups that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getPermissionGroupsAsync( - UUID productId, final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call getPermissionGroupsAsync(UUID productId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getPermissionGroupsValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updatePermissionGroup - * * @param permissionGroupId The identifier of the Permission Group. (required) - * @param updatePermissionGroupRequest (required) + * @param updatePermissionGroupRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updatePermissionGroupCall( - Long permissionGroupId, - UpdatePermissionGroupRequest updatePermissionGroupRequest, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updatePermissionGroupCall(Long permissionGroupId, UpdatePermissionGroupRequest updatePermissionGroupRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -780,11 +655,8 @@ public okhttp3.Call updatePermissionGroupCall( Object localVarPostBody = updatePermissionGroupRequest; // create path and map variables - String localVarPath = - "/v1/permissions/{permissionGroupId}" - .replace( - "{" + "permissionGroupId" + "}", - localVarApiClient.escapeString(permissionGroupId.toString())); + String localVarPath = "/v1/permissions/{permissionGroupId}" + .replace("{" + "permissionGroupId" + "}", localVarApiClient.escapeString(permissionGroupId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -792,143 +664,108 @@ public okhttp3.Call updatePermissionGroupCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updatePermissionGroupValidateBeforeCall( - Long permissionGroupId, - UpdatePermissionGroupRequest updatePermissionGroupRequest, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updatePermissionGroupValidateBeforeCall(Long permissionGroupId, UpdatePermissionGroupRequest updatePermissionGroupRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'permissionGroupId' is set if (permissionGroupId == null) { - throw new ApiException( - "Missing the required parameter 'permissionGroupId' when calling" - + " updatePermissionGroup(Async)"); + throw new ApiException("Missing the required parameter 'permissionGroupId' when calling updatePermissionGroup(Async)"); } // verify the required parameter 'updatePermissionGroupRequest' is set if (updatePermissionGroupRequest == null) { - throw new ApiException( - "Missing the required parameter 'updatePermissionGroupRequest' when calling" - + " updatePermissionGroup(Async)"); + throw new ApiException("Missing the required parameter 'updatePermissionGroupRequest' when calling updatePermissionGroup(Async)"); } - return updatePermissionGroupCall( - permissionGroupId, updatePermissionGroupRequest, _callback); + return updatePermissionGroupCall(permissionGroupId, updatePermissionGroupRequest, _callback); + } /** - * Update Permission Group This endpoint updates a Permission Group identified by the - * `permissionGroupId` parameter. - * + * Update Permission Group + * This endpoint updates a Permission Group identified by the `permissionGroupId` parameter. * @param permissionGroupId The identifier of the Permission Group. (required) - * @param updatePermissionGroupRequest (required) + * @param updatePermissionGroupRequest (required) * @return PermissionGroupModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public PermissionGroupModel updatePermissionGroup( - Long permissionGroupId, UpdatePermissionGroupRequest updatePermissionGroupRequest) - throws ApiException { - ApiResponse localVarResp = - updatePermissionGroupWithHttpInfo(permissionGroupId, updatePermissionGroupRequest); + public PermissionGroupModel updatePermissionGroup(Long permissionGroupId, UpdatePermissionGroupRequest updatePermissionGroupRequest) throws ApiException { + ApiResponse localVarResp = updatePermissionGroupWithHttpInfo(permissionGroupId, updatePermissionGroupRequest); return localVarResp.getData(); } /** - * Update Permission Group This endpoint updates a Permission Group identified by the - * `permissionGroupId` parameter. - * + * Update Permission Group + * This endpoint updates a Permission Group identified by the `permissionGroupId` parameter. * @param permissionGroupId The identifier of the Permission Group. (required) - * @param updatePermissionGroupRequest (required) + * @param updatePermissionGroupRequest (required) * @return ApiResponse<PermissionGroupModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updatePermissionGroupWithHttpInfo( - Long permissionGroupId, UpdatePermissionGroupRequest updatePermissionGroupRequest) - throws ApiException { - okhttp3.Call localVarCall = - updatePermissionGroupValidateBeforeCall( - permissionGroupId, updatePermissionGroupRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updatePermissionGroupWithHttpInfo(Long permissionGroupId, UpdatePermissionGroupRequest updatePermissionGroupRequest) throws ApiException { + okhttp3.Call localVarCall = updatePermissionGroupValidateBeforeCall(permissionGroupId, updatePermissionGroupRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Permission Group (asynchronously) This endpoint updates a Permission Group identified - * by the `permissionGroupId` parameter. - * + * Update Permission Group (asynchronously) + * This endpoint updates a Permission Group identified by the `permissionGroupId` parameter. * @param permissionGroupId The identifier of the Permission Group. (required) - * @param updatePermissionGroupRequest (required) + * @param updatePermissionGroupRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updatePermissionGroupAsync( - Long permissionGroupId, - UpdatePermissionGroupRequest updatePermissionGroupRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updatePermissionGroupValidateBeforeCall( - permissionGroupId, updatePermissionGroupRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updatePermissionGroupAsync(Long permissionGroupId, UpdatePermissionGroupRequest updatePermissionGroupRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updatePermissionGroupValidateBeforeCall(permissionGroupId, updatePermissionGroupRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/ProductsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/ProductsApi.java index f47d04e..d48b4a6 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/ProductsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/ProductsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,18 +19,26 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.CreateProductRequest; import com.configcat.publicapi.java.client.model.PreferencesModel; import com.configcat.publicapi.java.client.model.ProductModel; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdatePreferencesRequest; import com.configcat.publicapi.java.client.model.UpdateProductRequest; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class ProductsApi { private ApiClient localVarApiClient; @@ -71,34 +79,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createProduct - * * @param organizationId The identifier of the Organization. (required) - * @param createProductRequest (required) + * @param createProductRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createProductCall( - UUID organizationId, - CreateProductRequest createProductRequest, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createProductCall(UUID organizationId, CreateProductRequest createProductRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -107,11 +110,8 @@ public okhttp3.Call createProductCall( Object localVarPostBody = createProductRequest; // create path and map variables - String localVarPath = - "/v1/organizations/{organizationId}/products" - .replace( - "{" + "organizationId" + "}", - localVarApiClient.escapeString(organizationId.toString())); + String localVarPath = "/v1/organizations/{organizationId}/products" + .replace("{" + "organizationId" + "}", localVarApiClient.escapeString(organizationId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -119,170 +119,135 @@ public okhttp3.Call createProductCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createProductValidateBeforeCall( - UUID organizationId, - CreateProductRequest createProductRequest, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createProductValidateBeforeCall(UUID organizationId, CreateProductRequest createProductRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'organizationId' is set if (organizationId == null) { - throw new ApiException( - "Missing the required parameter 'organizationId' when calling" - + " createProduct(Async)"); + throw new ApiException("Missing the required parameter 'organizationId' when calling createProduct(Async)"); } // verify the required parameter 'createProductRequest' is set if (createProductRequest == null) { - throw new ApiException( - "Missing the required parameter 'createProductRequest' when calling" - + " createProduct(Async)"); + throw new ApiException("Missing the required parameter 'createProductRequest' when calling createProduct(Async)"); } return createProductCall(organizationId, createProductRequest, _callback); + } /** - * Create Product This endpoint creates a new Product in a specified Organization identified by - * the `organizationId` parameter, which can be obtained from the [List - * Organizations](#operation/get-organizations) endpoint. - * + * Create Product + * This endpoint creates a new Product in a specified Organization identified by the `organizationId` parameter, which can be obtained from the [List Organizations](#operation/get-organizations) endpoint. * @param organizationId The identifier of the Organization. (required) - * @param createProductRequest (required) + * @param createProductRequest (required) * @return ProductModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ProductModel createProduct( - UUID organizationId, CreateProductRequest createProductRequest) throws ApiException { - ApiResponse localVarResp = - createProductWithHttpInfo(organizationId, createProductRequest); + public ProductModel createProduct(UUID organizationId, CreateProductRequest createProductRequest) throws ApiException { + ApiResponse localVarResp = createProductWithHttpInfo(organizationId, createProductRequest); return localVarResp.getData(); } /** - * Create Product This endpoint creates a new Product in a specified Organization identified by - * the `organizationId` parameter, which can be obtained from the [List - * Organizations](#operation/get-organizations) endpoint. - * + * Create Product + * This endpoint creates a new Product in a specified Organization identified by the `organizationId` parameter, which can be obtained from the [List Organizations](#operation/get-organizations) endpoint. * @param organizationId The identifier of the Organization. (required) - * @param createProductRequest (required) + * @param createProductRequest (required) * @return ApiResponse<ProductModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createProductWithHttpInfo( - UUID organizationId, CreateProductRequest createProductRequest) throws ApiException { - okhttp3.Call localVarCall = - createProductValidateBeforeCall(organizationId, createProductRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse createProductWithHttpInfo(UUID organizationId, CreateProductRequest createProductRequest) throws ApiException { + okhttp3.Call localVarCall = createProductValidateBeforeCall(organizationId, createProductRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Product (asynchronously) This endpoint creates a new Product in a specified - * Organization identified by the `organizationId` parameter, which can be obtained - * from the [List Organizations](#operation/get-organizations) endpoint. - * + * Create Product (asynchronously) + * This endpoint creates a new Product in a specified Organization identified by the `organizationId` parameter, which can be obtained from the [List Organizations](#operation/get-organizations) endpoint. * @param organizationId The identifier of the Organization. (required) - * @param createProductRequest (required) + * @param createProductRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createProductAsync( - UUID organizationId, - CreateProductRequest createProductRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createProductValidateBeforeCall(organizationId, createProductRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call createProductAsync(UUID organizationId, CreateProductRequest createProductRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createProductValidateBeforeCall(organizationId, createProductRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteProduct - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteProductCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteProductCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -291,11 +256,8 @@ public okhttp3.Call deleteProductCall(UUID productId, final ApiCallback _callbac Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -303,82 +265,67 @@ public okhttp3.Call deleteProductCall(UUID productId, final ApiCallback _callbac Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteProductValidateBeforeCall( - UUID productId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deleteProductValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling deleteProduct(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling deleteProduct(Async)"); } return deleteProductCall(productId, _callback); + } /** - * Delete Product This endpoint removes a Product identified by the `productId` - * parameter. - * + * Delete Product + * This endpoint removes a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteProduct(UUID productId) throws ApiException { deleteProductWithHttpInfo(productId); } /** - * Delete Product This endpoint removes a Product identified by the `productId` - * parameter. - * + * Delete Product + * This endpoint removes a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse deleteProductWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = deleteProductValidateBeforeCall(productId, null); @@ -386,25 +333,22 @@ public ApiResponse deleteProductWithHttpInfo(UUID productId) throws ApiExc } /** - * Delete Product (asynchronously) This endpoint removes a Product identified by the - * `productId` parameter. - * + * Delete Product (asynchronously) + * This endpoint removes a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteProductAsync(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteProductAsync(UUID productId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteProductValidateBeforeCall(productId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -412,30 +356,28 @@ public okhttp3.Call deleteProductAsync(UUID productId, final ApiCallback _ } /** * Build call for getProduct - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the product data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the product data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getProductCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getProductCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -444,11 +386,8 @@ public okhttp3.Call getProductCall(UUID productId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -456,62 +395,50 @@ public okhttp3.Call getProductCall(UUID productId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getProductValidateBeforeCall(UUID productId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getProductValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling getProduct(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getProduct(Async)"); } return getProductCall(productId, _callback); + } /** - * Get Product This endpoint returns the metadata of a Product identified by the - * `productId`. - * + * Get Product + * This endpoint returns the metadata of a Product identified by the `productId`. * @param productId The identifier of the Product. (required) * @return ProductModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the product data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the product data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ProductModel getProduct(UUID productId) throws ApiException { ApiResponse localVarResp = getProductWithHttpInfo(productId); @@ -519,80 +446,73 @@ public ProductModel getProduct(UUID productId) throws ApiException { } /** - * Get Product This endpoint returns the metadata of a Product identified by the - * `productId`. - * + * Get Product + * This endpoint returns the metadata of a Product identified by the `productId`. * @param productId The identifier of the Product. (required) * @return ApiResponse<ProductModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the product data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the product data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse getProductWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getProductValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Product (asynchronously) This endpoint returns the metadata of a Product identified by - * the `productId`. - * + * Get Product (asynchronously) + * This endpoint returns the metadata of a Product identified by the `productId`. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the product data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the product data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getProductAsync(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getProductAsync(UUID productId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getProductValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getProductPreferences - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the product preferences data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the product preferences data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getProductPreferencesCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getProductPreferencesCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -601,11 +521,8 @@ public okhttp3.Call getProductPreferencesCall(UUID productId, final ApiCallback Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/preferences" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/preferences" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -613,63 +530,50 @@ public okhttp3.Call getProductPreferencesCall(UUID productId, final ApiCallback Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getProductPreferencesValidateBeforeCall( - UUID productId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getProductPreferencesValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " getProductPreferences(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getProductPreferences(Async)"); } return getProductPreferencesCall(productId, _callback); + } /** - * Get Product Preferences This endpoint returns the preferences of a Product identified by the - * `productId`. - * + * Get Product Preferences + * This endpoint returns the preferences of a Product identified by the `productId`. * @param productId The identifier of the Product. (required) * @return PreferencesModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the product preferences data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the product preferences data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public PreferencesModel getProductPreferences(UUID productId) throws ApiException { ApiResponse localVarResp = getProductPreferencesWithHttpInfo(productId); @@ -677,77 +581,70 @@ public PreferencesModel getProductPreferences(UUID productId) throws ApiExceptio } /** - * Get Product Preferences This endpoint returns the preferences of a Product identified by the - * `productId`. - * + * Get Product Preferences + * This endpoint returns the preferences of a Product identified by the `productId`. * @param productId The identifier of the Product. (required) * @return ApiResponse<PreferencesModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the product preferences data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the product preferences data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getProductPreferencesWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse getProductPreferencesWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getProductPreferencesValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Product Preferences (asynchronously) This endpoint returns the preferences of a Product - * identified by the `productId`. - * + * Get Product Preferences (asynchronously) + * This endpoint returns the preferences of a Product identified by the `productId`. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the product preferences data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the product preferences data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getProductPreferencesAsync( - UUID productId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getProductPreferencesAsync(UUID productId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getProductPreferencesValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getProducts - * * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public okhttp3.Call getProductsCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -764,52 +661,42 @@ public okhttp3.Call getProductsCall(final ApiCallback _callback) throws ApiExcep Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getProductsValidateBeforeCall(final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getProductsValidateBeforeCall(final ApiCallback _callback) throws ApiException { return getProductsCall(_callback); + } /** - * List Products This endpoint returns the list of the Products that belongs to the user. - * + * List Products + * This endpoint returns the list of the Products that belongs to the user. * @return List<ProductModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getProducts() throws ApiException { ApiResponse> localVarResp = getProductsWithHttpInfo(); @@ -817,75 +704,68 @@ public List getProducts() throws ApiException { } /** - * List Products This endpoint returns the list of the Products that belongs to the user. - * + * List Products + * This endpoint returns the list of the Products that belongs to the user. * @return ApiResponse<List<ProductModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse> getProductsWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getProductsValidateBeforeCall(null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Products (asynchronously) This endpoint returns the list of the Products that belongs to - * the user. - * + * List Products (asynchronously) + * This endpoint returns the list of the Products that belongs to the user. * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getProductsAsync(final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call getProductsAsync(final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getProductsValidateBeforeCall(_callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateProduct - * * @param productId The identifier of the Product. (required) - * @param updateProductRequest (required) + * @param updateProductRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateProductCall( - UUID productId, UpdateProductRequest updateProductRequest, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateProductCall(UUID productId, UpdateProductRequest updateProductRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -894,11 +774,8 @@ public okhttp3.Call updateProductCall( Object localVarPostBody = updateProductRequest; // create path and map variables - String localVarPath = - "/v1/products/{productId}" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -906,168 +783,136 @@ public okhttp3.Call updateProductCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateProductValidateBeforeCall( - UUID productId, UpdateProductRequest updateProductRequest, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateProductValidateBeforeCall(UUID productId, UpdateProductRequest updateProductRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling updateProduct(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling updateProduct(Async)"); } // verify the required parameter 'updateProductRequest' is set if (updateProductRequest == null) { - throw new ApiException( - "Missing the required parameter 'updateProductRequest' when calling" - + " updateProduct(Async)"); + throw new ApiException("Missing the required parameter 'updateProductRequest' when calling updateProduct(Async)"); } return updateProductCall(productId, updateProductRequest, _callback); + } /** - * Update Product This endpoint updates a Product identified by the `productId` - * parameter. - * + * Update Product + * This endpoint updates a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param updateProductRequest (required) + * @param updateProductRequest (required) * @return ProductModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ProductModel updateProduct(UUID productId, UpdateProductRequest updateProductRequest) - throws ApiException { - ApiResponse localVarResp = - updateProductWithHttpInfo(productId, updateProductRequest); + public ProductModel updateProduct(UUID productId, UpdateProductRequest updateProductRequest) throws ApiException { + ApiResponse localVarResp = updateProductWithHttpInfo(productId, updateProductRequest); return localVarResp.getData(); } /** - * Update Product This endpoint updates a Product identified by the `productId` - * parameter. - * + * Update Product + * This endpoint updates a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param updateProductRequest (required) + * @param updateProductRequest (required) * @return ApiResponse<ProductModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateProductWithHttpInfo( - UUID productId, UpdateProductRequest updateProductRequest) throws ApiException { - okhttp3.Call localVarCall = - updateProductValidateBeforeCall(productId, updateProductRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateProductWithHttpInfo(UUID productId, UpdateProductRequest updateProductRequest) throws ApiException { + okhttp3.Call localVarCall = updateProductValidateBeforeCall(productId, updateProductRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Product (asynchronously) This endpoint updates a Product identified by the - * `productId` parameter. - * + * Update Product (asynchronously) + * This endpoint updates a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param updateProductRequest (required) + * @param updateProductRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateProductAsync( - UUID productId, - UpdateProductRequest updateProductRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateProductValidateBeforeCall(productId, updateProductRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateProductAsync(UUID productId, UpdateProductRequest updateProductRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateProductValidateBeforeCall(productId, updateProductRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateProductPreferences - * * @param productId The identifier of the Product. (required) - * @param updatePreferencesRequest (required) + * @param updatePreferencesRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateProductPreferencesCall( - UUID productId, - UpdatePreferencesRequest updatePreferencesRequest, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateProductPreferencesCall(UUID productId, UpdatePreferencesRequest updatePreferencesRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1076,11 +921,8 @@ public okhttp3.Call updateProductPreferencesCall( Object localVarPostBody = updatePreferencesRequest; // create path and map variables - String localVarPath = - "/v1/products/{productId}/preferences" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/preferences" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1088,140 +930,108 @@ public okhttp3.Call updateProductPreferencesCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateProductPreferencesValidateBeforeCall( - UUID productId, - UpdatePreferencesRequest updatePreferencesRequest, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateProductPreferencesValidateBeforeCall(UUID productId, UpdatePreferencesRequest updatePreferencesRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling" - + " updateProductPreferences(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling updateProductPreferences(Async)"); } // verify the required parameter 'updatePreferencesRequest' is set if (updatePreferencesRequest == null) { - throw new ApiException( - "Missing the required parameter 'updatePreferencesRequest' when calling" - + " updateProductPreferences(Async)"); + throw new ApiException("Missing the required parameter 'updatePreferencesRequest' when calling updateProductPreferences(Async)"); } return updateProductPreferencesCall(productId, updatePreferencesRequest, _callback); + } /** - * Update Product Preferences This endpoint updates the preferences of a Product identified by - * the `productId` parameter. - * + * Update Product Preferences + * This endpoint updates the preferences of a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param updatePreferencesRequest (required) + * @param updatePreferencesRequest (required) * @return PreferencesModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public PreferencesModel updateProductPreferences( - UUID productId, UpdatePreferencesRequest updatePreferencesRequest) throws ApiException { - ApiResponse localVarResp = - updateProductPreferencesWithHttpInfo(productId, updatePreferencesRequest); + public PreferencesModel updateProductPreferences(UUID productId, UpdatePreferencesRequest updatePreferencesRequest) throws ApiException { + ApiResponse localVarResp = updateProductPreferencesWithHttpInfo(productId, updatePreferencesRequest); return localVarResp.getData(); } /** - * Update Product Preferences This endpoint updates the preferences of a Product identified by - * the `productId` parameter. - * + * Update Product Preferences + * This endpoint updates the preferences of a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param updatePreferencesRequest (required) + * @param updatePreferencesRequest (required) * @return ApiResponse<PreferencesModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateProductPreferencesWithHttpInfo( - UUID productId, UpdatePreferencesRequest updatePreferencesRequest) throws ApiException { - okhttp3.Call localVarCall = - updateProductPreferencesValidateBeforeCall( - productId, updatePreferencesRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateProductPreferencesWithHttpInfo(UUID productId, UpdatePreferencesRequest updatePreferencesRequest) throws ApiException { + okhttp3.Call localVarCall = updateProductPreferencesValidateBeforeCall(productId, updatePreferencesRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Product Preferences (asynchronously) This endpoint updates the preferences of a - * Product identified by the `productId` parameter. - * + * Update Product Preferences (asynchronously) + * This endpoint updates the preferences of a Product identified by the `productId` parameter. * @param productId The identifier of the Product. (required) - * @param updatePreferencesRequest (required) + * @param updatePreferencesRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateProductPreferencesAsync( - UUID productId, - UpdatePreferencesRequest updatePreferencesRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateProductPreferencesValidateBeforeCall( - productId, updatePreferencesRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateProductPreferencesAsync(UUID productId, UpdatePreferencesRequest updatePreferencesRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateProductPreferencesValidateBeforeCall(productId, updatePreferencesRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/SdkKeysApi.java b/src/main/java/com/configcat/publicapi/java/client/api/SdkKeysApi.java index 4a892b6..7de5cac 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/SdkKeysApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/SdkKeysApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,14 +19,22 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; -import com.configcat.publicapi.java.client.model.SdkKeysModel; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.configcat.publicapi.java.client.model.SdkKeysModel; +import java.util.UUID; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class SdkKeysApi { private ApiClient localVarApiClient; @@ -67,31 +75,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getSdkKeys - * * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSdkKeysCall( - UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getSdkKeysCall(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -100,14 +106,9 @@ public okhttp3.Call getSdkKeysCall( Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/configs/{configId}/environments/{environmentId}" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())) - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v1/configs/{configId}/environments/{environmentId}" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())) + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -115,69 +116,56 @@ public okhttp3.Call getSdkKeysCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSdkKeysValidateBeforeCall( - UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getSdkKeysValidateBeforeCall(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling getSdkKeys(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling getSdkKeys(Async)"); } // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " getSdkKeys(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling getSdkKeys(Async)"); } return getSdkKeysCall(configId, environmentId, _callback); + } /** - * Get SDK Key This endpoint returns the SDK Key for your Config in a specified Environment. - * + * Get SDK Key + * This endpoint returns the SDK Key for your Config in a specified Environment. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @return SdkKeysModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public SdkKeysModel getSdkKeys(UUID configId, UUID environmentId) throws ApiException { ApiResponse localVarResp = getSdkKeysWithHttpInfo(configId, environmentId); @@ -185,55 +173,48 @@ public SdkKeysModel getSdkKeys(UUID configId, UUID environmentId) throws ApiExce } /** - * Get SDK Key This endpoint returns the SDK Key for your Config in a specified Environment. - * + * Get SDK Key + * This endpoint returns the SDK Key for your Config in a specified Environment. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @return ApiResponse<SdkKeysModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getSdkKeysWithHttpInfo(UUID configId, UUID environmentId) - throws ApiException { + public ApiResponse getSdkKeysWithHttpInfo(UUID configId, UUID environmentId) throws ApiException { okhttp3.Call localVarCall = getSdkKeysValidateBeforeCall(configId, environmentId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get SDK Key (asynchronously) This endpoint returns the SDK Key for your Config in a specified - * Environment. - * + * Get SDK Key (asynchronously) + * This endpoint returns the SDK Key for your Config in a specified Environment. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSdkKeysAsync( - UUID configId, UUID environmentId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSdkKeysAsync(UUID configId, UUID environmentId, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - getSdkKeysValidateBeforeCall(configId, environmentId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = getSdkKeysValidateBeforeCall(configId, environmentId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/SegmentsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/SegmentsApi.java index 7281802..5057acc 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/SegmentsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/SegmentsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,17 +19,25 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.CreateSegmentModel; import com.configcat.publicapi.java.client.model.SegmentListModel; import com.configcat.publicapi.java.client.model.SegmentModel; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdateSegmentModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class SegmentsApi { private ApiClient localVarApiClient; @@ -70,32 +78,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createSegment - * * @param productId The identifier of the Product. (required) - * @param createSegmentModel (required) + * @param createSegmentModel (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createSegmentCall( - UUID productId, CreateSegmentModel createSegmentModel, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createSegmentCall(UUID productId, CreateSegmentModel createSegmentModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -104,11 +109,8 @@ public okhttp3.Call createSegmentCall( Object localVarPostBody = createSegmentModel; // create path and map variables - String localVarPath = - "/v1/products/{productId}/segments" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/segments" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -116,167 +118,135 @@ public okhttp3.Call createSegmentCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createSegmentValidateBeforeCall( - UUID productId, CreateSegmentModel createSegmentModel, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createSegmentValidateBeforeCall(UUID productId, CreateSegmentModel createSegmentModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling createSegment(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling createSegment(Async)"); } // verify the required parameter 'createSegmentModel' is set if (createSegmentModel == null) { - throw new ApiException( - "Missing the required parameter 'createSegmentModel' when calling" - + " createSegment(Async)"); + throw new ApiException("Missing the required parameter 'createSegmentModel' when calling createSegment(Async)"); } return createSegmentCall(productId, createSegmentModel, _callback); + } /** - * Create Segment This endpoint creates a new Segment in a specified Product identified by the - * `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Segment + * This endpoint creates a new Segment in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createSegmentModel (required) + * @param createSegmentModel (required) * @return SegmentModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SegmentModel createSegment(UUID productId, CreateSegmentModel createSegmentModel) - throws ApiException { - ApiResponse localVarResp = - createSegmentWithHttpInfo(productId, createSegmentModel); + public SegmentModel createSegment(UUID productId, CreateSegmentModel createSegmentModel) throws ApiException { + ApiResponse localVarResp = createSegmentWithHttpInfo(productId, createSegmentModel); return localVarResp.getData(); } /** - * Create Segment This endpoint creates a new Segment in a specified Product identified by the - * `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Segment + * This endpoint creates a new Segment in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createSegmentModel (required) + * @param createSegmentModel (required) * @return ApiResponse<SegmentModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createSegmentWithHttpInfo( - UUID productId, CreateSegmentModel createSegmentModel) throws ApiException { - okhttp3.Call localVarCall = - createSegmentValidateBeforeCall(productId, createSegmentModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse createSegmentWithHttpInfo(UUID productId, CreateSegmentModel createSegmentModel) throws ApiException { + okhttp3.Call localVarCall = createSegmentValidateBeforeCall(productId, createSegmentModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Segment (asynchronously) This endpoint creates a new Segment in a specified Product - * identified by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Segment (asynchronously) + * This endpoint creates a new Segment in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) - * @param createSegmentModel (required) + * @param createSegmentModel (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createSegmentAsync( - UUID productId, - CreateSegmentModel createSegmentModel, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createSegmentValidateBeforeCall(productId, createSegmentModel, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call createSegmentAsync(UUID productId, CreateSegmentModel createSegmentModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createSegmentValidateBeforeCall(productId, createSegmentModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteSegment - * * @param segmentId The identifier of the Segment. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteSegmentCall(UUID segmentId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteSegmentCall(UUID segmentId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -285,11 +255,8 @@ public okhttp3.Call deleteSegmentCall(UUID segmentId, final ApiCallback _callbac Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/segments/{segmentId}" - .replace( - "{" + "segmentId" + "}", - localVarApiClient.escapeString(segmentId.toString())); + String localVarPath = "/v1/segments/{segmentId}" + .replace("{" + "segmentId" + "}", localVarApiClient.escapeString(segmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -297,82 +264,67 @@ public okhttp3.Call deleteSegmentCall(UUID segmentId, final ApiCallback _callbac Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteSegmentValidateBeforeCall( - UUID segmentId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deleteSegmentValidateBeforeCall(UUID segmentId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'segmentId' is set if (segmentId == null) { - throw new ApiException( - "Missing the required parameter 'segmentId' when calling deleteSegment(Async)"); + throw new ApiException("Missing the required parameter 'segmentId' when calling deleteSegment(Async)"); } return deleteSegmentCall(segmentId, _callback); + } /** - * Delete Segment This endpoint removes a Segment identified by the `segmentId` - * parameter. - * + * Delete Segment + * This endpoint removes a Segment identified by the `segmentId` parameter. * @param segmentId The identifier of the Segment. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteSegment(UUID segmentId) throws ApiException { deleteSegmentWithHttpInfo(segmentId); } /** - * Delete Segment This endpoint removes a Segment identified by the `segmentId` - * parameter. - * + * Delete Segment + * This endpoint removes a Segment identified by the `segmentId` parameter. * @param segmentId The identifier of the Segment. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse deleteSegmentWithHttpInfo(UUID segmentId) throws ApiException { okhttp3.Call localVarCall = deleteSegmentValidateBeforeCall(segmentId, null); @@ -380,25 +332,22 @@ public ApiResponse deleteSegmentWithHttpInfo(UUID segmentId) throws ApiExc } /** - * Delete Segment (asynchronously) This endpoint removes a Segment identified by the - * `segmentId` parameter. - * + * Delete Segment (asynchronously) + * This endpoint removes a Segment identified by the `segmentId` parameter. * @param segmentId The identifier of the Segment. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteSegmentAsync(UUID segmentId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteSegmentAsync(UUID segmentId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteSegmentValidateBeforeCall(segmentId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -406,30 +355,28 @@ public okhttp3.Call deleteSegmentAsync(UUID segmentId, final ApiCallback _ } /** * Build call for getSegment - * * @param segmentId The identifier of the Segment. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSegmentCall(UUID segmentId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSegmentCall(UUID segmentId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -438,11 +385,8 @@ public okhttp3.Call getSegmentCall(UUID segmentId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/segments/{segmentId}" - .replace( - "{" + "segmentId" + "}", - localVarApiClient.escapeString(segmentId.toString())); + String localVarPath = "/v1/segments/{segmentId}" + .replace("{" + "segmentId" + "}", localVarApiClient.escapeString(segmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -450,62 +394,50 @@ public okhttp3.Call getSegmentCall(UUID segmentId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSegmentValidateBeforeCall(UUID segmentId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getSegmentValidateBeforeCall(UUID segmentId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'segmentId' is set if (segmentId == null) { - throw new ApiException( - "Missing the required parameter 'segmentId' when calling getSegment(Async)"); + throw new ApiException("Missing the required parameter 'segmentId' when calling getSegment(Async)"); } return getSegmentCall(segmentId, _callback); + } /** - * Get Segment This endpoint returns the metadata of a Segment identified by the - * `segmentId`. - * + * Get Segment + * This endpoint returns the metadata of a Segment identified by the `segmentId`. * @param segmentId The identifier of the Segment. (required) * @return SegmentModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public SegmentModel getSegment(UUID segmentId) throws ApiException { ApiResponse localVarResp = getSegmentWithHttpInfo(segmentId); @@ -513,80 +445,73 @@ public SegmentModel getSegment(UUID segmentId) throws ApiException { } /** - * Get Segment This endpoint returns the metadata of a Segment identified by the - * `segmentId`. - * + * Get Segment + * This endpoint returns the metadata of a Segment identified by the `segmentId`. * @param segmentId The identifier of the Segment. (required) * @return ApiResponse<SegmentModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse getSegmentWithHttpInfo(UUID segmentId) throws ApiException { okhttp3.Call localVarCall = getSegmentValidateBeforeCall(segmentId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Segment (asynchronously) This endpoint returns the metadata of a Segment identified by - * the `segmentId`. - * + * Get Segment (asynchronously) + * This endpoint returns the metadata of a Segment identified by the `segmentId`. * @param segmentId The identifier of the Segment. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the config data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSegmentAsync(UUID segmentId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSegmentAsync(UUID segmentId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getSegmentValidateBeforeCall(segmentId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getSegments - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSegmentsCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSegmentsCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -595,11 +520,8 @@ public okhttp3.Call getSegmentsCall(UUID productId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/segments" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/segments" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -607,63 +529,50 @@ public okhttp3.Call getSegmentsCall(UUID productId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSegmentsValidateBeforeCall(UUID productId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getSegmentsValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling getSegments(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getSegments(Async)"); } return getSegmentsCall(productId, _callback); + } /** - * List Segments This endpoint returns the list of the Segments that belongs to the given - * Product identified by the `productId` parameter, which can be obtained from the - * [List Products](#operation/get-products) endpoint. - * + * List Segments + * This endpoint returns the list of the Segments that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return List<SegmentListModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getSegments(UUID productId) throws ApiException { ApiResponse> localVarResp = getSegmentsWithHttpInfo(productId); @@ -671,86 +580,74 @@ public List getSegments(UUID productId) throws ApiException { } /** - * List Segments This endpoint returns the list of the Segments that belongs to the given - * Product identified by the `productId` parameter, which can be obtained from the - * [List Products](#operation/get-products) endpoint. - * + * List Segments + * This endpoint returns the list of the Segments that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return ApiResponse<List<SegmentListModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getSegmentsWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse> getSegmentsWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getSegmentsValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Segments (asynchronously) This endpoint returns the list of the Segments that belongs to - * the given Product identified by the `productId` parameter, which can be obtained - * from the [List Products](#operation/get-products) endpoint. - * + * List Segments (asynchronously) + * This endpoint returns the list of the Segments that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSegmentsAsync( - UUID productId, final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call getSegmentsAsync(UUID productId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getSegmentsValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateSegment - * * @param segmentId The identifier of the Segment. (required) - * @param updateSegmentModel (required) + * @param updateSegmentModel (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSegmentCall( - UUID segmentId, UpdateSegmentModel updateSegmentModel, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateSegmentCall(UUID segmentId, UpdateSegmentModel updateSegmentModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -759,11 +656,8 @@ public okhttp3.Call updateSegmentCall( Object localVarPostBody = updateSegmentModel; // create path and map variables - String localVarPath = - "/v1/segments/{segmentId}" - .replace( - "{" + "segmentId" + "}", - localVarApiClient.escapeString(segmentId.toString())); + String localVarPath = "/v1/segments/{segmentId}" + .replace("{" + "segmentId" + "}", localVarApiClient.escapeString(segmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -771,135 +665,108 @@ public okhttp3.Call updateSegmentCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateSegmentValidateBeforeCall( - UUID segmentId, UpdateSegmentModel updateSegmentModel, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateSegmentValidateBeforeCall(UUID segmentId, UpdateSegmentModel updateSegmentModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'segmentId' is set if (segmentId == null) { - throw new ApiException( - "Missing the required parameter 'segmentId' when calling updateSegment(Async)"); + throw new ApiException("Missing the required parameter 'segmentId' when calling updateSegment(Async)"); } // verify the required parameter 'updateSegmentModel' is set if (updateSegmentModel == null) { - throw new ApiException( - "Missing the required parameter 'updateSegmentModel' when calling" - + " updateSegment(Async)"); + throw new ApiException("Missing the required parameter 'updateSegmentModel' when calling updateSegment(Async)"); } return updateSegmentCall(segmentId, updateSegmentModel, _callback); + } /** - * Update Segment This endpoint updates a Segment identified by the `segmentId` - * parameter. - * + * Update Segment + * This endpoint updates a Segment identified by the `segmentId` parameter. * @param segmentId The identifier of the Segment. (required) - * @param updateSegmentModel (required) + * @param updateSegmentModel (required) * @return SegmentModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public SegmentModel updateSegment(UUID segmentId, UpdateSegmentModel updateSegmentModel) - throws ApiException { - ApiResponse localVarResp = - updateSegmentWithHttpInfo(segmentId, updateSegmentModel); + public SegmentModel updateSegment(UUID segmentId, UpdateSegmentModel updateSegmentModel) throws ApiException { + ApiResponse localVarResp = updateSegmentWithHttpInfo(segmentId, updateSegmentModel); return localVarResp.getData(); } /** - * Update Segment This endpoint updates a Segment identified by the `segmentId` - * parameter. - * + * Update Segment + * This endpoint updates a Segment identified by the `segmentId` parameter. * @param segmentId The identifier of the Segment. (required) - * @param updateSegmentModel (required) + * @param updateSegmentModel (required) * @return ApiResponse<SegmentModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateSegmentWithHttpInfo( - UUID segmentId, UpdateSegmentModel updateSegmentModel) throws ApiException { - okhttp3.Call localVarCall = - updateSegmentValidateBeforeCall(segmentId, updateSegmentModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateSegmentWithHttpInfo(UUID segmentId, UpdateSegmentModel updateSegmentModel) throws ApiException { + okhttp3.Call localVarCall = updateSegmentValidateBeforeCall(segmentId, updateSegmentModel, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Segment (asynchronously) This endpoint updates a Segment identified by the - * `segmentId` parameter. - * + * Update Segment (asynchronously) + * This endpoint updates a Segment identified by the `segmentId` parameter. * @param segmentId The identifier of the Segment. (required) - * @param updateSegmentModel (required) + * @param updateSegmentModel (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateSegmentAsync( - UUID segmentId, - UpdateSegmentModel updateSegmentModel, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateSegmentValidateBeforeCall(segmentId, updateSegmentModel, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateSegmentAsync(UUID segmentId, UpdateSegmentModel updateSegmentModel, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateSegmentValidateBeforeCall(segmentId, updateSegmentModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/TagsApi.java b/src/main/java/com/configcat/publicapi/java/client/api/TagsApi.java index 23b1b80..6f7b523 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/TagsApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/TagsApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,17 +19,25 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.CreateTagModel; import com.configcat.publicapi.java.client.model.SettingModel; import com.configcat.publicapi.java.client.model.TagModel; +import java.util.UUID; import com.configcat.publicapi.java.client.model.UpdateTagModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class TagsApi { private ApiClient localVarApiClient; @@ -70,32 +78,29 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createTag - * * @param productId The identifier of the Organization. (required) - * @param createTagModel (required) + * @param createTagModel (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createTagCall( - UUID productId, CreateTagModel createTagModel, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createTagCall(UUID productId, CreateTagModel createTagModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -104,11 +109,8 @@ public okhttp3.Call createTagCall( Object localVarPostBody = createTagModel; // create path and map variables - String localVarPath = - "/v1/products/{productId}/tags" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/tags" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -116,74 +118,59 @@ public okhttp3.Call createTagCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createTagValidateBeforeCall( - UUID productId, CreateTagModel createTagModel, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createTagValidateBeforeCall(UUID productId, CreateTagModel createTagModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling createTag(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling createTag(Async)"); } // verify the required parameter 'createTagModel' is set if (createTagModel == null) { - throw new ApiException( - "Missing the required parameter 'createTagModel' when calling" - + " createTag(Async)"); + throw new ApiException("Missing the required parameter 'createTagModel' when calling createTag(Async)"); } return createTagCall(productId, createTagModel, _callback); + } /** - * Create Tag This endpoint creates a new Tag in a specified Product identified by the - * `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Tag + * This endpoint creates a new Tag in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Organization. (required) - * @param createTagModel (required) + * @param createTagModel (required) * @return TagModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public TagModel createTag(UUID productId, CreateTagModel createTagModel) throws ApiException { ApiResponse localVarResp = createTagWithHttpInfo(productId, createTagModel); @@ -191,86 +178,75 @@ public TagModel createTag(UUID productId, CreateTagModel createTagModel) throws } /** - * Create Tag This endpoint creates a new Tag in a specified Product identified by the - * `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Tag + * This endpoint creates a new Tag in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Organization. (required) - * @param createTagModel (required) + * @param createTagModel (required) * @return ApiResponse<TagModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createTagWithHttpInfo( - UUID productId, CreateTagModel createTagModel) throws ApiException { + public ApiResponse createTagWithHttpInfo(UUID productId, CreateTagModel createTagModel) throws ApiException { okhttp3.Call localVarCall = createTagValidateBeforeCall(productId, createTagModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Tag (asynchronously) This endpoint creates a new Tag in a specified Product identified - * by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Tag (asynchronously) + * This endpoint creates a new Tag in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Organization. (required) - * @param createTagModel (required) + * @param createTagModel (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createTagAsync( - UUID productId, CreateTagModel createTagModel, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createTagAsync(UUID productId, CreateTagModel createTagModel, final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = - createTagValidateBeforeCall(productId, createTagModel, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + okhttp3.Call localVarCall = createTagValidateBeforeCall(productId, createTagModel, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteTag - * * @param tagId The identifier of the Tag. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public okhttp3.Call deleteTagCall(Long tagId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -279,11 +255,8 @@ public okhttp3.Call deleteTagCall(Long tagId, final ApiCallback _callback) throw Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/tags/{tagId}" - .replace( - "{" + "tagId" + "}", - localVarApiClient.escapeString(tagId.toString())); + String localVarPath = "/v1/tags/{tagId}" + .replace("{" + "tagId" + "}", localVarApiClient.escapeString(tagId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -291,84 +264,67 @@ public okhttp3.Call deleteTagCall(Long tagId, final ApiCallback _callback) throw Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteTagValidateBeforeCall(Long tagId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call deleteTagValidateBeforeCall(Long tagId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'tagId' is set if (tagId == null) { - throw new ApiException( - "Missing the required parameter 'tagId' when calling deleteTag(Async)"); + throw new ApiException("Missing the required parameter 'tagId' when calling deleteTag(Async)"); } return deleteTagCall(tagId, _callback); + } /** - * Delete Tag This endpoint deletes a Tag identified by the `tagId` parameter. To - * remove a Tag from a Feature Flag or Setting use the [Update Flag](#operation/update-setting) - * endpoint. - * + * Delete Tag + * This endpoint deletes a Tag identified by the `tagId` parameter. To remove a Tag from a Feature Flag or Setting use the [Update Flag](#operation/update-setting) endpoint. * @param tagId The identifier of the Tag. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteTag(Long tagId) throws ApiException { deleteTagWithHttpInfo(tagId); } /** - * Delete Tag This endpoint deletes a Tag identified by the `tagId` parameter. To - * remove a Tag from a Feature Flag or Setting use the [Update Flag](#operation/update-setting) - * endpoint. - * + * Delete Tag + * This endpoint deletes a Tag identified by the `tagId` parameter. To remove a Tag from a Feature Flag or Setting use the [Update Flag](#operation/update-setting) endpoint. * @param tagId The identifier of the Tag. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse deleteTagWithHttpInfo(Long tagId) throws ApiException { okhttp3.Call localVarCall = deleteTagValidateBeforeCall(tagId, null); @@ -376,26 +332,22 @@ public ApiResponse deleteTagWithHttpInfo(Long tagId) throws ApiException { } /** - * Delete Tag (asynchronously) This endpoint deletes a Tag identified by the `tagId` - * parameter. To remove a Tag from a Feature Flag or Setting use the [Update - * Flag](#operation/update-setting) endpoint. - * + * Delete Tag (asynchronously) + * This endpoint deletes a Tag identified by the `tagId` parameter. To remove a Tag from a Feature Flag or Setting use the [Update Flag](#operation/update-setting) endpoint. * @param tagId The identifier of the Tag. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteTagAsync(Long tagId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteTagAsync(Long tagId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteTagValidateBeforeCall(tagId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -403,30 +355,28 @@ public okhttp3.Call deleteTagAsync(Long tagId, final ApiCallback _callback } /** * Build call for getSettingsByTag - * * @param tagId The identifier of the Tag. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the settings data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the settings data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingsByTagCall(Long tagId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getSettingsByTagCall(Long tagId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -435,11 +385,8 @@ public okhttp3.Call getSettingsByTagCall(Long tagId, final ApiCallback _callback Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/tags/{tagId}/settings" - .replace( - "{" + "tagId" + "}", - localVarApiClient.escapeString(tagId.toString())); + String localVarPath = "/v1/tags/{tagId}/settings" + .replace("{" + "tagId" + "}", localVarApiClient.escapeString(tagId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -447,62 +394,50 @@ public okhttp3.Call getSettingsByTagCall(Long tagId, final ApiCallback _callback Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getSettingsByTagValidateBeforeCall(Long tagId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getSettingsByTagValidateBeforeCall(Long tagId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'tagId' is set if (tagId == null) { - throw new ApiException( - "Missing the required parameter 'tagId' when calling getSettingsByTag(Async)"); + throw new ApiException("Missing the required parameter 'tagId' when calling getSettingsByTag(Async)"); } return getSettingsByTagCall(tagId, _callback); + } /** - * List Settings by Tag This endpoint returns the list of the Settings that has the specified - * Tag, identified by the `tagId` parameter. - * + * List Settings by Tag + * This endpoint returns the list of the Settings that has the specified Tag, identified by the `tagId` parameter. * @param tagId The identifier of the Tag. (required) * @return List<SettingModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the settings data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the settings data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getSettingsByTag(Long tagId) throws ApiException { ApiResponse> localVarResp = getSettingsByTagWithHttpInfo(tagId); @@ -510,80 +445,73 @@ public List getSettingsByTag(Long tagId) throws ApiException { } /** - * List Settings by Tag This endpoint returns the list of the Settings that has the specified - * Tag, identified by the `tagId` parameter. - * + * List Settings by Tag + * This endpoint returns the list of the Settings that has the specified Tag, identified by the `tagId` parameter. * @param tagId The identifier of the Tag. (required) * @return ApiResponse<List<SettingModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the settings data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the settings data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getSettingsByTagWithHttpInfo(Long tagId) - throws ApiException { + public ApiResponse> getSettingsByTagWithHttpInfo(Long tagId) throws ApiException { okhttp3.Call localVarCall = getSettingsByTagValidateBeforeCall(tagId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Settings by Tag (asynchronously) This endpoint returns the list of the Settings that has - * the specified Tag, identified by the `tagId` parameter. - * + * List Settings by Tag (asynchronously) + * This endpoint returns the list of the Settings that has the specified Tag, identified by the `tagId` parameter. * @param tagId The identifier of the Tag. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the settings data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the settings data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getSettingsByTagAsync( - Long tagId, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getSettingsByTagAsync(Long tagId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getSettingsByTagValidateBeforeCall(tagId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getTag - * * @param tagId The identifier of the Tag. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the tag data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the tag data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public okhttp3.Call getTagCall(Long tagId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -592,11 +520,8 @@ public okhttp3.Call getTagCall(Long tagId, final ApiCallback _callback) throws A Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/tags/{tagId}" - .replace( - "{" + "tagId" + "}", - localVarApiClient.escapeString(tagId.toString())); + String localVarPath = "/v1/tags/{tagId}" + .replace("{" + "tagId" + "}", localVarApiClient.escapeString(tagId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -604,61 +529,50 @@ public okhttp3.Call getTagCall(Long tagId, final ApiCallback _callback) throws A Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getTagValidateBeforeCall(Long tagId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getTagValidateBeforeCall(Long tagId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'tagId' is set if (tagId == null) { - throw new ApiException( - "Missing the required parameter 'tagId' when calling getTag(Async)"); + throw new ApiException("Missing the required parameter 'tagId' when calling getTag(Async)"); } return getTagCall(tagId, _callback); + } /** - * Get Tag This endpoint returns the metadata of a Tag identified by the `tagId`. - * + * Get Tag + * This endpoint returns the metadata of a Tag identified by the `tagId`. * @param tagId The identifier of the Tag. (required) * @return TagModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the tag data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the tag data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public TagModel getTag(Long tagId) throws ApiException { ApiResponse localVarResp = getTagWithHttpInfo(tagId); @@ -666,77 +580,71 @@ public TagModel getTag(Long tagId) throws ApiException { } /** - * Get Tag This endpoint returns the metadata of a Tag identified by the `tagId`. - * + * Get Tag + * This endpoint returns the metadata of a Tag identified by the `tagId`. * @param tagId The identifier of the Tag. (required) * @return ApiResponse<TagModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the tag data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the tag data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse getTagWithHttpInfo(Long tagId) throws ApiException { okhttp3.Call localVarCall = getTagValidateBeforeCall(tagId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Tag (asynchronously) This endpoint returns the metadata of a Tag identified by the - * `tagId`. - * + * Get Tag (asynchronously) + * This endpoint returns the metadata of a Tag identified by the `tagId`. * @param tagId The identifier of the Tag. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the tag data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the tag data returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getTagAsync(Long tagId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getTagAsync(Long tagId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getTagValidateBeforeCall(tagId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getTags - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getTagsCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getTagsCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -745,11 +653,8 @@ public okhttp3.Call getTagsCall(UUID productId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/tags" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/tags" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -757,60 +662,48 @@ public okhttp3.Call getTagsCall(UUID productId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getTagsValidateBeforeCall(UUID productId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getTagsValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling getTags(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getTags(Async)"); } return getTagsCall(productId, _callback); + } /** - * List Tags This endpoint returns the list of the Tags in a specified Product, identified by - * the `productId` parameter. - * + * List Tags + * This endpoint returns the list of the Tags in a specified Product, identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @return List<TagModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getTags(UUID productId) throws ApiException { ApiResponse> localVarResp = getTagsWithHttpInfo(productId); @@ -818,78 +711,70 @@ public List getTags(UUID productId) throws ApiException { } /** - * List Tags This endpoint returns the list of the Tags in a specified Product, identified by - * the `productId` parameter. - * + * List Tags + * This endpoint returns the list of the Tags in a specified Product, identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @return ApiResponse<List<TagModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse> getTagsWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getTagsValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Tags (asynchronously) This endpoint returns the list of the Tags in a specified Product, - * identified by the `productId` parameter. - * + * List Tags (asynchronously) + * This endpoint returns the list of the Tags in a specified Product, identified by the `productId` parameter. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getTagsAsync(UUID productId, final ApiCallback> _callback) - throws ApiException { + public okhttp3.Call getTagsAsync(UUID productId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getTagsValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateTag - * * @param tagId The identifier of the Tag. (required) - * @param updateTagModel (required) + * @param updateTagModel (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateTagCall( - Long tagId, UpdateTagModel updateTagModel, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateTagCall(Long tagId, UpdateTagModel updateTagModel, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -898,11 +783,8 @@ public okhttp3.Call updateTagCall( Object localVarPostBody = updateTagModel; // create path and map variables - String localVarPath = - "/v1/tags/{tagId}" - .replace( - "{" + "tagId" + "}", - localVarApiClient.escapeString(tagId.toString())); + String localVarPath = "/v1/tags/{tagId}" + .replace("{" + "tagId" + "}", localVarApiClient.escapeString(tagId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -910,72 +792,59 @@ public okhttp3.Call updateTagCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateTagValidateBeforeCall( - Long tagId, UpdateTagModel updateTagModel, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateTagValidateBeforeCall(Long tagId, UpdateTagModel updateTagModel, final ApiCallback _callback) throws ApiException { // verify the required parameter 'tagId' is set if (tagId == null) { - throw new ApiException( - "Missing the required parameter 'tagId' when calling updateTag(Async)"); + throw new ApiException("Missing the required parameter 'tagId' when calling updateTag(Async)"); } // verify the required parameter 'updateTagModel' is set if (updateTagModel == null) { - throw new ApiException( - "Missing the required parameter 'updateTagModel' when calling" - + " updateTag(Async)"); + throw new ApiException("Missing the required parameter 'updateTagModel' when calling updateTag(Async)"); } return updateTagCall(tagId, updateTagModel, _callback); + } /** - * Update Tag This endpoint updates a Tag identified by the `tagId` parameter. - * + * Update Tag + * This endpoint updates a Tag identified by the `tagId` parameter. * @param tagId The identifier of the Tag. (required) - * @param updateTagModel (required) + * @param updateTagModel (required) * @return TagModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public TagModel updateTag(Long tagId, UpdateTagModel updateTagModel) throws ApiException { ApiResponse localVarResp = updateTagWithHttpInfo(tagId, updateTagModel); @@ -983,54 +852,48 @@ public TagModel updateTag(Long tagId, UpdateTagModel updateTagModel) throws ApiE } /** - * Update Tag This endpoint updates a Tag identified by the `tagId` parameter. - * + * Update Tag + * This endpoint updates a Tag identified by the `tagId` parameter. * @param tagId The identifier of the Tag. (required) - * @param updateTagModel (required) + * @param updateTagModel (required) * @return ApiResponse<TagModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateTagWithHttpInfo(Long tagId, UpdateTagModel updateTagModel) - throws ApiException { + public ApiResponse updateTagWithHttpInfo(Long tagId, UpdateTagModel updateTagModel) throws ApiException { okhttp3.Call localVarCall = updateTagValidateBeforeCall(tagId, updateTagModel, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Tag (asynchronously) This endpoint updates a Tag identified by the `tagId` - * parameter. - * + * Update Tag (asynchronously) + * This endpoint updates a Tag identified by the `tagId` parameter. * @param tagId The identifier of the Tag. (required) - * @param updateTagModel (required) + * @param updateTagModel (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateTagAsync( - Long tagId, UpdateTagModel updateTagModel, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateTagAsync(Long tagId, UpdateTagModel updateTagModel, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = updateTagValidateBeforeCall(tagId, updateTagModel, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/api/WebhooksApi.java b/src/main/java/com/configcat/publicapi/java/client/api/WebhooksApi.java index f09ce72..e0e4189 100644 --- a/src/main/java/com/configcat/publicapi/java/client/api/WebhooksApi.java +++ b/src/main/java/com/configcat/publicapi/java/client/api/WebhooksApi.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,8 +10,8 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.api; +package com.configcat.publicapi.java.client.api; import com.configcat.publicapi.java.client.ApiCallback; import com.configcat.publicapi.java.client.ApiClient; @@ -19,17 +19,25 @@ import com.configcat.publicapi.java.client.ApiResponse; import com.configcat.publicapi.java.client.Configuration; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ProgressRequestBody; +import com.configcat.publicapi.java.client.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + import com.configcat.publicapi.java.client.model.JsonPatchOperation; +import java.util.UUID; import com.configcat.publicapi.java.client.model.WebHookRequest; import com.configcat.publicapi.java.client.model.WebhookModel; import com.configcat.publicapi.java.client.model.WebhookSigningKeysModel; -import com.google.gson.reflect.TypeToken; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; public class WebhooksApi { private ApiClient localVarApiClient; @@ -70,36 +78,30 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for createWebhook - * * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param webHookRequest (required) + * @param webHookRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createWebhookCall( - UUID configId, - UUID environmentId, - WebHookRequest webHookRequest, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call createWebhookCall(UUID configId, UUID environmentId, WebHookRequest webHookRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -108,14 +110,9 @@ public okhttp3.Call createWebhookCall( Object localVarPostBody = webHookRequest; // create path and map variables - String localVarPath = - "/v1/configs/{configId}/environments/{environmentId}/webhooks" - .replace( - "{" + "configId" + "}", - localVarApiClient.escapeString(configId.toString())) - .replace( - "{" + "environmentId" + "}", - localVarApiClient.escapeString(environmentId.toString())); + String localVarPath = "/v1/configs/{configId}/environments/{environmentId}/webhooks" + .replace("{" + "configId" + "}", localVarApiClient.escapeString(configId.toString())) + .replace("{" + "environmentId" + "}", localVarApiClient.escapeString(environmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -123,181 +120,143 @@ public okhttp3.Call createWebhookCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "POST", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call createWebhookValidateBeforeCall( - UUID configId, - UUID environmentId, - WebHookRequest webHookRequest, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call createWebhookValidateBeforeCall(UUID configId, UUID environmentId, WebHookRequest webHookRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'configId' is set if (configId == null) { - throw new ApiException( - "Missing the required parameter 'configId' when calling createWebhook(Async)"); + throw new ApiException("Missing the required parameter 'configId' when calling createWebhook(Async)"); } // verify the required parameter 'environmentId' is set if (environmentId == null) { - throw new ApiException( - "Missing the required parameter 'environmentId' when calling" - + " createWebhook(Async)"); + throw new ApiException("Missing the required parameter 'environmentId' when calling createWebhook(Async)"); } // verify the required parameter 'webHookRequest' is set if (webHookRequest == null) { - throw new ApiException( - "Missing the required parameter 'webHookRequest' when calling" - + " createWebhook(Async)"); + throw new ApiException("Missing the required parameter 'webHookRequest' when calling createWebhook(Async)"); } return createWebhookCall(configId, environmentId, webHookRequest, _callback); + } /** - * Create Webhook This endpoint creates a new Webhook in a specified Product identified by the - * `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Webhook + * This endpoint creates a new Webhook in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param webHookRequest (required) + * @param webHookRequest (required) * @return WebhookModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public WebhookModel createWebhook( - UUID configId, UUID environmentId, WebHookRequest webHookRequest) throws ApiException { - ApiResponse localVarResp = - createWebhookWithHttpInfo(configId, environmentId, webHookRequest); + public WebhookModel createWebhook(UUID configId, UUID environmentId, WebHookRequest webHookRequest) throws ApiException { + ApiResponse localVarResp = createWebhookWithHttpInfo(configId, environmentId, webHookRequest); return localVarResp.getData(); } /** - * Create Webhook This endpoint creates a new Webhook in a specified Product identified by the - * `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Webhook + * This endpoint creates a new Webhook in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param webHookRequest (required) + * @param webHookRequest (required) * @return ApiResponse<WebhookModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse createWebhookWithHttpInfo( - UUID configId, UUID environmentId, WebHookRequest webHookRequest) throws ApiException { - okhttp3.Call localVarCall = - createWebhookValidateBeforeCall(configId, environmentId, webHookRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse createWebhookWithHttpInfo(UUID configId, UUID environmentId, WebHookRequest webHookRequest) throws ApiException { + okhttp3.Call localVarCall = createWebhookValidateBeforeCall(configId, environmentId, webHookRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Create Webhook (asynchronously) This endpoint creates a new Webhook in a specified Product - * identified by the `productId` parameter, which can be obtained from the [List - * Products](#operation/get-products) endpoint. - * + * Create Webhook (asynchronously) + * This endpoint creates a new Webhook in a specified Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param configId The identifier of the Config. (required) * @param environmentId The identifier of the Environment. (required) - * @param webHookRequest (required) + * @param webHookRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
201 When the creation was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call createWebhookAsync( - UUID configId, - UUID environmentId, - WebHookRequest webHookRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - createWebhookValidateBeforeCall(configId, environmentId, webHookRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call createWebhookAsync(UUID configId, UUID environmentId, WebHookRequest webHookRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createWebhookValidateBeforeCall(configId, environmentId, webHookRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteWebhook - * * @param webhookId The identifier of the Webhook. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteWebhookCall(Integer webhookId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteWebhookCall(Integer webhookId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -306,11 +265,8 @@ public okhttp3.Call deleteWebhookCall(Integer webhookId, final ApiCallback _call Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/webhooks/{webhookId}" - .replace( - "{" + "webhookId" + "}", - localVarApiClient.escapeString(webhookId.toString())); + String localVarPath = "/v1/webhooks/{webhookId}" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -318,82 +274,67 @@ public okhttp3.Call deleteWebhookCall(Integer webhookId, final ApiCallback _call Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {}; + final String[] localVarAccepts = { + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "DELETE", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call deleteWebhookValidateBeforeCall( - Integer webhookId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call deleteWebhookValidateBeforeCall(Integer webhookId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'webhookId' is set if (webhookId == null) { - throw new ApiException( - "Missing the required parameter 'webhookId' when calling deleteWebhook(Async)"); + throw new ApiException("Missing the required parameter 'webhookId' when calling deleteWebhook(Async)"); } return deleteWebhookCall(webhookId, _callback); + } /** - * Delete Webhook This endpoint removes a Webhook identified by the `webhookId` - * parameter. - * + * Delete Webhook + * This endpoint removes a Webhook identified by the `webhookId` parameter. * @param webhookId The identifier of the Webhook. (required) - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public void deleteWebhook(Integer webhookId) throws ApiException { deleteWebhookWithHttpInfo(webhookId); } /** - * Delete Webhook This endpoint removes a Webhook identified by the `webhookId` - * parameter. - * + * Delete Webhook + * This endpoint removes a Webhook identified by the `webhookId` parameter. * @param webhookId The identifier of the Webhook. (required) * @return ApiResponse<Void> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse deleteWebhookWithHttpInfo(Integer webhookId) throws ApiException { okhttp3.Call localVarCall = deleteWebhookValidateBeforeCall(webhookId, null); @@ -401,25 +342,22 @@ public ApiResponse deleteWebhookWithHttpInfo(Integer webhookId) throws Api } /** - * Delete Webhook (asynchronously) This endpoint removes a Webhook identified by the - * `webhookId` parameter. - * + * Delete Webhook (asynchronously) + * This endpoint removes a Webhook identified by the `webhookId` parameter. * @param webhookId The identifier of the Webhook. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
204 When the delete was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call deleteWebhookAsync(Integer webhookId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call deleteWebhookAsync(Integer webhookId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = deleteWebhookValidateBeforeCall(webhookId, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -427,30 +365,28 @@ public okhttp3.Call deleteWebhookAsync(Integer webhookId, final ApiCallback - * Status Code Description Response Headers - * 200 When everything is ok, the webhook data is returned. - - * 400 Bad request. - - * 404 Not found. - - * 429 Too many requests. In case of the request rate exceeds the rate limits. - - * + + + + + + +
Status Code Description Response Headers
200 When everything is ok, the webhook data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getWebhookCall(Integer webhookId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getWebhookCall(Integer webhookId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -459,11 +395,8 @@ public okhttp3.Call getWebhookCall(Integer webhookId, final ApiCallback _callbac Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/webhooks/{webhookId}" - .replace( - "{" + "webhookId" + "}", - localVarApiClient.escapeString(webhookId.toString())); + String localVarPath = "/v1/webhooks/{webhookId}" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -471,62 +404,50 @@ public okhttp3.Call getWebhookCall(Integer webhookId, final ApiCallback _callbac Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getWebhookValidateBeforeCall( - Integer webhookId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getWebhookValidateBeforeCall(Integer webhookId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'webhookId' is set if (webhookId == null) { - throw new ApiException( - "Missing the required parameter 'webhookId' when calling getWebhook(Async)"); + throw new ApiException("Missing the required parameter 'webhookId' when calling getWebhook(Async)"); } return getWebhookCall(webhookId, _callback); + } /** - * Get Webhook This endpoint returns the metadata of a Webhook identified by the - * `webhookId`. - * + * Get Webhook + * This endpoint returns the metadata of a Webhook identified by the `webhookId`. * @param webhookId The identifier of the Webhook. (required) * @return WebhookModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the webhook data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the webhook data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public WebhookModel getWebhook(Integer webhookId) throws ApiException { ApiResponse localVarResp = getWebhookWithHttpInfo(webhookId); @@ -534,80 +455,73 @@ public WebhookModel getWebhook(Integer webhookId) throws ApiException { } /** - * Get Webhook This endpoint returns the metadata of a Webhook identified by the - * `webhookId`. - * + * Get Webhook + * This endpoint returns the metadata of a Webhook identified by the `webhookId`. * @param webhookId The identifier of the Webhook. (required) * @return ApiResponse<WebhookModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the webhook data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the webhook data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public ApiResponse getWebhookWithHttpInfo(Integer webhookId) throws ApiException { okhttp3.Call localVarCall = getWebhookValidateBeforeCall(webhookId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Webhook (asynchronously) This endpoint returns the metadata of a Webhook identified by - * the `webhookId`. - * + * Get Webhook (asynchronously) + * This endpoint returns the metadata of a Webhook identified by the `webhookId`. * @param webhookId The identifier of the Webhook. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the webhook data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the webhook data is returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getWebhookAsync( - Integer webhookId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getWebhookAsync(Integer webhookId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getWebhookValidateBeforeCall(webhookId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getWebhookSigningKeys - * * @param webhookId The identifier of the Webhook. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the webhook signing keys are returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the webhook signing keys are returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getWebhookSigningKeysCall(Integer webhookId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getWebhookSigningKeysCall(Integer webhookId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -616,11 +530,8 @@ public okhttp3.Call getWebhookSigningKeysCall(Integer webhookId, final ApiCallba Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/webhooks/{webhookId}/keys" - .replace( - "{" + "webhookId" + "}", - localVarApiClient.escapeString(webhookId.toString())); + String localVarPath = "/v1/webhooks/{webhookId}/keys" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -628,157 +539,122 @@ public okhttp3.Call getWebhookSigningKeysCall(Integer webhookId, final ApiCallba Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getWebhookSigningKeysValidateBeforeCall( - Integer webhookId, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getWebhookSigningKeysValidateBeforeCall(Integer webhookId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'webhookId' is set if (webhookId == null) { - throw new ApiException( - "Missing the required parameter 'webhookId' when calling" - + " getWebhookSigningKeys(Async)"); + throw new ApiException("Missing the required parameter 'webhookId' when calling getWebhookSigningKeys(Async)"); } return getWebhookSigningKeysCall(webhookId, _callback); + } /** - * Get Webhook Signing Keys This endpoint returns the signing keys of a Webhook identified by - * the `webhookId`. Signing keys are used for ensuring the Webhook requests you - * receive are actually sent by ConfigCat. <a - * href=\"https://configcat.com/docs/advanced/notifications-webhooks/#verifying-webhook-requests\" - * target=\"_blank\" rel=\"noopener noreferrer\">Here</a> - * you can read more about Webhook request verification. - * + * Get Webhook Signing Keys + * This endpoint returns the signing keys of a Webhook identified by the `webhookId`. Signing keys are used for ensuring the Webhook requests you receive are actually sent by ConfigCat. <a href=\"https://configcat.com/docs/advanced/notifications-webhooks/#verifying-webhook-requests\" target=\"_blank\" rel=\"noopener noreferrer\">Here</a> you can read more about Webhook request verification. * @param webhookId The identifier of the Webhook. (required) * @return WebhookSigningKeysModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the webhook signing keys are returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the webhook signing keys are returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public WebhookSigningKeysModel getWebhookSigningKeys(Integer webhookId) throws ApiException { - ApiResponse localVarResp = - getWebhookSigningKeysWithHttpInfo(webhookId); + ApiResponse localVarResp = getWebhookSigningKeysWithHttpInfo(webhookId); return localVarResp.getData(); } /** - * Get Webhook Signing Keys This endpoint returns the signing keys of a Webhook identified by - * the `webhookId`. Signing keys are used for ensuring the Webhook requests you - * receive are actually sent by ConfigCat. <a - * href=\"https://configcat.com/docs/advanced/notifications-webhooks/#verifying-webhook-requests\" - * target=\"_blank\" rel=\"noopener noreferrer\">Here</a> - * you can read more about Webhook request verification. - * + * Get Webhook Signing Keys + * This endpoint returns the signing keys of a Webhook identified by the `webhookId`. Signing keys are used for ensuring the Webhook requests you receive are actually sent by ConfigCat. <a href=\"https://configcat.com/docs/advanced/notifications-webhooks/#verifying-webhook-requests\" target=\"_blank\" rel=\"noopener noreferrer\">Here</a> you can read more about Webhook request verification. * @param webhookId The identifier of the Webhook. (required) * @return ApiResponse<WebhookSigningKeysModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the webhook signing keys are returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the webhook signing keys are returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse getWebhookSigningKeysWithHttpInfo(Integer webhookId) - throws ApiException { + public ApiResponse getWebhookSigningKeysWithHttpInfo(Integer webhookId) throws ApiException { okhttp3.Call localVarCall = getWebhookSigningKeysValidateBeforeCall(webhookId, null); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Get Webhook Signing Keys (asynchronously) This endpoint returns the signing keys of a Webhook - * identified by the `webhookId`. Signing keys are used for ensuring the Webhook - * requests you receive are actually sent by ConfigCat. <a - * href=\"https://configcat.com/docs/advanced/notifications-webhooks/#verifying-webhook-requests\" - * target=\"_blank\" rel=\"noopener noreferrer\">Here</a> - * you can read more about Webhook request verification. - * + * Get Webhook Signing Keys (asynchronously) + * This endpoint returns the signing keys of a Webhook identified by the `webhookId`. Signing keys are used for ensuring the Webhook requests you receive are actually sent by ConfigCat. <a href=\"https://configcat.com/docs/advanced/notifications-webhooks/#verifying-webhook-requests\" target=\"_blank\" rel=\"noopener noreferrer\">Here</a> you can read more about Webhook request verification. * @param webhookId The identifier of the Webhook. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When everything is ok, the webhook signing keys are returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When everything is ok, the webhook signing keys are returned. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getWebhookSigningKeysAsync( - Integer webhookId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getWebhookSigningKeysAsync(Integer webhookId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getWebhookSigningKeysValidateBeforeCall(webhookId, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getWebhooks - * * @param productId The identifier of the Product. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getWebhooksCall(UUID productId, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call getWebhooksCall(UUID productId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -787,11 +663,8 @@ public okhttp3.Call getWebhooksCall(UUID productId, final ApiCallback _callback) Object localVarPostBody = null; // create path and map variables - String localVarPath = - "/v1/products/{productId}/webhooks" - .replace( - "{" + "productId" + "}", - localVarApiClient.escapeString(productId.toString())); + String localVarPath = "/v1/products/{productId}/webhooks" + .replace("{" + "productId" + "}", localVarApiClient.escapeString(productId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -799,61 +672,48 @@ public okhttp3.Call getWebhooksCall(UUID productId, final ApiCallback _callback) Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } - final String[] localVarContentTypes = {}; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String[] localVarContentTypes = { + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "GET", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getWebhooksValidateBeforeCall(UUID productId, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call getWebhooksValidateBeforeCall(UUID productId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'productId' is set if (productId == null) { - throw new ApiException( - "Missing the required parameter 'productId' when calling getWebhooks(Async)"); + throw new ApiException("Missing the required parameter 'productId' when calling getWebhooks(Async)"); } return getWebhooksCall(productId, _callback); + } /** - * List Webhooks This endpoint returns the list of the Webhooks that belongs to the given - * Product identified by the `productId` parameter, which can be obtained from the - * [List Products](#operation/get-products) endpoint. - * + * List Webhooks + * This endpoint returns the list of the Webhooks that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return List<WebhookModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ public List getWebhooks(UUID productId) throws ApiException { ApiResponse> localVarResp = getWebhooksWithHttpInfo(productId); @@ -861,81 +721,70 @@ public List getWebhooks(UUID productId) throws ApiException { } /** - * List Webhooks This endpoint returns the list of the Webhooks that belongs to the given - * Product identified by the `productId` parameter, which can be obtained from the - * [List Products](#operation/get-products) endpoint. - * + * List Webhooks + * This endpoint returns the list of the Webhooks that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @return ApiResponse<List<WebhookModel>> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse> getWebhooksWithHttpInfo(UUID productId) - throws ApiException { + public ApiResponse> getWebhooksWithHttpInfo(UUID productId) throws ApiException { okhttp3.Call localVarCall = getWebhooksValidateBeforeCall(productId, null); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * List Webhooks (asynchronously) This endpoint returns the list of the Webhooks that belongs to - * the given Product identified by the `productId` parameter, which can be obtained - * from the [List Products](#operation/get-products) endpoint. - * + * List Webhooks (asynchronously) + * This endpoint returns the list of the Webhooks that belongs to the given Product identified by the `productId` parameter, which can be obtained from the [List Products](#operation/get-products) endpoint. * @param productId The identifier of the Product. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - *
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + +
Status Code Description Response Headers
200 -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call getWebhooksAsync( - UUID productId, final ApiCallback> _callback) throws ApiException { + public okhttp3.Call getWebhooksAsync(UUID productId, final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = getWebhooksValidateBeforeCall(productId, _callback); - Type localVarReturnType = new TypeToken>() {}.getType(); + Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for replaceWebhook - * * @param webhookId The identifier of the Webhook. (required) - * @param webHookRequest (required) + * @param webHookRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceWebhookCall( - Integer webhookId, WebHookRequest webHookRequest, final ApiCallback _callback) - throws ApiException { + public okhttp3.Call replaceWebhookCall(Integer webhookId, WebHookRequest webHookRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -944,11 +793,8 @@ public okhttp3.Call replaceWebhookCall( Object localVarPostBody = webHookRequest; // create path and map variables - String localVarPath = - "/v1/webhooks/{webhookId}" - .replace( - "{" + "webhookId" + "}", - localVarApiClient.escapeString(webhookId.toString())); + String localVarPath = "/v1/webhooks/{webhookId}" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -956,175 +802,136 @@ public okhttp3.Call replaceWebhookCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PUT", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call replaceWebhookValidateBeforeCall( - Integer webhookId, WebHookRequest webHookRequest, final ApiCallback _callback) - throws ApiException { + private okhttp3.Call replaceWebhookValidateBeforeCall(Integer webhookId, WebHookRequest webHookRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'webhookId' is set if (webhookId == null) { - throw new ApiException( - "Missing the required parameter 'webhookId' when calling" - + " replaceWebhook(Async)"); + throw new ApiException("Missing the required parameter 'webhookId' when calling replaceWebhook(Async)"); } // verify the required parameter 'webHookRequest' is set if (webHookRequest == null) { - throw new ApiException( - "Missing the required parameter 'webHookRequest' when calling" - + " replaceWebhook(Async)"); + throw new ApiException("Missing the required parameter 'webHookRequest' when calling replaceWebhook(Async)"); } return replaceWebhookCall(webhookId, webHookRequest, _callback); + } /** - * Replace Webhook This endpoint replaces the whole value of a Webhook identified by the - * `webhookId` parameter. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other attribute that you don't want to change in its - * original state. Not listing one means it will reset. - * + * Replace Webhook + * This endpoint replaces the whole value of a Webhook identified by the `webhookId` parameter. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. * @param webhookId The identifier of the Webhook. (required) - * @param webHookRequest (required) + * @param webHookRequest (required) * @return WebhookModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public WebhookModel replaceWebhook(Integer webhookId, WebHookRequest webHookRequest) - throws ApiException { - ApiResponse localVarResp = - replaceWebhookWithHttpInfo(webhookId, webHookRequest); + public WebhookModel replaceWebhook(Integer webhookId, WebHookRequest webHookRequest) throws ApiException { + ApiResponse localVarResp = replaceWebhookWithHttpInfo(webhookId, webHookRequest); return localVarResp.getData(); } /** - * Replace Webhook This endpoint replaces the whole value of a Webhook identified by the - * `webhookId` parameter. **Important:** As this endpoint is doing a complete replace, - * it's important to set every other attribute that you don't want to change in its - * original state. Not listing one means it will reset. - * + * Replace Webhook + * This endpoint replaces the whole value of a Webhook identified by the `webhookId` parameter. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. * @param webhookId The identifier of the Webhook. (required) - * @param webHookRequest (required) + * @param webHookRequest (required) * @return ApiResponse<WebhookModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse replaceWebhookWithHttpInfo( - Integer webhookId, WebHookRequest webHookRequest) throws ApiException { - okhttp3.Call localVarCall = - replaceWebhookValidateBeforeCall(webhookId, webHookRequest, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse replaceWebhookWithHttpInfo(Integer webhookId, WebHookRequest webHookRequest) throws ApiException { + okhttp3.Call localVarCall = replaceWebhookValidateBeforeCall(webhookId, webHookRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Replace Webhook (asynchronously) This endpoint replaces the whole value of a Webhook - * identified by the `webhookId` parameter. **Important:** As this endpoint is doing a - * complete replace, it's important to set every other attribute that you don't want to - * change in its original state. Not listing one means it will reset. - * + * Replace Webhook (asynchronously) + * This endpoint replaces the whole value of a Webhook identified by the `webhookId` parameter. **Important:** As this endpoint is doing a complete replace, it's important to set every other attribute that you don't want to change in its original state. Not listing one means it will reset. * @param webhookId The identifier of the Webhook. (required) - * @param webHookRequest (required) + * @param webHookRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the replace was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call replaceWebhookAsync( - Integer webhookId, - WebHookRequest webHookRequest, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - replaceWebhookValidateBeforeCall(webhookId, webHookRequest, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call replaceWebhookAsync(Integer webhookId, WebHookRequest webHookRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = replaceWebhookValidateBeforeCall(webhookId, webHookRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateWebhook - * * @param webhookId The identifier of the Webhook. (required) - * @param jsonPatchOperation (required) + * @param jsonPatchOperation (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateWebhookCall( - Integer webhookId, - List jsonPatchOperation, - final ApiCallback _callback) - throws ApiException { + public okhttp3.Call updateWebhookCall(Integer webhookId, List jsonPatchOperation, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers - String[] localBasePaths = new String[] {}; + String[] localBasePaths = new String[] { }; // Determine Base Path to Use - if (localCustomBaseUrl != null) { + if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; - } else if (localBasePaths.length > 0) { + } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; @@ -1133,11 +940,8 @@ public okhttp3.Call updateWebhookCall( Object localVarPostBody = jsonPatchOperation; // create path and map variables - String localVarPath = - "/v1/webhooks/{webhookId}" - .replace( - "{" + "webhookId" + "}", - localVarApiClient.escapeString(webhookId.toString())); + String localVarPath = "/v1/webhooks/{webhookId}" + .replace("{" + "webhookId" + "}", localVarApiClient.escapeString(webhookId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); @@ -1145,194 +949,108 @@ public okhttp3.Call updateWebhookCall( Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = {"application/json"}; + final String[] localVarAccepts = { + "application/json" + }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { - "application/json", "text/json", "application/*+json" + "application/json", + "text/json", + "application/*+json" }; - final String localVarContentType = - localVarApiClient.selectHeaderContentType(localVarContentTypes); + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } - String[] localVarAuthNames = new String[] {"Basic"}; - return localVarApiClient.buildCall( - basePath, - localVarPath, - "PATCH", - localVarQueryParams, - localVarCollectionQueryParams, - localVarPostBody, - localVarHeaderParams, - localVarCookieParams, - localVarFormParams, - localVarAuthNames, - _callback); + String[] localVarAuthNames = new String[] { "Basic" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call updateWebhookValidateBeforeCall( - Integer webhookId, - List jsonPatchOperation, - final ApiCallback _callback) - throws ApiException { + private okhttp3.Call updateWebhookValidateBeforeCall(Integer webhookId, List jsonPatchOperation, final ApiCallback _callback) throws ApiException { // verify the required parameter 'webhookId' is set if (webhookId == null) { - throw new ApiException( - "Missing the required parameter 'webhookId' when calling updateWebhook(Async)"); + throw new ApiException("Missing the required parameter 'webhookId' when calling updateWebhook(Async)"); } // verify the required parameter 'jsonPatchOperation' is set if (jsonPatchOperation == null) { - throw new ApiException( - "Missing the required parameter 'jsonPatchOperation' when calling" - + " updateWebhook(Async)"); + throw new ApiException("Missing the required parameter 'jsonPatchOperation' when calling updateWebhook(Async)"); } return updateWebhookCall(webhookId, jsonPatchOperation, _callback); + } /** - * Update Webhook This endpoint updates a Webhook identified by the `webhookId` - * parameter with a collection of [JSON Patch](https://jsonpatch.com) operations. The advantage - * of using JSON Patch is that you can describe individual update operations on a resource - * without touching attributes that you don't want to change. For example: We have the - * following resource. ```json { \"webhookId\": 6, \"url\": - * \"https://example.com/hook\", \"httpMethod\": \"post\", - * \"content\": \"null\", \"webHookHeaders\": [] } - * ``` If we send an update request body as below (it changes the - * `content` field and adds a new HTTP header): ```json [ { - * \"op\": \"replace\", \"path\": \"/content\", - * \"value\": \"Some webhook content.\" }, { \"op\": - * \"add\", \"path\": \"/webHookHeaders/-\", \"value\": - * { \"key\": \"X-Custom-Header\", \"value\": \"Custom header - * value\" } } ] ``` Only the `content` and - * `webHookHeaders` are updated and all the other attributes remain unchanged. So we - * get a response like this: ```json { \"webhookId\": 6, - * \"url\": \"https://example.com/hook\", \"httpMethod\": - * \"post\", \"content\": \"Some webhook content.\", - * \"webHookHeaders\": [ { \"key\": \"X-Custom-Header\", - * \"value\": \"Custom header value\", \"isSecure\": false } ] } - * ``` - * + * Update Webhook + * This endpoint updates a Webhook identified by the `webhookId` parameter with a collection of [JSON Patch](https://jsonpatch.com) operations. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. For example: We have the following resource. ```json { \"webhookId\": 6, \"url\": \"https://example.com/hook\", \"httpMethod\": \"post\", \"content\": \"null\", \"webHookHeaders\": [] } ``` If we send an update request body as below (it changes the `content` field and adds a new HTTP header): ```json [ { \"op\": \"replace\", \"path\": \"/content\", \"value\": \"Some webhook content.\" }, { \"op\": \"add\", \"path\": \"/webHookHeaders/-\", \"value\": { \"key\": \"X-Custom-Header\", \"value\": \"Custom header value\" } } ] ``` Only the `content` and `webHookHeaders` are updated and all the other attributes remain unchanged. So we get a response like this: ```json { \"webhookId\": 6, \"url\": \"https://example.com/hook\", \"httpMethod\": \"post\", \"content\": \"Some webhook content.\", \"webHookHeaders\": [ { \"key\": \"X-Custom-Header\", \"value\": \"Custom header value\", \"isSecure\": false } ] } ``` * @param webhookId The identifier of the Webhook. (required) - * @param jsonPatchOperation (required) + * @param jsonPatchOperation (required) * @return WebhookModel - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public WebhookModel updateWebhook( - Integer webhookId, List jsonPatchOperation) throws ApiException { - ApiResponse localVarResp = - updateWebhookWithHttpInfo(webhookId, jsonPatchOperation); + public WebhookModel updateWebhook(Integer webhookId, List jsonPatchOperation) throws ApiException { + ApiResponse localVarResp = updateWebhookWithHttpInfo(webhookId, jsonPatchOperation); return localVarResp.getData(); } /** - * Update Webhook This endpoint updates a Webhook identified by the `webhookId` - * parameter with a collection of [JSON Patch](https://jsonpatch.com) operations. The advantage - * of using JSON Patch is that you can describe individual update operations on a resource - * without touching attributes that you don't want to change. For example: We have the - * following resource. ```json { \"webhookId\": 6, \"url\": - * \"https://example.com/hook\", \"httpMethod\": \"post\", - * \"content\": \"null\", \"webHookHeaders\": [] } - * ``` If we send an update request body as below (it changes the - * `content` field and adds a new HTTP header): ```json [ { - * \"op\": \"replace\", \"path\": \"/content\", - * \"value\": \"Some webhook content.\" }, { \"op\": - * \"add\", \"path\": \"/webHookHeaders/-\", \"value\": - * { \"key\": \"X-Custom-Header\", \"value\": \"Custom header - * value\" } } ] ``` Only the `content` and - * `webHookHeaders` are updated and all the other attributes remain unchanged. So we - * get a response like this: ```json { \"webhookId\": 6, - * \"url\": \"https://example.com/hook\", \"httpMethod\": - * \"post\", \"content\": \"Some webhook content.\", - * \"webHookHeaders\": [ { \"key\": \"X-Custom-Header\", - * \"value\": \"Custom header value\", \"isSecure\": false } ] } - * ``` - * + * Update Webhook + * This endpoint updates a Webhook identified by the `webhookId` parameter with a collection of [JSON Patch](https://jsonpatch.com) operations. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. For example: We have the following resource. ```json { \"webhookId\": 6, \"url\": \"https://example.com/hook\", \"httpMethod\": \"post\", \"content\": \"null\", \"webHookHeaders\": [] } ``` If we send an update request body as below (it changes the `content` field and adds a new HTTP header): ```json [ { \"op\": \"replace\", \"path\": \"/content\", \"value\": \"Some webhook content.\" }, { \"op\": \"add\", \"path\": \"/webHookHeaders/-\", \"value\": { \"key\": \"X-Custom-Header\", \"value\": \"Custom header value\" } } ] ``` Only the `content` and `webHookHeaders` are updated and all the other attributes remain unchanged. So we get a response like this: ```json { \"webhookId\": 6, \"url\": \"https://example.com/hook\", \"httpMethod\": \"post\", \"content\": \"Some webhook content.\", \"webHookHeaders\": [ { \"key\": \"X-Custom-Header\", \"value\": \"Custom header value\", \"isSecure\": false } ] } ``` * @param webhookId The identifier of the Webhook. (required) - * @param jsonPatchOperation (required) + * @param jsonPatchOperation (required) * @return ApiResponse<WebhookModel> - * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the - * response body + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public ApiResponse updateWebhookWithHttpInfo( - Integer webhookId, List jsonPatchOperation) throws ApiException { - okhttp3.Call localVarCall = - updateWebhookValidateBeforeCall(webhookId, jsonPatchOperation, null); - Type localVarReturnType = new TypeToken() {}.getType(); + public ApiResponse updateWebhookWithHttpInfo(Integer webhookId, List jsonPatchOperation) throws ApiException { + okhttp3.Call localVarCall = updateWebhookValidateBeforeCall(webhookId, jsonPatchOperation, null); + Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** - * Update Webhook (asynchronously) This endpoint updates a Webhook identified by the - * `webhookId` parameter with a collection of [JSON Patch](https://jsonpatch.com) - * operations. The advantage of using JSON Patch is that you can describe individual update - * operations on a resource without touching attributes that you don't want to change. For - * example: We have the following resource. ```json { \"webhookId\": 6, - * \"url\": \"https://example.com/hook\", \"httpMethod\": - * \"post\", \"content\": \"null\", \"webHookHeaders\": - * [] } ``` If we send an update request body as below (it changes the - * `content` field and adds a new HTTP header): ```json [ { - * \"op\": \"replace\", \"path\": \"/content\", - * \"value\": \"Some webhook content.\" }, { \"op\": - * \"add\", \"path\": \"/webHookHeaders/-\", \"value\": - * { \"key\": \"X-Custom-Header\", \"value\": \"Custom header - * value\" } } ] ``` Only the `content` and - * `webHookHeaders` are updated and all the other attributes remain unchanged. So we - * get a response like this: ```json { \"webhookId\": 6, - * \"url\": \"https://example.com/hook\", \"httpMethod\": - * \"post\", \"content\": \"Some webhook content.\", - * \"webHookHeaders\": [ { \"key\": \"X-Custom-Header\", - * \"value\": \"Custom header value\", \"isSecure\": false } ] } - * ``` - * + * Update Webhook (asynchronously) + * This endpoint updates a Webhook identified by the `webhookId` parameter with a collection of [JSON Patch](https://jsonpatch.com) operations. The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. For example: We have the following resource. ```json { \"webhookId\": 6, \"url\": \"https://example.com/hook\", \"httpMethod\": \"post\", \"content\": \"null\", \"webHookHeaders\": [] } ``` If we send an update request body as below (it changes the `content` field and adds a new HTTP header): ```json [ { \"op\": \"replace\", \"path\": \"/content\", \"value\": \"Some webhook content.\" }, { \"op\": \"add\", \"path\": \"/webHookHeaders/-\", \"value\": { \"key\": \"X-Custom-Header\", \"value\": \"Custom header value\" } } ] ``` Only the `content` and `webHookHeaders` are updated and all the other attributes remain unchanged. So we get a response like this: ```json { \"webhookId\": 6, \"url\": \"https://example.com/hook\", \"httpMethod\": \"post\", \"content\": \"Some webhook content.\", \"webHookHeaders\": [ { \"key\": \"X-Custom-Header\", \"value\": \"Custom header value\", \"isSecure\": false } ] } ``` * @param webhookId The identifier of the Webhook. (required) - * @param jsonPatchOperation (required) + * @param jsonPatchOperation (required) * @param _callback The callback to be executed when the API call finishes * @return The request call - * @throws ApiException If fail to process the API call, e.g. serializing the request body - * object + * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - * - * - * - * - * - * - *
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
+ + + + + + +
Status Code Description Response Headers
200 When the update was successful. -
400 Bad request. -
404 Not found. -
429 Too many requests. In case of the request rate exceeds the rate limits. -
*/ - public okhttp3.Call updateWebhookAsync( - Integer webhookId, - List jsonPatchOperation, - final ApiCallback _callback) - throws ApiException { - - okhttp3.Call localVarCall = - updateWebhookValidateBeforeCall(webhookId, jsonPatchOperation, _callback); - Type localVarReturnType = new TypeToken() {}.getType(); + public okhttp3.Call updateWebhookAsync(Integer webhookId, List jsonPatchOperation, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateWebhookValidateBeforeCall(webhookId, jsonPatchOperation, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } diff --git a/src/main/java/com/configcat/publicapi/java/client/auth/ApiKeyAuth.java b/src/main/java/com/configcat/publicapi/java/client/auth/ApiKeyAuth.java index 8780d31..36a056f 100644 --- a/src/main/java/com/configcat/publicapi/java/client/auth/ApiKeyAuth.java +++ b/src/main/java/com/configcat/publicapi/java/client/auth/ApiKeyAuth.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,79 +10,71 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.auth; +package com.configcat.publicapi.java.client.auth; import com.configcat.publicapi.java.client.ApiException; import com.configcat.publicapi.java.client.Pair; + import java.net.URI; -import java.util.List; import java.util.Map; +import java.util.List; -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class ApiKeyAuth implements Authentication { - private final String location; - private final String paramName; + private final String location; + private final String paramName; - private String apiKey; - private String apiKeyPrefix; + private String apiKey; + private String apiKeyPrefix; - public ApiKeyAuth(String location, String paramName) { - this.location = location; - this.paramName = paramName; - } + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } - public String getLocation() { - return location; - } + public String getLocation() { + return location; + } - public String getParamName() { - return paramName; - } + public String getParamName() { + return paramName; + } - public String getApiKey() { - return apiKey; - } + public String getApiKey() { + return apiKey; + } - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } - public String getApiKeyPrefix() { - return apiKeyPrefix; - } + public String getApiKeyPrefix() { + return apiKeyPrefix; + } - public void setApiKeyPrefix(String apiKeyPrefix) { - this.apiKeyPrefix = apiKeyPrefix; - } + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } - @Override - public void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams, - String payload, - String method, - URI uri) - throws ApiException { - if (apiKey == null) { - return; - } - String value; - if (apiKeyPrefix != null) { - value = apiKeyPrefix + " " + apiKey; - } else { - value = apiKey; - } - if ("query".equals(location)) { - queryParams.add(new Pair(paramName, value)); - } else if ("header".equals(location)) { - headerParams.put(paramName, value); - } else if ("cookie".equals(location)) { - cookieParams.put(paramName, value); - } + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); } + } } diff --git a/src/main/java/com/configcat/publicapi/java/client/auth/Authentication.java b/src/main/java/com/configcat/publicapi/java/client/auth/Authentication.java index 30b8a0b..9e0c12f 100644 --- a/src/main/java/com/configcat/publicapi/java/client/auth/Authentication.java +++ b/src/main/java/com/configcat/publicapi/java/client/auth/Authentication.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,14 +10,15 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.auth; +package com.configcat.publicapi.java.client.auth; -import com.configcat.publicapi.java.client.ApiException; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ApiException; + import java.net.URI; -import java.util.List; import java.util.Map; +import java.util.List; public interface Authentication { /** @@ -31,12 +32,5 @@ public interface Authentication { * @param uri URI * @throws ApiException if failed to update the parameters */ - void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams, - String payload, - String method, - URI uri) - throws ApiException; + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; } diff --git a/src/main/java/com/configcat/publicapi/java/client/auth/HttpBasicAuth.java b/src/main/java/com/configcat/publicapi/java/client/auth/HttpBasicAuth.java index 72db39e..f5abe41 100644 --- a/src/main/java/com/configcat/publicapi/java/client/auth/HttpBasicAuth.java +++ b/src/main/java/com/configcat/publicapi/java/client/auth/HttpBasicAuth.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,15 +10,17 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.auth; +package com.configcat.publicapi.java.client.auth; -import com.configcat.publicapi.java.client.ApiException; import com.configcat.publicapi.java.client.Pair; +import com.configcat.publicapi.java.client.ApiException; + +import okhttp3.Credentials; + import java.net.URI; -import java.util.List; import java.util.Map; -import okhttp3.Credentials; +import java.util.List; public class HttpBasicAuth implements Authentication { private String username; @@ -41,20 +43,13 @@ public void setPassword(String password) { } @Override - public void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams, - String payload, - String method, - URI uri) - throws ApiException { + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { if (username == null && password == null) { return; } - headerParams.put( - "Authorization", - Credentials.basic( - username == null ? "" : username, password == null ? "" : password)); + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); } } diff --git a/src/main/java/com/configcat/publicapi/java/client/auth/HttpBearerAuth.java b/src/main/java/com/configcat/publicapi/java/client/auth/HttpBearerAuth.java index 8937ced..209d7ce 100644 --- a/src/main/java/com/configcat/publicapi/java/client/auth/HttpBearerAuth.java +++ b/src/main/java/com/configcat/publicapi/java/client/auth/HttpBearerAuth.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,79 +10,66 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.auth; +package com.configcat.publicapi.java.client.auth; import com.configcat.publicapi.java.client.ApiException; import com.configcat.publicapi.java.client.Pair; + import java.net.URI; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Supplier; -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class HttpBearerAuth implements Authentication { - private final String scheme; - private Supplier tokenSupplier; - - public HttpBearerAuth(String scheme) { - this.scheme = scheme; - } + private final String scheme; + private Supplier tokenSupplier; - /** - * Gets the token, which together with the scheme, will be sent as the value of the - * Authorization header. - * - * @return The bearer token - */ - public String getBearerToken() { - return tokenSupplier.get(); - } + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } - /** - * Sets the token, which together with the scheme, will be sent as the value of the - * Authorization header. - * - * @param bearerToken The bearer token to send in the Authorization header - */ - public void setBearerToken(String bearerToken) { - this.tokenSupplier = () -> bearerToken; - } + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return tokenSupplier.get(); + } - /** - * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the - * Authorization header. - * - * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header - */ - public void setBearerToken(Supplier tokenSupplier) { - this.tokenSupplier = tokenSupplier; - } + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String bearerToken) { + this.tokenSupplier = () -> bearerToken; + } - @Override - public void applyToParams( - List queryParams, - Map headerParams, - Map cookieParams, - String payload, - String method, - URI uri) - throws ApiException { - String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); - if (bearerToken == null) { - return; - } + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; + } - headerParams.put( - "Authorization", - (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); + if (bearerToken == null) { + return; } - private static String upperCaseBearer(String scheme) { - return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; - } + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } } diff --git a/src/main/java/com/configcat/publicapi/java/client/model/AbstractOpenApiSchema.java b/src/main/java/com/configcat/publicapi/java/client/model/AbstractOpenApiSchema.java index a3b9fa6..805cb9b 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/AbstractOpenApiSchema.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,17 +10,18 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.model; +package com.configcat.publicapi.java.client.model; -import java.util.Map; +import com.configcat.publicapi.java.client.ApiException; import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; -/** Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object @@ -49,23 +50,18 @@ public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { * * @return an instance of the actual schema/object */ - // @JsonValue - public Object getActualInstance() { - return instance; - } + //@JsonValue + public Object getActualInstance() {return instance;} /** * Set the actual instance * * @param instance the actual instance of the schema/object */ - public void setActualInstance(Object instance) { - this.instance = instance; - } + public void setActualInstance(Object instance) {this.instance = instance;} /** - * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf - * schema as well + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well * * @return an instance of the actual schema/object */ @@ -77,7 +73,7 @@ private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { if (object.getActualInstance() == null) { return null; } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { - return getActualInstanceRecursively((AbstractOpenApiSchema) object.getActualInstance()); + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); } else { return object.getActualInstance(); } @@ -104,8 +100,8 @@ public String toString() { } /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { @@ -122,9 +118,9 @@ public boolean equals(Object o) { return false; } AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; - return Objects.equals(this.instance, a.instance) - && Objects.equals(this.isNullable, a.isNullable) - && Objects.equals(this.schemaType, a.schemaType); + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); } @Override @@ -144,4 +140,7 @@ public Boolean isNullable() { return Boolean.FALSE; } } + + + } diff --git a/src/main/java/com/configcat/publicapi/java/client/model/AccessType.java b/src/main/java/com/configcat/publicapi/java/client/model/AccessType.java index 9437e4b..e32ffb9 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/AccessType.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/AccessType.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,65 +10,71 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Represent the Feature Management permission. */ +/** + * Represent the Feature Management permission. + */ @JsonAdapter(AccessType.Adapter.class) public enum AccessType { - READ_ONLY("readOnly"), + + READ_ONLY("readOnly"), + + FULL("full"), + + CUSTOM("custom"); - FULL("full"), + private String value; - CUSTOM("custom"); + AccessType(String value) { + this.value = value; + } - private String value; + public String getValue() { + return value; + } - AccessType(String value) { - this.value = value; - } + @Override + public String toString() { + return String.valueOf(value); + } - public String getValue() { - return value; + public static AccessType fromValue(String value) { + for (AccessType b : AccessType.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); + public void write(final JsonWriter jsonWriter, final AccessType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static AccessType fromValue(String value) { - for (AccessType b : AccessType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final AccessType enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AccessType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return AccessType.fromValue(value); - } + @Override + public AccessType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AccessType.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - AccessType.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AccessType.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/AddOrUpdateIntegrationLinkModel.java b/src/main/java/com/configcat/publicapi/java/client/model/AddOrUpdateIntegrationLinkModel.java index d3ed7ee..6375f81 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/AddOrUpdateIntegrationLinkModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/AddOrUpdateIntegrationLinkModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,252 +10,319 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** AddOrUpdateIntegrationLinkModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * AddOrUpdateIntegrationLinkModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class AddOrUpdateIntegrationLinkModel { - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; - public static final String SERIALIZED_NAME_URL = "url"; + public AddOrUpdateIntegrationLinkModel() { + } - @SerializedName(SERIALIZED_NAME_URL) - private String url; + public AddOrUpdateIntegrationLinkModel description(String description) { + this.description = description; + return this; + } - public AddOrUpdateIntegrationLinkModel() {} + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } - public AddOrUpdateIntegrationLinkModel description(String description) { - this.description = description; - return this; - } + public void setDescription(String description) { + this.description = description; + } - /** - * Get description - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } + public AddOrUpdateIntegrationLinkModel url(String url) { + this.url = url; + return this; + } - public AddOrUpdateIntegrationLinkModel url(String url) { - this.url = url; - return this; - } + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } - /** - * Get url - * - * @return url - */ - @javax.annotation.Nullable - public String getUrl() { - return url; - } + public void setUrl(String url) { + this.url = url; + } - public void setUrl(String url) { - this.url = url; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel = - (AddOrUpdateIntegrationLinkModel) o; - return Objects.equals(this.description, addOrUpdateIntegrationLinkModel.description) - && Objects.equals(this.url, addOrUpdateIntegrationLinkModel.url); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AddOrUpdateIntegrationLinkModel instance itself + */ + public AddOrUpdateIntegrationLinkModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(description, url); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddOrUpdateIntegrationLinkModel addOrUpdateIntegrationLinkModel = (AddOrUpdateIntegrationLinkModel) o; + return Objects.equals(this.description, addOrUpdateIntegrationLinkModel.description) && + Objects.equals(this.url, addOrUpdateIntegrationLinkModel.url)&& + Objects.equals(this.additionalProperties, addOrUpdateIntegrationLinkModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddOrUpdateIntegrationLinkModel {\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(description, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddOrUpdateIntegrationLinkModel {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("description"); - openapiFields.add("url"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("description"); + openapiFields.add("url"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * AddOrUpdateIntegrationLinkModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!AddOrUpdateIntegrationLinkModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in AddOrUpdateIntegrationLinkModel is" - + " not found in the empty JSON string", - AddOrUpdateIntegrationLinkModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AddOrUpdateIntegrationLinkModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `AddOrUpdateIntegrationLinkModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddOrUpdateIntegrationLinkModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddOrUpdateIntegrationLinkModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AddOrUpdateIntegrationLinkModel is not found in the empty JSON string", AddOrUpdateIntegrationLinkModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) - && !jsonObj.get("url").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `url` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("url").toString())); - } - } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddOrUpdateIntegrationLinkModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddOrUpdateIntegrationLinkModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(AddOrUpdateIntegrationLinkModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, AddOrUpdateIntegrationLinkModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddOrUpdateIntegrationLinkModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddOrUpdateIntegrationLinkModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddOrUpdateIntegrationLinkModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AddOrUpdateIntegrationLinkModel.class)); - /** - * Create an instance of AddOrUpdateIntegrationLinkModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddOrUpdateIntegrationLinkModel - * @throws IOException if the JSON string is invalid with respect to - * AddOrUpdateIntegrationLinkModel - */ - public static AddOrUpdateIntegrationLinkModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AddOrUpdateIntegrationLinkModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AddOrUpdateIntegrationLinkModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AddOrUpdateIntegrationLinkModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AddOrUpdateIntegrationLinkModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of AddOrUpdateIntegrationLinkModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of AddOrUpdateIntegrationLinkModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddOrUpdateIntegrationLinkModel + * @throws IOException if the JSON string is invalid with respect to AddOrUpdateIntegrationLinkModel + */ + public static AddOrUpdateIntegrationLinkModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddOrUpdateIntegrationLinkModel.class); + } + + /** + * Convert an instance of AddOrUpdateIntegrationLinkModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/AddOrUpdateJiraIntegrationLinkModel.java b/src/main/java/com/configcat/publicapi/java/client/model/AddOrUpdateJiraIntegrationLinkModel.java index 120b5f9..e64df47 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/AddOrUpdateJiraIntegrationLinkModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/AddOrUpdateJiraIntegrationLinkModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,335 +10,386 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** AddOrUpdateJiraIntegrationLinkModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class AddOrUpdateJiraIntegrationLinkModel { - public static final String SERIALIZED_NAME_JIRA_JWT_TOKEN = "jiraJwtToken"; - - @SerializedName(SERIALIZED_NAME_JIRA_JWT_TOKEN) - private String jiraJwtToken; - - public static final String SERIALIZED_NAME_CLIENT_KEY = "clientKey"; - - @SerializedName(SERIALIZED_NAME_CLIENT_KEY) - private String clientKey; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_URL = "url"; - - @SerializedName(SERIALIZED_NAME_URL) - private String url; - - public AddOrUpdateJiraIntegrationLinkModel() {} - - public AddOrUpdateJiraIntegrationLinkModel jiraJwtToken(String jiraJwtToken) { - this.jiraJwtToken = jiraJwtToken; - return this; - } - - /** - * Get jiraJwtToken - * - * @return jiraJwtToken - */ - @javax.annotation.Nonnull - public String getJiraJwtToken() { - return jiraJwtToken; - } - - public void setJiraJwtToken(String jiraJwtToken) { - this.jiraJwtToken = jiraJwtToken; - } - - public AddOrUpdateJiraIntegrationLinkModel clientKey(String clientKey) { - this.clientKey = clientKey; - return this; - } - - /** - * Get clientKey - * - * @return clientKey - */ - @javax.annotation.Nonnull - public String getClientKey() { - return clientKey; - } - - public void setClientKey(String clientKey) { - this.clientKey = clientKey; - } - - public AddOrUpdateJiraIntegrationLinkModel description(String description) { - this.description = description; - return this; - } - /** - * Get description - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public AddOrUpdateJiraIntegrationLinkModel url(String url) { - this.url = url; - return this; - } - - /** - * Get url - * - * @return url - */ - @javax.annotation.Nullable - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel = - (AddOrUpdateJiraIntegrationLinkModel) o; - return Objects.equals(this.jiraJwtToken, addOrUpdateJiraIntegrationLinkModel.jiraJwtToken) - && Objects.equals(this.clientKey, addOrUpdateJiraIntegrationLinkModel.clientKey) - && Objects.equals(this.description, addOrUpdateJiraIntegrationLinkModel.description) - && Objects.equals(this.url, addOrUpdateJiraIntegrationLinkModel.url); +/** + * AddOrUpdateJiraIntegrationLinkModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class AddOrUpdateJiraIntegrationLinkModel { + public static final String SERIALIZED_NAME_JIRA_JWT_TOKEN = "jiraJwtToken"; + @SerializedName(SERIALIZED_NAME_JIRA_JWT_TOKEN) + private String jiraJwtToken; + + public static final String SERIALIZED_NAME_CLIENT_KEY = "clientKey"; + @SerializedName(SERIALIZED_NAME_CLIENT_KEY) + private String clientKey; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public AddOrUpdateJiraIntegrationLinkModel() { + } + + public AddOrUpdateJiraIntegrationLinkModel jiraJwtToken(String jiraJwtToken) { + this.jiraJwtToken = jiraJwtToken; + return this; + } + + /** + * Get jiraJwtToken + * @return jiraJwtToken + */ + @javax.annotation.Nonnull + public String getJiraJwtToken() { + return jiraJwtToken; + } + + public void setJiraJwtToken(String jiraJwtToken) { + this.jiraJwtToken = jiraJwtToken; + } + + + public AddOrUpdateJiraIntegrationLinkModel clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } + + /** + * Get clientKey + * @return clientKey + */ + @javax.annotation.Nonnull + public String getClientKey() { + return clientKey; + } + + public void setClientKey(String clientKey) { + this.clientKey = clientKey; + } + + + public AddOrUpdateJiraIntegrationLinkModel description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public AddOrUpdateJiraIntegrationLinkModel url(String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AddOrUpdateJiraIntegrationLinkModel instance itself + */ + public AddOrUpdateJiraIntegrationLinkModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(jiraJwtToken, clientKey, description, url); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AddOrUpdateJiraIntegrationLinkModel {\n"); - sb.append(" jiraJwtToken: ").append(toIndentedString(jiraJwtToken)).append("\n"); - sb.append(" clientKey: ").append(toIndentedString(clientKey)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + AddOrUpdateJiraIntegrationLinkModel addOrUpdateJiraIntegrationLinkModel = (AddOrUpdateJiraIntegrationLinkModel) o; + return Objects.equals(this.jiraJwtToken, addOrUpdateJiraIntegrationLinkModel.jiraJwtToken) && + Objects.equals(this.clientKey, addOrUpdateJiraIntegrationLinkModel.clientKey) && + Objects.equals(this.description, addOrUpdateJiraIntegrationLinkModel.description) && + Objects.equals(this.url, addOrUpdateJiraIntegrationLinkModel.url)&& + Objects.equals(this.additionalProperties, addOrUpdateJiraIntegrationLinkModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(jiraJwtToken, clientKey, description, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("jiraJwtToken"); - openapiFields.add("clientKey"); - openapiFields.add("description"); - openapiFields.add("url"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("jiraJwtToken"); - openapiRequiredFields.add("clientKey"); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddOrUpdateJiraIntegrationLinkModel {\n"); + sb.append(" jiraJwtToken: ").append(toIndentedString(jiraJwtToken)).append("\n"); + sb.append(" clientKey: ").append(toIndentedString(clientKey)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * AddOrUpdateJiraIntegrationLinkModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!AddOrUpdateJiraIntegrationLinkModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in AddOrUpdateJiraIntegrationLinkModel" - + " is not found in the empty JSON string", - AddOrUpdateJiraIntegrationLinkModel.openapiRequiredFields - .toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("jiraJwtToken"); + openapiFields.add("clientKey"); + openapiFields.add("description"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("jiraJwtToken"); + openapiRequiredFields.add("clientKey"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddOrUpdateJiraIntegrationLinkModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddOrUpdateJiraIntegrationLinkModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AddOrUpdateJiraIntegrationLinkModel is not found in the empty JSON string", AddOrUpdateJiraIntegrationLinkModel.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AddOrUpdateJiraIntegrationLinkModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `AddOrUpdateJiraIntegrationLinkModel` properties. JSON:" - + " %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : AddOrUpdateJiraIntegrationLinkModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddOrUpdateJiraIntegrationLinkModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("jiraJwtToken").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `jiraJwtToken` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("jiraJwtToken").toString())); - } - if (!jsonObj.get("clientKey").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `clientKey` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("clientKey").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) - && !jsonObj.get("url").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `url` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("url").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AddOrUpdateJiraIntegrationLinkModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AddOrUpdateJiraIntegrationLinkModel' and - // its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(AddOrUpdateJiraIntegrationLinkModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, AddOrUpdateJiraIntegrationLinkModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AddOrUpdateJiraIntegrationLinkModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of AddOrUpdateJiraIntegrationLinkModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of AddOrUpdateJiraIntegrationLinkModel - * @throws IOException if the JSON string is invalid with respect to - * AddOrUpdateJiraIntegrationLinkModel - */ - public static AddOrUpdateJiraIntegrationLinkModel fromJson(String jsonString) - throws IOException { - return JSON.getGson().fromJson(jsonString, AddOrUpdateJiraIntegrationLinkModel.class); - } - - /** - * Convert an instance of AddOrUpdateJiraIntegrationLinkModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("jiraJwtToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jiraJwtToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jiraJwtToken").toString())); + } + if (!jsonObj.get("clientKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `clientKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clientKey").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddOrUpdateJiraIntegrationLinkModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddOrUpdateJiraIntegrationLinkModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AddOrUpdateJiraIntegrationLinkModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AddOrUpdateJiraIntegrationLinkModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AddOrUpdateJiraIntegrationLinkModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AddOrUpdateJiraIntegrationLinkModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of AddOrUpdateJiraIntegrationLinkModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddOrUpdateJiraIntegrationLinkModel + * @throws IOException if the JSON string is invalid with respect to AddOrUpdateJiraIntegrationLinkModel + */ + public static AddOrUpdateJiraIntegrationLinkModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddOrUpdateJiraIntegrationLinkModel.class); + } + + /** + * Convert an instance of AddOrUpdateJiraIntegrationLinkModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/AuditLogItemModel.java b/src/main/java/com/configcat/publicapi/java/client/model/AuditLogItemModel.java index be009b5..a16fdc4 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/AuditLogItemModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/AuditLogItemModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,583 +10,604 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.AuditLogType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** AuditLogItemModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class AuditLogItemModel { - public static final String SERIALIZED_NAME_AUDIT_LOG_ID = "auditLogId"; - - @SerializedName(SERIALIZED_NAME_AUDIT_LOG_ID) - private Long auditLogId; - - public static final String SERIALIZED_NAME_AUDIT_LOG_DATE_TIME = "auditLogDateTime"; - - @SerializedName(SERIALIZED_NAME_AUDIT_LOG_DATE_TIME) - private OffsetDateTime auditLogDateTime; - - public static final String SERIALIZED_NAME_AUDIT_LOG_TYPE_ENUM = "auditLogTypeEnum"; - - @SerializedName(SERIALIZED_NAME_AUDIT_LOG_TYPE_ENUM) - private AuditLogType auditLogTypeEnum; - - public static final String SERIALIZED_NAME_CHANGE_SET_ID = "changeSetId"; - - @SerializedName(SERIALIZED_NAME_CHANGE_SET_ID) - private UUID changeSetId; - - public static final String SERIALIZED_NAME_TRUNCATED = "truncated"; - - @SerializedName(SERIALIZED_NAME_TRUNCATED) - private Boolean truncated; - - public static final String SERIALIZED_NAME_AUDIT_LOG_TYPE = "auditLogType"; - - @SerializedName(SERIALIZED_NAME_AUDIT_LOG_TYPE) - private String auditLogType; - - public static final String SERIALIZED_NAME_USER_EMAIL = "userEmail"; - - @SerializedName(SERIALIZED_NAME_USER_EMAIL) - private String userEmail; - - public static final String SERIALIZED_NAME_USER_NAME = "userName"; - - @SerializedName(SERIALIZED_NAME_USER_NAME) - private String userName; - - public static final String SERIALIZED_NAME_WHERE = "where"; - - @SerializedName(SERIALIZED_NAME_WHERE) - private String where; - - public static final String SERIALIZED_NAME_WHY = "why"; - @SerializedName(SERIALIZED_NAME_WHY) - private String why; - - public static final String SERIALIZED_NAME_ACTION_TARGET = "actionTarget"; - - @SerializedName(SERIALIZED_NAME_ACTION_TARGET) - private String actionTarget; - - public static final String SERIALIZED_NAME_DETAILS = "details"; - - @SerializedName(SERIALIZED_NAME_DETAILS) - private String details; - - public AuditLogItemModel() {} - - public AuditLogItemModel auditLogId(Long auditLogId) { - this.auditLogId = auditLogId; - return this; - } - - /** - * Get auditLogId - * - * @return auditLogId - */ - @javax.annotation.Nullable - public Long getAuditLogId() { - return auditLogId; - } - - public void setAuditLogId(Long auditLogId) { - this.auditLogId = auditLogId; - } - - public AuditLogItemModel auditLogDateTime(OffsetDateTime auditLogDateTime) { - this.auditLogDateTime = auditLogDateTime; - return this; - } - - /** - * Get auditLogDateTime - * - * @return auditLogDateTime - */ - @javax.annotation.Nullable - public OffsetDateTime getAuditLogDateTime() { - return auditLogDateTime; - } - - public void setAuditLogDateTime(OffsetDateTime auditLogDateTime) { - this.auditLogDateTime = auditLogDateTime; - } - - public AuditLogItemModel auditLogTypeEnum(AuditLogType auditLogTypeEnum) { - this.auditLogTypeEnum = auditLogTypeEnum; - return this; - } - - /** - * Get auditLogTypeEnum - * - * @return auditLogTypeEnum - */ - @javax.annotation.Nullable - public AuditLogType getAuditLogTypeEnum() { - return auditLogTypeEnum; - } - - public void setAuditLogTypeEnum(AuditLogType auditLogTypeEnum) { - this.auditLogTypeEnum = auditLogTypeEnum; - } - - public AuditLogItemModel changeSetId(UUID changeSetId) { - this.changeSetId = changeSetId; - return this; - } - - /** - * Get changeSetId - * - * @return changeSetId - */ - @javax.annotation.Nullable - public UUID getChangeSetId() { - return changeSetId; - } - - public void setChangeSetId(UUID changeSetId) { - this.changeSetId = changeSetId; - } - - public AuditLogItemModel truncated(Boolean truncated) { - this.truncated = truncated; - return this; - } - - /** - * Get truncated - * - * @return truncated - */ - @javax.annotation.Nullable - public Boolean getTruncated() { - return truncated; - } - - public void setTruncated(Boolean truncated) { - this.truncated = truncated; - } - - public AuditLogItemModel auditLogType(String auditLogType) { - this.auditLogType = auditLogType; - return this; - } - - /** - * Get auditLogType - * - * @return auditLogType - */ - @javax.annotation.Nullable - public String getAuditLogType() { - return auditLogType; - } - - public void setAuditLogType(String auditLogType) { - this.auditLogType = auditLogType; - } - - public AuditLogItemModel userEmail(String userEmail) { - this.userEmail = userEmail; - return this; - } - - /** - * Get userEmail - * - * @return userEmail - */ - @javax.annotation.Nullable - public String getUserEmail() { - return userEmail; - } - - public void setUserEmail(String userEmail) { - this.userEmail = userEmail; - } - - public AuditLogItemModel userName(String userName) { - this.userName = userName; - return this; - } - - /** - * Get userName - * - * @return userName - */ - @javax.annotation.Nullable - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public AuditLogItemModel where(String where) { - this.where = where; - return this; - } - - /** - * Get where - * - * @return where - */ - @javax.annotation.Nullable - public String getWhere() { - return where; - } - - public void setWhere(String where) { - this.where = where; - } - - public AuditLogItemModel why(String why) { - this.why = why; - return this; - } - - /** - * Get why - * - * @return why - */ - @javax.annotation.Nullable - public String getWhy() { - return why; - } - - public void setWhy(String why) { - this.why = why; - } - - public AuditLogItemModel actionTarget(String actionTarget) { - this.actionTarget = actionTarget; - return this; - } - - /** - * Get actionTarget - * - * @return actionTarget - */ - @javax.annotation.Nullable - public String getActionTarget() { - return actionTarget; - } - - public void setActionTarget(String actionTarget) { - this.actionTarget = actionTarget; - } - - public AuditLogItemModel details(String details) { - this.details = details; - return this; - } - - /** - * Get details - * - * @return details - */ - @javax.annotation.Nullable - public String getDetails() { - return details; - } - - public void setDetails(String details) { - this.details = details; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - AuditLogItemModel auditLogItemModel = (AuditLogItemModel) o; - return Objects.equals(this.auditLogId, auditLogItemModel.auditLogId) - && Objects.equals(this.auditLogDateTime, auditLogItemModel.auditLogDateTime) - && Objects.equals(this.auditLogTypeEnum, auditLogItemModel.auditLogTypeEnum) - && Objects.equals(this.changeSetId, auditLogItemModel.changeSetId) - && Objects.equals(this.truncated, auditLogItemModel.truncated) - && Objects.equals(this.auditLogType, auditLogItemModel.auditLogType) - && Objects.equals(this.userEmail, auditLogItemModel.userEmail) - && Objects.equals(this.userName, auditLogItemModel.userName) - && Objects.equals(this.where, auditLogItemModel.where) - && Objects.equals(this.why, auditLogItemModel.why) - && Objects.equals(this.actionTarget, auditLogItemModel.actionTarget) - && Objects.equals(this.details, auditLogItemModel.details); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - auditLogId, - auditLogDateTime, - auditLogTypeEnum, - changeSetId, - truncated, - auditLogType, - userEmail, - userName, - where, - why, - actionTarget, - details); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class AuditLogItemModel {\n"); - sb.append(" auditLogId: ").append(toIndentedString(auditLogId)).append("\n"); - sb.append(" auditLogDateTime: ").append(toIndentedString(auditLogDateTime)).append("\n"); - sb.append(" auditLogTypeEnum: ").append(toIndentedString(auditLogTypeEnum)).append("\n"); - sb.append(" changeSetId: ").append(toIndentedString(changeSetId)).append("\n"); - sb.append(" truncated: ").append(toIndentedString(truncated)).append("\n"); - sb.append(" auditLogType: ").append(toIndentedString(auditLogType)).append("\n"); - sb.append(" userEmail: ").append(toIndentedString(userEmail)).append("\n"); - sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); - sb.append(" where: ").append(toIndentedString(where)).append("\n"); - sb.append(" why: ").append(toIndentedString(why)).append("\n"); - sb.append(" actionTarget: ").append(toIndentedString(actionTarget)).append("\n"); - sb.append(" details: ").append(toIndentedString(details)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("auditLogId"); - openapiFields.add("auditLogDateTime"); - openapiFields.add("auditLogTypeEnum"); - openapiFields.add("changeSetId"); - openapiFields.add("truncated"); - openapiFields.add("auditLogType"); - openapiFields.add("userEmail"); - openapiFields.add("userName"); - openapiFields.add("where"); - openapiFields.add("why"); - openapiFields.add("actionTarget"); - openapiFields.add("details"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to AuditLogItemModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!AuditLogItemModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in AuditLogItemModel is not found in the" - + " empty JSON string", - AuditLogItemModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!AuditLogItemModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `AuditLogItemModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * AuditLogItemModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class AuditLogItemModel { + public static final String SERIALIZED_NAME_AUDIT_LOG_ID = "auditLogId"; + @SerializedName(SERIALIZED_NAME_AUDIT_LOG_ID) + private Long auditLogId; + + public static final String SERIALIZED_NAME_AUDIT_LOG_DATE_TIME = "auditLogDateTime"; + @SerializedName(SERIALIZED_NAME_AUDIT_LOG_DATE_TIME) + private OffsetDateTime auditLogDateTime; + + public static final String SERIALIZED_NAME_AUDIT_LOG_TYPE_ENUM = "auditLogTypeEnum"; + @SerializedName(SERIALIZED_NAME_AUDIT_LOG_TYPE_ENUM) + private AuditLogType auditLogTypeEnum; + + public static final String SERIALIZED_NAME_CHANGE_SET_ID = "changeSetId"; + @SerializedName(SERIALIZED_NAME_CHANGE_SET_ID) + private UUID changeSetId; + + public static final String SERIALIZED_NAME_TRUNCATED = "truncated"; + @SerializedName(SERIALIZED_NAME_TRUNCATED) + private Boolean truncated; + + public static final String SERIALIZED_NAME_AUDIT_LOG_TYPE = "auditLogType"; + @SerializedName(SERIALIZED_NAME_AUDIT_LOG_TYPE) + private String auditLogType; + + public static final String SERIALIZED_NAME_USER_EMAIL = "userEmail"; + @SerializedName(SERIALIZED_NAME_USER_EMAIL) + private String userEmail; + + public static final String SERIALIZED_NAME_USER_NAME = "userName"; + @SerializedName(SERIALIZED_NAME_USER_NAME) + private String userName; + + public static final String SERIALIZED_NAME_WHERE = "where"; + @SerializedName(SERIALIZED_NAME_WHERE) + private String where; + + public static final String SERIALIZED_NAME_WHY = "why"; + @SerializedName(SERIALIZED_NAME_WHY) + private String why; + + public static final String SERIALIZED_NAME_ACTION_TARGET = "actionTarget"; + @SerializedName(SERIALIZED_NAME_ACTION_TARGET) + private String actionTarget; + + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + private String details; + + public AuditLogItemModel() { + } + + public AuditLogItemModel auditLogId(Long auditLogId) { + this.auditLogId = auditLogId; + return this; + } + + /** + * Get auditLogId + * @return auditLogId + */ + @javax.annotation.Nullable + public Long getAuditLogId() { + return auditLogId; + } + + public void setAuditLogId(Long auditLogId) { + this.auditLogId = auditLogId; + } + + + public AuditLogItemModel auditLogDateTime(OffsetDateTime auditLogDateTime) { + this.auditLogDateTime = auditLogDateTime; + return this; + } + + /** + * Get auditLogDateTime + * @return auditLogDateTime + */ + @javax.annotation.Nullable + public OffsetDateTime getAuditLogDateTime() { + return auditLogDateTime; + } + + public void setAuditLogDateTime(OffsetDateTime auditLogDateTime) { + this.auditLogDateTime = auditLogDateTime; + } + + + public AuditLogItemModel auditLogTypeEnum(AuditLogType auditLogTypeEnum) { + this.auditLogTypeEnum = auditLogTypeEnum; + return this; + } + + /** + * Get auditLogTypeEnum + * @return auditLogTypeEnum + */ + @javax.annotation.Nullable + public AuditLogType getAuditLogTypeEnum() { + return auditLogTypeEnum; + } + + public void setAuditLogTypeEnum(AuditLogType auditLogTypeEnum) { + this.auditLogTypeEnum = auditLogTypeEnum; + } + + + public AuditLogItemModel changeSetId(UUID changeSetId) { + this.changeSetId = changeSetId; + return this; + } + + /** + * Get changeSetId + * @return changeSetId + */ + @javax.annotation.Nullable + public UUID getChangeSetId() { + return changeSetId; + } + + public void setChangeSetId(UUID changeSetId) { + this.changeSetId = changeSetId; + } + + + public AuditLogItemModel truncated(Boolean truncated) { + this.truncated = truncated; + return this; + } + + /** + * Get truncated + * @return truncated + */ + @javax.annotation.Nullable + public Boolean getTruncated() { + return truncated; + } + + public void setTruncated(Boolean truncated) { + this.truncated = truncated; + } + + + public AuditLogItemModel auditLogType(String auditLogType) { + this.auditLogType = auditLogType; + return this; + } + + /** + * Get auditLogType + * @return auditLogType + */ + @javax.annotation.Nullable + public String getAuditLogType() { + return auditLogType; + } + + public void setAuditLogType(String auditLogType) { + this.auditLogType = auditLogType; + } + + + public AuditLogItemModel userEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Get userEmail + * @return userEmail + */ + @javax.annotation.Nullable + public String getUserEmail() { + return userEmail; + } + + public void setUserEmail(String userEmail) { + this.userEmail = userEmail; + } + + + public AuditLogItemModel userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * @return userName + */ + @javax.annotation.Nullable + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + + public AuditLogItemModel where(String where) { + this.where = where; + return this; + } + + /** + * Get where + * @return where + */ + @javax.annotation.Nullable + public String getWhere() { + return where; + } + + public void setWhere(String where) { + this.where = where; + } + + + public AuditLogItemModel why(String why) { + this.why = why; + return this; + } + + /** + * Get why + * @return why + */ + @javax.annotation.Nullable + public String getWhy() { + return why; + } + + public void setWhy(String why) { + this.why = why; + } + + + public AuditLogItemModel actionTarget(String actionTarget) { + this.actionTarget = actionTarget; + return this; + } + + /** + * Get actionTarget + * @return actionTarget + */ + @javax.annotation.Nullable + public String getActionTarget() { + return actionTarget; + } + + public void setActionTarget(String actionTarget) { + this.actionTarget = actionTarget; + } + + + public AuditLogItemModel details(String details) { + this.details = details; + return this; + } + + /** + * Get details + * @return details + */ + @javax.annotation.Nullable + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the AuditLogItemModel instance itself + */ + public AuditLogItemModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuditLogItemModel auditLogItemModel = (AuditLogItemModel) o; + return Objects.equals(this.auditLogId, auditLogItemModel.auditLogId) && + Objects.equals(this.auditLogDateTime, auditLogItemModel.auditLogDateTime) && + Objects.equals(this.auditLogTypeEnum, auditLogItemModel.auditLogTypeEnum) && + Objects.equals(this.changeSetId, auditLogItemModel.changeSetId) && + Objects.equals(this.truncated, auditLogItemModel.truncated) && + Objects.equals(this.auditLogType, auditLogItemModel.auditLogType) && + Objects.equals(this.userEmail, auditLogItemModel.userEmail) && + Objects.equals(this.userName, auditLogItemModel.userName) && + Objects.equals(this.where, auditLogItemModel.where) && + Objects.equals(this.why, auditLogItemModel.why) && + Objects.equals(this.actionTarget, auditLogItemModel.actionTarget) && + Objects.equals(this.details, auditLogItemModel.details)&& + Objects.equals(this.additionalProperties, auditLogItemModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(auditLogId, auditLogDateTime, auditLogTypeEnum, changeSetId, truncated, auditLogType, userEmail, userName, where, why, actionTarget, details, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuditLogItemModel {\n"); + sb.append(" auditLogId: ").append(toIndentedString(auditLogId)).append("\n"); + sb.append(" auditLogDateTime: ").append(toIndentedString(auditLogDateTime)).append("\n"); + sb.append(" auditLogTypeEnum: ").append(toIndentedString(auditLogTypeEnum)).append("\n"); + sb.append(" changeSetId: ").append(toIndentedString(changeSetId)).append("\n"); + sb.append(" truncated: ").append(toIndentedString(truncated)).append("\n"); + sb.append(" auditLogType: ").append(toIndentedString(auditLogType)).append("\n"); + sb.append(" userEmail: ").append(toIndentedString(userEmail)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" where: ").append(toIndentedString(where)).append("\n"); + sb.append(" why: ").append(toIndentedString(why)).append("\n"); + sb.append(" actionTarget: ").append(toIndentedString(actionTarget)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("auditLogId"); + openapiFields.add("auditLogDateTime"); + openapiFields.add("auditLogTypeEnum"); + openapiFields.add("changeSetId"); + openapiFields.add("truncated"); + openapiFields.add("auditLogType"); + openapiFields.add("userEmail"); + openapiFields.add("userName"); + openapiFields.add("where"); + openapiFields.add("why"); + openapiFields.add("actionTarget"); + openapiFields.add("details"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuditLogItemModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuditLogItemModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuditLogItemModel is not found in the empty JSON string", AuditLogItemModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `auditLogTypeEnum` - if (jsonObj.get("auditLogTypeEnum") != null - && !jsonObj.get("auditLogTypeEnum").isJsonNull()) { - AuditLogType.validateJsonElement(jsonObj.get("auditLogTypeEnum")); - } - if ((jsonObj.get("changeSetId") != null && !jsonObj.get("changeSetId").isJsonNull()) - && !jsonObj.get("changeSetId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `changeSetId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("changeSetId").toString())); - } - if ((jsonObj.get("auditLogType") != null && !jsonObj.get("auditLogType").isJsonNull()) - && !jsonObj.get("auditLogType").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `auditLogType` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("auditLogType").toString())); - } - if ((jsonObj.get("userEmail") != null && !jsonObj.get("userEmail").isJsonNull()) - && !jsonObj.get("userEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `userEmail` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("userEmail").toString())); - } - if ((jsonObj.get("userName") != null && !jsonObj.get("userName").isJsonNull()) - && !jsonObj.get("userName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `userName` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("userName").toString())); - } - if ((jsonObj.get("where") != null && !jsonObj.get("where").isJsonNull()) - && !jsonObj.get("where").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `where` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("where").toString())); - } - if ((jsonObj.get("why") != null && !jsonObj.get("why").isJsonNull()) - && !jsonObj.get("why").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `why` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("why").toString())); - } - if ((jsonObj.get("actionTarget") != null && !jsonObj.get("actionTarget").isJsonNull()) - && !jsonObj.get("actionTarget").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `actionTarget` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("actionTarget").toString())); - } - if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) - && !jsonObj.get("details").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `details` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("details").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!AuditLogItemModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'AuditLogItemModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(AuditLogItemModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, AuditLogItemModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public AuditLogItemModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of AuditLogItemModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of AuditLogItemModel - * @throws IOException if the JSON string is invalid with respect to AuditLogItemModel - */ - public static AuditLogItemModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, AuditLogItemModel.class); - } - - /** - * Convert an instance of AuditLogItemModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + // validate the optional field `auditLogTypeEnum` + if (jsonObj.get("auditLogTypeEnum") != null && !jsonObj.get("auditLogTypeEnum").isJsonNull()) { + AuditLogType.validateJsonElement(jsonObj.get("auditLogTypeEnum")); + } + if ((jsonObj.get("changeSetId") != null && !jsonObj.get("changeSetId").isJsonNull()) && !jsonObj.get("changeSetId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `changeSetId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("changeSetId").toString())); + } + if ((jsonObj.get("auditLogType") != null && !jsonObj.get("auditLogType").isJsonNull()) && !jsonObj.get("auditLogType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `auditLogType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("auditLogType").toString())); + } + if ((jsonObj.get("userEmail") != null && !jsonObj.get("userEmail").isJsonNull()) && !jsonObj.get("userEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userEmail").toString())); + } + if ((jsonObj.get("userName") != null && !jsonObj.get("userName").isJsonNull()) && !jsonObj.get("userName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userName").toString())); + } + if ((jsonObj.get("where") != null && !jsonObj.get("where").isJsonNull()) && !jsonObj.get("where").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `where` to be a primitive type in the JSON string but got `%s`", jsonObj.get("where").toString())); + } + if ((jsonObj.get("why") != null && !jsonObj.get("why").isJsonNull()) && !jsonObj.get("why").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `why` to be a primitive type in the JSON string but got `%s`", jsonObj.get("why").toString())); + } + if ((jsonObj.get("actionTarget") != null && !jsonObj.get("actionTarget").isJsonNull()) && !jsonObj.get("actionTarget").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `actionTarget` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionTarget").toString())); + } + if ((jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) && !jsonObj.get("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuditLogItemModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuditLogItemModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuditLogItemModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuditLogItemModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public AuditLogItemModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + AuditLogItemModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuditLogItemModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuditLogItemModel + * @throws IOException if the JSON string is invalid with respect to AuditLogItemModel + */ + public static AuditLogItemModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuditLogItemModel.class); + } + + /** + * Convert an instance of AuditLogItemModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/AuditLogType.java b/src/main/java/com/configcat/publicapi/java/client/model/AuditLogType.java index 70ce8bc..d3c7a56 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/AuditLogType.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/AuditLogType.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,217 +10,243 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Gets or Sets AuditLogType */ +/** + * Gets or Sets AuditLogType + */ @JsonAdapter(AuditLogType.Adapter.class) public enum AuditLogType { - PRODUCT_CREATED("productCreated"), - - PRODUCT_CHANGED("productChanged"), - - PRODUCT_OWNERSHIP_TRANSFERRED("productOwnershipTransferred"), - - PRODUCT_DELETED("productDeleted"), - - PRODUCTS_REORDERED("productsReordered"), - - TEAM_MEMBER_INVITED("teamMemberInvited"), - - TEAM_MEMBER_INVITATION_REVOKED("teamMemberInvitationRevoked"), - - TEAM_MEMBER_JOINED("teamMemberJoined"), - - TEAM_MEMBER_PERMISSION_GROUP_CHANGED("teamMemberPermissionGroupChanged"), - - TEAM_MEMBER_REMOVED("teamMemberRemoved"), - - TEAM_MEMBER_LEFT("teamMemberLeft"), - - TEAM_MEMBER_INVITATION_CHANGED("teamMemberInvitationChanged"), - - TEAM_MEMBER_INVITATION_RESENT("teamMemberInvitationResent"), - - TEAM_MEMBER_INVITATION_REJECTED("teamMemberInvitationRejected"), - - CONFIG_CREATED("configCreated"), - - CONFIG_CHANGED("configChanged"), - - CONFIG_DELETED("configDeleted"), - - CONFIGS_REORDERED("configsReordered"), - - ENVIRONMENT_CREATED("environmentCreated"), - - ENVIRONMENT_CHANGED("environmentChanged"), - - ENVIRONMENT_DELETED("environmentDeleted"), - - ENVIRONMENTS_REORDERED("environmentsReordered"), - - SETTING_CREATED("settingCreated"), - - SETTING_CHANGED("settingChanged"), - - SETTING_DELETED("settingDeleted"), - - SETTINGS_REORDERED("settingsReordered"), - - SETTING_VALUE_CHANGED("settingValueChanged"), - - WEB_HOOK_CREATED("webHookCreated"), - - WEB_HOOK_CHANGED("webHookChanged"), - - WEB_HOOK_DELETED("webHookDeleted"), - - PERMISSION_GROUP_CREATED("permissionGroupCreated"), - - PERMISSION_GROUP_CHANGED("permissionGroupChanged"), - - PERMISSION_GROUP_DELETED("permissionGroupDeleted"), - - PERMISSION_GROUP_DEFAULT("permissionGroupDefault"), - - API_KEY_ADDED("apiKeyAdded"), - - API_KEY_REMOVED("apiKeyRemoved"), - - INTEGRATION_ADDED("integrationAdded"), - - INTEGRATION_CHANGED("integrationChanged"), - - INTEGRATION_REMOVED("integrationRemoved"), - - API_KEY_CONNECTED("apiKeyConnected"), - - INTEGRATION_LINK_ADDED("integrationLinkAdded"), - - INTEGRATION_LINK_REMOVED("integrationLinkRemoved"), - - ORGANIZATION_ADDED("organizationAdded"), - - ORGANIZATION_REMOVED("organizationRemoved"), - - ORGANIZATION_CHANGED("organizationChanged"), - - ORGANIZATION_SUBSCRIPTION_TYPE_CHANGED("organizationSubscriptionTypeChanged"), - - ORGANIZATION_ADMIN_CHANGED("organizationAdminChanged"), - - ORGANIZATION_ADMIN_LEFT("organizationAdminLeft"), - - TWO_FACTOR_DISABLED_FOR_MEMBER("twoFactorDisabledForMember"), - - TAG_ADDED("tagAdded"), - - TAG_CHANGED("tagChanged"), - - TAG_REMOVED("tagRemoved"), - - SETTING_TAG_ADDED("settingTagAdded"), - - SETTING_TAG_REMOVED("settingTagRemoved"), - - PUBLIC_API_ACCESS_TOKEN_ADDED("publicApiAccessTokenAdded"), - - PUBLIC_API_ACCESS_TOKEN_REMOVED("publicApiAccessTokenRemoved"), - - DOMAIN_ADDED("domainAdded"), - - DOMAIN_VERIFIED("domainVerified"), - - DOMAIN_REMOVED("domainRemoved"), - - DOMAIN_SAML_CONFIGURED("domainSamlConfigured"), - - DOMAIN_SAML_DELETED("domainSamlDeleted"), - - AUTO_PROVISIONING_CONFIGURATION_CHANGED("autoProvisioningConfigurationChanged"), - - SAML_IDP_CONFIGURATION_ADDED("samlIdpConfigurationAdded"), - - SAML_IDP_CONFIGURATION_REMOVED("samlIdpConfigurationRemoved"), - - SAML_IDP_CONFIGURATION_UPDATED("samlIdpConfigurationUpdated"), - - ORGANIZATION_MEMBER_JOINED("organizationMemberJoined"), - - ORGANIZATION_MEMBER_PRODUCT_JOIN_REQUESTED("organizationMemberProductJoinRequested"), - - ORGANIZATION_MEMBER_PRODUCT_JOIN_REQUEST_REJECTED( - "organizationMemberProductJoinRequestRejected"), - - ORGANIZATION_MEMBER_PRODUCT_JOIN_REQUEST_APPROVED( - "organizationMemberProductJoinRequestApproved"), - - ORGANIZATION_MEMBER_REMOVED("organizationMemberRemoved"), - - CODE_REFERENCES_UPLOADED("codeReferencesUploaded"), - - CODE_REFERENCE_DELETED("codeReferenceDeleted"), - - CODE_REFERENCE_STALE_BRANCH_DELETED("codeReferenceStaleBranchDeleted"), - - SEGMENT_CREATED("segmentCreated"), - - SEGMENT_CHANGED("segmentChanged"), - - SEGMENT_DELETED("segmentDeleted"), - - WEBHOOK_SIGNING_KEY_DELETED("webhookSigningKeyDeleted"), - - WEBHOOK_SIGNING_KEY_CREATED("webhookSigningKeyCreated"); - - private String value; - - AuditLogType(String value) { - this.value = value; - } - - public String getValue() { - return value; + + PRODUCT_CREATED("productCreated"), + + PRODUCT_CHANGED("productChanged"), + + PRODUCT_OWNERSHIP_TRANSFERRED("productOwnershipTransferred"), + + PRODUCT_DELETED("productDeleted"), + + PRODUCTS_REORDERED("productsReordered"), + + TEAM_MEMBER_INVITED("teamMemberInvited"), + + TEAM_MEMBER_INVITATION_REVOKED("teamMemberInvitationRevoked"), + + TEAM_MEMBER_JOINED("teamMemberJoined"), + + TEAM_MEMBER_PERMISSION_GROUP_CHANGED("teamMemberPermissionGroupChanged"), + + TEAM_MEMBER_REMOVED("teamMemberRemoved"), + + TEAM_MEMBER_LEFT("teamMemberLeft"), + + TEAM_MEMBER_INVITATION_CHANGED("teamMemberInvitationChanged"), + + TEAM_MEMBER_INVITATION_RESENT("teamMemberInvitationResent"), + + TEAM_MEMBER_INVITATION_REJECTED("teamMemberInvitationRejected"), + + CONFIG_CREATED("configCreated"), + + CONFIG_CHANGED("configChanged"), + + CONFIG_DELETED("configDeleted"), + + CONFIGS_REORDERED("configsReordered"), + + ENVIRONMENT_CREATED("environmentCreated"), + + ENVIRONMENT_CHANGED("environmentChanged"), + + ENVIRONMENT_DELETED("environmentDeleted"), + + ENVIRONMENTS_REORDERED("environmentsReordered"), + + SETTING_CREATED("settingCreated"), + + SETTING_CHANGED("settingChanged"), + + SETTING_DELETED("settingDeleted"), + + SETTINGS_REORDERED("settingsReordered"), + + SETTING_VALUE_CHANGED("settingValueChanged"), + + WEB_HOOK_CREATED("webHookCreated"), + + WEB_HOOK_CHANGED("webHookChanged"), + + WEB_HOOK_DELETED("webHookDeleted"), + + PERMISSION_GROUP_CREATED("permissionGroupCreated"), + + PERMISSION_GROUP_CHANGED("permissionGroupChanged"), + + PERMISSION_GROUP_DELETED("permissionGroupDeleted"), + + PERMISSION_GROUP_DEFAULT("permissionGroupDefault"), + + API_KEY_ADDED("apiKeyAdded"), + + API_KEY_REMOVED("apiKeyRemoved"), + + INTEGRATION_ADDED("integrationAdded"), + + INTEGRATION_CHANGED("integrationChanged"), + + INTEGRATION_REMOVED("integrationRemoved"), + + API_KEY_CONNECTED("apiKeyConnected"), + + INTEGRATION_LINK_ADDED("integrationLinkAdded"), + + INTEGRATION_LINK_REMOVED("integrationLinkRemoved"), + + ORGANIZATION_ADDED("organizationAdded"), + + ORGANIZATION_REMOVED("organizationRemoved"), + + ORGANIZATION_CHANGED("organizationChanged"), + + ORGANIZATION_SUBSCRIPTION_TYPE_CHANGED("organizationSubscriptionTypeChanged"), + + ORGANIZATION_ADMIN_CHANGED("organizationAdminChanged"), + + ORGANIZATION_ADMIN_LEFT("organizationAdminLeft"), + + TWO_FACTOR_DISABLED_FOR_MEMBER("twoFactorDisabledForMember"), + + TAG_ADDED("tagAdded"), + + TAG_CHANGED("tagChanged"), + + TAG_REMOVED("tagRemoved"), + + SETTING_TAG_ADDED("settingTagAdded"), + + SETTING_TAG_REMOVED("settingTagRemoved"), + + PUBLIC_API_ACCESS_TOKEN_ADDED("publicApiAccessTokenAdded"), + + PUBLIC_API_ACCESS_TOKEN_REMOVED("publicApiAccessTokenRemoved"), + + DOMAIN_ADDED("domainAdded"), + + DOMAIN_VERIFIED("domainVerified"), + + DOMAIN_REMOVED("domainRemoved"), + + DOMAIN_SAML_CONFIGURED("domainSamlConfigured"), + + DOMAIN_SAML_DELETED("domainSamlDeleted"), + + AUTO_PROVISIONING_CONFIGURATION_CHANGED("autoProvisioningConfigurationChanged"), + + SAML_IDP_CONFIGURATION_ADDED("samlIdpConfigurationAdded"), + + SAML_IDP_CONFIGURATION_REMOVED("samlIdpConfigurationRemoved"), + + SAML_IDP_CONFIGURATION_UPDATED("samlIdpConfigurationUpdated"), + + AUTO_PROVISIONING_ENABLED_CHANGED("autoProvisioningEnabledChanged"), + + ORGANIZATION_MEMBER_JOINED("organizationMemberJoined"), + + ORGANIZATION_MEMBER_PRODUCT_JOIN_REQUESTED("organizationMemberProductJoinRequested"), + + ORGANIZATION_MEMBER_PRODUCT_JOIN_REQUEST_REJECTED("organizationMemberProductJoinRequestRejected"), + + ORGANIZATION_MEMBER_PRODUCT_JOIN_REQUEST_APPROVED("organizationMemberProductJoinRequestApproved"), + + ORGANIZATION_MEMBER_REMOVED("organizationMemberRemoved"), + + CODE_REFERENCES_UPLOADED("codeReferencesUploaded"), + + CODE_REFERENCE_DELETED("codeReferenceDeleted"), + + CODE_REFERENCE_STALE_BRANCH_DELETED("codeReferenceStaleBranchDeleted"), + + SEGMENT_CREATED("segmentCreated"), + + SEGMENT_CHANGED("segmentChanged"), + + SEGMENT_DELETED("segmentDeleted"), + + WEBHOOK_SIGNING_KEY_DELETED("webhookSigningKeyDeleted"), + + WEBHOOK_SIGNING_KEY_CREATED("webhookSigningKeyCreated"), + + USER_PROVISIONING_CONFIGURATION_CHANGED("userProvisioningConfigurationChanged"), + + SYNC_GROUP_PROVISIONING_RULE_CHANGED("syncGroupProvisioningRuleChanged"), + + SYNC_GROUPS_REORDERED("syncGroupsReordered"), + + SYNC_USER_PROVISIONING_ENABLED("syncUserProvisioningEnabled"), + + SYNC_USER_PROVISIONING_DISABLED("syncUserProvisioningDisabled"), + + USER_EMAIL_CHANGED("userEmailChanged"), + + USER_FULL_NAME_CHANGED("userFullNameChanged"), + + USER_DISABLED("userDisabled"), + + AWS_CONNECTED("awsConnected"), + + AWS_DISCONNECTED("awsDisconnected"); + + private String value; + + AuditLogType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static AuditLogType fromValue(String value) { + for (AuditLogType b : AuditLogType.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); + public void write(final JsonWriter jsonWriter, final AuditLogType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static AuditLogType fromValue(String value) { - for (AuditLogType b : AuditLogType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final AuditLogType enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public AuditLogType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return AuditLogType.fromValue(value); - } + @Override + public AuditLogType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AuditLogType.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - AuditLogType.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AuditLogType.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CodeReferenceModel.java b/src/main/java/com/configcat/publicapi/java/client/model/CodeReferenceModel.java index cec7d62..1164cbf 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CodeReferenceModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CodeReferenceModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,481 +10,514 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ReferenceLines; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** CodeReferenceModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CodeReferenceModel { - public static final String SERIALIZED_NAME_BRANCH = "branch"; - - @SerializedName(SERIALIZED_NAME_BRANCH) - private String branch; - - public static final String SERIALIZED_NAME_REFERENCES = "references"; - - @SerializedName(SERIALIZED_NAME_REFERENCES) - private List references; - - public static final String SERIALIZED_NAME_COMMIT_URL = "commitUrl"; - - @SerializedName(SERIALIZED_NAME_COMMIT_URL) - private String commitUrl; - - public static final String SERIALIZED_NAME_COMMIT_HASH = "commitHash"; - - @SerializedName(SERIALIZED_NAME_COMMIT_HASH) - private String commitHash; - - public static final String SERIALIZED_NAME_SYNCED_AT = "syncedAt"; - - @SerializedName(SERIALIZED_NAME_SYNCED_AT) - private OffsetDateTime syncedAt; - - public static final String SERIALIZED_NAME_REPOSITORY = "repository"; - - @SerializedName(SERIALIZED_NAME_REPOSITORY) - private String repository; - - public static final String SERIALIZED_NAME_CODE_REFERENCE_ID = "codeReferenceId"; - - @SerializedName(SERIALIZED_NAME_CODE_REFERENCE_ID) - private UUID codeReferenceId; - - public static final String SERIALIZED_NAME_UPLOADER = "uploader"; - - @SerializedName(SERIALIZED_NAME_UPLOADER) - private String uploader; - - public CodeReferenceModel() {} - - public CodeReferenceModel branch(String branch) { - this.branch = branch; - return this; - } - - /** - * The source control branch on where the scan was performed. (Source of the branch selector on - * the ConfigCat Dashboard) - * - * @return branch - */ - @javax.annotation.Nullable - public String getBranch() { - return branch; - } - - public void setBranch(String branch) { - this.branch = branch; - } - - public CodeReferenceModel references(List references) { - this.references = references; - return this; - } - - public CodeReferenceModel addReferencesItem(ReferenceLines referencesItem) { - if (this.references == null) { - this.references = new ArrayList<>(); - } - this.references.add(referencesItem); - return this; - } - - /** - * The actual references to the given Feature Flag or Setting. - * - * @return references - */ - @javax.annotation.Nullable - public List getReferences() { - return references; - } - - public void setReferences(List references) { - this.references = references; - } - - public CodeReferenceModel commitUrl(String commitUrl) { - this.commitUrl = commitUrl; - return this; - } - - /** - * The related commit's URL. - * - * @return commitUrl - */ - @javax.annotation.Nullable - public String getCommitUrl() { - return commitUrl; - } - - public void setCommitUrl(String commitUrl) { - this.commitUrl = commitUrl; - } - - public CodeReferenceModel commitHash(String commitHash) { - this.commitHash = commitHash; - return this; - } - - /** - * The related commit's hash. - * - * @return commitHash - */ - @javax.annotation.Nullable - public String getCommitHash() { - return commitHash; - } - public void setCommitHash(String commitHash) { - this.commitHash = commitHash; - } - - public CodeReferenceModel syncedAt(OffsetDateTime syncedAt) { - this.syncedAt = syncedAt; - return this; - } - - /** - * The date and time when the reference report was uploaded. - * - * @return syncedAt - */ - @javax.annotation.Nullable - public OffsetDateTime getSyncedAt() { - return syncedAt; - } - - public void setSyncedAt(OffsetDateTime syncedAt) { - this.syncedAt = syncedAt; - } - - public CodeReferenceModel repository(String repository) { - this.repository = repository; - return this; - } - - /** - * The source control repository that contains the scanned code. - * - * @return repository - */ - @javax.annotation.Nullable - public String getRepository() { - return repository; - } - - public void setRepository(String repository) { - this.repository = repository; - } - - public CodeReferenceModel codeReferenceId(UUID codeReferenceId) { - this.codeReferenceId = codeReferenceId; - return this; - } - - /** - * The identifier of the reference report. - * - * @return codeReferenceId - */ - @javax.annotation.Nullable - public UUID getCodeReferenceId() { - return codeReferenceId; - } - - public void setCodeReferenceId(UUID codeReferenceId) { - this.codeReferenceId = codeReferenceId; - } - - public CodeReferenceModel uploader(String uploader) { - this.uploader = uploader; - return this; - } - - /** - * The code reference scanning tool's name. - * - * @return uploader - */ - @javax.annotation.Nullable - public String getUploader() { - return uploader; - } - - public void setUploader(String uploader) { - this.uploader = uploader; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CodeReferenceModel codeReferenceModel = (CodeReferenceModel) o; - return Objects.equals(this.branch, codeReferenceModel.branch) - && Objects.equals(this.references, codeReferenceModel.references) - && Objects.equals(this.commitUrl, codeReferenceModel.commitUrl) - && Objects.equals(this.commitHash, codeReferenceModel.commitHash) - && Objects.equals(this.syncedAt, codeReferenceModel.syncedAt) - && Objects.equals(this.repository, codeReferenceModel.repository) - && Objects.equals(this.codeReferenceId, codeReferenceModel.codeReferenceId) - && Objects.equals(this.uploader, codeReferenceModel.uploader); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - branch, - references, - commitUrl, - commitHash, - syncedAt, - repository, - codeReferenceId, - uploader); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CodeReferenceModel {\n"); - sb.append(" branch: ").append(toIndentedString(branch)).append("\n"); - sb.append(" references: ").append(toIndentedString(references)).append("\n"); - sb.append(" commitUrl: ").append(toIndentedString(commitUrl)).append("\n"); - sb.append(" commitHash: ").append(toIndentedString(commitHash)).append("\n"); - sb.append(" syncedAt: ").append(toIndentedString(syncedAt)).append("\n"); - sb.append(" repository: ").append(toIndentedString(repository)).append("\n"); - sb.append(" codeReferenceId: ").append(toIndentedString(codeReferenceId)).append("\n"); - sb.append(" uploader: ").append(toIndentedString(uploader)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("branch"); - openapiFields.add("references"); - openapiFields.add("commitUrl"); - openapiFields.add("commitHash"); - openapiFields.add("syncedAt"); - openapiFields.add("repository"); - openapiFields.add("codeReferenceId"); - openapiFields.add("uploader"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CodeReferenceModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CodeReferenceModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CodeReferenceModel is not found in" - + " the empty JSON string", - CodeReferenceModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CodeReferenceModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CodeReferenceModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * CodeReferenceModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CodeReferenceModel { + public static final String SERIALIZED_NAME_BRANCH = "branch"; + @SerializedName(SERIALIZED_NAME_BRANCH) + private String branch; + + public static final String SERIALIZED_NAME_REFERENCES = "references"; + @SerializedName(SERIALIZED_NAME_REFERENCES) + private List references; + + public static final String SERIALIZED_NAME_COMMIT_URL = "commitUrl"; + @SerializedName(SERIALIZED_NAME_COMMIT_URL) + private String commitUrl; + + public static final String SERIALIZED_NAME_COMMIT_HASH = "commitHash"; + @SerializedName(SERIALIZED_NAME_COMMIT_HASH) + private String commitHash; + + public static final String SERIALIZED_NAME_SYNCED_AT = "syncedAt"; + @SerializedName(SERIALIZED_NAME_SYNCED_AT) + private OffsetDateTime syncedAt; + + public static final String SERIALIZED_NAME_REPOSITORY = "repository"; + @SerializedName(SERIALIZED_NAME_REPOSITORY) + private String repository; + + public static final String SERIALIZED_NAME_CODE_REFERENCE_ID = "codeReferenceId"; + @SerializedName(SERIALIZED_NAME_CODE_REFERENCE_ID) + private UUID codeReferenceId; + + public static final String SERIALIZED_NAME_UPLOADER = "uploader"; + @SerializedName(SERIALIZED_NAME_UPLOADER) + private String uploader; + + public CodeReferenceModel() { + } + + public CodeReferenceModel branch(String branch) { + this.branch = branch; + return this; + } + + /** + * The source control branch on where the scan was performed. (Source of the branch selector on the ConfigCat Dashboard) + * @return branch + */ + @javax.annotation.Nullable + public String getBranch() { + return branch; + } + + public void setBranch(String branch) { + this.branch = branch; + } + + + public CodeReferenceModel references(List references) { + this.references = references; + return this; + } + + public CodeReferenceModel addReferencesItem(ReferenceLines referencesItem) { + if (this.references == null) { + this.references = new ArrayList<>(); + } + this.references.add(referencesItem); + return this; + } + + /** + * The actual references to the given Feature Flag or Setting. + * @return references + */ + @javax.annotation.Nullable + public List getReferences() { + return references; + } + + public void setReferences(List references) { + this.references = references; + } + + + public CodeReferenceModel commitUrl(String commitUrl) { + this.commitUrl = commitUrl; + return this; + } + + /** + * The related commit's URL. + * @return commitUrl + */ + @javax.annotation.Nullable + public String getCommitUrl() { + return commitUrl; + } + + public void setCommitUrl(String commitUrl) { + this.commitUrl = commitUrl; + } + + + public CodeReferenceModel commitHash(String commitHash) { + this.commitHash = commitHash; + return this; + } + + /** + * The related commit's hash. + * @return commitHash + */ + @javax.annotation.Nullable + public String getCommitHash() { + return commitHash; + } + + public void setCommitHash(String commitHash) { + this.commitHash = commitHash; + } + + + public CodeReferenceModel syncedAt(OffsetDateTime syncedAt) { + this.syncedAt = syncedAt; + return this; + } + + /** + * The date and time when the reference report was uploaded. + * @return syncedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getSyncedAt() { + return syncedAt; + } + + public void setSyncedAt(OffsetDateTime syncedAt) { + this.syncedAt = syncedAt; + } + + + public CodeReferenceModel repository(String repository) { + this.repository = repository; + return this; + } + + /** + * The source control repository that contains the scanned code. + * @return repository + */ + @javax.annotation.Nullable + public String getRepository() { + return repository; + } + + public void setRepository(String repository) { + this.repository = repository; + } + + + public CodeReferenceModel codeReferenceId(UUID codeReferenceId) { + this.codeReferenceId = codeReferenceId; + return this; + } + + /** + * The identifier of the reference report. + * @return codeReferenceId + */ + @javax.annotation.Nullable + public UUID getCodeReferenceId() { + return codeReferenceId; + } + + public void setCodeReferenceId(UUID codeReferenceId) { + this.codeReferenceId = codeReferenceId; + } + + + public CodeReferenceModel uploader(String uploader) { + this.uploader = uploader; + return this; + } + + /** + * The code reference scanning tool's name. + * @return uploader + */ + @javax.annotation.Nullable + public String getUploader() { + return uploader; + } + + public void setUploader(String uploader) { + this.uploader = uploader; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CodeReferenceModel instance itself + */ + public CodeReferenceModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CodeReferenceModel codeReferenceModel = (CodeReferenceModel) o; + return Objects.equals(this.branch, codeReferenceModel.branch) && + Objects.equals(this.references, codeReferenceModel.references) && + Objects.equals(this.commitUrl, codeReferenceModel.commitUrl) && + Objects.equals(this.commitHash, codeReferenceModel.commitHash) && + Objects.equals(this.syncedAt, codeReferenceModel.syncedAt) && + Objects.equals(this.repository, codeReferenceModel.repository) && + Objects.equals(this.codeReferenceId, codeReferenceModel.codeReferenceId) && + Objects.equals(this.uploader, codeReferenceModel.uploader)&& + Objects.equals(this.additionalProperties, codeReferenceModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(branch, references, commitUrl, commitHash, syncedAt, repository, codeReferenceId, uploader, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CodeReferenceModel {\n"); + sb.append(" branch: ").append(toIndentedString(branch)).append("\n"); + sb.append(" references: ").append(toIndentedString(references)).append("\n"); + sb.append(" commitUrl: ").append(toIndentedString(commitUrl)).append("\n"); + sb.append(" commitHash: ").append(toIndentedString(commitHash)).append("\n"); + sb.append(" syncedAt: ").append(toIndentedString(syncedAt)).append("\n"); + sb.append(" repository: ").append(toIndentedString(repository)).append("\n"); + sb.append(" codeReferenceId: ").append(toIndentedString(codeReferenceId)).append("\n"); + sb.append(" uploader: ").append(toIndentedString(uploader)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("branch"); + openapiFields.add("references"); + openapiFields.add("commitUrl"); + openapiFields.add("commitHash"); + openapiFields.add("syncedAt"); + openapiFields.add("repository"); + openapiFields.add("codeReferenceId"); + openapiFields.add("uploader"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CodeReferenceModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CodeReferenceModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CodeReferenceModel is not found in the empty JSON string", CodeReferenceModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("branch") != null && !jsonObj.get("branch").isJsonNull()) - && !jsonObj.get("branch").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `branch` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("branch").toString())); + if ((jsonObj.get("branch") != null && !jsonObj.get("branch").isJsonNull()) && !jsonObj.get("branch").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `branch` to be a primitive type in the JSON string but got `%s`", jsonObj.get("branch").toString())); + } + if (jsonObj.get("references") != null && !jsonObj.get("references").isJsonNull()) { + JsonArray jsonArrayreferences = jsonObj.getAsJsonArray("references"); + if (jsonArrayreferences != null) { + // ensure the json data is an array + if (!jsonObj.get("references").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `references` to be an array in the JSON string but got `%s`", jsonObj.get("references").toString())); + } + + // validate the optional field `references` (array) + for (int i = 0; i < jsonArrayreferences.size(); i++) { + ReferenceLines.validateJsonElement(jsonArrayreferences.get(i)); + }; } - if (jsonObj.get("references") != null && !jsonObj.get("references").isJsonNull()) { - JsonArray jsonArrayreferences = jsonObj.getAsJsonArray("references"); - if (jsonArrayreferences != null) { - // ensure the json data is an array - if (!jsonObj.get("references").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `references` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("references").toString())); - } - - // validate the optional field `references` (array) - for (int i = 0; i < jsonArrayreferences.size(); i++) { - ReferenceLines.validateJsonElement(jsonArrayreferences.get(i)); - } - ; - } - } - if ((jsonObj.get("commitUrl") != null && !jsonObj.get("commitUrl").isJsonNull()) - && !jsonObj.get("commitUrl").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `commitUrl` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("commitUrl").toString())); - } - if ((jsonObj.get("commitHash") != null && !jsonObj.get("commitHash").isJsonNull()) - && !jsonObj.get("commitHash").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `commitHash` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("commitHash").toString())); - } - if ((jsonObj.get("repository") != null && !jsonObj.get("repository").isJsonNull()) - && !jsonObj.get("repository").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `repository` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("repository").toString())); - } - if ((jsonObj.get("codeReferenceId") != null && !jsonObj.get("codeReferenceId").isJsonNull()) - && !jsonObj.get("codeReferenceId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `codeReferenceId` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("codeReferenceId").toString())); - } - if ((jsonObj.get("uploader") != null && !jsonObj.get("uploader").isJsonNull()) - && !jsonObj.get("uploader").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `uploader` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("uploader").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CodeReferenceModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CodeReferenceModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CodeReferenceModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CodeReferenceModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CodeReferenceModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of CodeReferenceModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of CodeReferenceModel - * @throws IOException if the JSON string is invalid with respect to CodeReferenceModel - */ - public static CodeReferenceModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CodeReferenceModel.class); - } - - /** - * Convert an instance of CodeReferenceModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + } + if ((jsonObj.get("commitUrl") != null && !jsonObj.get("commitUrl").isJsonNull()) && !jsonObj.get("commitUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commitUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commitUrl").toString())); + } + if ((jsonObj.get("commitHash") != null && !jsonObj.get("commitHash").isJsonNull()) && !jsonObj.get("commitHash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commitHash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commitHash").toString())); + } + if ((jsonObj.get("repository") != null && !jsonObj.get("repository").isJsonNull()) && !jsonObj.get("repository").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `repository` to be a primitive type in the JSON string but got `%s`", jsonObj.get("repository").toString())); + } + if ((jsonObj.get("codeReferenceId") != null && !jsonObj.get("codeReferenceId").isJsonNull()) && !jsonObj.get("codeReferenceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `codeReferenceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("codeReferenceId").toString())); + } + if ((jsonObj.get("uploader") != null && !jsonObj.get("uploader").isJsonNull()) && !jsonObj.get("uploader").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uploader` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uploader").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CodeReferenceModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CodeReferenceModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CodeReferenceModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CodeReferenceModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CodeReferenceModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CodeReferenceModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CodeReferenceModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of CodeReferenceModel + * @throws IOException if the JSON string is invalid with respect to CodeReferenceModel + */ + public static CodeReferenceModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CodeReferenceModel.class); + } + + /** + * Convert an instance of CodeReferenceModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CodeReferenceRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/CodeReferenceRequest.java index 1f7b1ef..741c117 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CodeReferenceRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CodeReferenceRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,510 +10,535 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.FlagReference; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** CodeReferenceRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CodeReferenceRequest { - public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; - - @SerializedName(SERIALIZED_NAME_CONFIG_ID) - private UUID configId; - - public static final String SERIALIZED_NAME_REPOSITORY = "repository"; - - @SerializedName(SERIALIZED_NAME_REPOSITORY) - private String repository; - - public static final String SERIALIZED_NAME_BRANCH = "branch"; - - @SerializedName(SERIALIZED_NAME_BRANCH) - private String branch; - - public static final String SERIALIZED_NAME_COMMIT_URL = "commitUrl"; - - @SerializedName(SERIALIZED_NAME_COMMIT_URL) - private String commitUrl; - - public static final String SERIALIZED_NAME_COMMIT_HASH = "commitHash"; - - @SerializedName(SERIALIZED_NAME_COMMIT_HASH) - private String commitHash; - - public static final String SERIALIZED_NAME_UPLOADER = "uploader"; - - @SerializedName(SERIALIZED_NAME_UPLOADER) - private String uploader; - - public static final String SERIALIZED_NAME_ACTIVE_BRANCHES = "activeBranches"; - - @SerializedName(SERIALIZED_NAME_ACTIVE_BRANCHES) - private List activeBranches; - - public static final String SERIALIZED_NAME_FLAG_REFERENCES = "flagReferences"; - - @SerializedName(SERIALIZED_NAME_FLAG_REFERENCES) - private List flagReferences; - - public CodeReferenceRequest() {} - - public CodeReferenceRequest configId(UUID configId) { - this.configId = configId; - return this; - } - - /** - * The Config's identifier the scanning was performed against. - * - * @return configId - */ - @javax.annotation.Nonnull - public UUID getConfigId() { - return configId; - } - - public void setConfigId(UUID configId) { - this.configId = configId; - } - - public CodeReferenceRequest repository(String repository) { - this.repository = repository; - return this; - } - - /** - * The source control repository that contains the scanned code. (Source of the repository - * selector on the ConfigCat Dashboard) - * - * @return repository - */ - @javax.annotation.Nonnull - public String getRepository() { - return repository; - } - - public void setRepository(String repository) { - this.repository = repository; - } - - public CodeReferenceRequest branch(String branch) { - this.branch = branch; - return this; - } - - /** - * The source control branch on where the scan was performed. (Source of the branch selector on - * the ConfigCat Dashboard) - * - * @return branch - */ - @javax.annotation.Nonnull - public String getBranch() { - return branch; - } - - public void setBranch(String branch) { - this.branch = branch; - } - - public CodeReferenceRequest commitUrl(String commitUrl) { - this.commitUrl = commitUrl; - return this; - } - - /** - * The related commit's URL. (Appears on the ConfigCat Dashboard) - * - * @return commitUrl - */ - @javax.annotation.Nullable - public String getCommitUrl() { - return commitUrl; - } - - public void setCommitUrl(String commitUrl) { - this.commitUrl = commitUrl; - } - - public CodeReferenceRequest commitHash(String commitHash) { - this.commitHash = commitHash; - return this; - } - - /** - * The related commit's hash. (Appears on the ConfigCat Dashboard) - * - * @return commitHash - */ - @javax.annotation.Nullable - public String getCommitHash() { - return commitHash; - } - public void setCommitHash(String commitHash) { - this.commitHash = commitHash; - } - - public CodeReferenceRequest uploader(String uploader) { - this.uploader = uploader; - return this; - } - - /** - * The scanning tool's name. (Appears on the ConfigCat Dashboard) - * - * @return uploader - */ - @javax.annotation.Nullable - public String getUploader() { - return uploader; - } - - public void setUploader(String uploader) { - this.uploader = uploader; - } - - public CodeReferenceRequest activeBranches(List activeBranches) { - this.activeBranches = activeBranches; - return this; - } - - public CodeReferenceRequest addActiveBranchesItem(String activeBranchesItem) { - if (this.activeBranches == null) { - this.activeBranches = new ArrayList<>(); - } - this.activeBranches.add(activeBranchesItem); - return this; - } - - /** - * The currently active branches of the repository. Each previously uploaded report that belongs - * to a non-reported active branch is being deleted. - * - * @return activeBranches - */ - @javax.annotation.Nullable - public List getActiveBranches() { - return activeBranches; - } - - public void setActiveBranches(List activeBranches) { - this.activeBranches = activeBranches; - } - - public CodeReferenceRequest flagReferences(List flagReferences) { - this.flagReferences = flagReferences; - return this; - } - - public CodeReferenceRequest addFlagReferencesItem(FlagReference flagReferencesItem) { - if (this.flagReferences == null) { - this.flagReferences = new ArrayList<>(); - } - this.flagReferences.add(flagReferencesItem); - return this; - } - - /** - * The actual code reference collection. - * - * @return flagReferences - */ - @javax.annotation.Nullable - public List getFlagReferences() { - return flagReferences; - } - - public void setFlagReferences(List flagReferences) { - this.flagReferences = flagReferences; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CodeReferenceRequest codeReferenceRequest = (CodeReferenceRequest) o; - return Objects.equals(this.configId, codeReferenceRequest.configId) - && Objects.equals(this.repository, codeReferenceRequest.repository) - && Objects.equals(this.branch, codeReferenceRequest.branch) - && Objects.equals(this.commitUrl, codeReferenceRequest.commitUrl) - && Objects.equals(this.commitHash, codeReferenceRequest.commitHash) - && Objects.equals(this.uploader, codeReferenceRequest.uploader) - && Objects.equals(this.activeBranches, codeReferenceRequest.activeBranches) - && Objects.equals(this.flagReferences, codeReferenceRequest.flagReferences); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - configId, - repository, - branch, - commitUrl, - commitHash, - uploader, - activeBranches, - flagReferences); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CodeReferenceRequest {\n"); - sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); - sb.append(" repository: ").append(toIndentedString(repository)).append("\n"); - sb.append(" branch: ").append(toIndentedString(branch)).append("\n"); - sb.append(" commitUrl: ").append(toIndentedString(commitUrl)).append("\n"); - sb.append(" commitHash: ").append(toIndentedString(commitHash)).append("\n"); - sb.append(" uploader: ").append(toIndentedString(uploader)).append("\n"); - sb.append(" activeBranches: ").append(toIndentedString(activeBranches)).append("\n"); - sb.append(" flagReferences: ").append(toIndentedString(flagReferences)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("configId"); - openapiFields.add("repository"); - openapiFields.add("branch"); - openapiFields.add("commitUrl"); - openapiFields.add("commitHash"); - openapiFields.add("uploader"); - openapiFields.add("activeBranches"); - openapiFields.add("flagReferences"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("configId"); - openapiRequiredFields.add("repository"); - openapiRequiredFields.add("branch"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CodeReferenceRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CodeReferenceRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CodeReferenceRequest is not found in" - + " the empty JSON string", - CodeReferenceRequest.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CodeReferenceRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CodeReferenceRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * CodeReferenceRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CodeReferenceRequest { + public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; + @SerializedName(SERIALIZED_NAME_CONFIG_ID) + private UUID configId; + + public static final String SERIALIZED_NAME_REPOSITORY = "repository"; + @SerializedName(SERIALIZED_NAME_REPOSITORY) + private String repository; + + public static final String SERIALIZED_NAME_BRANCH = "branch"; + @SerializedName(SERIALIZED_NAME_BRANCH) + private String branch; + + public static final String SERIALIZED_NAME_COMMIT_URL = "commitUrl"; + @SerializedName(SERIALIZED_NAME_COMMIT_URL) + private String commitUrl; + + public static final String SERIALIZED_NAME_COMMIT_HASH = "commitHash"; + @SerializedName(SERIALIZED_NAME_COMMIT_HASH) + private String commitHash; + + public static final String SERIALIZED_NAME_UPLOADER = "uploader"; + @SerializedName(SERIALIZED_NAME_UPLOADER) + private String uploader; + + public static final String SERIALIZED_NAME_ACTIVE_BRANCHES = "activeBranches"; + @SerializedName(SERIALIZED_NAME_ACTIVE_BRANCHES) + private List activeBranches; + + public static final String SERIALIZED_NAME_FLAG_REFERENCES = "flagReferences"; + @SerializedName(SERIALIZED_NAME_FLAG_REFERENCES) + private List flagReferences; + + public CodeReferenceRequest() { + } + + public CodeReferenceRequest configId(UUID configId) { + this.configId = configId; + return this; + } + + /** + * The Config's identifier the scanning was performed against. + * @return configId + */ + @javax.annotation.Nonnull + public UUID getConfigId() { + return configId; + } + + public void setConfigId(UUID configId) { + this.configId = configId; + } + + + public CodeReferenceRequest repository(String repository) { + this.repository = repository; + return this; + } + + /** + * The source control repository that contains the scanned code. (Source of the repository selector on the ConfigCat Dashboard) + * @return repository + */ + @javax.annotation.Nonnull + public String getRepository() { + return repository; + } + + public void setRepository(String repository) { + this.repository = repository; + } + + + public CodeReferenceRequest branch(String branch) { + this.branch = branch; + return this; + } + + /** + * The source control branch on where the scan was performed. (Source of the branch selector on the ConfigCat Dashboard) + * @return branch + */ + @javax.annotation.Nonnull + public String getBranch() { + return branch; + } + + public void setBranch(String branch) { + this.branch = branch; + } + + + public CodeReferenceRequest commitUrl(String commitUrl) { + this.commitUrl = commitUrl; + return this; + } + + /** + * The related commit's URL. (Appears on the ConfigCat Dashboard) + * @return commitUrl + */ + @javax.annotation.Nullable + public String getCommitUrl() { + return commitUrl; + } + + public void setCommitUrl(String commitUrl) { + this.commitUrl = commitUrl; + } + + + public CodeReferenceRequest commitHash(String commitHash) { + this.commitHash = commitHash; + return this; + } + + /** + * The related commit's hash. (Appears on the ConfigCat Dashboard) + * @return commitHash + */ + @javax.annotation.Nullable + public String getCommitHash() { + return commitHash; + } + + public void setCommitHash(String commitHash) { + this.commitHash = commitHash; + } + + + public CodeReferenceRequest uploader(String uploader) { + this.uploader = uploader; + return this; + } + + /** + * The scanning tool's name. (Appears on the ConfigCat Dashboard) + * @return uploader + */ + @javax.annotation.Nullable + public String getUploader() { + return uploader; + } + + public void setUploader(String uploader) { + this.uploader = uploader; + } + + + public CodeReferenceRequest activeBranches(List activeBranches) { + this.activeBranches = activeBranches; + return this; + } + + public CodeReferenceRequest addActiveBranchesItem(String activeBranchesItem) { + if (this.activeBranches == null) { + this.activeBranches = new ArrayList<>(); + } + this.activeBranches.add(activeBranchesItem); + return this; + } + + /** + * The currently active branches of the repository. Each previously uploaded report that belongs to a non-reported active branch is being deleted. + * @return activeBranches + */ + @javax.annotation.Nullable + public List getActiveBranches() { + return activeBranches; + } + + public void setActiveBranches(List activeBranches) { + this.activeBranches = activeBranches; + } + + + public CodeReferenceRequest flagReferences(List flagReferences) { + this.flagReferences = flagReferences; + return this; + } + + public CodeReferenceRequest addFlagReferencesItem(FlagReference flagReferencesItem) { + if (this.flagReferences == null) { + this.flagReferences = new ArrayList<>(); + } + this.flagReferences.add(flagReferencesItem); + return this; + } + + /** + * The actual code reference collection. + * @return flagReferences + */ + @javax.annotation.Nullable + public List getFlagReferences() { + return flagReferences; + } + + public void setFlagReferences(List flagReferences) { + this.flagReferences = flagReferences; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CodeReferenceRequest instance itself + */ + public CodeReferenceRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CodeReferenceRequest codeReferenceRequest = (CodeReferenceRequest) o; + return Objects.equals(this.configId, codeReferenceRequest.configId) && + Objects.equals(this.repository, codeReferenceRequest.repository) && + Objects.equals(this.branch, codeReferenceRequest.branch) && + Objects.equals(this.commitUrl, codeReferenceRequest.commitUrl) && + Objects.equals(this.commitHash, codeReferenceRequest.commitHash) && + Objects.equals(this.uploader, codeReferenceRequest.uploader) && + Objects.equals(this.activeBranches, codeReferenceRequest.activeBranches) && + Objects.equals(this.flagReferences, codeReferenceRequest.flagReferences)&& + Objects.equals(this.additionalProperties, codeReferenceRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(configId, repository, branch, commitUrl, commitHash, uploader, activeBranches, flagReferences, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CodeReferenceRequest {\n"); + sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); + sb.append(" repository: ").append(toIndentedString(repository)).append("\n"); + sb.append(" branch: ").append(toIndentedString(branch)).append("\n"); + sb.append(" commitUrl: ").append(toIndentedString(commitUrl)).append("\n"); + sb.append(" commitHash: ").append(toIndentedString(commitHash)).append("\n"); + sb.append(" uploader: ").append(toIndentedString(uploader)).append("\n"); + sb.append(" activeBranches: ").append(toIndentedString(activeBranches)).append("\n"); + sb.append(" flagReferences: ").append(toIndentedString(flagReferences)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("configId"); + openapiFields.add("repository"); + openapiFields.add("branch"); + openapiFields.add("commitUrl"); + openapiFields.add("commitHash"); + openapiFields.add("uploader"); + openapiFields.add("activeBranches"); + openapiFields.add("flagReferences"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("configId"); + openapiRequiredFields.add("repository"); + openapiRequiredFields.add("branch"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CodeReferenceRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CodeReferenceRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CodeReferenceRequest is not found in the empty JSON string", CodeReferenceRequest.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CodeReferenceRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CodeReferenceRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("configId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("configId").toString())); + if (!jsonObj.get("configId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `configId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("configId").toString())); + } + if (!jsonObj.get("repository").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `repository` to be a primitive type in the JSON string but got `%s`", jsonObj.get("repository").toString())); + } + if (!jsonObj.get("branch").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `branch` to be a primitive type in the JSON string but got `%s`", jsonObj.get("branch").toString())); + } + if ((jsonObj.get("commitUrl") != null && !jsonObj.get("commitUrl").isJsonNull()) && !jsonObj.get("commitUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commitUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commitUrl").toString())); + } + if ((jsonObj.get("commitHash") != null && !jsonObj.get("commitHash").isJsonNull()) && !jsonObj.get("commitHash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `commitHash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("commitHash").toString())); + } + if ((jsonObj.get("uploader") != null && !jsonObj.get("uploader").isJsonNull()) && !jsonObj.get("uploader").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uploader` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uploader").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("activeBranches") != null && !jsonObj.get("activeBranches").isJsonNull() && !jsonObj.get("activeBranches").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `activeBranches` to be an array in the JSON string but got `%s`", jsonObj.get("activeBranches").toString())); + } + if (jsonObj.get("flagReferences") != null && !jsonObj.get("flagReferences").isJsonNull()) { + JsonArray jsonArrayflagReferences = jsonObj.getAsJsonArray("flagReferences"); + if (jsonArrayflagReferences != null) { + // ensure the json data is an array + if (!jsonObj.get("flagReferences").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `flagReferences` to be an array in the JSON string but got `%s`", jsonObj.get("flagReferences").toString())); + } + + // validate the optional field `flagReferences` (array) + for (int i = 0; i < jsonArrayflagReferences.size(); i++) { + FlagReference.validateJsonElement(jsonArrayflagReferences.get(i)); + }; } - if (!jsonObj.get("repository").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `repository` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("repository").toString())); - } - if (!jsonObj.get("branch").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `branch` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("branch").toString())); - } - if ((jsonObj.get("commitUrl") != null && !jsonObj.get("commitUrl").isJsonNull()) - && !jsonObj.get("commitUrl").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `commitUrl` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("commitUrl").toString())); - } - if ((jsonObj.get("commitHash") != null && !jsonObj.get("commitHash").isJsonNull()) - && !jsonObj.get("commitHash").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `commitHash` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("commitHash").toString())); - } - if ((jsonObj.get("uploader") != null && !jsonObj.get("uploader").isJsonNull()) - && !jsonObj.get("uploader").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `uploader` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("uploader").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("activeBranches") != null - && !jsonObj.get("activeBranches").isJsonNull() - && !jsonObj.get("activeBranches").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `activeBranches` to be an array in the JSON string" - + " but got `%s`", - jsonObj.get("activeBranches").toString())); - } - if (jsonObj.get("flagReferences") != null && !jsonObj.get("flagReferences").isJsonNull()) { - JsonArray jsonArrayflagReferences = jsonObj.getAsJsonArray("flagReferences"); - if (jsonArrayflagReferences != null) { - // ensure the json data is an array - if (!jsonObj.get("flagReferences").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `flagReferences` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("flagReferences").toString())); - } - - // validate the optional field `flagReferences` (array) - for (int i = 0; i < jsonArrayflagReferences.size(); i++) { - FlagReference.validateJsonElement(jsonArrayflagReferences.get(i)); - } - ; - } - } - } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CodeReferenceRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CodeReferenceRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CodeReferenceRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CodeReferenceRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CodeReferenceRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of CodeReferenceRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of CodeReferenceRequest - * @throws IOException if the JSON string is invalid with respect to CodeReferenceRequest - */ - public static CodeReferenceRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CodeReferenceRequest.class); - } - - /** - * Convert an instance of CodeReferenceRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CodeReferenceRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CodeReferenceRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CodeReferenceRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CodeReferenceRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CodeReferenceRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CodeReferenceRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CodeReferenceRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CodeReferenceRequest + * @throws IOException if the JSON string is invalid with respect to CodeReferenceRequest + */ + public static CodeReferenceRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CodeReferenceRequest.class); + } + + /** + * Convert an instance of CodeReferenceRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ComparisonValueListModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ComparisonValueListModel.java index e19c261..e217ed2 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ComparisonValueListModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ComparisonValueListModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,257 +10,327 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** ComparisonValueListModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * ComparisonValueListModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class ComparisonValueListModel { - public static final String SERIALIZED_NAME_VALUE = "value"; + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; - @SerializedName(SERIALIZED_NAME_VALUE) - private String value; + public static final String SERIALIZED_NAME_HINT = "hint"; + @SerializedName(SERIALIZED_NAME_HINT) + private String hint; - public static final String SERIALIZED_NAME_HINT = "hint"; + public ComparisonValueListModel() { + } - @SerializedName(SERIALIZED_NAME_HINT) - private String hint; + public ComparisonValueListModel value(String value) { + this.value = value; + return this; + } - public ComparisonValueListModel() {} + /** + * The actual comparison value. + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } - public ComparisonValueListModel value(String value) { - this.value = value; - return this; - } + public void setValue(String value) { + this.value = value; + } - /** - * The actual comparison value. - * - * @return value - */ - @javax.annotation.Nonnull - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } + public ComparisonValueListModel hint(String hint) { + this.hint = hint; + return this; + } - public ComparisonValueListModel hint(String hint) { - this.hint = hint; - return this; - } + /** + * An optional hint for the comparison value. + * @return hint + */ + @javax.annotation.Nullable + public String getHint() { + return hint; + } - /** - * An optional hint for the comparison value. - * - * @return hint - */ - @javax.annotation.Nullable - public String getHint() { - return hint; - } + public void setHint(String hint) { + this.hint = hint; + } - public void setHint(String hint) { - this.hint = hint; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ComparisonValueListModel comparisonValueListModel = (ComparisonValueListModel) o; - return Objects.equals(this.value, comparisonValueListModel.value) - && Objects.equals(this.hint, comparisonValueListModel.hint); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ComparisonValueListModel instance itself + */ + public ComparisonValueListModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(value, hint); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + ComparisonValueListModel comparisonValueListModel = (ComparisonValueListModel) o; + return Objects.equals(this.value, comparisonValueListModel.value) && + Objects.equals(this.hint, comparisonValueListModel.hint)&& + Objects.equals(this.additionalProperties, comparisonValueListModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ComparisonValueListModel {\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(value, hint, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComparisonValueListModel {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("value"); - openapiFields.add("hint"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("value"); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("value"); + openapiFields.add("hint"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ComparisonValueListModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ComparisonValueListModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ComparisonValueListModel is not found" - + " in the empty JSON string", - ComparisonValueListModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("value"); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ComparisonValueListModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ComparisonValueListModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ComparisonValueListModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ComparisonValueListModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ComparisonValueListModel is not found in the empty JSON string", ComparisonValueListModel.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ComparisonValueListModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComparisonValueListModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("value").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `value` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("value").toString())); - } - if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) - && !jsonObj.get("hint").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `hint` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("hint").toString())); - } - } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) && !jsonObj.get("hint").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hint` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hint").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ComparisonValueListModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ComparisonValueListModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ComparisonValueListModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ComparisonValueListModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ComparisonValueListModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ComparisonValueListModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComparisonValueListModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ComparisonValueListModel.class)); - /** - * Create an instance of ComparisonValueListModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ComparisonValueListModel - * @throws IOException if the JSON string is invalid with respect to ComparisonValueListModel - */ - public static ComparisonValueListModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ComparisonValueListModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ComparisonValueListModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ComparisonValueListModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ComparisonValueListModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of ComparisonValueListModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of ComparisonValueListModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComparisonValueListModel + * @throws IOException if the JSON string is invalid with respect to ComparisonValueListModel + */ + public static ComparisonValueListModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComparisonValueListModel.class); + } + + /** + * Convert an instance of ComparisonValueListModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ComparisonValueModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ComparisonValueModel.java index 1527aa3..b62a0da 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ComparisonValueModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ComparisonValueModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,295 +10,367 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ComparisonValueListModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** The value that the user object's attribute is compared to. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ComparisonValueModel { - public static final String SERIALIZED_NAME_STRING_VALUE = "stringValue"; - - @SerializedName(SERIALIZED_NAME_STRING_VALUE) - private String stringValue; - - public static final String SERIALIZED_NAME_DOUBLE_VALUE = "doubleValue"; - - @SerializedName(SERIALIZED_NAME_DOUBLE_VALUE) - private Double doubleValue; - - public static final String SERIALIZED_NAME_LIST_VALUE = "listValue"; - - @SerializedName(SERIALIZED_NAME_LIST_VALUE) - private List listValue; - - public ComparisonValueModel() {} - - public ComparisonValueModel stringValue(String stringValue) { - this.stringValue = stringValue; - return this; - } - - /** - * The string representation of the comparison value. - * - * @return stringValue - */ - @javax.annotation.Nullable - public String getStringValue() { - return stringValue; - } - - public void setStringValue(String stringValue) { - this.stringValue = stringValue; - } - - public ComparisonValueModel doubleValue(Double doubleValue) { - this.doubleValue = doubleValue; - return this; - } - - /** - * The number representation of the comparison value. - * - * @return doubleValue - */ - @javax.annotation.Nullable - public Double getDoubleValue() { - return doubleValue; - } - public void setDoubleValue(Double doubleValue) { - this.doubleValue = doubleValue; - } - - public ComparisonValueModel listValue(List listValue) { - this.listValue = listValue; - return this; - } - - public ComparisonValueModel addListValueItem(ComparisonValueListModel listValueItem) { - if (this.listValue == null) { - this.listValue = new ArrayList<>(); - } - this.listValue.add(listValueItem); - return this; - } - - /** - * The list representation of the comparison value. - * - * @return listValue - */ - @javax.annotation.Nullable - public List getListValue() { - return listValue; - } +import com.configcat.publicapi.java.client.JSON; - public void setListValue(List listValue) { - this.listValue = listValue; +/** + * The value that the user object's attribute is compared to. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ComparisonValueModel { + public static final String SERIALIZED_NAME_STRING_VALUE = "stringValue"; + @SerializedName(SERIALIZED_NAME_STRING_VALUE) + private String stringValue; + + public static final String SERIALIZED_NAME_DOUBLE_VALUE = "doubleValue"; + @SerializedName(SERIALIZED_NAME_DOUBLE_VALUE) + private Double doubleValue; + + public static final String SERIALIZED_NAME_LIST_VALUE = "listValue"; + @SerializedName(SERIALIZED_NAME_LIST_VALUE) + private List listValue; + + public ComparisonValueModel() { + } + + public ComparisonValueModel stringValue(String stringValue) { + this.stringValue = stringValue; + return this; + } + + /** + * The string representation of the comparison value. + * @return stringValue + */ + @javax.annotation.Nullable + public String getStringValue() { + return stringValue; + } + + public void setStringValue(String stringValue) { + this.stringValue = stringValue; + } + + + public ComparisonValueModel doubleValue(Double doubleValue) { + this.doubleValue = doubleValue; + return this; + } + + /** + * The number representation of the comparison value. + * @return doubleValue + */ + @javax.annotation.Nullable + public Double getDoubleValue() { + return doubleValue; + } + + public void setDoubleValue(Double doubleValue) { + this.doubleValue = doubleValue; + } + + + public ComparisonValueModel listValue(List listValue) { + this.listValue = listValue; + return this; + } + + public ComparisonValueModel addListValueItem(ComparisonValueListModel listValueItem) { + if (this.listValue == null) { + this.listValue = new ArrayList<>(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ComparisonValueModel comparisonValueModel = (ComparisonValueModel) o; - return Objects.equals(this.stringValue, comparisonValueModel.stringValue) - && Objects.equals(this.doubleValue, comparisonValueModel.doubleValue) - && Objects.equals(this.listValue, comparisonValueModel.listValue); + this.listValue.add(listValueItem); + return this; + } + + /** + * The list representation of the comparison value. + * @return listValue + */ + @javax.annotation.Nullable + public List getListValue() { + return listValue; + } + + public void setListValue(List listValue) { + this.listValue = listValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ComparisonValueModel instance itself + */ + public ComparisonValueModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(stringValue, doubleValue, listValue); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ComparisonValueModel {\n"); - sb.append(" stringValue: ").append(toIndentedString(stringValue)).append("\n"); - sb.append(" doubleValue: ").append(toIndentedString(doubleValue)).append("\n"); - sb.append(" listValue: ").append(toIndentedString(listValue)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + ComparisonValueModel comparisonValueModel = (ComparisonValueModel) o; + return Objects.equals(this.stringValue, comparisonValueModel.stringValue) && + Objects.equals(this.doubleValue, comparisonValueModel.doubleValue) && + Objects.equals(this.listValue, comparisonValueModel.listValue)&& + Objects.equals(this.additionalProperties, comparisonValueModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(stringValue, doubleValue, listValue, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("stringValue"); - openapiFields.add("doubleValue"); - openapiFields.add("listValue"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComparisonValueModel {\n"); + sb.append(" stringValue: ").append(toIndentedString(stringValue)).append("\n"); + sb.append(" doubleValue: ").append(toIndentedString(doubleValue)).append("\n"); + sb.append(" listValue: ").append(toIndentedString(listValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ComparisonValueModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ComparisonValueModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ComparisonValueModel is not found in" - + " the empty JSON string", - ComparisonValueModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ComparisonValueModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ComparisonValueModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("stringValue"); + openapiFields.add("doubleValue"); + openapiFields.add("listValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ComparisonValueModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ComparisonValueModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ComparisonValueModel is not found in the empty JSON string", ComparisonValueModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("stringValue") != null && !jsonObj.get("stringValue").isJsonNull()) - && !jsonObj.get("stringValue").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `stringValue` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("stringValue").toString())); + if ((jsonObj.get("stringValue") != null && !jsonObj.get("stringValue").isJsonNull()) && !jsonObj.get("stringValue").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stringValue` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stringValue").toString())); + } + if (jsonObj.get("listValue") != null && !jsonObj.get("listValue").isJsonNull()) { + JsonArray jsonArraylistValue = jsonObj.getAsJsonArray("listValue"); + if (jsonArraylistValue != null) { + // ensure the json data is an array + if (!jsonObj.get("listValue").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `listValue` to be an array in the JSON string but got `%s`", jsonObj.get("listValue").toString())); + } + + // validate the optional field `listValue` (array) + for (int i = 0; i < jsonArraylistValue.size(); i++) { + ComparisonValueListModel.validateJsonElement(jsonArraylistValue.get(i)); + }; } - if (jsonObj.get("listValue") != null && !jsonObj.get("listValue").isJsonNull()) { - JsonArray jsonArraylistValue = jsonObj.getAsJsonArray("listValue"); - if (jsonArraylistValue != null) { - // ensure the json data is an array - if (!jsonObj.get("listValue").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `listValue` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("listValue").toString())); - } - - // validate the optional field `listValue` (array) - for (int i = 0; i < jsonArraylistValue.size(); i++) { - ComparisonValueListModel.validateJsonElement(jsonArraylistValue.get(i)); - } - ; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ComparisonValueModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ComparisonValueModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ComparisonValueModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ComparisonValueModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ComparisonValueModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + } + } - /** - * Create an instance of ComparisonValueModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ComparisonValueModel - * @throws IOException if the JSON string is invalid with respect to ComparisonValueModel - */ - public static ComparisonValueModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ComparisonValueModel.class); - } - - /** - * Convert an instance of ComparisonValueModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ComparisonValueModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComparisonValueModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ComparisonValueModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ComparisonValueModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ComparisonValueModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ComparisonValueModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ComparisonValueModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComparisonValueModel + * @throws IOException if the JSON string is invalid with respect to ComparisonValueModel + */ + public static ComparisonValueModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComparisonValueModel.class); + } + + /** + * Convert an instance of ComparisonValueModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ConditionModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ConditionModel.java index 336fa6a..513aa9c 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ConditionModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ConditionModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,259 +10,342 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.PrerequisiteFlagConditionModel; +import com.configcat.publicapi.java.client.model.SegmentConditionModel; +import com.configcat.publicapi.java.client.model.UserConditionModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** ConditionModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ConditionModel { - public static final String SERIALIZED_NAME_USER_CONDITION = "userCondition"; - - @SerializedName(SERIALIZED_NAME_USER_CONDITION) - private UserConditionModel userCondition; - - public static final String SERIALIZED_NAME_SEGMENT_CONDITION = "segmentCondition"; - - @SerializedName(SERIALIZED_NAME_SEGMENT_CONDITION) - private SegmentConditionModel segmentCondition; - - public static final String SERIALIZED_NAME_PREREQUISITE_FLAG_CONDITION = - "prerequisiteFlagCondition"; - - @SerializedName(SERIALIZED_NAME_PREREQUISITE_FLAG_CONDITION) - private PrerequisiteFlagConditionModel prerequisiteFlagCondition; - - public ConditionModel() {} - - public ConditionModel userCondition(UserConditionModel userCondition) { - this.userCondition = userCondition; - return this; - } - - /** - * Get userCondition - * - * @return userCondition - */ - @javax.annotation.Nullable - public UserConditionModel getUserCondition() { - return userCondition; - } - - public void setUserCondition(UserConditionModel userCondition) { - this.userCondition = userCondition; - } - - public ConditionModel segmentCondition(SegmentConditionModel segmentCondition) { - this.segmentCondition = segmentCondition; - return this; - } - - /** - * Get segmentCondition - * - * @return segmentCondition - */ - @javax.annotation.Nullable - public SegmentConditionModel getSegmentCondition() { - return segmentCondition; - } - - public void setSegmentCondition(SegmentConditionModel segmentCondition) { - this.segmentCondition = segmentCondition; - } - - public ConditionModel prerequisiteFlagCondition( - PrerequisiteFlagConditionModel prerequisiteFlagCondition) { - this.prerequisiteFlagCondition = prerequisiteFlagCondition; - return this; - } +import com.configcat.publicapi.java.client.JSON; - /** - * Get prerequisiteFlagCondition - * - * @return prerequisiteFlagCondition - */ - @javax.annotation.Nullable - public PrerequisiteFlagConditionModel getPrerequisiteFlagCondition() { - return prerequisiteFlagCondition; +/** + * ConditionModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ConditionModel { + public static final String SERIALIZED_NAME_USER_CONDITION = "userCondition"; + @SerializedName(SERIALIZED_NAME_USER_CONDITION) + private UserConditionModel userCondition; + + public static final String SERIALIZED_NAME_SEGMENT_CONDITION = "segmentCondition"; + @SerializedName(SERIALIZED_NAME_SEGMENT_CONDITION) + private SegmentConditionModel segmentCondition; + + public static final String SERIALIZED_NAME_PREREQUISITE_FLAG_CONDITION = "prerequisiteFlagCondition"; + @SerializedName(SERIALIZED_NAME_PREREQUISITE_FLAG_CONDITION) + private PrerequisiteFlagConditionModel prerequisiteFlagCondition; + + public ConditionModel() { + } + + public ConditionModel userCondition(UserConditionModel userCondition) { + this.userCondition = userCondition; + return this; + } + + /** + * Get userCondition + * @return userCondition + */ + @javax.annotation.Nullable + public UserConditionModel getUserCondition() { + return userCondition; + } + + public void setUserCondition(UserConditionModel userCondition) { + this.userCondition = userCondition; + } + + + public ConditionModel segmentCondition(SegmentConditionModel segmentCondition) { + this.segmentCondition = segmentCondition; + return this; + } + + /** + * Get segmentCondition + * @return segmentCondition + */ + @javax.annotation.Nullable + public SegmentConditionModel getSegmentCondition() { + return segmentCondition; + } + + public void setSegmentCondition(SegmentConditionModel segmentCondition) { + this.segmentCondition = segmentCondition; + } + + + public ConditionModel prerequisiteFlagCondition(PrerequisiteFlagConditionModel prerequisiteFlagCondition) { + this.prerequisiteFlagCondition = prerequisiteFlagCondition; + return this; + } + + /** + * Get prerequisiteFlagCondition + * @return prerequisiteFlagCondition + */ + @javax.annotation.Nullable + public PrerequisiteFlagConditionModel getPrerequisiteFlagCondition() { + return prerequisiteFlagCondition; + } + + public void setPrerequisiteFlagCondition(PrerequisiteFlagConditionModel prerequisiteFlagCondition) { + this.prerequisiteFlagCondition = prerequisiteFlagCondition; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConditionModel instance itself + */ + public ConditionModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public void setPrerequisiteFlagCondition( - PrerequisiteFlagConditionModel prerequisiteFlagCondition) { - this.prerequisiteFlagCondition = prerequisiteFlagCondition; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConditionModel conditionModel = (ConditionModel) o; - return Objects.equals(this.userCondition, conditionModel.userCondition) - && Objects.equals(this.segmentCondition, conditionModel.segmentCondition) - && Objects.equals( - this.prerequisiteFlagCondition, conditionModel.prerequisiteFlagCondition); - } - @Override - public int hashCode() { - return Objects.hash(userCondition, segmentCondition, prerequisiteFlagCondition); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConditionModel {\n"); - sb.append(" userCondition: ").append(toIndentedString(userCondition)).append("\n"); - sb.append(" segmentCondition: ").append(toIndentedString(segmentCondition)).append("\n"); - sb.append(" prerequisiteFlagCondition: ") - .append(toIndentedString(prerequisiteFlagCondition)) - .append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + ConditionModel conditionModel = (ConditionModel) o; + return Objects.equals(this.userCondition, conditionModel.userCondition) && + Objects.equals(this.segmentCondition, conditionModel.segmentCondition) && + Objects.equals(this.prerequisiteFlagCondition, conditionModel.prerequisiteFlagCondition)&& + Objects.equals(this.additionalProperties, conditionModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(userCondition, segmentCondition, prerequisiteFlagCondition, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConditionModel {\n"); + sb.append(" userCondition: ").append(toIndentedString(userCondition)).append("\n"); + sb.append(" segmentCondition: ").append(toIndentedString(segmentCondition)).append("\n"); + sb.append(" prerequisiteFlagCondition: ").append(toIndentedString(prerequisiteFlagCondition)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userCondition"); - openapiFields.add("segmentCondition"); - openapiFields.add("prerequisiteFlagCondition"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ConditionModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ConditionModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ConditionModel is not found in the" - + " empty JSON string", - ConditionModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConditionModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ConditionModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userCondition"); + openapiFields.add("segmentCondition"); + openapiFields.add("prerequisiteFlagCondition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConditionModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConditionModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConditionModel is not found in the empty JSON string", ConditionModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `userCondition` - if (jsonObj.get("userCondition") != null && !jsonObj.get("userCondition").isJsonNull()) { - UserConditionModel.validateJsonElement(jsonObj.get("userCondition")); - } - // validate the optional field `segmentCondition` - if (jsonObj.get("segmentCondition") != null - && !jsonObj.get("segmentCondition").isJsonNull()) { - SegmentConditionModel.validateJsonElement(jsonObj.get("segmentCondition")); - } - // validate the optional field `prerequisiteFlagCondition` - if (jsonObj.get("prerequisiteFlagCondition") != null - && !jsonObj.get("prerequisiteFlagCondition").isJsonNull()) { - PrerequisiteFlagConditionModel.validateJsonElement( - jsonObj.get("prerequisiteFlagCondition")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ConditionModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ConditionModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ConditionModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ConditionModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ConditionModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ConditionModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConditionModel - * @throws IOException if the JSON string is invalid with respect to ConditionModel - */ - public static ConditionModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ConditionModel.class); - } - - /** - * Convert an instance of ConditionModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + // validate the optional field `userCondition` + if (jsonObj.get("userCondition") != null && !jsonObj.get("userCondition").isJsonNull()) { + UserConditionModel.validateJsonElement(jsonObj.get("userCondition")); + } + // validate the optional field `segmentCondition` + if (jsonObj.get("segmentCondition") != null && !jsonObj.get("segmentCondition").isJsonNull()) { + SegmentConditionModel.validateJsonElement(jsonObj.get("segmentCondition")); + } + // validate the optional field `prerequisiteFlagCondition` + if (jsonObj.get("prerequisiteFlagCondition") != null && !jsonObj.get("prerequisiteFlagCondition").isJsonNull()) { + PrerequisiteFlagConditionModel.validateJsonElement(jsonObj.get("prerequisiteFlagCondition")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConditionModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConditionModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConditionModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConditionModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConditionModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConditionModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ConditionModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConditionModel + * @throws IOException if the JSON string is invalid with respect to ConditionModel + */ + public static ConditionModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConditionModel.class); + } + + /** + * Convert an instance of ConditionModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ConfigModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ConfigModel.java index c50c588..99038c5 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ConfigModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ConfigModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,410 +10,466 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.EvaluationVersion; +import com.configcat.publicapi.java.client.model.ProductModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** Details of the Config. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ConfigModel { - public static final String SERIALIZED_NAME_PRODUCT = "product"; - - @SerializedName(SERIALIZED_NAME_PRODUCT) - private ProductModel product; - - public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; - - @SerializedName(SERIALIZED_NAME_CONFIG_ID) - private UUID configId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_MIGRATED_CONFIG_ID = "migratedConfigId"; - - @SerializedName(SERIALIZED_NAME_MIGRATED_CONFIG_ID) - private UUID migratedConfigId; - - public static final String SERIALIZED_NAME_EVALUATION_VERSION = "evaluationVersion"; - - @SerializedName(SERIALIZED_NAME_EVALUATION_VERSION) - private EvaluationVersion evaluationVersion; - - public ConfigModel() {} - - public ConfigModel product(ProductModel product) { - this.product = product; - return this; - } - - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public ProductModel getProduct() { - return product; - } - - public void setProduct(ProductModel product) { - this.product = product; - } - - public ConfigModel configId(UUID configId) { - this.configId = configId; - return this; - } - - /** - * Identifier of the Config. - * - * @return configId - */ - @javax.annotation.Nullable - public UUID getConfigId() { - return configId; - } - - public void setConfigId(UUID configId) { - this.configId = configId; - } - - public ConfigModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Config. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public ConfigModel description(String description) { - this.description = description; - return this; - } - - /** - * Description of the Config. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public ConfigModel order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Config represented on the ConfigCat Dashboard. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public ConfigModel migratedConfigId(UUID migratedConfigId) { - this.migratedConfigId = migratedConfigId; - return this; - } - - /** - * Get migratedConfigId - * - * @return migratedConfigId - */ - @javax.annotation.Nullable - public UUID getMigratedConfigId() { - return migratedConfigId; - } - - public void setMigratedConfigId(UUID migratedConfigId) { - this.migratedConfigId = migratedConfigId; - } - - public ConfigModel evaluationVersion(EvaluationVersion evaluationVersion) { - this.evaluationVersion = evaluationVersion; - return this; - } - - /** - * Get evaluationVersion - * - * @return evaluationVersion - */ - @javax.annotation.Nullable - public EvaluationVersion getEvaluationVersion() { - return evaluationVersion; - } - - public void setEvaluationVersion(EvaluationVersion evaluationVersion) { - this.evaluationVersion = evaluationVersion; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConfigModel configModel = (ConfigModel) o; - return Objects.equals(this.product, configModel.product) - && Objects.equals(this.configId, configModel.configId) - && Objects.equals(this.name, configModel.name) - && Objects.equals(this.description, configModel.description) - && Objects.equals(this.order, configModel.order) - && Objects.equals(this.migratedConfigId, configModel.migratedConfigId) - && Objects.equals(this.evaluationVersion, configModel.evaluationVersion); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - product, configId, name, description, order, migratedConfigId, evaluationVersion); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConfigModel {\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" migratedConfigId: ").append(toIndentedString(migratedConfigId)).append("\n"); - sb.append(" evaluationVersion: ") - .append(toIndentedString(evaluationVersion)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("product"); - openapiFields.add("configId"); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("order"); - openapiFields.add("migratedConfigId"); - openapiFields.add("evaluationVersion"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ConfigModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ConfigModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ConfigModel is not found in the empty" - + " JSON string", - ConfigModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConfigModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ConfigModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * Details of the Config. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ConfigModel { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private ProductModel product; + + public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; + @SerializedName(SERIALIZED_NAME_CONFIG_ID) + private UUID configId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_MIGRATED_CONFIG_ID = "migratedConfigId"; + @SerializedName(SERIALIZED_NAME_MIGRATED_CONFIG_ID) + private UUID migratedConfigId; + + public static final String SERIALIZED_NAME_EVALUATION_VERSION = "evaluationVersion"; + @SerializedName(SERIALIZED_NAME_EVALUATION_VERSION) + private EvaluationVersion evaluationVersion; + + public ConfigModel() { + } + + public ConfigModel product(ProductModel product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductModel getProduct() { + return product; + } + + public void setProduct(ProductModel product) { + this.product = product; + } + + + public ConfigModel configId(UUID configId) { + this.configId = configId; + return this; + } + + /** + * Identifier of the Config. + * @return configId + */ + @javax.annotation.Nullable + public UUID getConfigId() { + return configId; + } + + public void setConfigId(UUID configId) { + this.configId = configId; + } + + + public ConfigModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Config. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public ConfigModel description(String description) { + this.description = description; + return this; + } + + /** + * Description of the Config. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public ConfigModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Config represented on the ConfigCat Dashboard. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public ConfigModel migratedConfigId(UUID migratedConfigId) { + this.migratedConfigId = migratedConfigId; + return this; + } + + /** + * Get migratedConfigId + * @return migratedConfigId + */ + @javax.annotation.Nullable + public UUID getMigratedConfigId() { + return migratedConfigId; + } + + public void setMigratedConfigId(UUID migratedConfigId) { + this.migratedConfigId = migratedConfigId; + } + + + public ConfigModel evaluationVersion(EvaluationVersion evaluationVersion) { + this.evaluationVersion = evaluationVersion; + return this; + } + + /** + * Get evaluationVersion + * @return evaluationVersion + */ + @javax.annotation.Nullable + public EvaluationVersion getEvaluationVersion() { + return evaluationVersion; + } + + public void setEvaluationVersion(EvaluationVersion evaluationVersion) { + this.evaluationVersion = evaluationVersion; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfigModel instance itself + */ + public ConfigModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigModel configModel = (ConfigModel) o; + return Objects.equals(this.product, configModel.product) && + Objects.equals(this.configId, configModel.configId) && + Objects.equals(this.name, configModel.name) && + Objects.equals(this.description, configModel.description) && + Objects.equals(this.order, configModel.order) && + Objects.equals(this.migratedConfigId, configModel.migratedConfigId) && + Objects.equals(this.evaluationVersion, configModel.evaluationVersion)&& + Objects.equals(this.additionalProperties, configModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, configId, name, description, order, migratedConfigId, evaluationVersion, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigModel {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" migratedConfigId: ").append(toIndentedString(migratedConfigId)).append("\n"); + sb.append(" evaluationVersion: ").append(toIndentedString(evaluationVersion)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("configId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("order"); + openapiFields.add("migratedConfigId"); + openapiFields.add("evaluationVersion"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConfigModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConfigModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigModel is not found in the empty JSON string", ConfigModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - ProductModel.validateJsonElement(jsonObj.get("product")); - } - if ((jsonObj.get("configId") != null && !jsonObj.get("configId").isJsonNull()) - && !jsonObj.get("configId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("configId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - if ((jsonObj.get("migratedConfigId") != null - && !jsonObj.get("migratedConfigId").isJsonNull()) - && !jsonObj.get("migratedConfigId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `migratedConfigId` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("migratedConfigId").toString())); - } - // validate the optional field `evaluationVersion` - if (jsonObj.get("evaluationVersion") != null - && !jsonObj.get("evaluationVersion").isJsonNull()) { - EvaluationVersion.validateJsonElement(jsonObj.get("evaluationVersion")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ConfigModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ConfigModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ConfigModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ConfigModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ConfigModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ConfigModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConfigModel - * @throws IOException if the JSON string is invalid with respect to ConfigModel - */ - public static ConfigModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ConfigModel.class); - } - - /** - * Convert an instance of ConfigModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductModel.validateJsonElement(jsonObj.get("product")); + } + if ((jsonObj.get("configId") != null && !jsonObj.get("configId").isJsonNull()) && !jsonObj.get("configId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `configId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("configId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("migratedConfigId") != null && !jsonObj.get("migratedConfigId").isJsonNull()) && !jsonObj.get("migratedConfigId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `migratedConfigId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("migratedConfigId").toString())); + } + // validate the optional field `evaluationVersion` + if (jsonObj.get("evaluationVersion") != null && !jsonObj.get("evaluationVersion").isJsonNull()) { + EvaluationVersion.validateJsonElement(jsonObj.get("evaluationVersion")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConfigModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConfigModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConfigModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConfigModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConfigModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfigModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConfigModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConfigModel + * @throws IOException if the JSON string is invalid with respect to ConfigModel + */ + public static ConfigModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConfigModel.class); + } + + /** + * Convert an instance of ConfigModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingFormulaModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingFormulaModel.java index 08c38d4..677e3a1 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingFormulaModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingFormulaModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,657 +10,654 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.IntegrationLinkModel; +import com.configcat.publicapi.java.client.model.SettingDataModel; +import com.configcat.publicapi.java.client.model.SettingTagModel; +import com.configcat.publicapi.java.client.model.TargetingRuleModel; +import com.configcat.publicapi.java.client.model.ValueModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** ConfigSettingFormulaModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ConfigSettingFormulaModel { - public static final String SERIALIZED_NAME_LAST_VERSION_ID = "lastVersionId"; - - @SerializedName(SERIALIZED_NAME_LAST_VERSION_ID) - private UUID lastVersionId; - - public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; - - @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) - private ValueModel defaultValue; - - public static final String SERIALIZED_NAME_TARGETING_RULES = "targetingRules"; - - @SerializedName(SERIALIZED_NAME_TARGETING_RULES) - private List targetingRules; - - public static final String SERIALIZED_NAME_SETTING = "setting"; - - @SerializedName(SERIALIZED_NAME_SETTING) - private SettingDataModel setting; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public static final String SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE = - "percentageEvaluationAttribute"; - - @SerializedName(SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE) - private String percentageEvaluationAttribute; - - public static final String SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL = "lastUpdaterUserEmail"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL) - private String lastUpdaterUserEmail; - - public static final String SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME = - "lastUpdaterUserFullName"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME) - private String lastUpdaterUserFullName; - - public static final String SERIALIZED_NAME_INTEGRATION_LINKS = "integrationLinks"; - - @SerializedName(SERIALIZED_NAME_INTEGRATION_LINKS) - private List integrationLinks; - - public static final String SERIALIZED_NAME_SETTING_TAGS = "settingTags"; - - @SerializedName(SERIALIZED_NAME_SETTING_TAGS) - private List settingTags; - - public static final String SERIALIZED_NAME_SETTING_IDS_WHERE_PREREQUISITE = - "settingIdsWherePrerequisite"; - - @SerializedName(SERIALIZED_NAME_SETTING_IDS_WHERE_PREREQUISITE) - private List settingIdsWherePrerequisite; - - public ConfigSettingFormulaModel() {} - - public ConfigSettingFormulaModel lastVersionId(UUID lastVersionId) { - this.lastVersionId = lastVersionId; - return this; - } - - /** - * Get lastVersionId - * - * @return lastVersionId - */ - @javax.annotation.Nullable - public UUID getLastVersionId() { - return lastVersionId; - } - - public void setLastVersionId(UUID lastVersionId) { - this.lastVersionId = lastVersionId; - } - - public ConfigSettingFormulaModel defaultValue(ValueModel defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - /** - * Get defaultValue - * - * @return defaultValue - */ - @javax.annotation.Nullable - public ValueModel getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(ValueModel defaultValue) { - this.defaultValue = defaultValue; - } - - public ConfigSettingFormulaModel targetingRules(List targetingRules) { - this.targetingRules = targetingRules; - return this; - } - - public ConfigSettingFormulaModel addTargetingRulesItem(TargetingRuleModel targetingRulesItem) { - if (this.targetingRules == null) { - this.targetingRules = new ArrayList<>(); - } - this.targetingRules.add(targetingRulesItem); - return this; - } - - /** - * The targeting rules of the Feature Flag or Setting. - * - * @return targetingRules - */ - @javax.annotation.Nullable - public List getTargetingRules() { - return targetingRules; - } - - public void setTargetingRules(List targetingRules) { - this.targetingRules = targetingRules; - } - - public ConfigSettingFormulaModel setting(SettingDataModel setting) { - this.setting = setting; - return this; - } - - /** - * Get setting - * - * @return setting - */ - @javax.annotation.Nullable - public SettingDataModel getSetting() { - return setting; - } - - public void setSetting(SettingDataModel setting) { - this.setting = setting; - } - - public ConfigSettingFormulaModel updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * The last updated date and time when the Feature Flag or Setting. - * - * @return updatedAt - */ - @javax.annotation.Nullable - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public ConfigSettingFormulaModel percentageEvaluationAttribute( - String percentageEvaluationAttribute) { - this.percentageEvaluationAttribute = percentageEvaluationAttribute; - return this; - } - - /** - * The user attribute used for percentage evaluation. If not set, it defaults to the - * `Identifier` user object attribute. - * - * @return percentageEvaluationAttribute - */ - @javax.annotation.Nullable - public String getPercentageEvaluationAttribute() { - return percentageEvaluationAttribute; - } - - public void setPercentageEvaluationAttribute(String percentageEvaluationAttribute) { - this.percentageEvaluationAttribute = percentageEvaluationAttribute; - } - - public ConfigSettingFormulaModel lastUpdaterUserEmail(String lastUpdaterUserEmail) { - this.lastUpdaterUserEmail = lastUpdaterUserEmail; - return this; - } - - /** - * The email of the user who last updated the Feature Flag or Setting. - * - * @return lastUpdaterUserEmail - */ - @javax.annotation.Nullable - public String getLastUpdaterUserEmail() { - return lastUpdaterUserEmail; - } - - public void setLastUpdaterUserEmail(String lastUpdaterUserEmail) { - this.lastUpdaterUserEmail = lastUpdaterUserEmail; - } - - public ConfigSettingFormulaModel lastUpdaterUserFullName(String lastUpdaterUserFullName) { - this.lastUpdaterUserFullName = lastUpdaterUserFullName; - return this; - } - - /** - * The name of the user who last updated the Feature Flag or Setting. - * - * @return lastUpdaterUserFullName - */ - @javax.annotation.Nullable - public String getLastUpdaterUserFullName() { - return lastUpdaterUserFullName; - } - - public void setLastUpdaterUserFullName(String lastUpdaterUserFullName) { - this.lastUpdaterUserFullName = lastUpdaterUserFullName; - } - - public ConfigSettingFormulaModel integrationLinks(List integrationLinks) { - this.integrationLinks = integrationLinks; - return this; - } - - public ConfigSettingFormulaModel addIntegrationLinksItem( - IntegrationLinkModel integrationLinksItem) { - if (this.integrationLinks == null) { - this.integrationLinks = new ArrayList<>(); - } - this.integrationLinks.add(integrationLinksItem); - return this; - } - - /** - * The integration links attached to the Feature Flag or Setting. - * - * @return integrationLinks - */ - @javax.annotation.Nullable - public List getIntegrationLinks() { - return integrationLinks; - } - - public void setIntegrationLinks(List integrationLinks) { - this.integrationLinks = integrationLinks; - } - - public ConfigSettingFormulaModel settingTags(List settingTags) { - this.settingTags = settingTags; - return this; - } - - public ConfigSettingFormulaModel addSettingTagsItem(SettingTagModel settingTagsItem) { - if (this.settingTags == null) { - this.settingTags = new ArrayList<>(); - } - this.settingTags.add(settingTagsItem); - return this; - } - - /** - * The tags attached to the Feature Flag or Setting. - * - * @return settingTags - */ - @javax.annotation.Nullable - public List getSettingTags() { - return settingTags; - } - - public void setSettingTags(List settingTags) { - this.settingTags = settingTags; - } - - public ConfigSettingFormulaModel settingIdsWherePrerequisite( - List settingIdsWherePrerequisite) { - this.settingIdsWherePrerequisite = settingIdsWherePrerequisite; - return this; - } - - public ConfigSettingFormulaModel addSettingIdsWherePrerequisiteItem( - Integer settingIdsWherePrerequisiteItem) { - if (this.settingIdsWherePrerequisite == null) { - this.settingIdsWherePrerequisite = new ArrayList<>(); - } - this.settingIdsWherePrerequisite.add(settingIdsWherePrerequisiteItem); - return this; - } - - /** - * List of Feature Flag and Setting IDs where the actual Feature Flag or Setting is - * prerequisite. - * - * @return settingIdsWherePrerequisite - */ - @javax.annotation.Nullable - public List getSettingIdsWherePrerequisite() { - return settingIdsWherePrerequisite; - } - - public void setSettingIdsWherePrerequisite(List settingIdsWherePrerequisite) { - this.settingIdsWherePrerequisite = settingIdsWherePrerequisite; - } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConfigSettingFormulaModel configSettingFormulaModel = (ConfigSettingFormulaModel) o; - return Objects.equals(this.lastVersionId, configSettingFormulaModel.lastVersionId) - && Objects.equals(this.defaultValue, configSettingFormulaModel.defaultValue) - && Objects.equals(this.targetingRules, configSettingFormulaModel.targetingRules) - && Objects.equals(this.setting, configSettingFormulaModel.setting) - && Objects.equals(this.updatedAt, configSettingFormulaModel.updatedAt) - && Objects.equals( - this.percentageEvaluationAttribute, - configSettingFormulaModel.percentageEvaluationAttribute) - && Objects.equals( - this.lastUpdaterUserEmail, configSettingFormulaModel.lastUpdaterUserEmail) - && Objects.equals( - this.lastUpdaterUserFullName, - configSettingFormulaModel.lastUpdaterUserFullName) - && Objects.equals(this.integrationLinks, configSettingFormulaModel.integrationLinks) - && Objects.equals(this.settingTags, configSettingFormulaModel.settingTags) - && Objects.equals( - this.settingIdsWherePrerequisite, - configSettingFormulaModel.settingIdsWherePrerequisite); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - lastVersionId, - defaultValue, - targetingRules, - setting, - updatedAt, - percentageEvaluationAttribute, - lastUpdaterUserEmail, - lastUpdaterUserFullName, - integrationLinks, - settingTags, - settingIdsWherePrerequisite); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConfigSettingFormulaModel {\n"); - sb.append(" lastVersionId: ").append(toIndentedString(lastVersionId)).append("\n"); - sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); - sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); - sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" percentageEvaluationAttribute: ") - .append(toIndentedString(percentageEvaluationAttribute)) - .append("\n"); - sb.append(" lastUpdaterUserEmail: ") - .append(toIndentedString(lastUpdaterUserEmail)) - .append("\n"); - sb.append(" lastUpdaterUserFullName: ") - .append(toIndentedString(lastUpdaterUserFullName)) - .append("\n"); - sb.append(" integrationLinks: ").append(toIndentedString(integrationLinks)).append("\n"); - sb.append(" settingTags: ").append(toIndentedString(settingTags)).append("\n"); - sb.append(" settingIdsWherePrerequisite: ") - .append(toIndentedString(settingIdsWherePrerequisite)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("lastVersionId"); - openapiFields.add("defaultValue"); - openapiFields.add("targetingRules"); - openapiFields.add("setting"); - openapiFields.add("updatedAt"); - openapiFields.add("percentageEvaluationAttribute"); - openapiFields.add("lastUpdaterUserEmail"); - openapiFields.add("lastUpdaterUserFullName"); - openapiFields.add("integrationLinks"); - openapiFields.add("settingTags"); - openapiFields.add("settingIdsWherePrerequisite"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ConfigSettingFormulaModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ConfigSettingFormulaModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ConfigSettingFormulaModel is not" - + " found in the empty JSON string", - ConfigSettingFormulaModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConfigSettingFormulaModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ConfigSettingFormulaModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * ConfigSettingFormulaModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ConfigSettingFormulaModel { + public static final String SERIALIZED_NAME_LAST_VERSION_ID = "lastVersionId"; + @SerializedName(SERIALIZED_NAME_LAST_VERSION_ID) + private UUID lastVersionId; + + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private ValueModel defaultValue; + + public static final String SERIALIZED_NAME_TARGETING_RULES = "targetingRules"; + @SerializedName(SERIALIZED_NAME_TARGETING_RULES) + private List targetingRules; + + public static final String SERIALIZED_NAME_SETTING = "setting"; + @SerializedName(SERIALIZED_NAME_SETTING) + private SettingDataModel setting; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE = "percentageEvaluationAttribute"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE) + private String percentageEvaluationAttribute; + + public static final String SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL = "lastUpdaterUserEmail"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL) + private String lastUpdaterUserEmail; + + public static final String SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME = "lastUpdaterUserFullName"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME) + private String lastUpdaterUserFullName; + + public static final String SERIALIZED_NAME_INTEGRATION_LINKS = "integrationLinks"; + @SerializedName(SERIALIZED_NAME_INTEGRATION_LINKS) + private List integrationLinks; + + public static final String SERIALIZED_NAME_SETTING_TAGS = "settingTags"; + @SerializedName(SERIALIZED_NAME_SETTING_TAGS) + private List settingTags; + + public static final String SERIALIZED_NAME_SETTING_IDS_WHERE_PREREQUISITE = "settingIdsWherePrerequisite"; + @SerializedName(SERIALIZED_NAME_SETTING_IDS_WHERE_PREREQUISITE) + private List settingIdsWherePrerequisite; + + public ConfigSettingFormulaModel() { + } + + public ConfigSettingFormulaModel lastVersionId(UUID lastVersionId) { + this.lastVersionId = lastVersionId; + return this; + } + + /** + * Get lastVersionId + * @return lastVersionId + */ + @javax.annotation.Nullable + public UUID getLastVersionId() { + return lastVersionId; + } + + public void setLastVersionId(UUID lastVersionId) { + this.lastVersionId = lastVersionId; + } + + + public ConfigSettingFormulaModel defaultValue(ValueModel defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * Get defaultValue + * @return defaultValue + */ + @javax.annotation.Nullable + public ValueModel getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(ValueModel defaultValue) { + this.defaultValue = defaultValue; + } + + + public ConfigSettingFormulaModel targetingRules(List targetingRules) { + this.targetingRules = targetingRules; + return this; + } + + public ConfigSettingFormulaModel addTargetingRulesItem(TargetingRuleModel targetingRulesItem) { + if (this.targetingRules == null) { + this.targetingRules = new ArrayList<>(); + } + this.targetingRules.add(targetingRulesItem); + return this; + } + + /** + * The targeting rules of the Feature Flag or Setting. + * @return targetingRules + */ + @javax.annotation.Nullable + public List getTargetingRules() { + return targetingRules; + } + + public void setTargetingRules(List targetingRules) { + this.targetingRules = targetingRules; + } + + + public ConfigSettingFormulaModel setting(SettingDataModel setting) { + this.setting = setting; + return this; + } + + /** + * Get setting + * @return setting + */ + @javax.annotation.Nullable + public SettingDataModel getSetting() { + return setting; + } + + public void setSetting(SettingDataModel setting) { + this.setting = setting; + } + + + public ConfigSettingFormulaModel updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The last updated date and time when the Feature Flag or Setting. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public ConfigSettingFormulaModel percentageEvaluationAttribute(String percentageEvaluationAttribute) { + this.percentageEvaluationAttribute = percentageEvaluationAttribute; + return this; + } + + /** + * The user attribute used for percentage evaluation. If not set, it defaults to the `Identifier` user object attribute. + * @return percentageEvaluationAttribute + */ + @javax.annotation.Nullable + public String getPercentageEvaluationAttribute() { + return percentageEvaluationAttribute; + } + + public void setPercentageEvaluationAttribute(String percentageEvaluationAttribute) { + this.percentageEvaluationAttribute = percentageEvaluationAttribute; + } + + + public ConfigSettingFormulaModel lastUpdaterUserEmail(String lastUpdaterUserEmail) { + this.lastUpdaterUserEmail = lastUpdaterUserEmail; + return this; + } + + /** + * The email of the user who last updated the Feature Flag or Setting. + * @return lastUpdaterUserEmail + */ + @javax.annotation.Nullable + public String getLastUpdaterUserEmail() { + return lastUpdaterUserEmail; + } + + public void setLastUpdaterUserEmail(String lastUpdaterUserEmail) { + this.lastUpdaterUserEmail = lastUpdaterUserEmail; + } + + + public ConfigSettingFormulaModel lastUpdaterUserFullName(String lastUpdaterUserFullName) { + this.lastUpdaterUserFullName = lastUpdaterUserFullName; + return this; + } + + /** + * The name of the user who last updated the Feature Flag or Setting. + * @return lastUpdaterUserFullName + */ + @javax.annotation.Nullable + public String getLastUpdaterUserFullName() { + return lastUpdaterUserFullName; + } + + public void setLastUpdaterUserFullName(String lastUpdaterUserFullName) { + this.lastUpdaterUserFullName = lastUpdaterUserFullName; + } + + + public ConfigSettingFormulaModel integrationLinks(List integrationLinks) { + this.integrationLinks = integrationLinks; + return this; + } + + public ConfigSettingFormulaModel addIntegrationLinksItem(IntegrationLinkModel integrationLinksItem) { + if (this.integrationLinks == null) { + this.integrationLinks = new ArrayList<>(); + } + this.integrationLinks.add(integrationLinksItem); + return this; + } + + /** + * The integration links attached to the Feature Flag or Setting. + * @return integrationLinks + */ + @javax.annotation.Nullable + public List getIntegrationLinks() { + return integrationLinks; + } + + public void setIntegrationLinks(List integrationLinks) { + this.integrationLinks = integrationLinks; + } + + + public ConfigSettingFormulaModel settingTags(List settingTags) { + this.settingTags = settingTags; + return this; + } + + public ConfigSettingFormulaModel addSettingTagsItem(SettingTagModel settingTagsItem) { + if (this.settingTags == null) { + this.settingTags = new ArrayList<>(); + } + this.settingTags.add(settingTagsItem); + return this; + } + + /** + * The tags attached to the Feature Flag or Setting. + * @return settingTags + */ + @javax.annotation.Nullable + public List getSettingTags() { + return settingTags; + } + + public void setSettingTags(List settingTags) { + this.settingTags = settingTags; + } + + + public ConfigSettingFormulaModel settingIdsWherePrerequisite(List settingIdsWherePrerequisite) { + this.settingIdsWherePrerequisite = settingIdsWherePrerequisite; + return this; + } + + public ConfigSettingFormulaModel addSettingIdsWherePrerequisiteItem(Integer settingIdsWherePrerequisiteItem) { + if (this.settingIdsWherePrerequisite == null) { + this.settingIdsWherePrerequisite = new ArrayList<>(); + } + this.settingIdsWherePrerequisite.add(settingIdsWherePrerequisiteItem); + return this; + } + + /** + * List of Feature Flag and Setting IDs where the actual Feature Flag or Setting is prerequisite. + * @return settingIdsWherePrerequisite + */ + @javax.annotation.Nullable + public List getSettingIdsWherePrerequisite() { + return settingIdsWherePrerequisite; + } + + public void setSettingIdsWherePrerequisite(List settingIdsWherePrerequisite) { + this.settingIdsWherePrerequisite = settingIdsWherePrerequisite; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfigSettingFormulaModel instance itself + */ + public ConfigSettingFormulaModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigSettingFormulaModel configSettingFormulaModel = (ConfigSettingFormulaModel) o; + return Objects.equals(this.lastVersionId, configSettingFormulaModel.lastVersionId) && + Objects.equals(this.defaultValue, configSettingFormulaModel.defaultValue) && + Objects.equals(this.targetingRules, configSettingFormulaModel.targetingRules) && + Objects.equals(this.setting, configSettingFormulaModel.setting) && + Objects.equals(this.updatedAt, configSettingFormulaModel.updatedAt) && + Objects.equals(this.percentageEvaluationAttribute, configSettingFormulaModel.percentageEvaluationAttribute) && + Objects.equals(this.lastUpdaterUserEmail, configSettingFormulaModel.lastUpdaterUserEmail) && + Objects.equals(this.lastUpdaterUserFullName, configSettingFormulaModel.lastUpdaterUserFullName) && + Objects.equals(this.integrationLinks, configSettingFormulaModel.integrationLinks) && + Objects.equals(this.settingTags, configSettingFormulaModel.settingTags) && + Objects.equals(this.settingIdsWherePrerequisite, configSettingFormulaModel.settingIdsWherePrerequisite)&& + Objects.equals(this.additionalProperties, configSettingFormulaModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(lastVersionId, defaultValue, targetingRules, setting, updatedAt, percentageEvaluationAttribute, lastUpdaterUserEmail, lastUpdaterUserFullName, integrationLinks, settingTags, settingIdsWherePrerequisite, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigSettingFormulaModel {\n"); + sb.append(" lastVersionId: ").append(toIndentedString(lastVersionId)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); + sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" percentageEvaluationAttribute: ").append(toIndentedString(percentageEvaluationAttribute)).append("\n"); + sb.append(" lastUpdaterUserEmail: ").append(toIndentedString(lastUpdaterUserEmail)).append("\n"); + sb.append(" lastUpdaterUserFullName: ").append(toIndentedString(lastUpdaterUserFullName)).append("\n"); + sb.append(" integrationLinks: ").append(toIndentedString(integrationLinks)).append("\n"); + sb.append(" settingTags: ").append(toIndentedString(settingTags)).append("\n"); + sb.append(" settingIdsWherePrerequisite: ").append(toIndentedString(settingIdsWherePrerequisite)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lastVersionId"); + openapiFields.add("defaultValue"); + openapiFields.add("targetingRules"); + openapiFields.add("setting"); + openapiFields.add("updatedAt"); + openapiFields.add("percentageEvaluationAttribute"); + openapiFields.add("lastUpdaterUserEmail"); + openapiFields.add("lastUpdaterUserFullName"); + openapiFields.add("integrationLinks"); + openapiFields.add("settingTags"); + openapiFields.add("settingIdsWherePrerequisite"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConfigSettingFormulaModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConfigSettingFormulaModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigSettingFormulaModel is not found in the empty JSON string", ConfigSettingFormulaModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("lastVersionId") != null && !jsonObj.get("lastVersionId").isJsonNull()) - && !jsonObj.get("lastVersionId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastVersionId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("lastVersionId").toString())); - } - // validate the optional field `defaultValue` - if (jsonObj.get("defaultValue") != null && !jsonObj.get("defaultValue").isJsonNull()) { - ValueModel.validateJsonElement(jsonObj.get("defaultValue")); - } - if (jsonObj.get("targetingRules") != null && !jsonObj.get("targetingRules").isJsonNull()) { - JsonArray jsonArraytargetingRules = jsonObj.getAsJsonArray("targetingRules"); - if (jsonArraytargetingRules != null) { - // ensure the json data is an array - if (!jsonObj.get("targetingRules").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `targetingRules` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("targetingRules").toString())); - } - - // validate the optional field `targetingRules` (array) - for (int i = 0; i < jsonArraytargetingRules.size(); i++) { - TargetingRuleModel.validateJsonElement(jsonArraytargetingRules.get(i)); - } - ; - } - } - // validate the optional field `setting` - if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { - SettingDataModel.validateJsonElement(jsonObj.get("setting")); - } - if ((jsonObj.get("percentageEvaluationAttribute") != null - && !jsonObj.get("percentageEvaluationAttribute").isJsonNull()) - && !jsonObj.get("percentageEvaluationAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `percentageEvaluationAttribute` to be a primitive" - + " type in the JSON string but got `%s`", - jsonObj.get("percentageEvaluationAttribute").toString())); - } - if ((jsonObj.get("lastUpdaterUserEmail") != null - && !jsonObj.get("lastUpdaterUserEmail").isJsonNull()) - && !jsonObj.get("lastUpdaterUserEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterUserEmail` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("lastUpdaterUserEmail").toString())); - } - if ((jsonObj.get("lastUpdaterUserFullName") != null - && !jsonObj.get("lastUpdaterUserFullName").isJsonNull()) - && !jsonObj.get("lastUpdaterUserFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterUserFullName` to be a primitive type" - + " in the JSON string but got `%s`", - jsonObj.get("lastUpdaterUserFullName").toString())); - } - if (jsonObj.get("integrationLinks") != null - && !jsonObj.get("integrationLinks").isJsonNull()) { - JsonArray jsonArrayintegrationLinks = jsonObj.getAsJsonArray("integrationLinks"); - if (jsonArrayintegrationLinks != null) { - // ensure the json data is an array - if (!jsonObj.get("integrationLinks").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `integrationLinks` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("integrationLinks").toString())); - } - - // validate the optional field `integrationLinks` (array) - for (int i = 0; i < jsonArrayintegrationLinks.size(); i++) { - IntegrationLinkModel.validateJsonElement(jsonArrayintegrationLinks.get(i)); - } - ; - } + if ((jsonObj.get("lastVersionId") != null && !jsonObj.get("lastVersionId").isJsonNull()) && !jsonObj.get("lastVersionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastVersionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastVersionId").toString())); + } + // validate the optional field `defaultValue` + if (jsonObj.get("defaultValue") != null && !jsonObj.get("defaultValue").isJsonNull()) { + ValueModel.validateJsonElement(jsonObj.get("defaultValue")); + } + if (jsonObj.get("targetingRules") != null && !jsonObj.get("targetingRules").isJsonNull()) { + JsonArray jsonArraytargetingRules = jsonObj.getAsJsonArray("targetingRules"); + if (jsonArraytargetingRules != null) { + // ensure the json data is an array + if (!jsonObj.get("targetingRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `targetingRules` to be an array in the JSON string but got `%s`", jsonObj.get("targetingRules").toString())); + } + + // validate the optional field `targetingRules` (array) + for (int i = 0; i < jsonArraytargetingRules.size(); i++) { + TargetingRuleModel.validateJsonElement(jsonArraytargetingRules.get(i)); + }; } - if (jsonObj.get("settingTags") != null && !jsonObj.get("settingTags").isJsonNull()) { - JsonArray jsonArraysettingTags = jsonObj.getAsJsonArray("settingTags"); - if (jsonArraysettingTags != null) { - // ensure the json data is an array - if (!jsonObj.get("settingTags").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingTags` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("settingTags").toString())); - } - - // validate the optional field `settingTags` (array) - for (int i = 0; i < jsonArraysettingTags.size(); i++) { - SettingTagModel.validateJsonElement(jsonArraysettingTags.get(i)); - } - ; - } + } + // validate the optional field `setting` + if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { + SettingDataModel.validateJsonElement(jsonObj.get("setting")); + } + if ((jsonObj.get("percentageEvaluationAttribute") != null && !jsonObj.get("percentageEvaluationAttribute").isJsonNull()) && !jsonObj.get("percentageEvaluationAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentageEvaluationAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentageEvaluationAttribute").toString())); + } + if ((jsonObj.get("lastUpdaterUserEmail") != null && !jsonObj.get("lastUpdaterUserEmail").isJsonNull()) && !jsonObj.get("lastUpdaterUserEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterUserEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterUserEmail").toString())); + } + if ((jsonObj.get("lastUpdaterUserFullName") != null && !jsonObj.get("lastUpdaterUserFullName").isJsonNull()) && !jsonObj.get("lastUpdaterUserFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterUserFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterUserFullName").toString())); + } + if (jsonObj.get("integrationLinks") != null && !jsonObj.get("integrationLinks").isJsonNull()) { + JsonArray jsonArrayintegrationLinks = jsonObj.getAsJsonArray("integrationLinks"); + if (jsonArrayintegrationLinks != null) { + // ensure the json data is an array + if (!jsonObj.get("integrationLinks").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `integrationLinks` to be an array in the JSON string but got `%s`", jsonObj.get("integrationLinks").toString())); + } + + // validate the optional field `integrationLinks` (array) + for (int i = 0; i < jsonArrayintegrationLinks.size(); i++) { + IntegrationLinkModel.validateJsonElement(jsonArrayintegrationLinks.get(i)); + }; } - // ensure the optional json data is an array if present - if (jsonObj.get("settingIdsWherePrerequisite") != null - && !jsonObj.get("settingIdsWherePrerequisite").isJsonNull() - && !jsonObj.get("settingIdsWherePrerequisite").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingIdsWherePrerequisite` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("settingIdsWherePrerequisite").toString())); + } + if (jsonObj.get("settingTags") != null && !jsonObj.get("settingTags").isJsonNull()) { + JsonArray jsonArraysettingTags = jsonObj.getAsJsonArray("settingTags"); + if (jsonArraysettingTags != null) { + // ensure the json data is an array + if (!jsonObj.get("settingTags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingTags` to be an array in the JSON string but got `%s`", jsonObj.get("settingTags").toString())); + } + + // validate the optional field `settingTags` (array) + for (int i = 0; i < jsonArraysettingTags.size(); i++) { + SettingTagModel.validateJsonElement(jsonArraysettingTags.get(i)); + }; } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ConfigSettingFormulaModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ConfigSettingFormulaModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ConfigSettingFormulaModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ConfigSettingFormulaModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ConfigSettingFormulaModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ConfigSettingFormulaModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConfigSettingFormulaModel - * @throws IOException if the JSON string is invalid with respect to ConfigSettingFormulaModel - */ - public static ConfigSettingFormulaModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ConfigSettingFormulaModel.class); - } - - /** - * Convert an instance of ConfigSettingFormulaModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + } + // ensure the optional json data is an array if present + if (jsonObj.get("settingIdsWherePrerequisite") != null && !jsonObj.get("settingIdsWherePrerequisite").isJsonNull() && !jsonObj.get("settingIdsWherePrerequisite").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingIdsWherePrerequisite` to be an array in the JSON string but got `%s`", jsonObj.get("settingIdsWherePrerequisite").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConfigSettingFormulaModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConfigSettingFormulaModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConfigSettingFormulaModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConfigSettingFormulaModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConfigSettingFormulaModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfigSettingFormulaModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConfigSettingFormulaModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConfigSettingFormulaModel + * @throws IOException if the JSON string is invalid with respect to ConfigSettingFormulaModel + */ + public static ConfigSettingFormulaModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConfigSettingFormulaModel.class); + } + + /** + * Convert an instance of ConfigSettingFormulaModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingFormulasModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingFormulasModel.java index cfc7417..7518101 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingFormulasModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingFormulasModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,363 +10,431 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ConfigModel; +import com.configcat.publicapi.java.client.model.ConfigSettingFormulaModel; +import com.configcat.publicapi.java.client.model.EnvironmentModel; +import com.configcat.publicapi.java.client.model.FeatureFlagLimitations; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** ConfigSettingFormulasModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ConfigSettingFormulasModel { - public static final String SERIALIZED_NAME_CONFIG = "config"; - - @SerializedName(SERIALIZED_NAME_CONFIG) - private ConfigModel config; - - public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT) - private EnvironmentModel environment; - - public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; - - @SerializedName(SERIALIZED_NAME_READ_ONLY) - private Boolean readOnly; - - public static final String SERIALIZED_NAME_SETTING_FORMULAS = "settingFormulas"; - - @SerializedName(SERIALIZED_NAME_SETTING_FORMULAS) - private List settingFormulas; - - public static final String SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS = "featureFlagLimitations"; - - @SerializedName(SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS) - private FeatureFlagLimitations featureFlagLimitations; - - public ConfigSettingFormulasModel() {} - - public ConfigSettingFormulasModel config(ConfigModel config) { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config - */ - @javax.annotation.Nullable - public ConfigModel getConfig() { - return config; - } - - public void setConfig(ConfigModel config) { - this.config = config; - } - - public ConfigSettingFormulasModel environment(EnvironmentModel environment) { - this.environment = environment; - return this; - } - - /** - * Get environment - * - * @return environment - */ - @javax.annotation.Nullable - public EnvironmentModel getEnvironment() { - return environment; - } - - public void setEnvironment(EnvironmentModel environment) { - this.environment = environment; - } - - public ConfigSettingFormulasModel readOnly(Boolean readOnly) { - this.readOnly = readOnly; - return this; - } - - /** - * Get readOnly - * - * @return readOnly - */ - @javax.annotation.Nullable - public Boolean getReadOnly() { - return readOnly; - } - public void setReadOnly(Boolean readOnly) { - this.readOnly = readOnly; - } - - public ConfigSettingFormulasModel settingFormulas( - List settingFormulas) { - this.settingFormulas = settingFormulas; - return this; - } - - public ConfigSettingFormulasModel addSettingFormulasItem( - ConfigSettingFormulaModel settingFormulasItem) { - if (this.settingFormulas == null) { - this.settingFormulas = new ArrayList<>(); - } - this.settingFormulas.add(settingFormulasItem); - return this; - } +import com.configcat.publicapi.java.client.JSON; - /** - * Evaluation descriptors of each updated Feature Flag and Setting. - * - * @return settingFormulas - */ - @javax.annotation.Nullable - public List getSettingFormulas() { - return settingFormulas; +/** + * ConfigSettingFormulasModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ConfigSettingFormulasModel { + public static final String SERIALIZED_NAME_CONFIG = "config"; + @SerializedName(SERIALIZED_NAME_CONFIG) + private ConfigModel config; + + public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT) + private EnvironmentModel environment; + + public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; + @SerializedName(SERIALIZED_NAME_READ_ONLY) + private Boolean readOnly; + + public static final String SERIALIZED_NAME_SETTING_FORMULAS = "settingFormulas"; + @SerializedName(SERIALIZED_NAME_SETTING_FORMULAS) + private List settingFormulas; + + public static final String SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS = "featureFlagLimitations"; + @SerializedName(SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS) + private FeatureFlagLimitations featureFlagLimitations; + + public ConfigSettingFormulasModel() { + } + + public ConfigSettingFormulasModel config(ConfigModel config) { + this.config = config; + return this; + } + + /** + * Get config + * @return config + */ + @javax.annotation.Nullable + public ConfigModel getConfig() { + return config; + } + + public void setConfig(ConfigModel config) { + this.config = config; + } + + + public ConfigSettingFormulasModel environment(EnvironmentModel environment) { + this.environment = environment; + return this; + } + + /** + * Get environment + * @return environment + */ + @javax.annotation.Nullable + public EnvironmentModel getEnvironment() { + return environment; + } + + public void setEnvironment(EnvironmentModel environment) { + this.environment = environment; + } + + + public ConfigSettingFormulasModel readOnly(Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + /** + * Get readOnly + * @return readOnly + */ + @javax.annotation.Nullable + public Boolean getReadOnly() { + return readOnly; + } + + public void setReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + } + + + public ConfigSettingFormulasModel settingFormulas(List settingFormulas) { + this.settingFormulas = settingFormulas; + return this; + } + + public ConfigSettingFormulasModel addSettingFormulasItem(ConfigSettingFormulaModel settingFormulasItem) { + if (this.settingFormulas == null) { + this.settingFormulas = new ArrayList<>(); } - - public void setSettingFormulas(List settingFormulas) { - this.settingFormulas = settingFormulas; + this.settingFormulas.add(settingFormulasItem); + return this; + } + + /** + * Evaluation descriptors of each updated Feature Flag and Setting. + * @return settingFormulas + */ + @javax.annotation.Nullable + public List getSettingFormulas() { + return settingFormulas; + } + + public void setSettingFormulas(List settingFormulas) { + this.settingFormulas = settingFormulas; + } + + + public ConfigSettingFormulasModel featureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { + this.featureFlagLimitations = featureFlagLimitations; + return this; + } + + /** + * Get featureFlagLimitations + * @return featureFlagLimitations + */ + @javax.annotation.Nullable + public FeatureFlagLimitations getFeatureFlagLimitations() { + return featureFlagLimitations; + } + + public void setFeatureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { + this.featureFlagLimitations = featureFlagLimitations; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfigSettingFormulasModel instance itself + */ + public ConfigSettingFormulasModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public ConfigSettingFormulasModel featureFlagLimitations( - FeatureFlagLimitations featureFlagLimitations) { - this.featureFlagLimitations = featureFlagLimitations; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Get featureFlagLimitations - * - * @return featureFlagLimitations - */ - @javax.annotation.Nullable - public FeatureFlagLimitations getFeatureFlagLimitations() { - return featureFlagLimitations; - } - public void setFeatureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { - this.featureFlagLimitations = featureFlagLimitations; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConfigSettingFormulasModel configSettingFormulasModel = (ConfigSettingFormulasModel) o; - return Objects.equals(this.config, configSettingFormulasModel.config) - && Objects.equals(this.environment, configSettingFormulasModel.environment) - && Objects.equals(this.readOnly, configSettingFormulasModel.readOnly) - && Objects.equals(this.settingFormulas, configSettingFormulasModel.settingFormulas) - && Objects.equals( - this.featureFlagLimitations, - configSettingFormulasModel.featureFlagLimitations); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + ConfigSettingFormulasModel configSettingFormulasModel = (ConfigSettingFormulasModel) o; + return Objects.equals(this.config, configSettingFormulasModel.config) && + Objects.equals(this.environment, configSettingFormulasModel.environment) && + Objects.equals(this.readOnly, configSettingFormulasModel.readOnly) && + Objects.equals(this.settingFormulas, configSettingFormulasModel.settingFormulas) && + Objects.equals(this.featureFlagLimitations, configSettingFormulasModel.featureFlagLimitations)&& + Objects.equals(this.additionalProperties, configSettingFormulasModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(config, environment, readOnly, settingFormulas, featureFlagLimitations, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(config, environment, readOnly, settingFormulas, featureFlagLimitations); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigSettingFormulasModel {\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); + sb.append(" settingFormulas: ").append(toIndentedString(settingFormulas)).append("\n"); + sb.append(" featureFlagLimitations: ").append(toIndentedString(featureFlagLimitations)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConfigSettingFormulasModel {\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); - sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); - sb.append(" settingFormulas: ").append(toIndentedString(settingFormulas)).append("\n"); - sb.append(" featureFlagLimitations: ") - .append(toIndentedString(featureFlagLimitations)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("config"); - openapiFields.add("environment"); - openapiFields.add("readOnly"); - openapiFields.add("settingFormulas"); - openapiFields.add("featureFlagLimitations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ConfigSettingFormulasModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ConfigSettingFormulasModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ConfigSettingFormulasModel is not" - + " found in the empty JSON string", - ConfigSettingFormulasModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConfigSettingFormulasModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ConfigSettingFormulasModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("config"); + openapiFields.add("environment"); + openapiFields.add("readOnly"); + openapiFields.add("settingFormulas"); + openapiFields.add("featureFlagLimitations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConfigSettingFormulasModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConfigSettingFormulasModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigSettingFormulasModel is not found in the empty JSON string", ConfigSettingFormulasModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `config` - if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { - ConfigModel.validateJsonElement(jsonObj.get("config")); - } - // validate the optional field `environment` - if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { - EnvironmentModel.validateJsonElement(jsonObj.get("environment")); + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ConfigModel.validateJsonElement(jsonObj.get("config")); + } + // validate the optional field `environment` + if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { + EnvironmentModel.validateJsonElement(jsonObj.get("environment")); + } + if (jsonObj.get("settingFormulas") != null && !jsonObj.get("settingFormulas").isJsonNull()) { + JsonArray jsonArraysettingFormulas = jsonObj.getAsJsonArray("settingFormulas"); + if (jsonArraysettingFormulas != null) { + // ensure the json data is an array + if (!jsonObj.get("settingFormulas").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingFormulas` to be an array in the JSON string but got `%s`", jsonObj.get("settingFormulas").toString())); + } + + // validate the optional field `settingFormulas` (array) + for (int i = 0; i < jsonArraysettingFormulas.size(); i++) { + ConfigSettingFormulaModel.validateJsonElement(jsonArraysettingFormulas.get(i)); + }; } - if (jsonObj.get("settingFormulas") != null - && !jsonObj.get("settingFormulas").isJsonNull()) { - JsonArray jsonArraysettingFormulas = jsonObj.getAsJsonArray("settingFormulas"); - if (jsonArraysettingFormulas != null) { - // ensure the json data is an array - if (!jsonObj.get("settingFormulas").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingFormulas` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("settingFormulas").toString())); - } - - // validate the optional field `settingFormulas` (array) - for (int i = 0; i < jsonArraysettingFormulas.size(); i++) { - ConfigSettingFormulaModel.validateJsonElement(jsonArraysettingFormulas.get(i)); - } - ; - } - } - // validate the optional field `featureFlagLimitations` - if (jsonObj.get("featureFlagLimitations") != null - && !jsonObj.get("featureFlagLimitations").isJsonNull()) { - FeatureFlagLimitations.validateJsonElement(jsonObj.get("featureFlagLimitations")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ConfigSettingFormulasModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ConfigSettingFormulasModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ConfigSettingFormulasModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ConfigSettingFormulasModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ConfigSettingFormulasModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ConfigSettingFormulasModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConfigSettingFormulasModel - * @throws IOException if the JSON string is invalid with respect to ConfigSettingFormulasModel - */ - public static ConfigSettingFormulasModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ConfigSettingFormulasModel.class); - } - - /** - * Convert an instance of ConfigSettingFormulasModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + } + // validate the optional field `featureFlagLimitations` + if (jsonObj.get("featureFlagLimitations") != null && !jsonObj.get("featureFlagLimitations").isJsonNull()) { + FeatureFlagLimitations.validateJsonElement(jsonObj.get("featureFlagLimitations")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConfigSettingFormulasModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConfigSettingFormulasModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConfigSettingFormulasModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConfigSettingFormulasModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConfigSettingFormulasModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfigSettingFormulasModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ConfigSettingFormulasModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConfigSettingFormulasModel + * @throws IOException if the JSON string is invalid with respect to ConfigSettingFormulasModel + */ + public static ConfigSettingFormulasModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConfigSettingFormulasModel.class); + } + + /** + * Convert an instance of ConfigSettingFormulasModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingValueModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingValueModel.java index 8047333..0e05b8c 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingValueModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingValueModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,581 +10,601 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.IntegrationLinkModel; +import com.configcat.publicapi.java.client.model.RolloutPercentageItemModel; +import com.configcat.publicapi.java.client.model.RolloutRuleModel; +import com.configcat.publicapi.java.client.model.SettingDataModel; +import com.configcat.publicapi.java.client.model.SettingTagModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** ConfigSettingValueModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ConfigSettingValueModel { - public static final String SERIALIZED_NAME_ROLLOUT_RULES = "rolloutRules"; - - @SerializedName(SERIALIZED_NAME_ROLLOUT_RULES) - private List rolloutRules; - - public static final String SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS = "rolloutPercentageItems"; - - @SerializedName(SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS) - private List rolloutPercentageItems; - - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) - private Object value = null; - - public static final String SERIALIZED_NAME_SETTING = "setting"; - - @SerializedName(SERIALIZED_NAME_SETTING) - private SettingDataModel setting; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public static final String SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL = "lastUpdaterUserEmail"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL) - private String lastUpdaterUserEmail; - - public static final String SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME = - "lastUpdaterUserFullName"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME) - private String lastUpdaterUserFullName; - public static final String SERIALIZED_NAME_INTEGRATION_LINKS = "integrationLinks"; - - @SerializedName(SERIALIZED_NAME_INTEGRATION_LINKS) - private List integrationLinks; - - public static final String SERIALIZED_NAME_SETTING_TAGS = "settingTags"; - - @SerializedName(SERIALIZED_NAME_SETTING_TAGS) - private List settingTags; - - public ConfigSettingValueModel() {} - - public ConfigSettingValueModel rolloutRules(List rolloutRules) { - this.rolloutRules = rolloutRules; - return this; - } - - public ConfigSettingValueModel addRolloutRulesItem(RolloutRuleModel rolloutRulesItem) { - if (this.rolloutRules == null) { - this.rolloutRules = new ArrayList<>(); - } - this.rolloutRules.add(rolloutRulesItem); - return this; - } - - /** - * The targeting rule collection. - * - * @return rolloutRules - */ - @javax.annotation.Nullable - public List getRolloutRules() { - return rolloutRules; - } - - public void setRolloutRules(List rolloutRules) { - this.rolloutRules = rolloutRules; - } - - public ConfigSettingValueModel rolloutPercentageItems( - List rolloutPercentageItems) { - this.rolloutPercentageItems = rolloutPercentageItems; - return this; - } - - public ConfigSettingValueModel addRolloutPercentageItemsItem( - RolloutPercentageItemModel rolloutPercentageItemsItem) { - if (this.rolloutPercentageItems == null) { - this.rolloutPercentageItems = new ArrayList<>(); - } - this.rolloutPercentageItems.add(rolloutPercentageItemsItem); - return this; - } - - /** - * The percentage rule collection. - * - * @return rolloutPercentageItems - */ - @javax.annotation.Nullable - public List getRolloutPercentageItems() { - return rolloutPercentageItems; - } - - public void setRolloutPercentageItems(List rolloutPercentageItems) { - this.rolloutPercentageItems = rolloutPercentageItems; - } - - public ConfigSettingValueModel value(Object value) { - this.value = value; - return this; - } - - /** - * The value to serve. It must respect the setting type. - * - * @return value - */ - @javax.annotation.Nullable - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - public ConfigSettingValueModel setting(SettingDataModel setting) { - this.setting = setting; - return this; - } - - /** - * Get setting - * - * @return setting - */ - @javax.annotation.Nullable - public SettingDataModel getSetting() { - return setting; - } - - public void setSetting(SettingDataModel setting) { - this.setting = setting; - } - - public ConfigSettingValueModel updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * The last updated date and time when the Feature Flag or Setting. - * - * @return updatedAt - */ - @javax.annotation.Nullable - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public ConfigSettingValueModel lastUpdaterUserEmail(String lastUpdaterUserEmail) { - this.lastUpdaterUserEmail = lastUpdaterUserEmail; - return this; - } - - /** - * The email of the user who last updated the Feature Flag or Setting. - * - * @return lastUpdaterUserEmail - */ - @javax.annotation.Nullable - public String getLastUpdaterUserEmail() { - return lastUpdaterUserEmail; - } - - public void setLastUpdaterUserEmail(String lastUpdaterUserEmail) { - this.lastUpdaterUserEmail = lastUpdaterUserEmail; - } - - public ConfigSettingValueModel lastUpdaterUserFullName(String lastUpdaterUserFullName) { - this.lastUpdaterUserFullName = lastUpdaterUserFullName; - return this; - } - - /** - * The name of the user who last updated the Feature Flag or Setting. - * - * @return lastUpdaterUserFullName - */ - @javax.annotation.Nullable - public String getLastUpdaterUserFullName() { - return lastUpdaterUserFullName; - } - - public void setLastUpdaterUserFullName(String lastUpdaterUserFullName) { - this.lastUpdaterUserFullName = lastUpdaterUserFullName; - } - - public ConfigSettingValueModel integrationLinks(List integrationLinks) { - this.integrationLinks = integrationLinks; - return this; - } - - public ConfigSettingValueModel addIntegrationLinksItem( - IntegrationLinkModel integrationLinksItem) { - if (this.integrationLinks == null) { - this.integrationLinks = new ArrayList<>(); - } - this.integrationLinks.add(integrationLinksItem); - return this; - } - - /** - * The integration links attached to the Feature Flag or Setting. - * - * @return integrationLinks - */ - @javax.annotation.Nullable - public List getIntegrationLinks() { - return integrationLinks; - } - - public void setIntegrationLinks(List integrationLinks) { - this.integrationLinks = integrationLinks; - } - - public ConfigSettingValueModel settingTags(List settingTags) { - this.settingTags = settingTags; - return this; - } - - public ConfigSettingValueModel addSettingTagsItem(SettingTagModel settingTagsItem) { - if (this.settingTags == null) { - this.settingTags = new ArrayList<>(); - } - this.settingTags.add(settingTagsItem); - return this; - } - - /** - * The tags attached to the Feature Flag or Setting. - * - * @return settingTags - */ - @javax.annotation.Nullable - public List getSettingTags() { - return settingTags; - } - - public void setSettingTags(List settingTags) { - this.settingTags = settingTags; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConfigSettingValueModel configSettingValueModel = (ConfigSettingValueModel) o; - return Objects.equals(this.rolloutRules, configSettingValueModel.rolloutRules) - && Objects.equals( - this.rolloutPercentageItems, configSettingValueModel.rolloutPercentageItems) - && Objects.equals(this.value, configSettingValueModel.value) - && Objects.equals(this.setting, configSettingValueModel.setting) - && Objects.equals(this.updatedAt, configSettingValueModel.updatedAt) - && Objects.equals( - this.lastUpdaterUserEmail, configSettingValueModel.lastUpdaterUserEmail) - && Objects.equals( - this.lastUpdaterUserFullName, - configSettingValueModel.lastUpdaterUserFullName) - && Objects.equals(this.integrationLinks, configSettingValueModel.integrationLinks) - && Objects.equals(this.settingTags, configSettingValueModel.settingTags); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - rolloutRules, - rolloutPercentageItems, - value, - setting, - updatedAt, - lastUpdaterUserEmail, - lastUpdaterUserFullName, - integrationLinks, - settingTags); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConfigSettingValueModel {\n"); - sb.append(" rolloutRules: ").append(toIndentedString(rolloutRules)).append("\n"); - sb.append(" rolloutPercentageItems: ") - .append(toIndentedString(rolloutPercentageItems)) - .append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" lastUpdaterUserEmail: ") - .append(toIndentedString(lastUpdaterUserEmail)) - .append("\n"); - sb.append(" lastUpdaterUserFullName: ") - .append(toIndentedString(lastUpdaterUserFullName)) - .append("\n"); - sb.append(" integrationLinks: ").append(toIndentedString(integrationLinks)).append("\n"); - sb.append(" settingTags: ").append(toIndentedString(settingTags)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("rolloutRules"); - openapiFields.add("rolloutPercentageItems"); - openapiFields.add("value"); - openapiFields.add("setting"); - openapiFields.add("updatedAt"); - openapiFields.add("lastUpdaterUserEmail"); - openapiFields.add("lastUpdaterUserFullName"); - openapiFields.add("integrationLinks"); - openapiFields.add("settingTags"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ConfigSettingValueModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ConfigSettingValueModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ConfigSettingValueModel is not found" - + " in the empty JSON string", - ConfigSettingValueModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConfigSettingValueModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ConfigSettingValueModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * ConfigSettingValueModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ConfigSettingValueModel { + public static final String SERIALIZED_NAME_ROLLOUT_RULES = "rolloutRules"; + @SerializedName(SERIALIZED_NAME_ROLLOUT_RULES) + private List rolloutRules; + + public static final String SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS = "rolloutPercentageItems"; + @SerializedName(SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS) + private List rolloutPercentageItems; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; + + public static final String SERIALIZED_NAME_SETTING = "setting"; + @SerializedName(SERIALIZED_NAME_SETTING) + private SettingDataModel setting; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL = "lastUpdaterUserEmail"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL) + private String lastUpdaterUserEmail; + + public static final String SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME = "lastUpdaterUserFullName"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME) + private String lastUpdaterUserFullName; + + public static final String SERIALIZED_NAME_INTEGRATION_LINKS = "integrationLinks"; + @SerializedName(SERIALIZED_NAME_INTEGRATION_LINKS) + private List integrationLinks; + + public static final String SERIALIZED_NAME_SETTING_TAGS = "settingTags"; + @SerializedName(SERIALIZED_NAME_SETTING_TAGS) + private List settingTags; + + public ConfigSettingValueModel() { + } + + public ConfigSettingValueModel rolloutRules(List rolloutRules) { + this.rolloutRules = rolloutRules; + return this; + } + + public ConfigSettingValueModel addRolloutRulesItem(RolloutRuleModel rolloutRulesItem) { + if (this.rolloutRules == null) { + this.rolloutRules = new ArrayList<>(); + } + this.rolloutRules.add(rolloutRulesItem); + return this; + } + + /** + * The targeting rule collection. + * @return rolloutRules + */ + @javax.annotation.Nullable + public List getRolloutRules() { + return rolloutRules; + } + + public void setRolloutRules(List rolloutRules) { + this.rolloutRules = rolloutRules; + } + + + public ConfigSettingValueModel rolloutPercentageItems(List rolloutPercentageItems) { + this.rolloutPercentageItems = rolloutPercentageItems; + return this; + } + + public ConfigSettingValueModel addRolloutPercentageItemsItem(RolloutPercentageItemModel rolloutPercentageItemsItem) { + if (this.rolloutPercentageItems == null) { + this.rolloutPercentageItems = new ArrayList<>(); + } + this.rolloutPercentageItems.add(rolloutPercentageItemsItem); + return this; + } + + /** + * The percentage rule collection. + * @return rolloutPercentageItems + */ + @javax.annotation.Nullable + public List getRolloutPercentageItems() { + return rolloutPercentageItems; + } + + public void setRolloutPercentageItems(List rolloutPercentageItems) { + this.rolloutPercentageItems = rolloutPercentageItems; + } + + + public ConfigSettingValueModel value(Object value) { + this.value = value; + return this; + } + + /** + * The value to serve. It must respect the setting type. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + + public ConfigSettingValueModel setting(SettingDataModel setting) { + this.setting = setting; + return this; + } + + /** + * Get setting + * @return setting + */ + @javax.annotation.Nullable + public SettingDataModel getSetting() { + return setting; + } + + public void setSetting(SettingDataModel setting) { + this.setting = setting; + } + + + public ConfigSettingValueModel updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The last updated date and time when the Feature Flag or Setting. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public ConfigSettingValueModel lastUpdaterUserEmail(String lastUpdaterUserEmail) { + this.lastUpdaterUserEmail = lastUpdaterUserEmail; + return this; + } + + /** + * The email of the user who last updated the Feature Flag or Setting. + * @return lastUpdaterUserEmail + */ + @javax.annotation.Nullable + public String getLastUpdaterUserEmail() { + return lastUpdaterUserEmail; + } + + public void setLastUpdaterUserEmail(String lastUpdaterUserEmail) { + this.lastUpdaterUserEmail = lastUpdaterUserEmail; + } + + + public ConfigSettingValueModel lastUpdaterUserFullName(String lastUpdaterUserFullName) { + this.lastUpdaterUserFullName = lastUpdaterUserFullName; + return this; + } + + /** + * The name of the user who last updated the Feature Flag or Setting. + * @return lastUpdaterUserFullName + */ + @javax.annotation.Nullable + public String getLastUpdaterUserFullName() { + return lastUpdaterUserFullName; + } + + public void setLastUpdaterUserFullName(String lastUpdaterUserFullName) { + this.lastUpdaterUserFullName = lastUpdaterUserFullName; + } + + + public ConfigSettingValueModel integrationLinks(List integrationLinks) { + this.integrationLinks = integrationLinks; + return this; + } + + public ConfigSettingValueModel addIntegrationLinksItem(IntegrationLinkModel integrationLinksItem) { + if (this.integrationLinks == null) { + this.integrationLinks = new ArrayList<>(); + } + this.integrationLinks.add(integrationLinksItem); + return this; + } + + /** + * The integration links attached to the Feature Flag or Setting. + * @return integrationLinks + */ + @javax.annotation.Nullable + public List getIntegrationLinks() { + return integrationLinks; + } + + public void setIntegrationLinks(List integrationLinks) { + this.integrationLinks = integrationLinks; + } + + + public ConfigSettingValueModel settingTags(List settingTags) { + this.settingTags = settingTags; + return this; + } + + public ConfigSettingValueModel addSettingTagsItem(SettingTagModel settingTagsItem) { + if (this.settingTags == null) { + this.settingTags = new ArrayList<>(); + } + this.settingTags.add(settingTagsItem); + return this; + } + + /** + * The tags attached to the Feature Flag or Setting. + * @return settingTags + */ + @javax.annotation.Nullable + public List getSettingTags() { + return settingTags; + } + + public void setSettingTags(List settingTags) { + this.settingTags = settingTags; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfigSettingValueModel instance itself + */ + public ConfigSettingValueModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigSettingValueModel configSettingValueModel = (ConfigSettingValueModel) o; + return Objects.equals(this.rolloutRules, configSettingValueModel.rolloutRules) && + Objects.equals(this.rolloutPercentageItems, configSettingValueModel.rolloutPercentageItems) && + Objects.equals(this.value, configSettingValueModel.value) && + Objects.equals(this.setting, configSettingValueModel.setting) && + Objects.equals(this.updatedAt, configSettingValueModel.updatedAt) && + Objects.equals(this.lastUpdaterUserEmail, configSettingValueModel.lastUpdaterUserEmail) && + Objects.equals(this.lastUpdaterUserFullName, configSettingValueModel.lastUpdaterUserFullName) && + Objects.equals(this.integrationLinks, configSettingValueModel.integrationLinks) && + Objects.equals(this.settingTags, configSettingValueModel.settingTags)&& + Objects.equals(this.additionalProperties, configSettingValueModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(rolloutRules, rolloutPercentageItems, value, setting, updatedAt, lastUpdaterUserEmail, lastUpdaterUserFullName, integrationLinks, settingTags, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigSettingValueModel {\n"); + sb.append(" rolloutRules: ").append(toIndentedString(rolloutRules)).append("\n"); + sb.append(" rolloutPercentageItems: ").append(toIndentedString(rolloutPercentageItems)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" lastUpdaterUserEmail: ").append(toIndentedString(lastUpdaterUserEmail)).append("\n"); + sb.append(" lastUpdaterUserFullName: ").append(toIndentedString(lastUpdaterUserFullName)).append("\n"); + sb.append(" integrationLinks: ").append(toIndentedString(integrationLinks)).append("\n"); + sb.append(" settingTags: ").append(toIndentedString(settingTags)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rolloutRules"); + openapiFields.add("rolloutPercentageItems"); + openapiFields.add("value"); + openapiFields.add("setting"); + openapiFields.add("updatedAt"); + openapiFields.add("lastUpdaterUserEmail"); + openapiFields.add("lastUpdaterUserFullName"); + openapiFields.add("integrationLinks"); + openapiFields.add("settingTags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConfigSettingValueModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConfigSettingValueModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigSettingValueModel is not found in the empty JSON string", ConfigSettingValueModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("rolloutRules") != null && !jsonObj.get("rolloutRules").isJsonNull()) { - JsonArray jsonArrayrolloutRules = jsonObj.getAsJsonArray("rolloutRules"); - if (jsonArrayrolloutRules != null) { - // ensure the json data is an array - if (!jsonObj.get("rolloutRules").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `rolloutRules` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("rolloutRules").toString())); - } - - // validate the optional field `rolloutRules` (array) - for (int i = 0; i < jsonArrayrolloutRules.size(); i++) { - RolloutRuleModel.validateJsonElement(jsonArrayrolloutRules.get(i)); - } - ; - } - } - if (jsonObj.get("rolloutPercentageItems") != null - && !jsonObj.get("rolloutPercentageItems").isJsonNull()) { - JsonArray jsonArrayrolloutPercentageItems = - jsonObj.getAsJsonArray("rolloutPercentageItems"); - if (jsonArrayrolloutPercentageItems != null) { - // ensure the json data is an array - if (!jsonObj.get("rolloutPercentageItems").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `rolloutPercentageItems` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("rolloutPercentageItems").toString())); - } - - // validate the optional field `rolloutPercentageItems` (array) - for (int i = 0; i < jsonArrayrolloutPercentageItems.size(); i++) { - RolloutPercentageItemModel.validateJsonElement( - jsonArrayrolloutPercentageItems.get(i)); - } - ; - } - } - // validate the optional field `setting` - if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { - SettingDataModel.validateJsonElement(jsonObj.get("setting")); - } - if ((jsonObj.get("lastUpdaterUserEmail") != null - && !jsonObj.get("lastUpdaterUserEmail").isJsonNull()) - && !jsonObj.get("lastUpdaterUserEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterUserEmail` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("lastUpdaterUserEmail").toString())); + if (jsonObj.get("rolloutRules") != null && !jsonObj.get("rolloutRules").isJsonNull()) { + JsonArray jsonArrayrolloutRules = jsonObj.getAsJsonArray("rolloutRules"); + if (jsonArrayrolloutRules != null) { + // ensure the json data is an array + if (!jsonObj.get("rolloutRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rolloutRules` to be an array in the JSON string but got `%s`", jsonObj.get("rolloutRules").toString())); + } + + // validate the optional field `rolloutRules` (array) + for (int i = 0; i < jsonArrayrolloutRules.size(); i++) { + RolloutRuleModel.validateJsonElement(jsonArrayrolloutRules.get(i)); + }; } - if ((jsonObj.get("lastUpdaterUserFullName") != null - && !jsonObj.get("lastUpdaterUserFullName").isJsonNull()) - && !jsonObj.get("lastUpdaterUserFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterUserFullName` to be a primitive type" - + " in the JSON string but got `%s`", - jsonObj.get("lastUpdaterUserFullName").toString())); + } + if (jsonObj.get("rolloutPercentageItems") != null && !jsonObj.get("rolloutPercentageItems").isJsonNull()) { + JsonArray jsonArrayrolloutPercentageItems = jsonObj.getAsJsonArray("rolloutPercentageItems"); + if (jsonArrayrolloutPercentageItems != null) { + // ensure the json data is an array + if (!jsonObj.get("rolloutPercentageItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rolloutPercentageItems` to be an array in the JSON string but got `%s`", jsonObj.get("rolloutPercentageItems").toString())); + } + + // validate the optional field `rolloutPercentageItems` (array) + for (int i = 0; i < jsonArrayrolloutPercentageItems.size(); i++) { + RolloutPercentageItemModel.validateJsonElement(jsonArrayrolloutPercentageItems.get(i)); + }; } - if (jsonObj.get("integrationLinks") != null - && !jsonObj.get("integrationLinks").isJsonNull()) { - JsonArray jsonArrayintegrationLinks = jsonObj.getAsJsonArray("integrationLinks"); - if (jsonArrayintegrationLinks != null) { - // ensure the json data is an array - if (!jsonObj.get("integrationLinks").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `integrationLinks` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("integrationLinks").toString())); - } - - // validate the optional field `integrationLinks` (array) - for (int i = 0; i < jsonArrayintegrationLinks.size(); i++) { - IntegrationLinkModel.validateJsonElement(jsonArrayintegrationLinks.get(i)); - } - ; - } + } + // validate the optional field `setting` + if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { + SettingDataModel.validateJsonElement(jsonObj.get("setting")); + } + if ((jsonObj.get("lastUpdaterUserEmail") != null && !jsonObj.get("lastUpdaterUserEmail").isJsonNull()) && !jsonObj.get("lastUpdaterUserEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterUserEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterUserEmail").toString())); + } + if ((jsonObj.get("lastUpdaterUserFullName") != null && !jsonObj.get("lastUpdaterUserFullName").isJsonNull()) && !jsonObj.get("lastUpdaterUserFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterUserFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterUserFullName").toString())); + } + if (jsonObj.get("integrationLinks") != null && !jsonObj.get("integrationLinks").isJsonNull()) { + JsonArray jsonArrayintegrationLinks = jsonObj.getAsJsonArray("integrationLinks"); + if (jsonArrayintegrationLinks != null) { + // ensure the json data is an array + if (!jsonObj.get("integrationLinks").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `integrationLinks` to be an array in the JSON string but got `%s`", jsonObj.get("integrationLinks").toString())); + } + + // validate the optional field `integrationLinks` (array) + for (int i = 0; i < jsonArrayintegrationLinks.size(); i++) { + IntegrationLinkModel.validateJsonElement(jsonArrayintegrationLinks.get(i)); + }; } - if (jsonObj.get("settingTags") != null && !jsonObj.get("settingTags").isJsonNull()) { - JsonArray jsonArraysettingTags = jsonObj.getAsJsonArray("settingTags"); - if (jsonArraysettingTags != null) { - // ensure the json data is an array - if (!jsonObj.get("settingTags").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingTags` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("settingTags").toString())); - } - - // validate the optional field `settingTags` (array) - for (int i = 0; i < jsonArraysettingTags.size(); i++) { - SettingTagModel.validateJsonElement(jsonArraysettingTags.get(i)); - } - ; - } + } + if (jsonObj.get("settingTags") != null && !jsonObj.get("settingTags").isJsonNull()) { + JsonArray jsonArraysettingTags = jsonObj.getAsJsonArray("settingTags"); + if (jsonArraysettingTags != null) { + // ensure the json data is an array + if (!jsonObj.get("settingTags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingTags` to be an array in the JSON string but got `%s`", jsonObj.get("settingTags").toString())); + } + + // validate the optional field `settingTags` (array) + for (int i = 0; i < jsonArraysettingTags.size(); i++) { + SettingTagModel.validateJsonElement(jsonArraysettingTags.get(i)); + }; } - } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ConfigSettingValueModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ConfigSettingValueModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ConfigSettingValueModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ConfigSettingValueModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ConfigSettingValueModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ConfigSettingValueModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConfigSettingValueModel - * @throws IOException if the JSON string is invalid with respect to ConfigSettingValueModel - */ - public static ConfigSettingValueModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ConfigSettingValueModel.class); - } - - /** - * Convert an instance of ConfigSettingValueModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConfigSettingValueModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConfigSettingValueModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConfigSettingValueModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConfigSettingValueModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConfigSettingValueModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfigSettingValueModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConfigSettingValueModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConfigSettingValueModel + * @throws IOException if the JSON string is invalid with respect to ConfigSettingValueModel + */ + public static ConfigSettingValueModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConfigSettingValueModel.class); + } + + /** + * Convert an instance of ConfigSettingValueModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingValuesModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingValuesModel.java index 6dd92da..62bee71 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingValuesModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ConfigSettingValuesModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,361 +10,431 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ConfigModel; +import com.configcat.publicapi.java.client.model.ConfigSettingValueModel; +import com.configcat.publicapi.java.client.model.EnvironmentModel; +import com.configcat.publicapi.java.client.model.FeatureFlagLimitations; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** ConfigSettingValuesModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ConfigSettingValuesModel { - public static final String SERIALIZED_NAME_CONFIG = "config"; - - @SerializedName(SERIALIZED_NAME_CONFIG) - private ConfigModel config; - - public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT) - private EnvironmentModel environment; - - public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; - - @SerializedName(SERIALIZED_NAME_READ_ONLY) - private Boolean readOnly; - - public static final String SERIALIZED_NAME_SETTING_VALUES = "settingValues"; - - @SerializedName(SERIALIZED_NAME_SETTING_VALUES) - private List settingValues; - - public static final String SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS = "featureFlagLimitations"; - - @SerializedName(SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS) - private FeatureFlagLimitations featureFlagLimitations; - - public ConfigSettingValuesModel() {} - - public ConfigSettingValuesModel config(ConfigModel config) { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config - */ - @javax.annotation.Nullable - public ConfigModel getConfig() { - return config; - } - - public void setConfig(ConfigModel config) { - this.config = config; - } - - public ConfigSettingValuesModel environment(EnvironmentModel environment) { - this.environment = environment; - return this; - } - - /** - * Get environment - * - * @return environment - */ - @javax.annotation.Nullable - public EnvironmentModel getEnvironment() { - return environment; - } - - public void setEnvironment(EnvironmentModel environment) { - this.environment = environment; - } - - public ConfigSettingValuesModel readOnly(Boolean readOnly) { - this.readOnly = readOnly; - return this; - } - - /** - * Get readOnly - * - * @return readOnly - */ - @javax.annotation.Nullable - public Boolean getReadOnly() { - return readOnly; - } - public void setReadOnly(Boolean readOnly) { - this.readOnly = readOnly; - } - - public ConfigSettingValuesModel settingValues(List settingValues) { - this.settingValues = settingValues; - return this; - } - - public ConfigSettingValuesModel addSettingValuesItem( - ConfigSettingValueModel settingValuesItem) { - if (this.settingValues == null) { - this.settingValues = new ArrayList<>(); - } - this.settingValues.add(settingValuesItem); - return this; - } +import com.configcat.publicapi.java.client.JSON; - /** - * Get settingValues - * - * @return settingValues - */ - @javax.annotation.Nullable - public List getSettingValues() { - return settingValues; +/** + * ConfigSettingValuesModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ConfigSettingValuesModel { + public static final String SERIALIZED_NAME_CONFIG = "config"; + @SerializedName(SERIALIZED_NAME_CONFIG) + private ConfigModel config; + + public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT) + private EnvironmentModel environment; + + public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; + @SerializedName(SERIALIZED_NAME_READ_ONLY) + private Boolean readOnly; + + public static final String SERIALIZED_NAME_SETTING_VALUES = "settingValues"; + @SerializedName(SERIALIZED_NAME_SETTING_VALUES) + private List settingValues; + + public static final String SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS = "featureFlagLimitations"; + @SerializedName(SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS) + private FeatureFlagLimitations featureFlagLimitations; + + public ConfigSettingValuesModel() { + } + + public ConfigSettingValuesModel config(ConfigModel config) { + this.config = config; + return this; + } + + /** + * Get config + * @return config + */ + @javax.annotation.Nullable + public ConfigModel getConfig() { + return config; + } + + public void setConfig(ConfigModel config) { + this.config = config; + } + + + public ConfigSettingValuesModel environment(EnvironmentModel environment) { + this.environment = environment; + return this; + } + + /** + * Get environment + * @return environment + */ + @javax.annotation.Nullable + public EnvironmentModel getEnvironment() { + return environment; + } + + public void setEnvironment(EnvironmentModel environment) { + this.environment = environment; + } + + + public ConfigSettingValuesModel readOnly(Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + /** + * Get readOnly + * @return readOnly + */ + @javax.annotation.Nullable + public Boolean getReadOnly() { + return readOnly; + } + + public void setReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + } + + + public ConfigSettingValuesModel settingValues(List settingValues) { + this.settingValues = settingValues; + return this; + } + + public ConfigSettingValuesModel addSettingValuesItem(ConfigSettingValueModel settingValuesItem) { + if (this.settingValues == null) { + this.settingValues = new ArrayList<>(); } - - public void setSettingValues(List settingValues) { - this.settingValues = settingValues; + this.settingValues.add(settingValuesItem); + return this; + } + + /** + * Get settingValues + * @return settingValues + */ + @javax.annotation.Nullable + public List getSettingValues() { + return settingValues; + } + + public void setSettingValues(List settingValues) { + this.settingValues = settingValues; + } + + + public ConfigSettingValuesModel featureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { + this.featureFlagLimitations = featureFlagLimitations; + return this; + } + + /** + * Get featureFlagLimitations + * @return featureFlagLimitations + */ + @javax.annotation.Nullable + public FeatureFlagLimitations getFeatureFlagLimitations() { + return featureFlagLimitations; + } + + public void setFeatureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { + this.featureFlagLimitations = featureFlagLimitations; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfigSettingValuesModel instance itself + */ + public ConfigSettingValuesModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public ConfigSettingValuesModel featureFlagLimitations( - FeatureFlagLimitations featureFlagLimitations) { - this.featureFlagLimitations = featureFlagLimitations; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Get featureFlagLimitations - * - * @return featureFlagLimitations - */ - @javax.annotation.Nullable - public FeatureFlagLimitations getFeatureFlagLimitations() { - return featureFlagLimitations; - } - public void setFeatureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { - this.featureFlagLimitations = featureFlagLimitations; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConfigSettingValuesModel configSettingValuesModel = (ConfigSettingValuesModel) o; - return Objects.equals(this.config, configSettingValuesModel.config) - && Objects.equals(this.environment, configSettingValuesModel.environment) - && Objects.equals(this.readOnly, configSettingValuesModel.readOnly) - && Objects.equals(this.settingValues, configSettingValuesModel.settingValues) - && Objects.equals( - this.featureFlagLimitations, - configSettingValuesModel.featureFlagLimitations); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + ConfigSettingValuesModel configSettingValuesModel = (ConfigSettingValuesModel) o; + return Objects.equals(this.config, configSettingValuesModel.config) && + Objects.equals(this.environment, configSettingValuesModel.environment) && + Objects.equals(this.readOnly, configSettingValuesModel.readOnly) && + Objects.equals(this.settingValues, configSettingValuesModel.settingValues) && + Objects.equals(this.featureFlagLimitations, configSettingValuesModel.featureFlagLimitations)&& + Objects.equals(this.additionalProperties, configSettingValuesModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(config, environment, readOnly, settingValues, featureFlagLimitations, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(config, environment, readOnly, settingValues, featureFlagLimitations); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigSettingValuesModel {\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); + sb.append(" settingValues: ").append(toIndentedString(settingValues)).append("\n"); + sb.append(" featureFlagLimitations: ").append(toIndentedString(featureFlagLimitations)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConfigSettingValuesModel {\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); - sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); - sb.append(" settingValues: ").append(toIndentedString(settingValues)).append("\n"); - sb.append(" featureFlagLimitations: ") - .append(toIndentedString(featureFlagLimitations)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("config"); - openapiFields.add("environment"); - openapiFields.add("readOnly"); - openapiFields.add("settingValues"); - openapiFields.add("featureFlagLimitations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ConfigSettingValuesModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ConfigSettingValuesModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ConfigSettingValuesModel is not found" - + " in the empty JSON string", - ConfigSettingValuesModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConfigSettingValuesModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ConfigSettingValuesModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("config"); + openapiFields.add("environment"); + openapiFields.add("readOnly"); + openapiFields.add("settingValues"); + openapiFields.add("featureFlagLimitations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConfigSettingValuesModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConfigSettingValuesModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigSettingValuesModel is not found in the empty JSON string", ConfigSettingValuesModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `config` - if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { - ConfigModel.validateJsonElement(jsonObj.get("config")); - } - // validate the optional field `environment` - if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { - EnvironmentModel.validateJsonElement(jsonObj.get("environment")); + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ConfigModel.validateJsonElement(jsonObj.get("config")); + } + // validate the optional field `environment` + if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { + EnvironmentModel.validateJsonElement(jsonObj.get("environment")); + } + if (jsonObj.get("settingValues") != null && !jsonObj.get("settingValues").isJsonNull()) { + JsonArray jsonArraysettingValues = jsonObj.getAsJsonArray("settingValues"); + if (jsonArraysettingValues != null) { + // ensure the json data is an array + if (!jsonObj.get("settingValues").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingValues` to be an array in the JSON string but got `%s`", jsonObj.get("settingValues").toString())); + } + + // validate the optional field `settingValues` (array) + for (int i = 0; i < jsonArraysettingValues.size(); i++) { + ConfigSettingValueModel.validateJsonElement(jsonArraysettingValues.get(i)); + }; } - if (jsonObj.get("settingValues") != null && !jsonObj.get("settingValues").isJsonNull()) { - JsonArray jsonArraysettingValues = jsonObj.getAsJsonArray("settingValues"); - if (jsonArraysettingValues != null) { - // ensure the json data is an array - if (!jsonObj.get("settingValues").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingValues` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("settingValues").toString())); - } - - // validate the optional field `settingValues` (array) - for (int i = 0; i < jsonArraysettingValues.size(); i++) { - ConfigSettingValueModel.validateJsonElement(jsonArraysettingValues.get(i)); - } - ; - } - } - // validate the optional field `featureFlagLimitations` - if (jsonObj.get("featureFlagLimitations") != null - && !jsonObj.get("featureFlagLimitations").isJsonNull()) { - FeatureFlagLimitations.validateJsonElement(jsonObj.get("featureFlagLimitations")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ConfigSettingValuesModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ConfigSettingValuesModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ConfigSettingValuesModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ConfigSettingValuesModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ConfigSettingValuesModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ConfigSettingValuesModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConfigSettingValuesModel - * @throws IOException if the JSON string is invalid with respect to ConfigSettingValuesModel - */ - public static ConfigSettingValuesModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ConfigSettingValuesModel.class); - } - - /** - * Convert an instance of ConfigSettingValuesModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + } + // validate the optional field `featureFlagLimitations` + if (jsonObj.get("featureFlagLimitations") != null && !jsonObj.get("featureFlagLimitations").isJsonNull()) { + FeatureFlagLimitations.validateJsonElement(jsonObj.get("featureFlagLimitations")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConfigSettingValuesModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConfigSettingValuesModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConfigSettingValuesModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConfigSettingValuesModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConfigSettingValuesModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfigSettingValuesModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ConfigSettingValuesModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConfigSettingValuesModel + * @throws IOException if the JSON string is invalid with respect to ConfigSettingValuesModel + */ + public static ConfigSettingValuesModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConfigSettingValuesModel.class); + } + + /** + * Convert an instance of ConfigSettingValuesModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ConnectRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/ConnectRequest.java index 11eef69..cfc9b53 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ConnectRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ConnectRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,237 +10,316 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** ConnectRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * ConnectRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class ConnectRequest { - public static final String SERIALIZED_NAME_CLIENT_KEY = "clientKey"; + public static final String SERIALIZED_NAME_CLIENT_KEY = "clientKey"; + @SerializedName(SERIALIZED_NAME_CLIENT_KEY) + private String clientKey; - @SerializedName(SERIALIZED_NAME_CLIENT_KEY) - private String clientKey; + public static final String SERIALIZED_NAME_JIRA_JWT_TOKEN = "jiraJwtToken"; + @SerializedName(SERIALIZED_NAME_JIRA_JWT_TOKEN) + private String jiraJwtToken; - public static final String SERIALIZED_NAME_JIRA_JWT_TOKEN = "jiraJwtToken"; + public ConnectRequest() { + } - @SerializedName(SERIALIZED_NAME_JIRA_JWT_TOKEN) - private String jiraJwtToken; + public ConnectRequest clientKey(String clientKey) { + this.clientKey = clientKey; + return this; + } - public ConnectRequest() {} + /** + * Get clientKey + * @return clientKey + */ + @javax.annotation.Nonnull + public String getClientKey() { + return clientKey; + } - public ConnectRequest clientKey(String clientKey) { - this.clientKey = clientKey; - return this; - } + public void setClientKey(String clientKey) { + this.clientKey = clientKey; + } - /** - * Get clientKey - * - * @return clientKey - */ - @javax.annotation.Nonnull - public String getClientKey() { - return clientKey; - } - public void setClientKey(String clientKey) { - this.clientKey = clientKey; - } + public ConnectRequest jiraJwtToken(String jiraJwtToken) { + this.jiraJwtToken = jiraJwtToken; + return this; + } - public ConnectRequest jiraJwtToken(String jiraJwtToken) { - this.jiraJwtToken = jiraJwtToken; - return this; - } + /** + * Get jiraJwtToken + * @return jiraJwtToken + */ + @javax.annotation.Nonnull + public String getJiraJwtToken() { + return jiraJwtToken; + } - /** - * Get jiraJwtToken - * - * @return jiraJwtToken - */ - @javax.annotation.Nonnull - public String getJiraJwtToken() { - return jiraJwtToken; - } + public void setJiraJwtToken(String jiraJwtToken) { + this.jiraJwtToken = jiraJwtToken; + } - public void setJiraJwtToken(String jiraJwtToken) { - this.jiraJwtToken = jiraJwtToken; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConnectRequest connectRequest = (ConnectRequest) o; - return Objects.equals(this.clientKey, connectRequest.clientKey) - && Objects.equals(this.jiraJwtToken, connectRequest.jiraJwtToken); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConnectRequest instance itself + */ + public ConnectRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(clientKey, jiraJwtToken); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConnectRequest {\n"); - sb.append(" clientKey: ").append(toIndentedString(clientKey)).append("\n"); - sb.append(" jiraJwtToken: ").append(toIndentedString(jiraJwtToken)).append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + ConnectRequest connectRequest = (ConnectRequest) o; + return Objects.equals(this.clientKey, connectRequest.clientKey) && + Objects.equals(this.jiraJwtToken, connectRequest.jiraJwtToken)&& + Objects.equals(this.additionalProperties, connectRequest.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(clientKey, jiraJwtToken, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("clientKey"); - openapiFields.add("jiraJwtToken"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConnectRequest {\n"); + sb.append(" clientKey: ").append(toIndentedString(clientKey)).append("\n"); + sb.append(" jiraJwtToken: ").append(toIndentedString(jiraJwtToken)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("clientKey"); - openapiRequiredFields.add("jiraJwtToken"); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ConnectRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ConnectRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ConnectRequest is not found in the" - + " empty JSON string", - ConnectRequest.openapiRequiredFields.toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ConnectRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ConnectRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("clientKey"); + openapiFields.add("jiraJwtToken"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("clientKey"); + openapiRequiredFields.add("jiraJwtToken"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConnectRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConnectRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConnectRequest is not found in the empty JSON string", ConnectRequest.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ConnectRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ConnectRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("clientKey").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `clientKey` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("clientKey").toString())); - } - if (!jsonObj.get("jiraJwtToken").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `jiraJwtToken` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("jiraJwtToken").toString())); - } - } + if (!jsonObj.get("clientKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `clientKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clientKey").toString())); + } + if (!jsonObj.get("jiraJwtToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `jiraJwtToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("jiraJwtToken").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ConnectRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ConnectRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ConnectRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ConnectRequest value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ConnectRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConnectRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConnectRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConnectRequest.class)); - /** - * Create an instance of ConnectRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of ConnectRequest - * @throws IOException if the JSON string is invalid with respect to ConnectRequest - */ - public static ConnectRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ConnectRequest.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConnectRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConnectRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConnectRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of ConnectRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of ConnectRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConnectRequest + * @throws IOException if the JSON string is invalid with respect to ConnectRequest + */ + public static ConnectRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConnectRequest.class); + } + + /** + * Convert an instance of ConnectRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreateConfigRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/CreateConfigRequest.java index 3bf1a4e..33ca65c 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreateConfigRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreateConfigRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,318 +10,384 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.EvaluationVersion; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** CreateConfigRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CreateConfigRequest { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_EVALUATION_VERSION = "evaluationVersion"; - - @SerializedName(SERIALIZED_NAME_EVALUATION_VERSION) - private EvaluationVersion evaluationVersion; - - public CreateConfigRequest() {} - - public CreateConfigRequest name(String name) { - this.name = name; - return this; - } - - /** - * The name of the Config. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CreateConfigRequest description(String description) { - this.description = description; - return this; - } - - /** - * The description of the Config. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public CreateConfigRequest order(Integer order) { - this.order = order; - return this; - } - /** - * The order of the Config represented on the ConfigCat Dashboard. Determined from an ascending - * sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } +import com.configcat.publicapi.java.client.JSON; - public void setOrder(Integer order) { - this.order = order; +/** + * CreateConfigRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CreateConfigRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_EVALUATION_VERSION = "evaluationVersion"; + @SerializedName(SERIALIZED_NAME_EVALUATION_VERSION) + private EvaluationVersion evaluationVersion; + + public CreateConfigRequest() { + } + + public CreateConfigRequest name(String name) { + this.name = name; + return this; + } + + /** + * The name of the Config. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public CreateConfigRequest description(String description) { + this.description = description; + return this; + } + + /** + * The description of the Config. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public CreateConfigRequest order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Config represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public CreateConfigRequest evaluationVersion(EvaluationVersion evaluationVersion) { + this.evaluationVersion = evaluationVersion; + return this; + } + + /** + * Get evaluationVersion + * @return evaluationVersion + */ + @javax.annotation.Nullable + public EvaluationVersion getEvaluationVersion() { + return evaluationVersion; + } + + public void setEvaluationVersion(EvaluationVersion evaluationVersion) { + this.evaluationVersion = evaluationVersion; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateConfigRequest instance itself + */ + public CreateConfigRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public CreateConfigRequest evaluationVersion(EvaluationVersion evaluationVersion) { - this.evaluationVersion = evaluationVersion; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Get evaluationVersion - * - * @return evaluationVersion - */ - @javax.annotation.Nullable - public EvaluationVersion getEvaluationVersion() { - return evaluationVersion; - } - public void setEvaluationVersion(EvaluationVersion evaluationVersion) { - this.evaluationVersion = evaluationVersion; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateConfigRequest createConfigRequest = (CreateConfigRequest) o; - return Objects.equals(this.name, createConfigRequest.name) - && Objects.equals(this.description, createConfigRequest.description) - && Objects.equals(this.order, createConfigRequest.order) - && Objects.equals(this.evaluationVersion, createConfigRequest.evaluationVersion); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + CreateConfigRequest createConfigRequest = (CreateConfigRequest) o; + return Objects.equals(this.name, createConfigRequest.name) && + Objects.equals(this.description, createConfigRequest.description) && + Objects.equals(this.order, createConfigRequest.order) && + Objects.equals(this.evaluationVersion, createConfigRequest.evaluationVersion)&& + Objects.equals(this.additionalProperties, createConfigRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, order, evaluationVersion, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(name, description, order, evaluationVersion); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateConfigRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" evaluationVersion: ").append(toIndentedString(evaluationVersion)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("order"); + openapiFields.add("evaluationVersion"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateConfigRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateConfigRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateConfigRequest is not found in the empty JSON string", CreateConfigRequest.openapiRequiredFields.toString())); } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateConfigRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" evaluationVersion: ") - .append(toIndentedString(evaluationVersion)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("order"); - openapiFields.add("evaluationVersion"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateConfigRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateConfigRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreateConfigRequest is not found in" - + " the empty JSON string", - CreateConfigRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateConfigRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreateConfigRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateConfigRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateConfigRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - // validate the optional field `evaluationVersion` - if (jsonObj.get("evaluationVersion") != null - && !jsonObj.get("evaluationVersion").isJsonNull()) { - EvaluationVersion.validateJsonElement(jsonObj.get("evaluationVersion")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateConfigRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateConfigRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateConfigRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateConfigRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateConfigRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of CreateConfigRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateConfigRequest - * @throws IOException if the JSON string is invalid with respect to CreateConfigRequest - */ - public static CreateConfigRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateConfigRequest.class); - } - - /** - * Convert an instance of CreateConfigRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `evaluationVersion` + if (jsonObj.get("evaluationVersion") != null && !jsonObj.get("evaluationVersion").isJsonNull()) { + EvaluationVersion.validateJsonElement(jsonObj.get("evaluationVersion")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateConfigRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateConfigRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateConfigRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateConfigRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateConfigRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateConfigRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of CreateConfigRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateConfigRequest + * @throws IOException if the JSON string is invalid with respect to CreateConfigRequest + */ + public static CreateConfigRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateConfigRequest.class); + } + + /** + * Convert an instance of CreateConfigRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreateEnvironmentModel.java b/src/main/java/com/configcat/publicapi/java/client/model/CreateEnvironmentModel.java index 94d2e16..f2732bf 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreateEnvironmentModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreateEnvironmentModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,319 +10,382 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** CreateEnvironmentModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CreateEnvironmentModel { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_COLOR = "color"; - - @SerializedName(SERIALIZED_NAME_COLOR) - private String color; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public CreateEnvironmentModel() {} - - public CreateEnvironmentModel name(String name) { - this.name = name; - return this; - } - - /** - * The name of the Environment. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CreateEnvironmentModel color(String color) { - this.color = color; - return this; - } - - /** - * The color of the Environment. RGB or HTML color codes are allowed. - * - * @return color - */ - @javax.annotation.Nullable - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public CreateEnvironmentModel description(String description) { - this.description = description; - return this; - } - /** - * The description of the Environment. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } +import com.configcat.publicapi.java.client.JSON; - public void setDescription(String description) { - this.description = description; +/** + * CreateEnvironmentModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CreateEnvironmentModel { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public CreateEnvironmentModel() { + } + + public CreateEnvironmentModel name(String name) { + this.name = name; + return this; + } + + /** + * The name of the Environment. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public CreateEnvironmentModel color(String color) { + this.color = color; + return this; + } + + /** + * The color of the Environment. RGB or HTML color codes are allowed. + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + public CreateEnvironmentModel description(String description) { + this.description = description; + return this; + } + + /** + * The description of the Environment. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public CreateEnvironmentModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Environment represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateEnvironmentModel instance itself + */ + public CreateEnvironmentModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public CreateEnvironmentModel order(Integer order) { - this.order = order; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * The order of the Environment represented on the ConfigCat Dashboard. Determined from an - * ascending sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - public void setOrder(Integer order) { - this.order = order; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateEnvironmentModel createEnvironmentModel = (CreateEnvironmentModel) o; - return Objects.equals(this.name, createEnvironmentModel.name) - && Objects.equals(this.color, createEnvironmentModel.color) - && Objects.equals(this.description, createEnvironmentModel.description) - && Objects.equals(this.order, createEnvironmentModel.order); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + CreateEnvironmentModel createEnvironmentModel = (CreateEnvironmentModel) o; + return Objects.equals(this.name, createEnvironmentModel.name) && + Objects.equals(this.color, createEnvironmentModel.color) && + Objects.equals(this.description, createEnvironmentModel.description) && + Objects.equals(this.order, createEnvironmentModel.order)&& + Objects.equals(this.additionalProperties, createEnvironmentModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, color, description, order, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(name, color, description, order); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateEnvironmentModel {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("color"); + openapiFields.add("description"); + openapiFields.add("order"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateEnvironmentModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateEnvironmentModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateEnvironmentModel is not found in the empty JSON string", CreateEnvironmentModel.openapiRequiredFields.toString())); } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateEnvironmentModel {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append("}"); - return sb.toString(); - } + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("color"); - openapiFields.add("description"); - openapiFields.add("order"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateEnvironmentModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateEnvironmentModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreateEnvironmentModel is not found" - + " in the empty JSON string", - CreateEnvironmentModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateEnvironmentModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreateEnvironmentModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateEnvironmentModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateEnvironmentModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) - && !jsonObj.get("color").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `color` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("color").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateEnvironmentModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateEnvironmentModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateEnvironmentModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateEnvironmentModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateEnvironmentModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of CreateEnvironmentModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateEnvironmentModel - * @throws IOException if the JSON string is invalid with respect to CreateEnvironmentModel - */ - public static CreateEnvironmentModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateEnvironmentModel.class); - } - - /** - * Convert an instance of CreateEnvironmentModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateEnvironmentModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateEnvironmentModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateEnvironmentModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateEnvironmentModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateEnvironmentModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateEnvironmentModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of CreateEnvironmentModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateEnvironmentModel + * @throws IOException if the JSON string is invalid with respect to CreateEnvironmentModel + */ + public static CreateEnvironmentModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateEnvironmentModel.class); + } + + /** + * Convert an instance of CreateEnvironmentModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreateIntegrationModel.java b/src/main/java/com/configcat/publicapi/java/client/model/CreateIntegrationModel.java index 24a1f8c..450a90e 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreateIntegrationModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreateIntegrationModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,371 +10,438 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.IntegrationType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; + +import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; - -/** CreateIntegrationModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CreateIntegrationModel { - public static final String SERIALIZED_NAME_INTEGRATION_TYPE = "integrationType"; - - @SerializedName(SERIALIZED_NAME_INTEGRATION_TYPE) - private IntegrationType integrationType; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; - - @SerializedName(SERIALIZED_NAME_PARAMETERS) - private Map parameters = new HashMap<>(); - - public static final String SERIALIZED_NAME_ENVIRONMENT_IDS = "environmentIds"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_IDS) - private List environmentIds = new ArrayList<>(); - - public static final String SERIALIZED_NAME_CONFIG_IDS = "configIds"; - - @SerializedName(SERIALIZED_NAME_CONFIG_IDS) - private List configIds = new ArrayList<>(); - - public CreateIntegrationModel() {} - - public CreateIntegrationModel integrationType(IntegrationType integrationType) { - this.integrationType = integrationType; - return this; - } - - /** - * Get integrationType - * - * @return integrationType - */ - @javax.annotation.Nonnull - public IntegrationType getIntegrationType() { - return integrationType; - } - - public void setIntegrationType(IntegrationType integrationType) { - this.integrationType = integrationType; - } - - public CreateIntegrationModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Integration. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CreateIntegrationModel parameters(Map parameters) { - this.parameters = parameters; - return this; - } - - public CreateIntegrationModel putParametersItem(String key, String parametersItem) { - if (this.parameters == null) { - this.parameters = new HashMap<>(); - } - this.parameters.put(key, parametersItem); - return this; - } - - /** - * Parameters of the Integration. - * - * @return parameters - */ - @javax.annotation.Nonnull - public Map getParameters() { - return parameters; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } - - public CreateIntegrationModel environmentIds(List environmentIds) { - this.environmentIds = environmentIds; - return this; - } - - public CreateIntegrationModel addEnvironmentIdsItem(UUID environmentIdsItem) { - if (this.environmentIds == null) { - this.environmentIds = new ArrayList<>(); - } - this.environmentIds.add(environmentIdsItem); - return this; - } - - /** - * List of Environment IDs that are connected with this Integration. If the list is empty, all - * of the Environments are connected. - * - * @return environmentIds - */ - @javax.annotation.Nonnull - public List getEnvironmentIds() { - return environmentIds; - } +import com.configcat.publicapi.java.client.JSON; - public void setEnvironmentIds(List environmentIds) { - this.environmentIds = environmentIds; +/** + * CreateIntegrationModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CreateIntegrationModel { + public static final String SERIALIZED_NAME_INTEGRATION_TYPE = "integrationType"; + @SerializedName(SERIALIZED_NAME_INTEGRATION_TYPE) + private IntegrationType integrationType; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + private Map parameters = new HashMap<>(); + + public static final String SERIALIZED_NAME_ENVIRONMENT_IDS = "environmentIds"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_IDS) + private List environmentIds = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CONFIG_IDS = "configIds"; + @SerializedName(SERIALIZED_NAME_CONFIG_IDS) + private List configIds = new ArrayList<>(); + + public CreateIntegrationModel() { + } + + public CreateIntegrationModel integrationType(IntegrationType integrationType) { + this.integrationType = integrationType; + return this; + } + + /** + * Get integrationType + * @return integrationType + */ + @javax.annotation.Nonnull + public IntegrationType getIntegrationType() { + return integrationType; + } + + public void setIntegrationType(IntegrationType integrationType) { + this.integrationType = integrationType; + } + + + public CreateIntegrationModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Integration. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public CreateIntegrationModel parameters(Map parameters) { + this.parameters = parameters; + return this; + } + + public CreateIntegrationModel putParametersItem(String key, String parametersItem) { + if (this.parameters == null) { + this.parameters = new HashMap<>(); } - - public CreateIntegrationModel configIds(List configIds) { - this.configIds = configIds; - return this; + this.parameters.put(key, parametersItem); + return this; + } + + /** + * Parameters of the Integration. + * @return parameters + */ + @javax.annotation.Nonnull + public Map getParameters() { + return parameters; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + + public CreateIntegrationModel environmentIds(List environmentIds) { + this.environmentIds = environmentIds; + return this; + } + + public CreateIntegrationModel addEnvironmentIdsItem(UUID environmentIdsItem) { + if (this.environmentIds == null) { + this.environmentIds = new ArrayList<>(); } - - public CreateIntegrationModel addConfigIdsItem(UUID configIdsItem) { - if (this.configIds == null) { - this.configIds = new ArrayList<>(); - } - this.configIds.add(configIdsItem); - return this; + this.environmentIds.add(environmentIdsItem); + return this; + } + + /** + * List of Environment IDs that are connected with this Integration. If the list is empty, all of the Environments are connected. + * @return environmentIds + */ + @javax.annotation.Nonnull + public List getEnvironmentIds() { + return environmentIds; + } + + public void setEnvironmentIds(List environmentIds) { + this.environmentIds = environmentIds; + } + + + public CreateIntegrationModel configIds(List configIds) { + this.configIds = configIds; + return this; + } + + public CreateIntegrationModel addConfigIdsItem(UUID configIdsItem) { + if (this.configIds == null) { + this.configIds = new ArrayList<>(); } - - /** - * List of Config IDs that are connected with this Integration. If the list is empty, all of the - * Configs are connected. - * - * @return configIds - */ - @javax.annotation.Nonnull - public List getConfigIds() { - return configIds; - } - - public void setConfigIds(List configIds) { - this.configIds = configIds; + this.configIds.add(configIdsItem); + return this; + } + + /** + * List of Config IDs that are connected with this Integration. If the list is empty, all of the Configs are connected. + * @return configIds + */ + @javax.annotation.Nonnull + public List getConfigIds() { + return configIds; + } + + public void setConfigIds(List configIds) { + this.configIds = configIds; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateIntegrationModel instance itself + */ + public CreateIntegrationModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateIntegrationModel createIntegrationModel = (CreateIntegrationModel) o; - return Objects.equals(this.integrationType, createIntegrationModel.integrationType) - && Objects.equals(this.name, createIntegrationModel.name) - && Objects.equals(this.parameters, createIntegrationModel.parameters) - && Objects.equals(this.environmentIds, createIntegrationModel.environmentIds) - && Objects.equals(this.configIds, createIntegrationModel.configIds); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(integrationType, name, parameters, environmentIds, configIds); - } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateIntegrationModel {\n"); - sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" environmentIds: ").append(toIndentedString(environmentIds)).append("\n"); - sb.append(" configIds: ").append(toIndentedString(configIds)).append("\n"); - sb.append("}"); - return sb.toString(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("integrationType"); - openapiFields.add("name"); - openapiFields.add("parameters"); - openapiFields.add("environmentIds"); - openapiFields.add("configIds"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("integrationType"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("parameters"); - openapiRequiredFields.add("environmentIds"); - openapiRequiredFields.add("configIds"); + CreateIntegrationModel createIntegrationModel = (CreateIntegrationModel) o; + return Objects.equals(this.integrationType, createIntegrationModel.integrationType) && + Objects.equals(this.name, createIntegrationModel.name) && + Objects.equals(this.parameters, createIntegrationModel.parameters) && + Objects.equals(this.environmentIds, createIntegrationModel.environmentIds) && + Objects.equals(this.configIds, createIntegrationModel.configIds)&& + Objects.equals(this.additionalProperties, createIntegrationModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(integrationType, name, parameters, environmentIds, configIds, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIntegrationModel {\n"); + sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" environmentIds: ").append(toIndentedString(environmentIds)).append("\n"); + sb.append(" configIds: ").append(toIndentedString(configIds)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateIntegrationModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateIntegrationModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreateIntegrationModel is not found" - + " in the empty JSON string", - CreateIntegrationModel.openapiRequiredFields.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("integrationType"); + openapiFields.add("name"); + openapiFields.add("parameters"); + openapiFields.add("environmentIds"); + openapiFields.add("configIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("integrationType"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("parameters"); + openapiRequiredFields.add("environmentIds"); + openapiRequiredFields.add("configIds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIntegrationModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIntegrationModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIntegrationModel is not found in the empty JSON string", CreateIntegrationModel.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateIntegrationModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreateIntegrationModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateIntegrationModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateIntegrationModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `integrationType` - IntegrationType.validateJsonElement(jsonObj.get("integrationType")); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - // ensure the required json array is present - if (jsonObj.get("environmentIds") == null) { - throw new IllegalArgumentException( - "Expected the field `linkedContent` to be an array in the JSON string but got" - + " `null`"); - } else if (!jsonObj.get("environmentIds").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentIds` to be an array in the JSON string" - + " but got `%s`", - jsonObj.get("environmentIds").toString())); - } - // ensure the required json array is present - if (jsonObj.get("configIds") == null) { - throw new IllegalArgumentException( - "Expected the field `linkedContent` to be an array in the JSON string but got" - + " `null`"); - } else if (!jsonObj.get("configIds").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configIds` to be an array in the JSON string but" - + " got `%s`", - jsonObj.get("configIds").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateIntegrationModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateIntegrationModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateIntegrationModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateIntegrationModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateIntegrationModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of CreateIntegrationModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateIntegrationModel - * @throws IOException if the JSON string is invalid with respect to CreateIntegrationModel - */ - public static CreateIntegrationModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateIntegrationModel.class); - } - - /** - * Convert an instance of CreateIntegrationModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + // validate the required field `integrationType` + IntegrationType.validateJsonElement(jsonObj.get("integrationType")); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("environmentIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("environmentIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentIds` to be an array in the JSON string but got `%s`", jsonObj.get("environmentIds").toString())); + } + // ensure the required json array is present + if (jsonObj.get("configIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("configIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `configIds` to be an array in the JSON string but got `%s`", jsonObj.get("configIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIntegrationModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIntegrationModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIntegrationModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIntegrationModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateIntegrationModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateIntegrationModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of CreateIntegrationModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIntegrationModel + * @throws IOException if the JSON string is invalid with respect to CreateIntegrationModel + */ + public static CreateIntegrationModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIntegrationModel.class); + } + + /** + * Convert an instance of CreateIntegrationModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreateOrUpdateEnvironmentAccessModel.java b/src/main/java/com/configcat/publicapi/java/client/model/CreateOrUpdateEnvironmentAccessModel.java index 9dfc0a8..0a274ad 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreateOrUpdateEnvironmentAccessModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreateOrUpdateEnvironmentAccessModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,242 +10,310 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.EnvironmentAccessType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -/** CreateOrUpdateEnvironmentAccessModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * CreateOrUpdateEnvironmentAccessModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class CreateOrUpdateEnvironmentAccessModel { - public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) + private UUID environmentId; - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) - private UUID environmentId; + public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESS_TYPE = "environmentAccessType"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESS_TYPE) + private EnvironmentAccessType environmentAccessType; - public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESS_TYPE = "environmentAccessType"; + public CreateOrUpdateEnvironmentAccessModel() { + } - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESS_TYPE) - private EnvironmentAccessType environmentAccessType; + public CreateOrUpdateEnvironmentAccessModel environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } - public CreateOrUpdateEnvironmentAccessModel() {} + /** + * Identifier of the Environment. + * @return environmentId + */ + @javax.annotation.Nullable + public UUID getEnvironmentId() { + return environmentId; + } - public CreateOrUpdateEnvironmentAccessModel environmentId(UUID environmentId) { - this.environmentId = environmentId; - return this; - } + public void setEnvironmentId(UUID environmentId) { + this.environmentId = environmentId; + } - /** - * Identifier of the Environment. - * - * @return environmentId - */ - @javax.annotation.Nullable - public UUID getEnvironmentId() { - return environmentId; - } - public void setEnvironmentId(UUID environmentId) { - this.environmentId = environmentId; - } + public CreateOrUpdateEnvironmentAccessModel environmentAccessType(EnvironmentAccessType environmentAccessType) { + this.environmentAccessType = environmentAccessType; + return this; + } - public CreateOrUpdateEnvironmentAccessModel environmentAccessType( - EnvironmentAccessType environmentAccessType) { - this.environmentAccessType = environmentAccessType; - return this; - } + /** + * Get environmentAccessType + * @return environmentAccessType + */ + @javax.annotation.Nullable + public EnvironmentAccessType getEnvironmentAccessType() { + return environmentAccessType; + } - /** - * Get environmentAccessType - * - * @return environmentAccessType - */ - @javax.annotation.Nullable - public EnvironmentAccessType getEnvironmentAccessType() { - return environmentAccessType; - } + public void setEnvironmentAccessType(EnvironmentAccessType environmentAccessType) { + this.environmentAccessType = environmentAccessType; + } - public void setEnvironmentAccessType(EnvironmentAccessType environmentAccessType) { - this.environmentAccessType = environmentAccessType; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateOrUpdateEnvironmentAccessModel createOrUpdateEnvironmentAccessModel = - (CreateOrUpdateEnvironmentAccessModel) o; - return Objects.equals( - this.environmentId, createOrUpdateEnvironmentAccessModel.environmentId) - && Objects.equals( - this.environmentAccessType, - createOrUpdateEnvironmentAccessModel.environmentAccessType); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateOrUpdateEnvironmentAccessModel instance itself + */ + public CreateOrUpdateEnvironmentAccessModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(environmentId, environmentAccessType); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateOrUpdateEnvironmentAccessModel {\n"); - sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); - sb.append(" environmentAccessType: ") - .append(toIndentedString(environmentAccessType)) - .append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + CreateOrUpdateEnvironmentAccessModel createOrUpdateEnvironmentAccessModel = (CreateOrUpdateEnvironmentAccessModel) o; + return Objects.equals(this.environmentId, createOrUpdateEnvironmentAccessModel.environmentId) && + Objects.equals(this.environmentAccessType, createOrUpdateEnvironmentAccessModel.environmentAccessType)&& + Objects.equals(this.additionalProperties, createOrUpdateEnvironmentAccessModel.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(environmentId, environmentAccessType, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("environmentId"); - openapiFields.add("environmentAccessType"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateOrUpdateEnvironmentAccessModel {\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" environmentAccessType: ").append(toIndentedString(environmentAccessType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * CreateOrUpdateEnvironmentAccessModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateOrUpdateEnvironmentAccessModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreateOrUpdateEnvironmentAccessModel" - + " is not found in the empty JSON string", - CreateOrUpdateEnvironmentAccessModel.openapiRequiredFields - .toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateOrUpdateEnvironmentAccessModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreateOrUpdateEnvironmentAccessModel` properties. JSON:" - + " %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("environmentId"); + openapiFields.add("environmentAccessType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateOrUpdateEnvironmentAccessModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateOrUpdateEnvironmentAccessModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateOrUpdateEnvironmentAccessModel is not found in the empty JSON string", CreateOrUpdateEnvironmentAccessModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) - && !jsonObj.get("environmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("environmentId").toString())); - } - // validate the optional field `environmentAccessType` - if (jsonObj.get("environmentAccessType") != null - && !jsonObj.get("environmentAccessType").isJsonNull()) { - EnvironmentAccessType.validateJsonElement(jsonObj.get("environmentAccessType")); - } - } + if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) && !jsonObj.get("environmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environmentId").toString())); + } + // validate the optional field `environmentAccessType` + if (jsonObj.get("environmentAccessType") != null && !jsonObj.get("environmentAccessType").isJsonNull()) { + EnvironmentAccessType.validateJsonElement(jsonObj.get("environmentAccessType")); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateOrUpdateEnvironmentAccessModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateOrUpdateEnvironmentAccessModel' - // and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(CreateOrUpdateEnvironmentAccessModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write( - JsonWriter out, CreateOrUpdateEnvironmentAccessModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateOrUpdateEnvironmentAccessModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateOrUpdateEnvironmentAccessModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateOrUpdateEnvironmentAccessModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateOrUpdateEnvironmentAccessModel.class)); - /** - * Create an instance of CreateOrUpdateEnvironmentAccessModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateOrUpdateEnvironmentAccessModel - * @throws IOException if the JSON string is invalid with respect to - * CreateOrUpdateEnvironmentAccessModel - */ - public static CreateOrUpdateEnvironmentAccessModel fromJson(String jsonString) - throws IOException { - return JSON.getGson().fromJson(jsonString, CreateOrUpdateEnvironmentAccessModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateOrUpdateEnvironmentAccessModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateOrUpdateEnvironmentAccessModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateOrUpdateEnvironmentAccessModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of CreateOrUpdateEnvironmentAccessModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of CreateOrUpdateEnvironmentAccessModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateOrUpdateEnvironmentAccessModel + * @throws IOException if the JSON string is invalid with respect to CreateOrUpdateEnvironmentAccessModel + */ + public static CreateOrUpdateEnvironmentAccessModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateOrUpdateEnvironmentAccessModel.class); + } + + /** + * Convert an instance of CreateOrUpdateEnvironmentAccessModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreatePermissionGroupRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/CreatePermissionGroupRequest.java index 9b467d8..3a66263 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreatePermissionGroupRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreatePermissionGroupRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,1013 +10,957 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.AccessType; +import com.configcat.publicapi.java.client.model.CreateOrUpdateEnvironmentAccessModel; +import com.configcat.publicapi.java.client.model.EnvironmentAccessType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** CreatePermissionGroupRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CreatePermissionGroupRequest { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_CAN_MANAGE_MEMBERS = "canManageMembers"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_MEMBERS) - private Boolean canManageMembers; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG = - "canCreateOrUpdateConfig"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG) - private Boolean canCreateOrUpdateConfig; - - public static final String SERIALIZED_NAME_CAN_DELETE_CONFIG = "canDeleteConfig"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_CONFIG) - private Boolean canDeleteConfig; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT = - "canCreateOrUpdateEnvironment"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT) - private Boolean canCreateOrUpdateEnvironment; - - public static final String SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT = "canDeleteEnvironment"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT) - private Boolean canDeleteEnvironment; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING = - "canCreateOrUpdateSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING) - private Boolean canCreateOrUpdateSetting; - - public static final String SERIALIZED_NAME_CAN_TAG_SETTING = "canTagSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_TAG_SETTING) - private Boolean canTagSetting; - - public static final String SERIALIZED_NAME_CAN_DELETE_SETTING = "canDeleteSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_SETTING) - private Boolean canDeleteSetting; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG = "canCreateOrUpdateTag"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG) - private Boolean canCreateOrUpdateTag; - - public static final String SERIALIZED_NAME_CAN_DELETE_TAG = "canDeleteTag"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_TAG) - private Boolean canDeleteTag; - - public static final String SERIALIZED_NAME_CAN_MANAGE_WEBHOOK = "canManageWebhook"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_WEBHOOK) - private Boolean canManageWebhook; - - public static final String SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT = "canUseExportImport"; - - @SerializedName(SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT) - private Boolean canUseExportImport; - - public static final String SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES = - "canManageProductPreferences"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES) - private Boolean canManageProductPreferences; - - public static final String SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS = "canManageIntegrations"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS) - private Boolean canManageIntegrations; - - public static final String SERIALIZED_NAME_CAN_VIEW_SDK_KEY = "canViewSdkKey"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_SDK_KEY) - private Boolean canViewSdkKey; - - public static final String SERIALIZED_NAME_CAN_ROTATE_SDK_KEY = "canRotateSdkKey"; - - @SerializedName(SERIALIZED_NAME_CAN_ROTATE_SDK_KEY) - private Boolean canRotateSdkKey; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS = - "canCreateOrUpdateSegments"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS) - private Boolean canCreateOrUpdateSegments; - - public static final String SERIALIZED_NAME_CAN_DELETE_SEGMENTS = "canDeleteSegments"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_SEGMENTS) - private Boolean canDeleteSegments; - - public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG = - "canViewProductAuditLog"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG) - private Boolean canViewProductAuditLog; - - public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS = - "canViewProductStatistics"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS) - private Boolean canViewProductStatistics; - - public static final String SERIALIZED_NAME_ACCESS_TYPE = "accessType"; - - @SerializedName(SERIALIZED_NAME_ACCESS_TYPE) - private AccessType accessType; - - public static final String SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE = - "newEnvironmentAccessType"; - - @SerializedName(SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE) - private EnvironmentAccessType newEnvironmentAccessType; - - public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESSES = "environmentAccesses"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESSES) - private List environmentAccesses; - - public static final String SERIALIZED_NAME_CAN_DISABLE2_F_A = "canDisable2FA"; - - @SerializedName(SERIALIZED_NAME_CAN_DISABLE2_F_A) - private Boolean canDisable2FA; - - public CreatePermissionGroupRequest() {} - - public CreatePermissionGroupRequest name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Permission Group. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CreatePermissionGroupRequest canManageMembers(Boolean canManageMembers) { - this.canManageMembers = canManageMembers; - return this; - } - - /** - * Group members can manage team members. - * - * @return canManageMembers - */ - @javax.annotation.Nullable - public Boolean getCanManageMembers() { - return canManageMembers; - } - - public void setCanManageMembers(Boolean canManageMembers) { - this.canManageMembers = canManageMembers; - } - - public CreatePermissionGroupRequest canCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { - this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; - return this; - } - - /** - * Group members can create/update Configs. - * - * @return canCreateOrUpdateConfig - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateConfig() { - return canCreateOrUpdateConfig; - } - - public void setCanCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { - this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; - } - - public CreatePermissionGroupRequest canDeleteConfig(Boolean canDeleteConfig) { - this.canDeleteConfig = canDeleteConfig; - return this; - } - - /** - * Group members can delete Configs. - * - * @return canDeleteConfig - */ - @javax.annotation.Nullable - public Boolean getCanDeleteConfig() { - return canDeleteConfig; - } - - public void setCanDeleteConfig(Boolean canDeleteConfig) { - this.canDeleteConfig = canDeleteConfig; - } - - public CreatePermissionGroupRequest canCreateOrUpdateEnvironment( - Boolean canCreateOrUpdateEnvironment) { - this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; - return this; - } - - /** - * Group members can create/update Environments. - * - * @return canCreateOrUpdateEnvironment - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateEnvironment() { - return canCreateOrUpdateEnvironment; - } - - public void setCanCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { - this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; - } - - public CreatePermissionGroupRequest canDeleteEnvironment(Boolean canDeleteEnvironment) { - this.canDeleteEnvironment = canDeleteEnvironment; - return this; - } - - /** - * Group members can delete Environments. - * - * @return canDeleteEnvironment - */ - @javax.annotation.Nullable - public Boolean getCanDeleteEnvironment() { - return canDeleteEnvironment; - } - - public void setCanDeleteEnvironment(Boolean canDeleteEnvironment) { - this.canDeleteEnvironment = canDeleteEnvironment; - } - - public CreatePermissionGroupRequest canCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { - this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; - return this; - } - - /** - * Group members can create/update Feature Flags and Settings. - * - * @return canCreateOrUpdateSetting - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateSetting() { - return canCreateOrUpdateSetting; - } - - public void setCanCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { - this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; - } - - public CreatePermissionGroupRequest canTagSetting(Boolean canTagSetting) { - this.canTagSetting = canTagSetting; - return this; - } - - /** - * Group members can attach/detach Tags to Feature Flags and Settings. - * - * @return canTagSetting - */ - @javax.annotation.Nullable - public Boolean getCanTagSetting() { - return canTagSetting; - } - - public void setCanTagSetting(Boolean canTagSetting) { - this.canTagSetting = canTagSetting; - } - - public CreatePermissionGroupRequest canDeleteSetting(Boolean canDeleteSetting) { - this.canDeleteSetting = canDeleteSetting; - return this; - } - - /** - * Group members can delete Feature Flags and Settings. - * - * @return canDeleteSetting - */ - @javax.annotation.Nullable - public Boolean getCanDeleteSetting() { - return canDeleteSetting; - } - - public void setCanDeleteSetting(Boolean canDeleteSetting) { - this.canDeleteSetting = canDeleteSetting; - } - - public CreatePermissionGroupRequest canCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { - this.canCreateOrUpdateTag = canCreateOrUpdateTag; - return this; - } - - /** - * Group members can create/update Tags. - * - * @return canCreateOrUpdateTag - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateTag() { - return canCreateOrUpdateTag; - } - public void setCanCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { - this.canCreateOrUpdateTag = canCreateOrUpdateTag; - } - - public CreatePermissionGroupRequest canDeleteTag(Boolean canDeleteTag) { - this.canDeleteTag = canDeleteTag; - return this; - } - - /** - * Group members can delete Tags. - * - * @return canDeleteTag - */ - @javax.annotation.Nullable - public Boolean getCanDeleteTag() { - return canDeleteTag; - } - - public void setCanDeleteTag(Boolean canDeleteTag) { - this.canDeleteTag = canDeleteTag; - } - - public CreatePermissionGroupRequest canManageWebhook(Boolean canManageWebhook) { - this.canManageWebhook = canManageWebhook; - return this; - } - - /** - * Group members can create/update/delete Webhooks. - * - * @return canManageWebhook - */ - @javax.annotation.Nullable - public Boolean getCanManageWebhook() { - return canManageWebhook; - } - - public void setCanManageWebhook(Boolean canManageWebhook) { - this.canManageWebhook = canManageWebhook; - } - - public CreatePermissionGroupRequest canUseExportImport(Boolean canUseExportImport) { - this.canUseExportImport = canUseExportImport; - return this; - } - - /** - * Group members can use the export/import feature. - * - * @return canUseExportImport - */ - @javax.annotation.Nullable - public Boolean getCanUseExportImport() { - return canUseExportImport; - } - - public void setCanUseExportImport(Boolean canUseExportImport) { - this.canUseExportImport = canUseExportImport; - } - - public CreatePermissionGroupRequest canManageProductPreferences( - Boolean canManageProductPreferences) { - this.canManageProductPreferences = canManageProductPreferences; - return this; - } - - /** - * Group members can update Product preferences. - * - * @return canManageProductPreferences - */ - @javax.annotation.Nullable - public Boolean getCanManageProductPreferences() { - return canManageProductPreferences; - } - - public void setCanManageProductPreferences(Boolean canManageProductPreferences) { - this.canManageProductPreferences = canManageProductPreferences; - } - - public CreatePermissionGroupRequest canManageIntegrations(Boolean canManageIntegrations) { - this.canManageIntegrations = canManageIntegrations; - return this; - } - - /** - * Group members can add and configure integrations. - * - * @return canManageIntegrations - */ - @javax.annotation.Nullable - public Boolean getCanManageIntegrations() { - return canManageIntegrations; - } - - public void setCanManageIntegrations(Boolean canManageIntegrations) { - this.canManageIntegrations = canManageIntegrations; - } - - public CreatePermissionGroupRequest canViewSdkKey(Boolean canViewSdkKey) { - this.canViewSdkKey = canViewSdkKey; - return this; - } - - /** - * Group members has access to SDK keys. - * - * @return canViewSdkKey - */ - @javax.annotation.Nullable - public Boolean getCanViewSdkKey() { - return canViewSdkKey; - } - - public void setCanViewSdkKey(Boolean canViewSdkKey) { - this.canViewSdkKey = canViewSdkKey; - } - - public CreatePermissionGroupRequest canRotateSdkKey(Boolean canRotateSdkKey) { - this.canRotateSdkKey = canRotateSdkKey; - return this; - } - - /** - * Group members can rotate SDK keys. - * - * @return canRotateSdkKey - */ - @javax.annotation.Nullable - public Boolean getCanRotateSdkKey() { - return canRotateSdkKey; - } - - public void setCanRotateSdkKey(Boolean canRotateSdkKey) { - this.canRotateSdkKey = canRotateSdkKey; - } - - public CreatePermissionGroupRequest canCreateOrUpdateSegments( - Boolean canCreateOrUpdateSegments) { - this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; - return this; - } - - /** - * Group members can create/update Segments. - * - * @return canCreateOrUpdateSegments - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateSegments() { - return canCreateOrUpdateSegments; - } - - public void setCanCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { - this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; - } - - public CreatePermissionGroupRequest canDeleteSegments(Boolean canDeleteSegments) { - this.canDeleteSegments = canDeleteSegments; - return this; - } - - /** - * Group members can delete Segments. - * - * @return canDeleteSegments - */ - @javax.annotation.Nullable - public Boolean getCanDeleteSegments() { - return canDeleteSegments; - } - - public void setCanDeleteSegments(Boolean canDeleteSegments) { - this.canDeleteSegments = canDeleteSegments; - } - - public CreatePermissionGroupRequest canViewProductAuditLog(Boolean canViewProductAuditLog) { - this.canViewProductAuditLog = canViewProductAuditLog; - return this; - } - - /** - * Group members has access to audit logs. - * - * @return canViewProductAuditLog - */ - @javax.annotation.Nullable - public Boolean getCanViewProductAuditLog() { - return canViewProductAuditLog; - } - - public void setCanViewProductAuditLog(Boolean canViewProductAuditLog) { - this.canViewProductAuditLog = canViewProductAuditLog; - } - - public CreatePermissionGroupRequest canViewProductStatistics(Boolean canViewProductStatistics) { - this.canViewProductStatistics = canViewProductStatistics; - return this; - } - - /** - * Group members has access to product statistics. - * - * @return canViewProductStatistics - */ - @javax.annotation.Nullable - public Boolean getCanViewProductStatistics() { - return canViewProductStatistics; - } - - public void setCanViewProductStatistics(Boolean canViewProductStatistics) { - this.canViewProductStatistics = canViewProductStatistics; - } - - public CreatePermissionGroupRequest accessType(AccessType accessType) { - this.accessType = accessType; - return this; - } - - /** - * Get accessType - * - * @return accessType - */ - @javax.annotation.Nullable - public AccessType getAccessType() { - return accessType; - } - - public void setAccessType(AccessType accessType) { - this.accessType = accessType; - } - - public CreatePermissionGroupRequest newEnvironmentAccessType( - EnvironmentAccessType newEnvironmentAccessType) { - this.newEnvironmentAccessType = newEnvironmentAccessType; - return this; - } - - /** - * Get newEnvironmentAccessType - * - * @return newEnvironmentAccessType - */ - @javax.annotation.Nullable - public EnvironmentAccessType getNewEnvironmentAccessType() { - return newEnvironmentAccessType; - } - - public void setNewEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { - this.newEnvironmentAccessType = newEnvironmentAccessType; - } - - public CreatePermissionGroupRequest environmentAccesses( - List environmentAccesses) { - this.environmentAccesses = environmentAccesses; - return this; - } - - public CreatePermissionGroupRequest addEnvironmentAccessesItem( - CreateOrUpdateEnvironmentAccessModel environmentAccessesItem) { - if (this.environmentAccesses == null) { - this.environmentAccesses = new ArrayList<>(); - } - this.environmentAccesses.add(environmentAccessesItem); - return this; - } - - /** - * List of environment specific permissions. - * - * @return environmentAccesses - */ - @javax.annotation.Nullable - public List getEnvironmentAccesses() { - return environmentAccesses; - } - - public void setEnvironmentAccesses( - List environmentAccesses) { - this.environmentAccesses = environmentAccesses; - } - - public CreatePermissionGroupRequest canDisable2FA(Boolean canDisable2FA) { - this.canDisable2FA = canDisable2FA; - return this; - } - - /** - * Group members can disable two-factor authentication for other members. - * - * @return canDisable2FA - */ - @javax.annotation.Nullable - public Boolean getCanDisable2FA() { - return canDisable2FA; - } - - public void setCanDisable2FA(Boolean canDisable2FA) { - this.canDisable2FA = canDisable2FA; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreatePermissionGroupRequest createPermissionGroupRequest = - (CreatePermissionGroupRequest) o; - return Objects.equals(this.name, createPermissionGroupRequest.name) - && Objects.equals( - this.canManageMembers, createPermissionGroupRequest.canManageMembers) - && Objects.equals( - this.canCreateOrUpdateConfig, - createPermissionGroupRequest.canCreateOrUpdateConfig) - && Objects.equals( - this.canDeleteConfig, createPermissionGroupRequest.canDeleteConfig) - && Objects.equals( - this.canCreateOrUpdateEnvironment, - createPermissionGroupRequest.canCreateOrUpdateEnvironment) - && Objects.equals( - this.canDeleteEnvironment, - createPermissionGroupRequest.canDeleteEnvironment) - && Objects.equals( - this.canCreateOrUpdateSetting, - createPermissionGroupRequest.canCreateOrUpdateSetting) - && Objects.equals(this.canTagSetting, createPermissionGroupRequest.canTagSetting) - && Objects.equals( - this.canDeleteSetting, createPermissionGroupRequest.canDeleteSetting) - && Objects.equals( - this.canCreateOrUpdateTag, - createPermissionGroupRequest.canCreateOrUpdateTag) - && Objects.equals(this.canDeleteTag, createPermissionGroupRequest.canDeleteTag) - && Objects.equals( - this.canManageWebhook, createPermissionGroupRequest.canManageWebhook) - && Objects.equals( - this.canUseExportImport, createPermissionGroupRequest.canUseExportImport) - && Objects.equals( - this.canManageProductPreferences, - createPermissionGroupRequest.canManageProductPreferences) - && Objects.equals( - this.canManageIntegrations, - createPermissionGroupRequest.canManageIntegrations) - && Objects.equals(this.canViewSdkKey, createPermissionGroupRequest.canViewSdkKey) - && Objects.equals( - this.canRotateSdkKey, createPermissionGroupRequest.canRotateSdkKey) - && Objects.equals( - this.canCreateOrUpdateSegments, - createPermissionGroupRequest.canCreateOrUpdateSegments) - && Objects.equals( - this.canDeleteSegments, createPermissionGroupRequest.canDeleteSegments) - && Objects.equals( - this.canViewProductAuditLog, - createPermissionGroupRequest.canViewProductAuditLog) - && Objects.equals( - this.canViewProductStatistics, - createPermissionGroupRequest.canViewProductStatistics) - && Objects.equals(this.accessType, createPermissionGroupRequest.accessType) - && Objects.equals( - this.newEnvironmentAccessType, - createPermissionGroupRequest.newEnvironmentAccessType) - && Objects.equals( - this.environmentAccesses, createPermissionGroupRequest.environmentAccesses) - && Objects.equals(this.canDisable2FA, createPermissionGroupRequest.canDisable2FA); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - name, - canManageMembers, - canCreateOrUpdateConfig, - canDeleteConfig, - canCreateOrUpdateEnvironment, - canDeleteEnvironment, - canCreateOrUpdateSetting, - canTagSetting, - canDeleteSetting, - canCreateOrUpdateTag, - canDeleteTag, - canManageWebhook, - canUseExportImport, - canManageProductPreferences, - canManageIntegrations, - canViewSdkKey, - canRotateSdkKey, - canCreateOrUpdateSegments, - canDeleteSegments, - canViewProductAuditLog, - canViewProductStatistics, - accessType, - newEnvironmentAccessType, - environmentAccesses, - canDisable2FA); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreatePermissionGroupRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" canManageMembers: ").append(toIndentedString(canManageMembers)).append("\n"); - sb.append(" canCreateOrUpdateConfig: ") - .append(toIndentedString(canCreateOrUpdateConfig)) - .append("\n"); - sb.append(" canDeleteConfig: ").append(toIndentedString(canDeleteConfig)).append("\n"); - sb.append(" canCreateOrUpdateEnvironment: ") - .append(toIndentedString(canCreateOrUpdateEnvironment)) - .append("\n"); - sb.append(" canDeleteEnvironment: ") - .append(toIndentedString(canDeleteEnvironment)) - .append("\n"); - sb.append(" canCreateOrUpdateSetting: ") - .append(toIndentedString(canCreateOrUpdateSetting)) - .append("\n"); - sb.append(" canTagSetting: ").append(toIndentedString(canTagSetting)).append("\n"); - sb.append(" canDeleteSetting: ").append(toIndentedString(canDeleteSetting)).append("\n"); - sb.append(" canCreateOrUpdateTag: ") - .append(toIndentedString(canCreateOrUpdateTag)) - .append("\n"); - sb.append(" canDeleteTag: ").append(toIndentedString(canDeleteTag)).append("\n"); - sb.append(" canManageWebhook: ").append(toIndentedString(canManageWebhook)).append("\n"); - sb.append(" canUseExportImport: ") - .append(toIndentedString(canUseExportImport)) - .append("\n"); - sb.append(" canManageProductPreferences: ") - .append(toIndentedString(canManageProductPreferences)) - .append("\n"); - sb.append(" canManageIntegrations: ") - .append(toIndentedString(canManageIntegrations)) - .append("\n"); - sb.append(" canViewSdkKey: ").append(toIndentedString(canViewSdkKey)).append("\n"); - sb.append(" canRotateSdkKey: ").append(toIndentedString(canRotateSdkKey)).append("\n"); - sb.append(" canCreateOrUpdateSegments: ") - .append(toIndentedString(canCreateOrUpdateSegments)) - .append("\n"); - sb.append(" canDeleteSegments: ") - .append(toIndentedString(canDeleteSegments)) - .append("\n"); - sb.append(" canViewProductAuditLog: ") - .append(toIndentedString(canViewProductAuditLog)) - .append("\n"); - sb.append(" canViewProductStatistics: ") - .append(toIndentedString(canViewProductStatistics)) - .append("\n"); - sb.append(" accessType: ").append(toIndentedString(accessType)).append("\n"); - sb.append(" newEnvironmentAccessType: ") - .append(toIndentedString(newEnvironmentAccessType)) - .append("\n"); - sb.append(" environmentAccesses: ") - .append(toIndentedString(environmentAccesses)) - .append("\n"); - sb.append(" canDisable2FA: ").append(toIndentedString(canDisable2FA)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } +import com.configcat.publicapi.java.client.JSON; - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("canManageMembers"); - openapiFields.add("canCreateOrUpdateConfig"); - openapiFields.add("canDeleteConfig"); - openapiFields.add("canCreateOrUpdateEnvironment"); - openapiFields.add("canDeleteEnvironment"); - openapiFields.add("canCreateOrUpdateSetting"); - openapiFields.add("canTagSetting"); - openapiFields.add("canDeleteSetting"); - openapiFields.add("canCreateOrUpdateTag"); - openapiFields.add("canDeleteTag"); - openapiFields.add("canManageWebhook"); - openapiFields.add("canUseExportImport"); - openapiFields.add("canManageProductPreferences"); - openapiFields.add("canManageIntegrations"); - openapiFields.add("canViewSdkKey"); - openapiFields.add("canRotateSdkKey"); - openapiFields.add("canCreateOrUpdateSegments"); - openapiFields.add("canDeleteSegments"); - openapiFields.add("canViewProductAuditLog"); - openapiFields.add("canViewProductStatistics"); - openapiFields.add("accessType"); - openapiFields.add("newEnvironmentAccessType"); - openapiFields.add("environmentAccesses"); - openapiFields.add("canDisable2FA"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - } +/** + * CreatePermissionGroupRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CreatePermissionGroupRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * CreatePermissionGroupRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreatePermissionGroupRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreatePermissionGroupRequest is not" - + " found in the empty JSON string", - CreatePermissionGroupRequest.openapiRequiredFields.toString())); - } - } + public static final String SERIALIZED_NAME_CAN_MANAGE_MEMBERS = "canManageMembers"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_MEMBERS) + private Boolean canManageMembers; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreatePermissionGroupRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreatePermissionGroupRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG = "canCreateOrUpdateConfig"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG) + private Boolean canCreateOrUpdateConfig; + + public static final String SERIALIZED_NAME_CAN_DELETE_CONFIG = "canDeleteConfig"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_CONFIG) + private Boolean canDeleteConfig; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT = "canCreateOrUpdateEnvironment"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT) + private Boolean canCreateOrUpdateEnvironment; + + public static final String SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT = "canDeleteEnvironment"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT) + private Boolean canDeleteEnvironment; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING = "canCreateOrUpdateSetting"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING) + private Boolean canCreateOrUpdateSetting; + + public static final String SERIALIZED_NAME_CAN_TAG_SETTING = "canTagSetting"; + @SerializedName(SERIALIZED_NAME_CAN_TAG_SETTING) + private Boolean canTagSetting; + + public static final String SERIALIZED_NAME_CAN_DELETE_SETTING = "canDeleteSetting"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_SETTING) + private Boolean canDeleteSetting; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG = "canCreateOrUpdateTag"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG) + private Boolean canCreateOrUpdateTag; + + public static final String SERIALIZED_NAME_CAN_DELETE_TAG = "canDeleteTag"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_TAG) + private Boolean canDeleteTag; + + public static final String SERIALIZED_NAME_CAN_MANAGE_WEBHOOK = "canManageWebhook"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_WEBHOOK) + private Boolean canManageWebhook; + + public static final String SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT = "canUseExportImport"; + @SerializedName(SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT) + private Boolean canUseExportImport; + + public static final String SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES = "canManageProductPreferences"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES) + private Boolean canManageProductPreferences; + + public static final String SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS = "canManageIntegrations"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS) + private Boolean canManageIntegrations; + + public static final String SERIALIZED_NAME_CAN_VIEW_SDK_KEY = "canViewSdkKey"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_SDK_KEY) + private Boolean canViewSdkKey; + + public static final String SERIALIZED_NAME_CAN_ROTATE_SDK_KEY = "canRotateSdkKey"; + @SerializedName(SERIALIZED_NAME_CAN_ROTATE_SDK_KEY) + private Boolean canRotateSdkKey; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS = "canCreateOrUpdateSegments"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS) + private Boolean canCreateOrUpdateSegments; + + public static final String SERIALIZED_NAME_CAN_DELETE_SEGMENTS = "canDeleteSegments"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_SEGMENTS) + private Boolean canDeleteSegments; + + public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG = "canViewProductAuditLog"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG) + private Boolean canViewProductAuditLog; + + public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS = "canViewProductStatistics"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS) + private Boolean canViewProductStatistics; + + public static final String SERIALIZED_NAME_ACCESS_TYPE = "accessType"; + @SerializedName(SERIALIZED_NAME_ACCESS_TYPE) + private AccessType accessType; + + public static final String SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE = "newEnvironmentAccessType"; + @SerializedName(SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE) + private EnvironmentAccessType newEnvironmentAccessType; + + public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESSES = "environmentAccesses"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESSES) + private List environmentAccesses; + + public static final String SERIALIZED_NAME_CAN_DISABLE2_F_A = "canDisable2FA"; + @SerializedName(SERIALIZED_NAME_CAN_DISABLE2_F_A) + private Boolean canDisable2FA; + + public CreatePermissionGroupRequest() { + } + + public CreatePermissionGroupRequest name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Permission Group. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public CreatePermissionGroupRequest canManageMembers(Boolean canManageMembers) { + this.canManageMembers = canManageMembers; + return this; + } + + /** + * Group members can manage team members. + * @return canManageMembers + */ + @javax.annotation.Nullable + public Boolean getCanManageMembers() { + return canManageMembers; + } + + public void setCanManageMembers(Boolean canManageMembers) { + this.canManageMembers = canManageMembers; + } + + + public CreatePermissionGroupRequest canCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { + this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; + return this; + } + + /** + * Group members can create/update Configs. + * @return canCreateOrUpdateConfig + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateConfig() { + return canCreateOrUpdateConfig; + } + + public void setCanCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { + this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; + } + + + public CreatePermissionGroupRequest canDeleteConfig(Boolean canDeleteConfig) { + this.canDeleteConfig = canDeleteConfig; + return this; + } + + /** + * Group members can delete Configs. + * @return canDeleteConfig + */ + @javax.annotation.Nullable + public Boolean getCanDeleteConfig() { + return canDeleteConfig; + } + + public void setCanDeleteConfig(Boolean canDeleteConfig) { + this.canDeleteConfig = canDeleteConfig; + } + + + public CreatePermissionGroupRequest canCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { + this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; + return this; + } + + /** + * Group members can create/update Environments. + * @return canCreateOrUpdateEnvironment + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateEnvironment() { + return canCreateOrUpdateEnvironment; + } + + public void setCanCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { + this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; + } + + + public CreatePermissionGroupRequest canDeleteEnvironment(Boolean canDeleteEnvironment) { + this.canDeleteEnvironment = canDeleteEnvironment; + return this; + } + + /** + * Group members can delete Environments. + * @return canDeleteEnvironment + */ + @javax.annotation.Nullable + public Boolean getCanDeleteEnvironment() { + return canDeleteEnvironment; + } + + public void setCanDeleteEnvironment(Boolean canDeleteEnvironment) { + this.canDeleteEnvironment = canDeleteEnvironment; + } + + + public CreatePermissionGroupRequest canCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { + this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; + return this; + } + + /** + * Group members can create/update Feature Flags and Settings. + * @return canCreateOrUpdateSetting + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateSetting() { + return canCreateOrUpdateSetting; + } + + public void setCanCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { + this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; + } + + + public CreatePermissionGroupRequest canTagSetting(Boolean canTagSetting) { + this.canTagSetting = canTagSetting; + return this; + } + + /** + * Group members can attach/detach Tags to Feature Flags and Settings. + * @return canTagSetting + */ + @javax.annotation.Nullable + public Boolean getCanTagSetting() { + return canTagSetting; + } + + public void setCanTagSetting(Boolean canTagSetting) { + this.canTagSetting = canTagSetting; + } + + + public CreatePermissionGroupRequest canDeleteSetting(Boolean canDeleteSetting) { + this.canDeleteSetting = canDeleteSetting; + return this; + } + + /** + * Group members can delete Feature Flags and Settings. + * @return canDeleteSetting + */ + @javax.annotation.Nullable + public Boolean getCanDeleteSetting() { + return canDeleteSetting; + } + + public void setCanDeleteSetting(Boolean canDeleteSetting) { + this.canDeleteSetting = canDeleteSetting; + } + + + public CreatePermissionGroupRequest canCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { + this.canCreateOrUpdateTag = canCreateOrUpdateTag; + return this; + } + + /** + * Group members can create/update Tags. + * @return canCreateOrUpdateTag + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateTag() { + return canCreateOrUpdateTag; + } + + public void setCanCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { + this.canCreateOrUpdateTag = canCreateOrUpdateTag; + } + + + public CreatePermissionGroupRequest canDeleteTag(Boolean canDeleteTag) { + this.canDeleteTag = canDeleteTag; + return this; + } + + /** + * Group members can delete Tags. + * @return canDeleteTag + */ + @javax.annotation.Nullable + public Boolean getCanDeleteTag() { + return canDeleteTag; + } + + public void setCanDeleteTag(Boolean canDeleteTag) { + this.canDeleteTag = canDeleteTag; + } + + + public CreatePermissionGroupRequest canManageWebhook(Boolean canManageWebhook) { + this.canManageWebhook = canManageWebhook; + return this; + } + + /** + * Group members can create/update/delete Webhooks. + * @return canManageWebhook + */ + @javax.annotation.Nullable + public Boolean getCanManageWebhook() { + return canManageWebhook; + } + + public void setCanManageWebhook(Boolean canManageWebhook) { + this.canManageWebhook = canManageWebhook; + } + + + public CreatePermissionGroupRequest canUseExportImport(Boolean canUseExportImport) { + this.canUseExportImport = canUseExportImport; + return this; + } + + /** + * Group members can use the export/import feature. + * @return canUseExportImport + */ + @javax.annotation.Nullable + public Boolean getCanUseExportImport() { + return canUseExportImport; + } + + public void setCanUseExportImport(Boolean canUseExportImport) { + this.canUseExportImport = canUseExportImport; + } + + + public CreatePermissionGroupRequest canManageProductPreferences(Boolean canManageProductPreferences) { + this.canManageProductPreferences = canManageProductPreferences; + return this; + } + + /** + * Group members can update Product preferences. + * @return canManageProductPreferences + */ + @javax.annotation.Nullable + public Boolean getCanManageProductPreferences() { + return canManageProductPreferences; + } + + public void setCanManageProductPreferences(Boolean canManageProductPreferences) { + this.canManageProductPreferences = canManageProductPreferences; + } + + + public CreatePermissionGroupRequest canManageIntegrations(Boolean canManageIntegrations) { + this.canManageIntegrations = canManageIntegrations; + return this; + } + + /** + * Group members can add and configure integrations. + * @return canManageIntegrations + */ + @javax.annotation.Nullable + public Boolean getCanManageIntegrations() { + return canManageIntegrations; + } + + public void setCanManageIntegrations(Boolean canManageIntegrations) { + this.canManageIntegrations = canManageIntegrations; + } + + + public CreatePermissionGroupRequest canViewSdkKey(Boolean canViewSdkKey) { + this.canViewSdkKey = canViewSdkKey; + return this; + } + + /** + * Group members has access to SDK keys. + * @return canViewSdkKey + */ + @javax.annotation.Nullable + public Boolean getCanViewSdkKey() { + return canViewSdkKey; + } + + public void setCanViewSdkKey(Boolean canViewSdkKey) { + this.canViewSdkKey = canViewSdkKey; + } + + + public CreatePermissionGroupRequest canRotateSdkKey(Boolean canRotateSdkKey) { + this.canRotateSdkKey = canRotateSdkKey; + return this; + } + + /** + * Group members can rotate SDK keys. + * @return canRotateSdkKey + */ + @javax.annotation.Nullable + public Boolean getCanRotateSdkKey() { + return canRotateSdkKey; + } + + public void setCanRotateSdkKey(Boolean canRotateSdkKey) { + this.canRotateSdkKey = canRotateSdkKey; + } + + + public CreatePermissionGroupRequest canCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { + this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; + return this; + } + + /** + * Group members can create/update Segments. + * @return canCreateOrUpdateSegments + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateSegments() { + return canCreateOrUpdateSegments; + } + + public void setCanCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { + this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; + } + + + public CreatePermissionGroupRequest canDeleteSegments(Boolean canDeleteSegments) { + this.canDeleteSegments = canDeleteSegments; + return this; + } + + /** + * Group members can delete Segments. + * @return canDeleteSegments + */ + @javax.annotation.Nullable + public Boolean getCanDeleteSegments() { + return canDeleteSegments; + } + + public void setCanDeleteSegments(Boolean canDeleteSegments) { + this.canDeleteSegments = canDeleteSegments; + } + + + public CreatePermissionGroupRequest canViewProductAuditLog(Boolean canViewProductAuditLog) { + this.canViewProductAuditLog = canViewProductAuditLog; + return this; + } + + /** + * Group members has access to audit logs. + * @return canViewProductAuditLog + */ + @javax.annotation.Nullable + public Boolean getCanViewProductAuditLog() { + return canViewProductAuditLog; + } + + public void setCanViewProductAuditLog(Boolean canViewProductAuditLog) { + this.canViewProductAuditLog = canViewProductAuditLog; + } + + + public CreatePermissionGroupRequest canViewProductStatistics(Boolean canViewProductStatistics) { + this.canViewProductStatistics = canViewProductStatistics; + return this; + } + + /** + * Group members has access to product statistics. + * @return canViewProductStatistics + */ + @javax.annotation.Nullable + public Boolean getCanViewProductStatistics() { + return canViewProductStatistics; + } + + public void setCanViewProductStatistics(Boolean canViewProductStatistics) { + this.canViewProductStatistics = canViewProductStatistics; + } + + + public CreatePermissionGroupRequest accessType(AccessType accessType) { + this.accessType = accessType; + return this; + } + + /** + * Get accessType + * @return accessType + */ + @javax.annotation.Nullable + public AccessType getAccessType() { + return accessType; + } + + public void setAccessType(AccessType accessType) { + this.accessType = accessType; + } + + + public CreatePermissionGroupRequest newEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { + this.newEnvironmentAccessType = newEnvironmentAccessType; + return this; + } + + /** + * Get newEnvironmentAccessType + * @return newEnvironmentAccessType + */ + @javax.annotation.Nullable + public EnvironmentAccessType getNewEnvironmentAccessType() { + return newEnvironmentAccessType; + } + + public void setNewEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { + this.newEnvironmentAccessType = newEnvironmentAccessType; + } + + + public CreatePermissionGroupRequest environmentAccesses(List environmentAccesses) { + this.environmentAccesses = environmentAccesses; + return this; + } + + public CreatePermissionGroupRequest addEnvironmentAccessesItem(CreateOrUpdateEnvironmentAccessModel environmentAccessesItem) { + if (this.environmentAccesses == null) { + this.environmentAccesses = new ArrayList<>(); + } + this.environmentAccesses.add(environmentAccessesItem); + return this; + } + + /** + * List of environment specific permissions. + * @return environmentAccesses + */ + @javax.annotation.Nullable + public List getEnvironmentAccesses() { + return environmentAccesses; + } + + public void setEnvironmentAccesses(List environmentAccesses) { + this.environmentAccesses = environmentAccesses; + } + + + public CreatePermissionGroupRequest canDisable2FA(Boolean canDisable2FA) { + this.canDisable2FA = canDisable2FA; + return this; + } + + /** + * Group members can disable two-factor authentication for other members. + * @return canDisable2FA + */ + @javax.annotation.Nullable + public Boolean getCanDisable2FA() { + return canDisable2FA; + } + + public void setCanDisable2FA(Boolean canDisable2FA) { + this.canDisable2FA = canDisable2FA; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreatePermissionGroupRequest instance itself + */ + public CreatePermissionGroupRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreatePermissionGroupRequest createPermissionGroupRequest = (CreatePermissionGroupRequest) o; + return Objects.equals(this.name, createPermissionGroupRequest.name) && + Objects.equals(this.canManageMembers, createPermissionGroupRequest.canManageMembers) && + Objects.equals(this.canCreateOrUpdateConfig, createPermissionGroupRequest.canCreateOrUpdateConfig) && + Objects.equals(this.canDeleteConfig, createPermissionGroupRequest.canDeleteConfig) && + Objects.equals(this.canCreateOrUpdateEnvironment, createPermissionGroupRequest.canCreateOrUpdateEnvironment) && + Objects.equals(this.canDeleteEnvironment, createPermissionGroupRequest.canDeleteEnvironment) && + Objects.equals(this.canCreateOrUpdateSetting, createPermissionGroupRequest.canCreateOrUpdateSetting) && + Objects.equals(this.canTagSetting, createPermissionGroupRequest.canTagSetting) && + Objects.equals(this.canDeleteSetting, createPermissionGroupRequest.canDeleteSetting) && + Objects.equals(this.canCreateOrUpdateTag, createPermissionGroupRequest.canCreateOrUpdateTag) && + Objects.equals(this.canDeleteTag, createPermissionGroupRequest.canDeleteTag) && + Objects.equals(this.canManageWebhook, createPermissionGroupRequest.canManageWebhook) && + Objects.equals(this.canUseExportImport, createPermissionGroupRequest.canUseExportImport) && + Objects.equals(this.canManageProductPreferences, createPermissionGroupRequest.canManageProductPreferences) && + Objects.equals(this.canManageIntegrations, createPermissionGroupRequest.canManageIntegrations) && + Objects.equals(this.canViewSdkKey, createPermissionGroupRequest.canViewSdkKey) && + Objects.equals(this.canRotateSdkKey, createPermissionGroupRequest.canRotateSdkKey) && + Objects.equals(this.canCreateOrUpdateSegments, createPermissionGroupRequest.canCreateOrUpdateSegments) && + Objects.equals(this.canDeleteSegments, createPermissionGroupRequest.canDeleteSegments) && + Objects.equals(this.canViewProductAuditLog, createPermissionGroupRequest.canViewProductAuditLog) && + Objects.equals(this.canViewProductStatistics, createPermissionGroupRequest.canViewProductStatistics) && + Objects.equals(this.accessType, createPermissionGroupRequest.accessType) && + Objects.equals(this.newEnvironmentAccessType, createPermissionGroupRequest.newEnvironmentAccessType) && + Objects.equals(this.environmentAccesses, createPermissionGroupRequest.environmentAccesses) && + Objects.equals(this.canDisable2FA, createPermissionGroupRequest.canDisable2FA)&& + Objects.equals(this.additionalProperties, createPermissionGroupRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, canManageMembers, canCreateOrUpdateConfig, canDeleteConfig, canCreateOrUpdateEnvironment, canDeleteEnvironment, canCreateOrUpdateSetting, canTagSetting, canDeleteSetting, canCreateOrUpdateTag, canDeleteTag, canManageWebhook, canUseExportImport, canManageProductPreferences, canManageIntegrations, canViewSdkKey, canRotateSdkKey, canCreateOrUpdateSegments, canDeleteSegments, canViewProductAuditLog, canViewProductStatistics, accessType, newEnvironmentAccessType, environmentAccesses, canDisable2FA, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreatePermissionGroupRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" canManageMembers: ").append(toIndentedString(canManageMembers)).append("\n"); + sb.append(" canCreateOrUpdateConfig: ").append(toIndentedString(canCreateOrUpdateConfig)).append("\n"); + sb.append(" canDeleteConfig: ").append(toIndentedString(canDeleteConfig)).append("\n"); + sb.append(" canCreateOrUpdateEnvironment: ").append(toIndentedString(canCreateOrUpdateEnvironment)).append("\n"); + sb.append(" canDeleteEnvironment: ").append(toIndentedString(canDeleteEnvironment)).append("\n"); + sb.append(" canCreateOrUpdateSetting: ").append(toIndentedString(canCreateOrUpdateSetting)).append("\n"); + sb.append(" canTagSetting: ").append(toIndentedString(canTagSetting)).append("\n"); + sb.append(" canDeleteSetting: ").append(toIndentedString(canDeleteSetting)).append("\n"); + sb.append(" canCreateOrUpdateTag: ").append(toIndentedString(canCreateOrUpdateTag)).append("\n"); + sb.append(" canDeleteTag: ").append(toIndentedString(canDeleteTag)).append("\n"); + sb.append(" canManageWebhook: ").append(toIndentedString(canManageWebhook)).append("\n"); + sb.append(" canUseExportImport: ").append(toIndentedString(canUseExportImport)).append("\n"); + sb.append(" canManageProductPreferences: ").append(toIndentedString(canManageProductPreferences)).append("\n"); + sb.append(" canManageIntegrations: ").append(toIndentedString(canManageIntegrations)).append("\n"); + sb.append(" canViewSdkKey: ").append(toIndentedString(canViewSdkKey)).append("\n"); + sb.append(" canRotateSdkKey: ").append(toIndentedString(canRotateSdkKey)).append("\n"); + sb.append(" canCreateOrUpdateSegments: ").append(toIndentedString(canCreateOrUpdateSegments)).append("\n"); + sb.append(" canDeleteSegments: ").append(toIndentedString(canDeleteSegments)).append("\n"); + sb.append(" canViewProductAuditLog: ").append(toIndentedString(canViewProductAuditLog)).append("\n"); + sb.append(" canViewProductStatistics: ").append(toIndentedString(canViewProductStatistics)).append("\n"); + sb.append(" accessType: ").append(toIndentedString(accessType)).append("\n"); + sb.append(" newEnvironmentAccessType: ").append(toIndentedString(newEnvironmentAccessType)).append("\n"); + sb.append(" environmentAccesses: ").append(toIndentedString(environmentAccesses)).append("\n"); + sb.append(" canDisable2FA: ").append(toIndentedString(canDisable2FA)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("canManageMembers"); + openapiFields.add("canCreateOrUpdateConfig"); + openapiFields.add("canDeleteConfig"); + openapiFields.add("canCreateOrUpdateEnvironment"); + openapiFields.add("canDeleteEnvironment"); + openapiFields.add("canCreateOrUpdateSetting"); + openapiFields.add("canTagSetting"); + openapiFields.add("canDeleteSetting"); + openapiFields.add("canCreateOrUpdateTag"); + openapiFields.add("canDeleteTag"); + openapiFields.add("canManageWebhook"); + openapiFields.add("canUseExportImport"); + openapiFields.add("canManageProductPreferences"); + openapiFields.add("canManageIntegrations"); + openapiFields.add("canViewSdkKey"); + openapiFields.add("canRotateSdkKey"); + openapiFields.add("canCreateOrUpdateSegments"); + openapiFields.add("canDeleteSegments"); + openapiFields.add("canViewProductAuditLog"); + openapiFields.add("canViewProductStatistics"); + openapiFields.add("accessType"); + openapiFields.add("newEnvironmentAccessType"); + openapiFields.add("environmentAccesses"); + openapiFields.add("canDisable2FA"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreatePermissionGroupRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreatePermissionGroupRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePermissionGroupRequest is not found in the empty JSON string", CreatePermissionGroupRequest.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreatePermissionGroupRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreatePermissionGroupRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - // validate the optional field `accessType` - if (jsonObj.get("accessType") != null && !jsonObj.get("accessType").isJsonNull()) { - AccessType.validateJsonElement(jsonObj.get("accessType")); - } - // validate the optional field `newEnvironmentAccessType` - if (jsonObj.get("newEnvironmentAccessType") != null - && !jsonObj.get("newEnvironmentAccessType").isJsonNull()) { - EnvironmentAccessType.validateJsonElement(jsonObj.get("newEnvironmentAccessType")); - } - if (jsonObj.get("environmentAccesses") != null - && !jsonObj.get("environmentAccesses").isJsonNull()) { - JsonArray jsonArrayenvironmentAccesses = jsonObj.getAsJsonArray("environmentAccesses"); - if (jsonArrayenvironmentAccesses != null) { - // ensure the json data is an array - if (!jsonObj.get("environmentAccesses").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentAccesses` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("environmentAccesses").toString())); - } - - // validate the optional field `environmentAccesses` (array) - for (int i = 0; i < jsonArrayenvironmentAccesses.size(); i++) { - CreateOrUpdateEnvironmentAccessModel.validateJsonElement( - jsonArrayenvironmentAccesses.get(i)); - } - ; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreatePermissionGroupRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreatePermissionGroupRequest' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(CreatePermissionGroupRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreatePermissionGroupRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreatePermissionGroupRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `accessType` + if (jsonObj.get("accessType") != null && !jsonObj.get("accessType").isJsonNull()) { + AccessType.validateJsonElement(jsonObj.get("accessType")); + } + // validate the optional field `newEnvironmentAccessType` + if (jsonObj.get("newEnvironmentAccessType") != null && !jsonObj.get("newEnvironmentAccessType").isJsonNull()) { + EnvironmentAccessType.validateJsonElement(jsonObj.get("newEnvironmentAccessType")); + } + if (jsonObj.get("environmentAccesses") != null && !jsonObj.get("environmentAccesses").isJsonNull()) { + JsonArray jsonArrayenvironmentAccesses = jsonObj.getAsJsonArray("environmentAccesses"); + if (jsonArrayenvironmentAccesses != null) { + // ensure the json data is an array + if (!jsonObj.get("environmentAccesses").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentAccesses` to be an array in the JSON string but got `%s`", jsonObj.get("environmentAccesses").toString())); + } + + // validate the optional field `environmentAccesses` (array) + for (int i = 0; i < jsonArrayenvironmentAccesses.size(); i++) { + CreateOrUpdateEnvironmentAccessModel.validateJsonElement(jsonArrayenvironmentAccesses.get(i)); + }; } - } - - /** - * Create an instance of CreatePermissionGroupRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreatePermissionGroupRequest - * @throws IOException if the JSON string is invalid with respect to - * CreatePermissionGroupRequest - */ - public static CreatePermissionGroupRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreatePermissionGroupRequest.class); - } + } + } - /** - * Convert an instance of CreatePermissionGroupRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreatePermissionGroupRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreatePermissionGroupRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreatePermissionGroupRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreatePermissionGroupRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreatePermissionGroupRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreatePermissionGroupRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreatePermissionGroupRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreatePermissionGroupRequest + * @throws IOException if the JSON string is invalid with respect to CreatePermissionGroupRequest + */ + public static CreatePermissionGroupRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreatePermissionGroupRequest.class); + } + + /** + * Convert an instance of CreatePermissionGroupRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreateProductRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/CreateProductRequest.java index 94d0f6a..a1f899b 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreateProductRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreateProductRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,284 +10,353 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** CreateProductRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CreateProductRequest { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public CreateProductRequest() {} - - public CreateProductRequest name(String name) { - this.name = name; - return this; - } - - /** - * The name of the Product. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CreateProductRequest description(String description) { - this.description = description; - return this; - } - - /** - * The description of the Product. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public CreateProductRequest order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Product represented on the ConfigCat Dashboard. Determined from an ascending - * sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateProductRequest createProductRequest = (CreateProductRequest) o; - return Objects.equals(this.name, createProductRequest.name) - && Objects.equals(this.description, createProductRequest.description) - && Objects.equals(this.order, createProductRequest.order); +/** + * CreateProductRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CreateProductRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public CreateProductRequest() { + } + + public CreateProductRequest name(String name) { + this.name = name; + return this; + } + + /** + * The name of the Product. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public CreateProductRequest description(String description) { + this.description = description; + return this; + } + + /** + * The description of the Product. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public CreateProductRequest order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Product represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateProductRequest instance itself + */ + public CreateProductRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(name, description, order); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateProductRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + CreateProductRequest createProductRequest = (CreateProductRequest) o; + return Objects.equals(this.name, createProductRequest.name) && + Objects.equals(this.description, createProductRequest.description) && + Objects.equals(this.order, createProductRequest.order)&& + Objects.equals(this.additionalProperties, createProductRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, order, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("order"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateProductRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateProductRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateProductRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreateProductRequest is not found in" - + " the empty JSON string", - CreateProductRequest.openapiRequiredFields.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("order"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateProductRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateProductRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateProductRequest is not found in the empty JSON string", CreateProductRequest.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateProductRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreateProductRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateProductRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateProductRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateProductRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateProductRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateProductRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateProductRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateProductRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of CreateProductRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateProductRequest - * @throws IOException if the JSON string is invalid with respect to CreateProductRequest - */ - public static CreateProductRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateProductRequest.class); - } - - /** - * Convert an instance of CreateProductRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateProductRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateProductRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateProductRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateProductRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateProductRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateProductRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of CreateProductRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateProductRequest + * @throws IOException if the JSON string is invalid with respect to CreateProductRequest + */ + public static CreateProductRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateProductRequest.class); + } + + /** + * Convert an instance of CreateProductRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreateSegmentModel.java b/src/main/java/com/configcat/publicapi/java/client/model/CreateSegmentModel.java index 2905252..384c2d0 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreateSegmentModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreateSegmentModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,358 +10,417 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.RolloutRuleComparator; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** CreateSegmentModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CreateSegmentModel { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) - private String comparisonAttribute; - - public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; - - @SerializedName(SERIALIZED_NAME_COMPARATOR) - private RolloutRuleComparator comparator; - - public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) - private String comparisonValue; - - public CreateSegmentModel() {} - - public CreateSegmentModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Segment. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CreateSegmentModel description(String description) { - this.description = description; - return this; - } - - /** - * Description of the Segment. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public CreateSegmentModel comparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - return this; - } - - /** - * The user's attribute the evaluation process must take into account. - * - * @return comparisonAttribute - */ - @javax.annotation.Nonnull - public String getComparisonAttribute() { - return comparisonAttribute; - } - public void setComparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - } - - public CreateSegmentModel comparator(RolloutRuleComparator comparator) { - this.comparator = comparator; - return this; - } - - /** - * Get comparator - * - * @return comparator - */ - @javax.annotation.Nonnull - public RolloutRuleComparator getComparator() { - return comparator; - } - - public void setComparator(RolloutRuleComparator comparator) { - this.comparator = comparator; - } - - public CreateSegmentModel comparisonValue(String comparisonValue) { - this.comparisonValue = comparisonValue; - return this; - } - - /** - * The value to compare with the given user attribute's value. - * - * @return comparisonValue - */ - @javax.annotation.Nonnull - public String getComparisonValue() { - return comparisonValue; - } - - public void setComparisonValue(String comparisonValue) { - this.comparisonValue = comparisonValue; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateSegmentModel createSegmentModel = (CreateSegmentModel) o; - return Objects.equals(this.name, createSegmentModel.name) - && Objects.equals(this.description, createSegmentModel.description) - && Objects.equals(this.comparisonAttribute, createSegmentModel.comparisonAttribute) - && Objects.equals(this.comparator, createSegmentModel.comparator) - && Objects.equals(this.comparisonValue, createSegmentModel.comparisonValue); +/** + * CreateSegmentModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CreateSegmentModel { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; + @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) + private String comparisonAttribute; + + public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; + @SerializedName(SERIALIZED_NAME_COMPARATOR) + private RolloutRuleComparator comparator; + + public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; + @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) + private String comparisonValue; + + public CreateSegmentModel() { + } + + public CreateSegmentModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Segment. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public CreateSegmentModel description(String description) { + this.description = description; + return this; + } + + /** + * Description of the Segment. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public CreateSegmentModel comparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + return this; + } + + /** + * The user's attribute the evaluation process must take into account. + * @return comparisonAttribute + */ + @javax.annotation.Nonnull + public String getComparisonAttribute() { + return comparisonAttribute; + } + + public void setComparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + } + + + public CreateSegmentModel comparator(RolloutRuleComparator comparator) { + this.comparator = comparator; + return this; + } + + /** + * Get comparator + * @return comparator + */ + @javax.annotation.Nonnull + public RolloutRuleComparator getComparator() { + return comparator; + } + + public void setComparator(RolloutRuleComparator comparator) { + this.comparator = comparator; + } + + + public CreateSegmentModel comparisonValue(String comparisonValue) { + this.comparisonValue = comparisonValue; + return this; + } + + /** + * The value to compare with the given user attribute's value. + * @return comparisonValue + */ + @javax.annotation.Nonnull + public String getComparisonValue() { + return comparisonValue; + } + + public void setComparisonValue(String comparisonValue) { + this.comparisonValue = comparisonValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateSegmentModel instance itself + */ + public CreateSegmentModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(name, description, comparisonAttribute, comparator, comparisonValue); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSegmentModel {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" comparisonAttribute: ") - .append(toIndentedString(comparisonAttribute)) - .append("\n"); - sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); - sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + CreateSegmentModel createSegmentModel = (CreateSegmentModel) o; + return Objects.equals(this.name, createSegmentModel.name) && + Objects.equals(this.description, createSegmentModel.description) && + Objects.equals(this.comparisonAttribute, createSegmentModel.comparisonAttribute) && + Objects.equals(this.comparator, createSegmentModel.comparator) && + Objects.equals(this.comparisonValue, createSegmentModel.comparisonValue)&& + Objects.equals(this.additionalProperties, createSegmentModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, comparisonAttribute, comparator, comparisonValue, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("comparisonAttribute"); - openapiFields.add("comparator"); - openapiFields.add("comparisonValue"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("comparisonAttribute"); - openapiRequiredFields.add("comparator"); - openapiRequiredFields.add("comparisonValue"); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSegmentModel {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" comparisonAttribute: ").append(toIndentedString(comparisonAttribute)).append("\n"); + sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); + sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateSegmentModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateSegmentModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreateSegmentModel is not found in" - + " the empty JSON string", - CreateSegmentModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateSegmentModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreateSegmentModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("comparisonAttribute"); + openapiFields.add("comparator"); + openapiFields.add("comparisonValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("comparisonAttribute"); + openapiRequiredFields.add("comparator"); + openapiRequiredFields.add("comparisonValue"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSegmentModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSegmentModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSegmentModel is not found in the empty JSON string", CreateSegmentModel.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateSegmentModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSegmentModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - if (!jsonObj.get("comparisonAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonAttribute` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("comparisonAttribute").toString())); - } - // validate the required field `comparator` - RolloutRuleComparator.validateJsonElement(jsonObj.get("comparator")); - if (!jsonObj.get("comparisonValue").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonValue` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("comparisonValue").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSegmentModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSegmentModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateSegmentModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSegmentModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSegmentModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of CreateSegmentModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSegmentModel - * @throws IOException if the JSON string is invalid with respect to CreateSegmentModel - */ - public static CreateSegmentModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSegmentModel.class); - } - - /** - * Convert an instance of CreateSegmentModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("comparisonAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonAttribute").toString())); + } + // validate the required field `comparator` + RolloutRuleComparator.validateJsonElement(jsonObj.get("comparator")); + if (!jsonObj.get("comparisonValue").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonValue` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonValue").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSegmentModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSegmentModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSegmentModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSegmentModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateSegmentModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSegmentModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of CreateSegmentModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSegmentModel + * @throws IOException if the JSON string is invalid with respect to CreateSegmentModel + */ + public static CreateSegmentModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSegmentModel.class); + } + + /** + * Convert an instance of CreateSegmentModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreateSettingInitialValues.java b/src/main/java/com/configcat/publicapi/java/client/model/CreateSettingInitialValues.java index 0bce894..cd91990 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreateSettingInitialValues.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreateSettingInitialValues.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,452 +10,502 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.InitialValue; +import com.configcat.publicapi.java.client.model.SettingType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** CreateSettingInitialValues */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class CreateSettingInitialValues { - public static final String SERIALIZED_NAME_HINT = "hint"; - - @SerializedName(SERIALIZED_NAME_HINT) - private String hint; - - public static final String SERIALIZED_NAME_TAGS = "tags"; - - @SerializedName(SERIALIZED_NAME_TAGS) - private List tags; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_KEY = "key"; - - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_SETTING_TYPE = "settingType"; - - @SerializedName(SERIALIZED_NAME_SETTING_TYPE) - private SettingType settingType; - - public static final String SERIALIZED_NAME_INITIAL_VALUES = "initialValues"; - - @SerializedName(SERIALIZED_NAME_INITIAL_VALUES) - private List initialValues; - - public CreateSettingInitialValues() {} - - public CreateSettingInitialValues hint(String hint) { - this.hint = hint; - return this; - } - - /** - * A short description for the setting, shown on the Dashboard UI. - * - * @return hint - */ - @javax.annotation.Nullable - public String getHint() { - return hint; - } - - public void setHint(String hint) { - this.hint = hint; - } - - public CreateSettingInitialValues tags(List tags) { - this.tags = tags; - return this; - } - - public CreateSettingInitialValues addTagsItem(Long tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList<>(); - } - this.tags.add(tagsItem); - return this; - } - - /** - * The IDs of the tags which are attached to the setting. - * - * @return tags - */ - @javax.annotation.Nullable - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - public CreateSettingInitialValues order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Setting represented on the ConfigCat Dashboard. Determined from an ascending - * sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public CreateSettingInitialValues key(String key) { - this.key = key; - return this; - } - - /** - * The key of the Feature Flag or Setting. - * - * @return key - */ - @javax.annotation.Nonnull - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - - public CreateSettingInitialValues name(String name) { - this.name = name; - return this; - } - - /** - * The name of the Feature Flag or Setting. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public CreateSettingInitialValues settingType(SettingType settingType) { - this.settingType = settingType; - return this; - } - - /** - * Get settingType - * - * @return settingType - */ - @javax.annotation.Nonnull - public SettingType getSettingType() { - return settingType; - } - - public void setSettingType(SettingType settingType) { - this.settingType = settingType; - } - - public CreateSettingInitialValues initialValues(List initialValues) { - this.initialValues = initialValues; - return this; - } - - public CreateSettingInitialValues addInitialValuesItem(InitialValue initialValuesItem) { - if (this.initialValues == null) { - this.initialValues = new ArrayList<>(); - } - this.initialValues.add(initialValuesItem); - return this; - } - - /** - * Optional, initial value of the Feature Flag or Setting in the given Environments. - * - * @return initialValues - */ - @javax.annotation.Nullable - public List getInitialValues() { - return initialValues; - } - - public void setInitialValues(List initialValues) { - this.initialValues = initialValues; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateSettingInitialValues createSettingInitialValues = (CreateSettingInitialValues) o; - return Objects.equals(this.hint, createSettingInitialValues.hint) - && Objects.equals(this.tags, createSettingInitialValues.tags) - && Objects.equals(this.order, createSettingInitialValues.order) - && Objects.equals(this.key, createSettingInitialValues.key) - && Objects.equals(this.name, createSettingInitialValues.name) - && Objects.equals(this.settingType, createSettingInitialValues.settingType) - && Objects.equals(this.initialValues, createSettingInitialValues.initialValues); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(hint, tags, order, key, name, settingType, initialValues); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateSettingInitialValues {\n"); - sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" settingType: ").append(toIndentedString(settingType)).append("\n"); - sb.append(" initialValues: ").append(toIndentedString(initialValues)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("hint"); - openapiFields.add("tags"); - openapiFields.add("order"); - openapiFields.add("key"); - openapiFields.add("name"); - openapiFields.add("settingType"); - openapiFields.add("initialValues"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("key"); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("settingType"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateSettingInitialValues - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateSettingInitialValues.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreateSettingInitialValues is not" - + " found in the empty JSON string", - CreateSettingInitialValues.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateSettingInitialValues.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreateSettingInitialValues` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * CreateSettingInitialValues + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class CreateSettingInitialValues { + public static final String SERIALIZED_NAME_HINT = "hint"; + @SerializedName(SERIALIZED_NAME_HINT) + private String hint; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_SETTING_TYPE = "settingType"; + @SerializedName(SERIALIZED_NAME_SETTING_TYPE) + private SettingType settingType; + + public static final String SERIALIZED_NAME_INITIAL_VALUES = "initialValues"; + @SerializedName(SERIALIZED_NAME_INITIAL_VALUES) + private List initialValues; + + public CreateSettingInitialValues() { + } + + public CreateSettingInitialValues hint(String hint) { + this.hint = hint; + return this; + } + + /** + * A short description for the setting, shown on the Dashboard UI. + * @return hint + */ + @javax.annotation.Nullable + public String getHint() { + return hint; + } + + public void setHint(String hint) { + this.hint = hint; + } + + + public CreateSettingInitialValues tags(List tags) { + this.tags = tags; + return this; + } + + public CreateSettingInitialValues addTagsItem(Long tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The IDs of the tags which are attached to the setting. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + + public CreateSettingInitialValues order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Setting represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public CreateSettingInitialValues key(String key) { + this.key = key; + return this; + } + + /** + * The key of the Feature Flag or Setting. + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + + public CreateSettingInitialValues name(String name) { + this.name = name; + return this; + } + + /** + * The name of the Feature Flag or Setting. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public CreateSettingInitialValues settingType(SettingType settingType) { + this.settingType = settingType; + return this; + } + + /** + * Get settingType + * @return settingType + */ + @javax.annotation.Nonnull + public SettingType getSettingType() { + return settingType; + } + + public void setSettingType(SettingType settingType) { + this.settingType = settingType; + } + + + public CreateSettingInitialValues initialValues(List initialValues) { + this.initialValues = initialValues; + return this; + } + + public CreateSettingInitialValues addInitialValuesItem(InitialValue initialValuesItem) { + if (this.initialValues == null) { + this.initialValues = new ArrayList<>(); + } + this.initialValues.add(initialValuesItem); + return this; + } + + /** + * Optional, initial value of the Feature Flag or Setting in the given Environments. + * @return initialValues + */ + @javax.annotation.Nullable + public List getInitialValues() { + return initialValues; + } + + public void setInitialValues(List initialValues) { + this.initialValues = initialValues; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateSettingInitialValues instance itself + */ + public CreateSettingInitialValues putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSettingInitialValues createSettingInitialValues = (CreateSettingInitialValues) o; + return Objects.equals(this.hint, createSettingInitialValues.hint) && + Objects.equals(this.tags, createSettingInitialValues.tags) && + Objects.equals(this.order, createSettingInitialValues.order) && + Objects.equals(this.key, createSettingInitialValues.key) && + Objects.equals(this.name, createSettingInitialValues.name) && + Objects.equals(this.settingType, createSettingInitialValues.settingType) && + Objects.equals(this.initialValues, createSettingInitialValues.initialValues)&& + Objects.equals(this.additionalProperties, createSettingInitialValues.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(hint, tags, order, key, name, settingType, initialValues, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateSettingInitialValues {\n"); + sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" settingType: ").append(toIndentedString(settingType)).append("\n"); + sb.append(" initialValues: ").append(toIndentedString(initialValues)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("hint"); + openapiFields.add("tags"); + openapiFields.add("order"); + openapiFields.add("key"); + openapiFields.add("name"); + openapiFields.add("settingType"); + openapiFields.add("initialValues"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("settingType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateSettingInitialValues + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSettingInitialValues.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSettingInitialValues is not found in the empty JSON string", CreateSettingInitialValues.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateSettingInitialValues.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSettingInitialValues.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) - && !jsonObj.get("hint").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `hint` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("hint").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("tags") != null - && !jsonObj.get("tags").isJsonNull() - && !jsonObj.get("tags").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `tags` to be an array in the JSON string but got" - + " `%s`", - jsonObj.get("tags").toString())); - } - if (!jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `key` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("key").toString())); + if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) && !jsonObj.get("hint").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hint` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hint").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull() && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + if (!jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the required field `settingType` + SettingType.validateJsonElement(jsonObj.get("settingType")); + if (jsonObj.get("initialValues") != null && !jsonObj.get("initialValues").isJsonNull()) { + JsonArray jsonArrayinitialValues = jsonObj.getAsJsonArray("initialValues"); + if (jsonArrayinitialValues != null) { + // ensure the json data is an array + if (!jsonObj.get("initialValues").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `initialValues` to be an array in the JSON string but got `%s`", jsonObj.get("initialValues").toString())); + } + + // validate the optional field `initialValues` (array) + for (int i = 0; i < jsonArrayinitialValues.size(); i++) { + InitialValue.validateJsonElement(jsonArrayinitialValues.get(i)); + }; } - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - // validate the required field `settingType` - SettingType.validateJsonElement(jsonObj.get("settingType")); - if (jsonObj.get("initialValues") != null && !jsonObj.get("initialValues").isJsonNull()) { - JsonArray jsonArrayinitialValues = jsonObj.getAsJsonArray("initialValues"); - if (jsonArrayinitialValues != null) { - // ensure the json data is an array - if (!jsonObj.get("initialValues").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `initialValues` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("initialValues").toString())); - } - - // validate the optional field `initialValues` (array) - for (int i = 0; i < jsonArrayinitialValues.size(); i++) { - InitialValue.validateJsonElement(jsonArrayinitialValues.get(i)); - } - ; - } - } - } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateSettingInitialValues.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateSettingInitialValues' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateSettingInitialValues.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateSettingInitialValues value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateSettingInitialValues read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of CreateSettingInitialValues given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateSettingInitialValues - * @throws IOException if the JSON string is invalid with respect to CreateSettingInitialValues - */ - public static CreateSettingInitialValues fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateSettingInitialValues.class); - } - - /** - * Convert an instance of CreateSettingInitialValues to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSettingInitialValues.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSettingInitialValues' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSettingInitialValues.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSettingInitialValues value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateSettingInitialValues read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateSettingInitialValues instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSettingInitialValues given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSettingInitialValues + * @throws IOException if the JSON string is invalid with respect to CreateSettingInitialValues + */ + public static CreateSettingInitialValues fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSettingInitialValues.class); + } + + /** + * Convert an instance of CreateSettingInitialValues to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/CreateTagModel.java b/src/main/java/com/configcat/publicapi/java/client/model/CreateTagModel.java index 8ccc8de..e616763 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/CreateTagModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/CreateTagModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,255 +10,327 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** CreateTagModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * CreateTagModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class CreateTagModel { - public static final String SERIALIZED_NAME_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; - public static final String SERIALIZED_NAME_COLOR = "color"; + public CreateTagModel() { + } - @SerializedName(SERIALIZED_NAME_COLOR) - private String color; + public CreateTagModel name(String name) { + this.name = name; + return this; + } - public CreateTagModel() {} + /** + * Name of the Tag. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - public CreateTagModel name(String name) { - this.name = name; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * Name of the Tag. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } + public CreateTagModel color(String color) { + this.color = color; + return this; + } - public CreateTagModel color(String color) { - this.color = color; - return this; - } + /** + * Color of the Tag. Possible values: `panther`, `whale`, `salmon`, `lizard`, `canary`, `koala`, or any HTML color code. + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } - /** - * Color of the Tag. - * - * @return color - */ - @javax.annotation.Nullable - public String getColor() { - return color; - } + public void setColor(String color) { + this.color = color; + } - public void setColor(String color) { - this.color = color; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CreateTagModel createTagModel = (CreateTagModel) o; - return Objects.equals(this.name, createTagModel.name) - && Objects.equals(this.color, createTagModel.color); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateTagModel instance itself + */ + public CreateTagModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(name, color); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTagModel createTagModel = (CreateTagModel) o; + return Objects.equals(this.name, createTagModel.name) && + Objects.equals(this.color, createTagModel.color)&& + Objects.equals(this.additionalProperties, createTagModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class CreateTagModel {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, color, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTagModel {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("color"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("color"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to CreateTagModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!CreateTagModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in CreateTagModel is not found in the" - + " empty JSON string", - CreateTagModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!CreateTagModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `CreateTagModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateTagModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTagModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTagModel is not found in the empty JSON string", CreateTagModel.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : CreateTagModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTagModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) - && !jsonObj.get("color").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `color` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("color").toString())); - } - } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!CreateTagModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'CreateTagModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(CreateTagModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, CreateTagModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public CreateTagModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateTagModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTagModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateTagModel.class)); - /** - * Create an instance of CreateTagModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of CreateTagModel - * @throws IOException if the JSON string is invalid with respect to CreateTagModel - */ - public static CreateTagModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, CreateTagModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTagModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateTagModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateTagModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of CreateTagModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of CreateTagModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTagModel + * @throws IOException if the JSON string is invalid with respect to CreateTagModel + */ + public static CreateTagModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTagModel.class); + } + + /** + * Convert an instance of CreateTagModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/DeleteIntegrationLinkModel.java b/src/main/java/com/configcat/publicapi/java/client/model/DeleteIntegrationLinkModel.java index 25cb133..736503b 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/DeleteIntegrationLinkModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/DeleteIntegrationLinkModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,192 +10,275 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** DeleteIntegrationLinkModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * DeleteIntegrationLinkModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class DeleteIntegrationLinkModel { - public static final String SERIALIZED_NAME_HAS_REMAINING_INTEGRATION_LINK = - "hasRemainingIntegrationLink"; + public static final String SERIALIZED_NAME_HAS_REMAINING_INTEGRATION_LINK = "hasRemainingIntegrationLink"; + @SerializedName(SERIALIZED_NAME_HAS_REMAINING_INTEGRATION_LINK) + private Boolean hasRemainingIntegrationLink; - @SerializedName(SERIALIZED_NAME_HAS_REMAINING_INTEGRATION_LINK) - private Boolean hasRemainingIntegrationLink; + public DeleteIntegrationLinkModel() { + } - public DeleteIntegrationLinkModel() {} + public DeleteIntegrationLinkModel hasRemainingIntegrationLink(Boolean hasRemainingIntegrationLink) { + this.hasRemainingIntegrationLink = hasRemainingIntegrationLink; + return this; + } - public DeleteIntegrationLinkModel hasRemainingIntegrationLink( - Boolean hasRemainingIntegrationLink) { - this.hasRemainingIntegrationLink = hasRemainingIntegrationLink; - return this; - } + /** + * Get hasRemainingIntegrationLink + * @return hasRemainingIntegrationLink + */ + @javax.annotation.Nullable + public Boolean getHasRemainingIntegrationLink() { + return hasRemainingIntegrationLink; + } - /** - * Get hasRemainingIntegrationLink - * - * @return hasRemainingIntegrationLink - */ - @javax.annotation.Nullable - public Boolean getHasRemainingIntegrationLink() { - return hasRemainingIntegrationLink; - } + public void setHasRemainingIntegrationLink(Boolean hasRemainingIntegrationLink) { + this.hasRemainingIntegrationLink = hasRemainingIntegrationLink; + } - public void setHasRemainingIntegrationLink(Boolean hasRemainingIntegrationLink) { - this.hasRemainingIntegrationLink = hasRemainingIntegrationLink; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeleteIntegrationLinkModel deleteIntegrationLinkModel = (DeleteIntegrationLinkModel) o; - return Objects.equals( - this.hasRemainingIntegrationLink, - deleteIntegrationLinkModel.hasRemainingIntegrationLink); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeleteIntegrationLinkModel instance itself + */ + public DeleteIntegrationLinkModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(hasRemainingIntegrationLink); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteIntegrationLinkModel {\n"); - sb.append(" hasRemainingIntegrationLink: ") - .append(toIndentedString(hasRemainingIntegrationLink)) - .append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + DeleteIntegrationLinkModel deleteIntegrationLinkModel = (DeleteIntegrationLinkModel) o; + return Objects.equals(this.hasRemainingIntegrationLink, deleteIntegrationLinkModel.hasRemainingIntegrationLink)&& + Objects.equals(this.additionalProperties, deleteIntegrationLinkModel.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(hasRemainingIntegrationLink, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("hasRemainingIntegrationLink"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteIntegrationLinkModel {\n"); + sb.append(" hasRemainingIntegrationLink: ").append(toIndentedString(hasRemainingIntegrationLink)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to DeleteIntegrationLinkModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!DeleteIntegrationLinkModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in DeleteIntegrationLinkModel is not" - + " found in the empty JSON string", - DeleteIntegrationLinkModel.openapiRequiredFields.toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!DeleteIntegrationLinkModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `DeleteIntegrationLinkModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("hasRemainingIntegrationLink"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteIntegrationLinkModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteIntegrationLinkModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteIntegrationLinkModel is not found in the empty JSON string", DeleteIntegrationLinkModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteIntegrationLinkModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteIntegrationLinkModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(DeleteIntegrationLinkModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteIntegrationLinkModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteIntegrationLinkModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteIntegrationLinkModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteIntegrationLinkModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeleteIntegrationLinkModel.class)); - /** - * Create an instance of DeleteIntegrationLinkModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteIntegrationLinkModel - * @throws IOException if the JSON string is invalid with respect to DeleteIntegrationLinkModel - */ - public static DeleteIntegrationLinkModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteIntegrationLinkModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteIntegrationLinkModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DeleteIntegrationLinkModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeleteIntegrationLinkModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of DeleteIntegrationLinkModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of DeleteIntegrationLinkModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteIntegrationLinkModel + * @throws IOException if the JSON string is invalid with respect to DeleteIntegrationLinkModel + */ + public static DeleteIntegrationLinkModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteIntegrationLinkModel.class); + } + + /** + * Convert an instance of DeleteIntegrationLinkModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/DeleteRepositoryReportsRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/DeleteRepositoryReportsRequest.java index 5d26e50..88ee18e 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/DeleteRepositoryReportsRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/DeleteRepositoryReportsRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,327 +10,384 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** DeleteRepositoryReportsRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class DeleteRepositoryReportsRequest { - public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; - - @SerializedName(SERIALIZED_NAME_CONFIG_ID) - private UUID configId; - - public static final String SERIALIZED_NAME_REPOSITORY = "repository"; - - @SerializedName(SERIALIZED_NAME_REPOSITORY) - private String repository; - - public static final String SERIALIZED_NAME_BRANCH = "branch"; - - @SerializedName(SERIALIZED_NAME_BRANCH) - private String branch; - - public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; - - @SerializedName(SERIALIZED_NAME_SETTING_ID) - private Integer settingId; - - public DeleteRepositoryReportsRequest() {} - - public DeleteRepositoryReportsRequest configId(UUID configId) { - this.configId = configId; - return this; - } - - /** - * The Config's identifier from where the reports should be deleted. - * - * @return configId - */ - @javax.annotation.Nonnull - public UUID getConfigId() { - return configId; - } - - public void setConfigId(UUID configId) { - this.configId = configId; - } - - public DeleteRepositoryReportsRequest repository(String repository) { - this.repository = repository; - return this; - } - - /** - * The source control repository which's reports should be deleted. - * - * @return repository - */ - @javax.annotation.Nonnull - public String getRepository() { - return repository; - } - - public void setRepository(String repository) { - this.repository = repository; - } - public DeleteRepositoryReportsRequest branch(String branch) { - this.branch = branch; - return this; - } +import com.configcat.publicapi.java.client.JSON; - /** - * If it's set, only this branch's reports belonging to the given repository will be - * deleted. - * - * @return branch - */ - @javax.annotation.Nullable - public String getBranch() { - return branch; +/** + * DeleteRepositoryReportsRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class DeleteRepositoryReportsRequest { + public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; + @SerializedName(SERIALIZED_NAME_CONFIG_ID) + private UUID configId; + + public static final String SERIALIZED_NAME_REPOSITORY = "repository"; + @SerializedName(SERIALIZED_NAME_REPOSITORY) + private String repository; + + public static final String SERIALIZED_NAME_BRANCH = "branch"; + @SerializedName(SERIALIZED_NAME_BRANCH) + private String branch; + + public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; + @SerializedName(SERIALIZED_NAME_SETTING_ID) + private Integer settingId; + + public DeleteRepositoryReportsRequest() { + } + + public DeleteRepositoryReportsRequest configId(UUID configId) { + this.configId = configId; + return this; + } + + /** + * The Config's identifier from where the reports should be deleted. + * @return configId + */ + @javax.annotation.Nonnull + public UUID getConfigId() { + return configId; + } + + public void setConfigId(UUID configId) { + this.configId = configId; + } + + + public DeleteRepositoryReportsRequest repository(String repository) { + this.repository = repository; + return this; + } + + /** + * The source control repository which's reports should be deleted. + * @return repository + */ + @javax.annotation.Nonnull + public String getRepository() { + return repository; + } + + public void setRepository(String repository) { + this.repository = repository; + } + + + public DeleteRepositoryReportsRequest branch(String branch) { + this.branch = branch; + return this; + } + + /** + * If it's set, only this branch's reports belonging to the given repository will be deleted. + * @return branch + */ + @javax.annotation.Nullable + public String getBranch() { + return branch; + } + + public void setBranch(String branch) { + this.branch = branch; + } + + + public DeleteRepositoryReportsRequest settingId(Integer settingId) { + this.settingId = settingId; + return this; + } + + /** + * If it's set, only this setting's reports belonging to the given repository will be deleted. + * @return settingId + */ + @javax.annotation.Nullable + public Integer getSettingId() { + return settingId; + } + + public void setSettingId(Integer settingId) { + this.settingId = settingId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the DeleteRepositoryReportsRequest instance itself + */ + public DeleteRepositoryReportsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public void setBranch(String branch) { - this.branch = branch; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - public DeleteRepositoryReportsRequest settingId(Integer settingId) { - this.settingId = settingId; - return this; - } - /** - * If it's set, only this setting's reports belonging to the given repository will be - * deleted. - * - * @return settingId - */ - @javax.annotation.Nullable - public Integer getSettingId() { - return settingId; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public void setSettingId(Integer settingId) { - this.settingId = settingId; + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DeleteRepositoryReportsRequest deleteRepositoryReportsRequest = - (DeleteRepositoryReportsRequest) o; - return Objects.equals(this.configId, deleteRepositoryReportsRequest.configId) - && Objects.equals(this.repository, deleteRepositoryReportsRequest.repository) - && Objects.equals(this.branch, deleteRepositoryReportsRequest.branch) - && Objects.equals(this.settingId, deleteRepositoryReportsRequest.settingId); + DeleteRepositoryReportsRequest deleteRepositoryReportsRequest = (DeleteRepositoryReportsRequest) o; + return Objects.equals(this.configId, deleteRepositoryReportsRequest.configId) && + Objects.equals(this.repository, deleteRepositoryReportsRequest.repository) && + Objects.equals(this.branch, deleteRepositoryReportsRequest.branch) && + Objects.equals(this.settingId, deleteRepositoryReportsRequest.settingId)&& + Objects.equals(this.additionalProperties, deleteRepositoryReportsRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(configId, repository, branch, settingId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeleteRepositoryReportsRequest {\n"); + sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); + sb.append(" repository: ").append(toIndentedString(repository)).append("\n"); + sb.append(" branch: ").append(toIndentedString(branch)).append("\n"); + sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - @Override - public int hashCode() { - return Objects.hash(configId, repository, branch, settingId); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("configId"); + openapiFields.add("repository"); + openapiFields.add("branch"); + openapiFields.add("settingId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("configId"); + openapiRequiredFields.add("repository"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DeleteRepositoryReportsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DeleteRepositoryReportsRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteRepositoryReportsRequest is not found in the empty JSON string", DeleteRepositoryReportsRequest.openapiRequiredFields.toString())); } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class DeleteRepositoryReportsRequest {\n"); - sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); - sb.append(" repository: ").append(toIndentedString(repository)).append("\n"); - sb.append(" branch: ").append(toIndentedString(branch)).append("\n"); - sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("configId"); - openapiFields.add("repository"); - openapiFields.add("branch"); - openapiFields.add("settingId"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("configId"); - openapiRequiredFields.add("repository"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * DeleteRepositoryReportsRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!DeleteRepositoryReportsRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in DeleteRepositoryReportsRequest is not" - + " found in the empty JSON string", - DeleteRepositoryReportsRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!DeleteRepositoryReportsRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `DeleteRepositoryReportsRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : DeleteRepositoryReportsRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DeleteRepositoryReportsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("configId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("configId").toString())); - } - if (!jsonObj.get("repository").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `repository` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("repository").toString())); - } - if ((jsonObj.get("branch") != null && !jsonObj.get("branch").isJsonNull()) - && !jsonObj.get("branch").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `branch` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("branch").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!DeleteRepositoryReportsRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'DeleteRepositoryReportsRequest' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(DeleteRepositoryReportsRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, DeleteRepositoryReportsRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public DeleteRepositoryReportsRequest read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of DeleteRepositoryReportsRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of DeleteRepositoryReportsRequest - * @throws IOException if the JSON string is invalid with respect to - * DeleteRepositoryReportsRequest - */ - public static DeleteRepositoryReportsRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, DeleteRepositoryReportsRequest.class); - } - - /** - * Convert an instance of DeleteRepositoryReportsRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("configId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `configId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("configId").toString())); + } + if (!jsonObj.get("repository").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `repository` to be a primitive type in the JSON string but got `%s`", jsonObj.get("repository").toString())); + } + if ((jsonObj.get("branch") != null && !jsonObj.get("branch").isJsonNull()) && !jsonObj.get("branch").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `branch` to be a primitive type in the JSON string but got `%s`", jsonObj.get("branch").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DeleteRepositoryReportsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DeleteRepositoryReportsRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DeleteRepositoryReportsRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DeleteRepositoryReportsRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public DeleteRepositoryReportsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + DeleteRepositoryReportsRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of DeleteRepositoryReportsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of DeleteRepositoryReportsRequest + * @throws IOException if the JSON string is invalid with respect to DeleteRepositoryReportsRequest + */ + public static DeleteRepositoryReportsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DeleteRepositoryReportsRequest.class); + } + + /** + * Convert an instance of DeleteRepositoryReportsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentAccessModel.java b/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentAccessModel.java index 90f2b93..d0e4d1f 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentAccessModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentAccessModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,415 +10,461 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.EnvironmentAccessType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** EnvironmentAccessModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class EnvironmentAccessModel { - public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) - private UUID environmentId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_COLOR = "color"; - - @SerializedName(SERIALIZED_NAME_COLOR) - private String color; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; - - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) - private Boolean reasonRequired; - - public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESS_TYPE = "environmentAccessType"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESS_TYPE) - private EnvironmentAccessType environmentAccessType; - - public EnvironmentAccessModel() {} - - public EnvironmentAccessModel environmentId(UUID environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Identifier of the Environment. - * - * @return environmentId - */ - @javax.annotation.Nullable - public UUID getEnvironmentId() { - return environmentId; - } - - public void setEnvironmentId(UUID environmentId) { - this.environmentId = environmentId; - } - - public EnvironmentAccessModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Environment. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public EnvironmentAccessModel color(String color) { - this.color = color; - return this; - } - - /** - * Color of the Environment. - * - * @return color - */ - @javax.annotation.Nullable - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public EnvironmentAccessModel description(String description) { - this.description = description; - return this; - } - - /** - * Description of the Environment. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public EnvironmentAccessModel order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Environment represented on the ConfigCat Dashboard. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public EnvironmentAccessModel reasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - return this; - } - - /** - * Determines whether a mandatory reason must be given every time when the Feature Flags or - * Settings in the given Environment are saved. - * - * @return reasonRequired - */ - @javax.annotation.Nullable - public Boolean getReasonRequired() { - return reasonRequired; - } - - public void setReasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - } - - public EnvironmentAccessModel environmentAccessType( - EnvironmentAccessType environmentAccessType) { - this.environmentAccessType = environmentAccessType; - return this; - } - - /** - * Get environmentAccessType - * - * @return environmentAccessType - */ - @javax.annotation.Nullable - public EnvironmentAccessType getEnvironmentAccessType() { - return environmentAccessType; - } - - public void setEnvironmentAccessType(EnvironmentAccessType environmentAccessType) { - this.environmentAccessType = environmentAccessType; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EnvironmentAccessModel environmentAccessModel = (EnvironmentAccessModel) o; - return Objects.equals(this.environmentId, environmentAccessModel.environmentId) - && Objects.equals(this.name, environmentAccessModel.name) - && Objects.equals(this.color, environmentAccessModel.color) - && Objects.equals(this.description, environmentAccessModel.description) - && Objects.equals(this.order, environmentAccessModel.order) - && Objects.equals(this.reasonRequired, environmentAccessModel.reasonRequired) - && Objects.equals( - this.environmentAccessType, environmentAccessModel.environmentAccessType); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - environmentId, - name, - color, - description, - order, - reasonRequired, - environmentAccessType); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EnvironmentAccessModel {\n"); - sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); - sb.append(" environmentAccessType: ") - .append(toIndentedString(environmentAccessType)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("environmentId"); - openapiFields.add("name"); - openapiFields.add("color"); - openapiFields.add("description"); - openapiFields.add("order"); - openapiFields.add("reasonRequired"); - openapiFields.add("environmentAccessType"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to EnvironmentAccessModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!EnvironmentAccessModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in EnvironmentAccessModel is not found" - + " in the empty JSON string", - EnvironmentAccessModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!EnvironmentAccessModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `EnvironmentAccessModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * EnvironmentAccessModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class EnvironmentAccessModel { + public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) + private UUID environmentId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) + private Boolean reasonRequired; + + public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESS_TYPE = "environmentAccessType"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESS_TYPE) + private EnvironmentAccessType environmentAccessType; + + public EnvironmentAccessModel() { + } + + public EnvironmentAccessModel environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Identifier of the Environment. + * @return environmentId + */ + @javax.annotation.Nullable + public UUID getEnvironmentId() { + return environmentId; + } + + public void setEnvironmentId(UUID environmentId) { + this.environmentId = environmentId; + } + + + public EnvironmentAccessModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Environment. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public EnvironmentAccessModel color(String color) { + this.color = color; + return this; + } + + /** + * Color of the Environment. + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + public EnvironmentAccessModel description(String description) { + this.description = description; + return this; + } + + /** + * Description of the Environment. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public EnvironmentAccessModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Environment represented on the ConfigCat Dashboard. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public EnvironmentAccessModel reasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + return this; + } + + /** + * Determines whether a mandatory reason must be given every time when the Feature Flags or Settings in the given Environment are saved. + * @return reasonRequired + */ + @javax.annotation.Nullable + public Boolean getReasonRequired() { + return reasonRequired; + } + + public void setReasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + } + + + public EnvironmentAccessModel environmentAccessType(EnvironmentAccessType environmentAccessType) { + this.environmentAccessType = environmentAccessType; + return this; + } + + /** + * Get environmentAccessType + * @return environmentAccessType + */ + @javax.annotation.Nullable + public EnvironmentAccessType getEnvironmentAccessType() { + return environmentAccessType; + } + + public void setEnvironmentAccessType(EnvironmentAccessType environmentAccessType) { + this.environmentAccessType = environmentAccessType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnvironmentAccessModel instance itself + */ + public EnvironmentAccessModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnvironmentAccessModel environmentAccessModel = (EnvironmentAccessModel) o; + return Objects.equals(this.environmentId, environmentAccessModel.environmentId) && + Objects.equals(this.name, environmentAccessModel.name) && + Objects.equals(this.color, environmentAccessModel.color) && + Objects.equals(this.description, environmentAccessModel.description) && + Objects.equals(this.order, environmentAccessModel.order) && + Objects.equals(this.reasonRequired, environmentAccessModel.reasonRequired) && + Objects.equals(this.environmentAccessType, environmentAccessModel.environmentAccessType)&& + Objects.equals(this.additionalProperties, environmentAccessModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(environmentId, name, color, description, order, reasonRequired, environmentAccessType, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnvironmentAccessModel {\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); + sb.append(" environmentAccessType: ").append(toIndentedString(environmentAccessType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("environmentId"); + openapiFields.add("name"); + openapiFields.add("color"); + openapiFields.add("description"); + openapiFields.add("order"); + openapiFields.add("reasonRequired"); + openapiFields.add("environmentAccessType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnvironmentAccessModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnvironmentAccessModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EnvironmentAccessModel is not found in the empty JSON string", EnvironmentAccessModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) - && !jsonObj.get("environmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("environmentId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) - && !jsonObj.get("color").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `color` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("color").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - // validate the optional field `environmentAccessType` - if (jsonObj.get("environmentAccessType") != null - && !jsonObj.get("environmentAccessType").isJsonNull()) { - EnvironmentAccessType.validateJsonElement(jsonObj.get("environmentAccessType")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EnvironmentAccessModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EnvironmentAccessModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(EnvironmentAccessModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, EnvironmentAccessModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public EnvironmentAccessModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of EnvironmentAccessModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of EnvironmentAccessModel - * @throws IOException if the JSON string is invalid with respect to EnvironmentAccessModel - */ - public static EnvironmentAccessModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EnvironmentAccessModel.class); - } - - /** - * Convert an instance of EnvironmentAccessModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) && !jsonObj.get("environmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environmentId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `environmentAccessType` + if (jsonObj.get("environmentAccessType") != null && !jsonObj.get("environmentAccessType").isJsonNull()) { + EnvironmentAccessType.validateJsonElement(jsonObj.get("environmentAccessType")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnvironmentAccessModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnvironmentAccessModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnvironmentAccessModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnvironmentAccessModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnvironmentAccessModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnvironmentAccessModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnvironmentAccessModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnvironmentAccessModel + * @throws IOException if the JSON string is invalid with respect to EnvironmentAccessModel + */ + public static EnvironmentAccessModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnvironmentAccessModel.class); + } + + /** + * Convert an instance of EnvironmentAccessModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentAccessType.java b/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentAccessType.java index ca32c99..ccd5963 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentAccessType.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentAccessType.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,65 +10,71 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Represent the environment specific Feature Management permission. */ +/** + * Represent the environment specific Feature Management permission. + */ @JsonAdapter(EnvironmentAccessType.Adapter.class) public enum EnvironmentAccessType { - FULL("full"), + + FULL("full"), + + READ_ONLY("readOnly"), + + NONE("none"); - READ_ONLY("readOnly"), + private String value; - NONE("none"); + EnvironmentAccessType(String value) { + this.value = value; + } - private String value; + public String getValue() { + return value; + } - EnvironmentAccessType(String value) { - this.value = value; - } + @Override + public String toString() { + return String.valueOf(value); + } - public String getValue() { - return value; + public static EnvironmentAccessType fromValue(String value) { + for (EnvironmentAccessType b : EnvironmentAccessType.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); + public void write(final JsonWriter jsonWriter, final EnvironmentAccessType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static EnvironmentAccessType fromValue(String value) { - for (EnvironmentAccessType b : EnvironmentAccessType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final EnvironmentAccessType enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public EnvironmentAccessType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return EnvironmentAccessType.fromValue(value); - } + @Override + public EnvironmentAccessType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EnvironmentAccessType.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - EnvironmentAccessType.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EnvironmentAccessType.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentModel.java b/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentModel.java index f4e3f84..99b8d3c 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/EnvironmentModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,404 +10,461 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ProductModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** Details of the Environment. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class EnvironmentModel { - public static final String SERIALIZED_NAME_PRODUCT = "product"; - - @SerializedName(SERIALIZED_NAME_PRODUCT) - private ProductModel product; - - public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) - private UUID environmentId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_COLOR = "color"; - - @SerializedName(SERIALIZED_NAME_COLOR) - private String color; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; - - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) - private Boolean reasonRequired; - - public EnvironmentModel() {} - - public EnvironmentModel product(ProductModel product) { - this.product = product; - return this; - } - - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public ProductModel getProduct() { - return product; - } - - public void setProduct(ProductModel product) { - this.product = product; - } - - public EnvironmentModel environmentId(UUID environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Identifier of the Environment. - * - * @return environmentId - */ - @javax.annotation.Nullable - public UUID getEnvironmentId() { - return environmentId; - } - - public void setEnvironmentId(UUID environmentId) { - this.environmentId = environmentId; - } - - public EnvironmentModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Environment. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public EnvironmentModel color(String color) { - this.color = color; - return this; - } - - /** - * The configured color of the Environment. - * - * @return color - */ - @javax.annotation.Nullable - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - public EnvironmentModel description(String description) { - this.description = description; - return this; - } - - /** - * Description of the Environment. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public EnvironmentModel order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Environment represented on the ConfigCat Dashboard. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public EnvironmentModel reasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - return this; - } - - /** - * Determines whether a mandatory reason must be given every time when the Feature Flags or - * Settings in the given Environment are saved. - * - * @return reasonRequired - */ - @javax.annotation.Nullable - public Boolean getReasonRequired() { - return reasonRequired; - } - - public void setReasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EnvironmentModel environmentModel = (EnvironmentModel) o; - return Objects.equals(this.product, environmentModel.product) - && Objects.equals(this.environmentId, environmentModel.environmentId) - && Objects.equals(this.name, environmentModel.name) - && Objects.equals(this.color, environmentModel.color) - && Objects.equals(this.description, environmentModel.description) - && Objects.equals(this.order, environmentModel.order) - && Objects.equals(this.reasonRequired, environmentModel.reasonRequired); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - product, environmentId, name, color, description, order, reasonRequired); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EnvironmentModel {\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("product"); - openapiFields.add("environmentId"); - openapiFields.add("name"); - openapiFields.add("color"); - openapiFields.add("description"); - openapiFields.add("order"); - openapiFields.add("reasonRequired"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to EnvironmentModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!EnvironmentModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in EnvironmentModel is not found in the" - + " empty JSON string", - EnvironmentModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!EnvironmentModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `EnvironmentModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * Details of the Environment. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class EnvironmentModel { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private ProductModel product; + + public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) + private UUID environmentId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) + private Boolean reasonRequired; + + public EnvironmentModel() { + } + + public EnvironmentModel product(ProductModel product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductModel getProduct() { + return product; + } + + public void setProduct(ProductModel product) { + this.product = product; + } + + + public EnvironmentModel environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Identifier of the Environment. + * @return environmentId + */ + @javax.annotation.Nullable + public UUID getEnvironmentId() { + return environmentId; + } + + public void setEnvironmentId(UUID environmentId) { + this.environmentId = environmentId; + } + + + public EnvironmentModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Environment. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public EnvironmentModel color(String color) { + this.color = color; + return this; + } + + /** + * The configured color of the Environment. + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + public EnvironmentModel description(String description) { + this.description = description; + return this; + } + + /** + * Description of the Environment. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public EnvironmentModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Environment represented on the ConfigCat Dashboard. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public EnvironmentModel reasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + return this; + } + + /** + * Determines whether a mandatory reason must be given every time when the Feature Flags or Settings in the given Environment are saved. + * @return reasonRequired + */ + @javax.annotation.Nullable + public Boolean getReasonRequired() { + return reasonRequired; + } + + public void setReasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the EnvironmentModel instance itself + */ + public EnvironmentModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnvironmentModel environmentModel = (EnvironmentModel) o; + return Objects.equals(this.product, environmentModel.product) && + Objects.equals(this.environmentId, environmentModel.environmentId) && + Objects.equals(this.name, environmentModel.name) && + Objects.equals(this.color, environmentModel.color) && + Objects.equals(this.description, environmentModel.description) && + Objects.equals(this.order, environmentModel.order) && + Objects.equals(this.reasonRequired, environmentModel.reasonRequired)&& + Objects.equals(this.additionalProperties, environmentModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, environmentId, name, color, description, order, reasonRequired, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnvironmentModel {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("environmentId"); + openapiFields.add("name"); + openapiFields.add("color"); + openapiFields.add("description"); + openapiFields.add("order"); + openapiFields.add("reasonRequired"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EnvironmentModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EnvironmentModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EnvironmentModel is not found in the empty JSON string", EnvironmentModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - ProductModel.validateJsonElement(jsonObj.get("product")); - } - if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) - && !jsonObj.get("environmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("environmentId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) - && !jsonObj.get("color").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `color` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("color").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!EnvironmentModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EnvironmentModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(EnvironmentModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, EnvironmentModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public EnvironmentModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of EnvironmentModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of EnvironmentModel - * @throws IOException if the JSON string is invalid with respect to EnvironmentModel - */ - public static EnvironmentModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EnvironmentModel.class); - } - - /** - * Convert an instance of EnvironmentModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductModel.validateJsonElement(jsonObj.get("product")); + } + if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) && !jsonObj.get("environmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environmentId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EnvironmentModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EnvironmentModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EnvironmentModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EnvironmentModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public EnvironmentModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + EnvironmentModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EnvironmentModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of EnvironmentModel + * @throws IOException if the JSON string is invalid with respect to EnvironmentModel + */ + public static EnvironmentModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EnvironmentModel.class); + } + + /** + * Convert an instance of EnvironmentModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/EvaluationVersion.java b/src/main/java/com/configcat/publicapi/java/client/model/EvaluationVersion.java index b02f3c1..856d51d 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/EvaluationVersion.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/EvaluationVersion.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,66 +10,69 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; /** - * Determines the evaluation version of a Config. Using `v2` enables the new features of - * Config V2 (https://configcat.com/docs/advanced/config-v2). + * Determines the evaluation version of a Config. Using `v2` enables the new features of Config V2 (https://configcat.com/docs/advanced/config-v2). */ @JsonAdapter(EvaluationVersion.Adapter.class) public enum EvaluationVersion { - V1("v1"), + + V1("v1"), + + V2("v2"); - V2("v2"); + private String value; - private String value; + EvaluationVersion(String value) { + this.value = value; + } - EvaluationVersion(String value) { - this.value = value; - } + public String getValue() { + return value; + } - public String getValue() { - return value; - } + @Override + public String toString() { + return String.valueOf(value); + } - @Override - public String toString() { - return String.valueOf(value); + public static EvaluationVersion fromValue(String value) { + for (EvaluationVersion b : EvaluationVersion.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static EvaluationVersion fromValue(String value) { - for (EvaluationVersion b : EvaluationVersion.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final EvaluationVersion enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final EvaluationVersion enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public EvaluationVersion read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return EvaluationVersion.fromValue(value); - } + @Override + public EvaluationVersion read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return EvaluationVersion.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - EvaluationVersion.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + EvaluationVersion.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/FeatureFlagLimitations.java b/src/main/java/com/configcat/publicapi/java/client/model/FeatureFlagLimitations.java index c1ee569..e28ba4f 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/FeatureFlagLimitations.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/FeatureFlagLimitations.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,392 +10,431 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** Subscription limitations regarding Feature flag or Setting values and targeting. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class FeatureFlagLimitations { - public static final String SERIALIZED_NAME_MAX_PERCENTAGE_OPTION_COUNT = - "maxPercentageOptionCount"; - - @SerializedName(SERIALIZED_NAME_MAX_PERCENTAGE_OPTION_COUNT) - private Integer maxPercentageOptionCount; - - public static final String SERIALIZED_NAME_MAX_TARGETING_RULE_COUNT = "maxTargetingRuleCount"; - - @SerializedName(SERIALIZED_NAME_MAX_TARGETING_RULE_COUNT) - private Integer maxTargetingRuleCount; - - public static final String SERIALIZED_NAME_MAX_COMPARISON_VALUE_LENGTH = - "maxComparisonValueLength"; - - @SerializedName(SERIALIZED_NAME_MAX_COMPARISON_VALUE_LENGTH) - private Integer maxComparisonValueLength; - - public static final String SERIALIZED_NAME_MAX_COMPARISON_VALUE_LIST_LENGTH = - "maxComparisonValueListLength"; - - @SerializedName(SERIALIZED_NAME_MAX_COMPARISON_VALUE_LIST_LENGTH) - private Integer maxComparisonValueListLength; - - public static final String SERIALIZED_NAME_MAX_COMPARISON_VALUE_LIST_ITEM_LENGTH = - "maxComparisonValueListItemLength"; - - @SerializedName(SERIALIZED_NAME_MAX_COMPARISON_VALUE_LIST_ITEM_LENGTH) - private Integer maxComparisonValueListItemLength; - - public static final String SERIALIZED_NAME_MAX_STRING_FLAG_VALUE_LENGTH = - "maxStringFlagValueLength"; - - @SerializedName(SERIALIZED_NAME_MAX_STRING_FLAG_VALUE_LENGTH) - private Integer maxStringFlagValueLength; - - public static final String SERIALIZED_NAME_MAX_CONDITION_PER_TARGETING_RULE_COUNT = - "maxConditionPerTargetingRuleCount"; - - @SerializedName(SERIALIZED_NAME_MAX_CONDITION_PER_TARGETING_RULE_COUNT) - private Integer maxConditionPerTargetingRuleCount; - - public FeatureFlagLimitations() {} - - public FeatureFlagLimitations maxPercentageOptionCount(Integer maxPercentageOptionCount) { - this.maxPercentageOptionCount = maxPercentageOptionCount; - return this; - } - - /** - * Maximum number of percentage options a Feature Flag or Setting can have within a targeting - * rule. - * - * @return maxPercentageOptionCount - */ - @javax.annotation.Nullable - public Integer getMaxPercentageOptionCount() { - return maxPercentageOptionCount; - } - - public void setMaxPercentageOptionCount(Integer maxPercentageOptionCount) { - this.maxPercentageOptionCount = maxPercentageOptionCount; - } - - public FeatureFlagLimitations maxTargetingRuleCount(Integer maxTargetingRuleCount) { - this.maxTargetingRuleCount = maxTargetingRuleCount; - return this; - } - - /** - * Maximum number of targeting rules a Feature Flag or Setting can have. - * - * @return maxTargetingRuleCount - */ - @javax.annotation.Nullable - public Integer getMaxTargetingRuleCount() { - return maxTargetingRuleCount; - } - - public void setMaxTargetingRuleCount(Integer maxTargetingRuleCount) { - this.maxTargetingRuleCount = maxTargetingRuleCount; - } - - public FeatureFlagLimitations maxComparisonValueLength(Integer maxComparisonValueLength) { - this.maxComparisonValueLength = maxComparisonValueLength; - return this; - } - - /** - * Maximum length of a text comparison value. - * - * @return maxComparisonValueLength - */ - @javax.annotation.Nullable - public Integer getMaxComparisonValueLength() { - return maxComparisonValueLength; - } - - public void setMaxComparisonValueLength(Integer maxComparisonValueLength) { - this.maxComparisonValueLength = maxComparisonValueLength; - } - - public FeatureFlagLimitations maxComparisonValueListLength( - Integer maxComparisonValueListLength) { - this.maxComparisonValueListLength = maxComparisonValueListLength; - return this; - } - - /** - * Maximum item count of a list comparison value. - * - * @return maxComparisonValueListLength - */ - @javax.annotation.Nullable - public Integer getMaxComparisonValueListLength() { - return maxComparisonValueListLength; - } - - public void setMaxComparisonValueListLength(Integer maxComparisonValueListLength) { - this.maxComparisonValueListLength = maxComparisonValueListLength; - } - - public FeatureFlagLimitations maxComparisonValueListItemLength( - Integer maxComparisonValueListItemLength) { - this.maxComparisonValueListItemLength = maxComparisonValueListItemLength; - return this; - } - - /** - * Maximum length of a list comparison value's item. - * - * @return maxComparisonValueListItemLength - */ - @javax.annotation.Nullable - public Integer getMaxComparisonValueListItemLength() { - return maxComparisonValueListItemLength; - } - - public void setMaxComparisonValueListItemLength(Integer maxComparisonValueListItemLength) { - this.maxComparisonValueListItemLength = maxComparisonValueListItemLength; - } - - public FeatureFlagLimitations maxStringFlagValueLength(Integer maxStringFlagValueLength) { - this.maxStringFlagValueLength = maxStringFlagValueLength; - return this; - } - - /** - * Maximum length of a text Setting's value. - * - * @return maxStringFlagValueLength - */ - @javax.annotation.Nullable - public Integer getMaxStringFlagValueLength() { - return maxStringFlagValueLength; - } - - public void setMaxStringFlagValueLength(Integer maxStringFlagValueLength) { - this.maxStringFlagValueLength = maxStringFlagValueLength; - } - - public FeatureFlagLimitations maxConditionPerTargetingRuleCount( - Integer maxConditionPerTargetingRuleCount) { - this.maxConditionPerTargetingRuleCount = maxConditionPerTargetingRuleCount; - return this; - } - - /** - * Maximum number of `AND` conditions a Feature Flag or Setting can have within a - * targeting rule. - * - * @return maxConditionPerTargetingRuleCount - */ - @javax.annotation.Nullable - public Integer getMaxConditionPerTargetingRuleCount() { - return maxConditionPerTargetingRuleCount; - } +import com.configcat.publicapi.java.client.JSON; - public void setMaxConditionPerTargetingRuleCount(Integer maxConditionPerTargetingRuleCount) { - this.maxConditionPerTargetingRuleCount = maxConditionPerTargetingRuleCount; +/** + * Subscription limitations regarding Feature flag or Setting values and targeting. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class FeatureFlagLimitations { + public static final String SERIALIZED_NAME_MAX_PERCENTAGE_OPTION_COUNT = "maxPercentageOptionCount"; + @SerializedName(SERIALIZED_NAME_MAX_PERCENTAGE_OPTION_COUNT) + private Integer maxPercentageOptionCount; + + public static final String SERIALIZED_NAME_MAX_TARGETING_RULE_COUNT = "maxTargetingRuleCount"; + @SerializedName(SERIALIZED_NAME_MAX_TARGETING_RULE_COUNT) + private Integer maxTargetingRuleCount; + + public static final String SERIALIZED_NAME_MAX_COMPARISON_VALUE_LENGTH = "maxComparisonValueLength"; + @SerializedName(SERIALIZED_NAME_MAX_COMPARISON_VALUE_LENGTH) + private Integer maxComparisonValueLength; + + public static final String SERIALIZED_NAME_MAX_COMPARISON_VALUE_LIST_LENGTH = "maxComparisonValueListLength"; + @SerializedName(SERIALIZED_NAME_MAX_COMPARISON_VALUE_LIST_LENGTH) + private Integer maxComparisonValueListLength; + + public static final String SERIALIZED_NAME_MAX_COMPARISON_VALUE_LIST_ITEM_LENGTH = "maxComparisonValueListItemLength"; + @SerializedName(SERIALIZED_NAME_MAX_COMPARISON_VALUE_LIST_ITEM_LENGTH) + private Integer maxComparisonValueListItemLength; + + public static final String SERIALIZED_NAME_MAX_STRING_FLAG_VALUE_LENGTH = "maxStringFlagValueLength"; + @SerializedName(SERIALIZED_NAME_MAX_STRING_FLAG_VALUE_LENGTH) + private Integer maxStringFlagValueLength; + + public static final String SERIALIZED_NAME_MAX_CONDITION_PER_TARGETING_RULE_COUNT = "maxConditionPerTargetingRuleCount"; + @SerializedName(SERIALIZED_NAME_MAX_CONDITION_PER_TARGETING_RULE_COUNT) + private Integer maxConditionPerTargetingRuleCount; + + public FeatureFlagLimitations() { + } + + public FeatureFlagLimitations maxPercentageOptionCount(Integer maxPercentageOptionCount) { + this.maxPercentageOptionCount = maxPercentageOptionCount; + return this; + } + + /** + * Maximum number of percentage options a Feature Flag or Setting can have within a targeting rule. + * @return maxPercentageOptionCount + */ + @javax.annotation.Nullable + public Integer getMaxPercentageOptionCount() { + return maxPercentageOptionCount; + } + + public void setMaxPercentageOptionCount(Integer maxPercentageOptionCount) { + this.maxPercentageOptionCount = maxPercentageOptionCount; + } + + + public FeatureFlagLimitations maxTargetingRuleCount(Integer maxTargetingRuleCount) { + this.maxTargetingRuleCount = maxTargetingRuleCount; + return this; + } + + /** + * Maximum number of targeting rules a Feature Flag or Setting can have. + * @return maxTargetingRuleCount + */ + @javax.annotation.Nullable + public Integer getMaxTargetingRuleCount() { + return maxTargetingRuleCount; + } + + public void setMaxTargetingRuleCount(Integer maxTargetingRuleCount) { + this.maxTargetingRuleCount = maxTargetingRuleCount; + } + + + public FeatureFlagLimitations maxComparisonValueLength(Integer maxComparisonValueLength) { + this.maxComparisonValueLength = maxComparisonValueLength; + return this; + } + + /** + * Maximum length of a text comparison value. + * @return maxComparisonValueLength + */ + @javax.annotation.Nullable + public Integer getMaxComparisonValueLength() { + return maxComparisonValueLength; + } + + public void setMaxComparisonValueLength(Integer maxComparisonValueLength) { + this.maxComparisonValueLength = maxComparisonValueLength; + } + + + public FeatureFlagLimitations maxComparisonValueListLength(Integer maxComparisonValueListLength) { + this.maxComparisonValueListLength = maxComparisonValueListLength; + return this; + } + + /** + * Maximum item count of a list comparison value. + * @return maxComparisonValueListLength + */ + @javax.annotation.Nullable + public Integer getMaxComparisonValueListLength() { + return maxComparisonValueListLength; + } + + public void setMaxComparisonValueListLength(Integer maxComparisonValueListLength) { + this.maxComparisonValueListLength = maxComparisonValueListLength; + } + + + public FeatureFlagLimitations maxComparisonValueListItemLength(Integer maxComparisonValueListItemLength) { + this.maxComparisonValueListItemLength = maxComparisonValueListItemLength; + return this; + } + + /** + * Maximum length of a list comparison value's item. + * @return maxComparisonValueListItemLength + */ + @javax.annotation.Nullable + public Integer getMaxComparisonValueListItemLength() { + return maxComparisonValueListItemLength; + } + + public void setMaxComparisonValueListItemLength(Integer maxComparisonValueListItemLength) { + this.maxComparisonValueListItemLength = maxComparisonValueListItemLength; + } + + + public FeatureFlagLimitations maxStringFlagValueLength(Integer maxStringFlagValueLength) { + this.maxStringFlagValueLength = maxStringFlagValueLength; + return this; + } + + /** + * Maximum length of a text Setting's value. + * @return maxStringFlagValueLength + */ + @javax.annotation.Nullable + public Integer getMaxStringFlagValueLength() { + return maxStringFlagValueLength; + } + + public void setMaxStringFlagValueLength(Integer maxStringFlagValueLength) { + this.maxStringFlagValueLength = maxStringFlagValueLength; + } + + + public FeatureFlagLimitations maxConditionPerTargetingRuleCount(Integer maxConditionPerTargetingRuleCount) { + this.maxConditionPerTargetingRuleCount = maxConditionPerTargetingRuleCount; + return this; + } + + /** + * Maximum number of `AND` conditions a Feature Flag or Setting can have within a targeting rule. + * @return maxConditionPerTargetingRuleCount + */ + @javax.annotation.Nullable + public Integer getMaxConditionPerTargetingRuleCount() { + return maxConditionPerTargetingRuleCount; + } + + public void setMaxConditionPerTargetingRuleCount(Integer maxConditionPerTargetingRuleCount) { + this.maxConditionPerTargetingRuleCount = maxConditionPerTargetingRuleCount; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FeatureFlagLimitations instance itself + */ + public FeatureFlagLimitations putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FeatureFlagLimitations featureFlagLimitations = (FeatureFlagLimitations) o; - return Objects.equals( - this.maxPercentageOptionCount, - featureFlagLimitations.maxPercentageOptionCount) - && Objects.equals( - this.maxTargetingRuleCount, featureFlagLimitations.maxTargetingRuleCount) - && Objects.equals( - this.maxComparisonValueLength, - featureFlagLimitations.maxComparisonValueLength) - && Objects.equals( - this.maxComparisonValueListLength, - featureFlagLimitations.maxComparisonValueListLength) - && Objects.equals( - this.maxComparisonValueListItemLength, - featureFlagLimitations.maxComparisonValueListItemLength) - && Objects.equals( - this.maxStringFlagValueLength, - featureFlagLimitations.maxStringFlagValueLength) - && Objects.equals( - this.maxConditionPerTargetingRuleCount, - featureFlagLimitations.maxConditionPerTargetingRuleCount); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash( - maxPercentageOptionCount, - maxTargetingRuleCount, - maxComparisonValueLength, - maxComparisonValueListLength, - maxComparisonValueListItemLength, - maxStringFlagValueLength, - maxConditionPerTargetingRuleCount); - } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FeatureFlagLimitations {\n"); - sb.append(" maxPercentageOptionCount: ") - .append(toIndentedString(maxPercentageOptionCount)) - .append("\n"); - sb.append(" maxTargetingRuleCount: ") - .append(toIndentedString(maxTargetingRuleCount)) - .append("\n"); - sb.append(" maxComparisonValueLength: ") - .append(toIndentedString(maxComparisonValueLength)) - .append("\n"); - sb.append(" maxComparisonValueListLength: ") - .append(toIndentedString(maxComparisonValueListLength)) - .append("\n"); - sb.append(" maxComparisonValueListItemLength: ") - .append(toIndentedString(maxComparisonValueListItemLength)) - .append("\n"); - sb.append(" maxStringFlagValueLength: ") - .append(toIndentedString(maxStringFlagValueLength)) - .append("\n"); - sb.append(" maxConditionPerTargetingRuleCount: ") - .append(toIndentedString(maxConditionPerTargetingRuleCount)) - .append("\n"); - sb.append("}"); - return sb.toString(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("maxPercentageOptionCount"); - openapiFields.add("maxTargetingRuleCount"); - openapiFields.add("maxComparisonValueLength"); - openapiFields.add("maxComparisonValueListLength"); - openapiFields.add("maxComparisonValueListItemLength"); - openapiFields.add("maxStringFlagValueLength"); - openapiFields.add("maxConditionPerTargetingRuleCount"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + FeatureFlagLimitations featureFlagLimitations = (FeatureFlagLimitations) o; + return Objects.equals(this.maxPercentageOptionCount, featureFlagLimitations.maxPercentageOptionCount) && + Objects.equals(this.maxTargetingRuleCount, featureFlagLimitations.maxTargetingRuleCount) && + Objects.equals(this.maxComparisonValueLength, featureFlagLimitations.maxComparisonValueLength) && + Objects.equals(this.maxComparisonValueListLength, featureFlagLimitations.maxComparisonValueListLength) && + Objects.equals(this.maxComparisonValueListItemLength, featureFlagLimitations.maxComparisonValueListItemLength) && + Objects.equals(this.maxStringFlagValueLength, featureFlagLimitations.maxStringFlagValueLength) && + Objects.equals(this.maxConditionPerTargetingRuleCount, featureFlagLimitations.maxConditionPerTargetingRuleCount)&& + Objects.equals(this.additionalProperties, featureFlagLimitations.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(maxPercentageOptionCount, maxTargetingRuleCount, maxComparisonValueLength, maxComparisonValueListLength, maxComparisonValueListItemLength, maxStringFlagValueLength, maxConditionPerTargetingRuleCount, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureFlagLimitations {\n"); + sb.append(" maxPercentageOptionCount: ").append(toIndentedString(maxPercentageOptionCount)).append("\n"); + sb.append(" maxTargetingRuleCount: ").append(toIndentedString(maxTargetingRuleCount)).append("\n"); + sb.append(" maxComparisonValueLength: ").append(toIndentedString(maxComparisonValueLength)).append("\n"); + sb.append(" maxComparisonValueListLength: ").append(toIndentedString(maxComparisonValueListLength)).append("\n"); + sb.append(" maxComparisonValueListItemLength: ").append(toIndentedString(maxComparisonValueListItemLength)).append("\n"); + sb.append(" maxStringFlagValueLength: ").append(toIndentedString(maxStringFlagValueLength)).append("\n"); + sb.append(" maxConditionPerTargetingRuleCount: ").append(toIndentedString(maxConditionPerTargetingRuleCount)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to FeatureFlagLimitations - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FeatureFlagLimitations.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in FeatureFlagLimitations is not found" - + " in the empty JSON string", - FeatureFlagLimitations.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FeatureFlagLimitations.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `FeatureFlagLimitations` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("maxPercentageOptionCount"); + openapiFields.add("maxTargetingRuleCount"); + openapiFields.add("maxComparisonValueLength"); + openapiFields.add("maxComparisonValueListLength"); + openapiFields.add("maxComparisonValueListItemLength"); + openapiFields.add("maxStringFlagValueLength"); + openapiFields.add("maxConditionPerTargetingRuleCount"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeatureFlagLimitations + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeatureFlagLimitations.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeatureFlagLimitations is not found in the empty JSON string", FeatureFlagLimitations.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FeatureFlagLimitations.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FeatureFlagLimitations' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(FeatureFlagLimitations.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, FeatureFlagLimitations value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public FeatureFlagLimitations read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of FeatureFlagLimitations given an JSON string - * - * @param jsonString JSON string - * @return An instance of FeatureFlagLimitations - * @throws IOException if the JSON string is invalid with respect to FeatureFlagLimitations - */ - public static FeatureFlagLimitations fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FeatureFlagLimitations.class); - } - - /** - * Convert an instance of FeatureFlagLimitations to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeatureFlagLimitations.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeatureFlagLimitations' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeatureFlagLimitations.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeatureFlagLimitations value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FeatureFlagLimitations read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FeatureFlagLimitations instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of FeatureFlagLimitations given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeatureFlagLimitations + * @throws IOException if the JSON string is invalid with respect to FeatureFlagLimitations + */ + public static FeatureFlagLimitations fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeatureFlagLimitations.class); + } + + /** + * Convert an instance of FeatureFlagLimitations to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/FlagReference.java b/src/main/java/com/configcat/publicapi/java/client/model/FlagReference.java index 5f9f741..71c946e 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/FlagReference.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/FlagReference.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,249 +10,331 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ReferenceLines; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** FlagReference */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * FlagReference + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class FlagReference { - public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; + public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; + @SerializedName(SERIALIZED_NAME_SETTING_ID) + private Integer settingId; - @SerializedName(SERIALIZED_NAME_SETTING_ID) - private Integer settingId; + public static final String SERIALIZED_NAME_REFERENCES = "references"; + @SerializedName(SERIALIZED_NAME_REFERENCES) + private List references = new ArrayList<>(); - public static final String SERIALIZED_NAME_REFERENCES = "references"; + public FlagReference() { + } - @SerializedName(SERIALIZED_NAME_REFERENCES) - private List references = new ArrayList<>(); + public FlagReference settingId(Integer settingId) { + this.settingId = settingId; + return this; + } - public FlagReference() {} + /** + * The identifier of the Feature Flag or Setting the code reference belongs to. + * @return settingId + */ + @javax.annotation.Nonnull + public Integer getSettingId() { + return settingId; + } - public FlagReference settingId(Integer settingId) { - this.settingId = settingId; - return this; - } + public void setSettingId(Integer settingId) { + this.settingId = settingId; + } - /** - * The identifier of the Feature Flag or Setting the code reference belongs to. - * - * @return settingId - */ - @javax.annotation.Nonnull - public Integer getSettingId() { - return settingId; - } - public void setSettingId(Integer settingId) { - this.settingId = settingId; - } + public FlagReference references(List references) { + this.references = references; + return this; + } - public FlagReference references(List references) { - this.references = references; - return this; + public FlagReference addReferencesItem(ReferenceLines referencesItem) { + if (this.references == null) { + this.references = new ArrayList<>(); } + this.references.add(referencesItem); + return this; + } - public FlagReference addReferencesItem(ReferenceLines referencesItem) { - if (this.references == null) { - this.references = new ArrayList<>(); - } - this.references.add(referencesItem); - return this; - } + /** + * The actual references to the given Feature Flag or Setting. + * @return references + */ + @javax.annotation.Nonnull + public List getReferences() { + return references; + } - /** - * The actual references to the given Feature Flag or Setting. - * - * @return references - */ - @javax.annotation.Nonnull - public List getReferences() { - return references; - } + public void setReferences(List references) { + this.references = references; + } - public void setReferences(List references) { - this.references = references; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - FlagReference flagReference = (FlagReference) o; - return Objects.equals(this.settingId, flagReference.settingId) - && Objects.equals(this.references, flagReference.references); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the FlagReference instance itself + */ + public FlagReference putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(settingId, references); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class FlagReference {\n"); - sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); - sb.append(" references: ").append(toIndentedString(references)).append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + FlagReference flagReference = (FlagReference) o; + return Objects.equals(this.settingId, flagReference.settingId) && + Objects.equals(this.references, flagReference.references)&& + Objects.equals(this.additionalProperties, flagReference.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(settingId, references, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("settingId"); - openapiFields.add("references"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FlagReference {\n"); + sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); + sb.append(" references: ").append(toIndentedString(references)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("settingId"); - openapiRequiredFields.add("references"); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to FlagReference - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!FlagReference.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in FlagReference is not found in the" - + " empty JSON string", - FlagReference.openapiRequiredFields.toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!FlagReference.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `FlagReference` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("settingId"); + openapiFields.add("references"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("settingId"); + openapiRequiredFields.add("references"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FlagReference + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FlagReference.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FlagReference is not found in the empty JSON string", FlagReference.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : FlagReference.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FlagReference.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // ensure the json data is an array - if (!jsonObj.get("references").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `references` to be an array in the JSON string but" - + " got `%s`", - jsonObj.get("references").toString())); - } + // ensure the json data is an array + if (!jsonObj.get("references").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `references` to be an array in the JSON string but got `%s`", jsonObj.get("references").toString())); + } - JsonArray jsonArrayreferences = jsonObj.getAsJsonArray("references"); - // validate the required field `references` (array) - for (int i = 0; i < jsonArrayreferences.size(); i++) { - ReferenceLines.validateJsonElement(jsonArrayreferences.get(i)); - } - ; - } + JsonArray jsonArrayreferences = jsonObj.getAsJsonArray("references"); + // validate the required field `references` (array) + for (int i = 0; i < jsonArrayreferences.size(); i++) { + ReferenceLines.validateJsonElement(jsonArrayreferences.get(i)); + }; + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!FlagReference.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'FlagReference' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(FlagReference.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, FlagReference value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public FlagReference read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FlagReference.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FlagReference' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FlagReference.class)); - /** - * Create an instance of FlagReference given an JSON string - * - * @param jsonString JSON string - * @return An instance of FlagReference - * @throws IOException if the JSON string is invalid with respect to FlagReference - */ - public static FlagReference fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, FlagReference.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FlagReference value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public FlagReference read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + FlagReference instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of FlagReference to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of FlagReference given an JSON string + * + * @param jsonString JSON string + * @return An instance of FlagReference + * @throws IOException if the JSON string is invalid with respect to FlagReference + */ + public static FlagReference fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FlagReference.class); + } + + /** + * Convert an instance of FlagReference to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/InitialValue.java b/src/main/java/com/configcat/publicapi/java/client/model/InitialValue.java index 2ec5610..b11af2a 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/InitialValue.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/InitialValue.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,238 +10,317 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; -/** InitialValue */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * InitialValue + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class InitialValue { - public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) + private UUID environmentId; - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) - private UUID environmentId; + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; - public static final String SERIALIZED_NAME_VALUE = "value"; + public InitialValue() { + } - @SerializedName(SERIALIZED_NAME_VALUE) - private Object value = null; + public InitialValue environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } - public InitialValue() {} + /** + * The ID of the Environment where the initial value must be set. + * @return environmentId + */ + @javax.annotation.Nullable + public UUID getEnvironmentId() { + return environmentId; + } - public InitialValue environmentId(UUID environmentId) { - this.environmentId = environmentId; - return this; - } + public void setEnvironmentId(UUID environmentId) { + this.environmentId = environmentId; + } - /** - * The ID of the Environment where the initial value must be set. - * - * @return environmentId - */ - @javax.annotation.Nullable - public UUID getEnvironmentId() { - return environmentId; - } - public void setEnvironmentId(UUID environmentId) { - this.environmentId = environmentId; - } + public InitialValue value(Object value) { + this.value = value; + return this; + } - public InitialValue value(Object value) { - this.value = value; - return this; - } + /** + * The initial value in the given Environment. It must respect the setting type. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } - /** - * The initial value in the given Environment. It must respect the setting type. - * - * @return value - */ - @javax.annotation.Nullable - public Object getValue() { - return value; - } + public void setValue(Object value) { + this.value = value; + } - public void setValue(Object value) { - this.value = value; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InitialValue initialValue = (InitialValue) o; - return Objects.equals(this.environmentId, initialValue.environmentId) - && Objects.equals(this.value, initialValue.value); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InitialValue instance itself + */ + public InitialValue putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(environmentId, value); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + InitialValue initialValue = (InitialValue) o; + return Objects.equals(this.environmentId, initialValue.environmentId) && + Objects.equals(this.value, initialValue.value)&& + Objects.equals(this.additionalProperties, initialValue.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InitialValue {\n"); - sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(environmentId, value, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InitialValue {\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("environmentId"); - openapiFields.add("value"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("environmentId"); + openapiFields.add("value"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to InitialValue - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!InitialValue.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in InitialValue is not found in the" - + " empty JSON string", - InitialValue.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!InitialValue.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `InitialValue` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InitialValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InitialValue.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InitialValue is not found in the empty JSON string", InitialValue.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) - && !jsonObj.get("environmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("environmentId").toString())); - } - } + if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) && !jsonObj.get("environmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environmentId").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!InitialValue.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'InitialValue' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(InitialValue.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, InitialValue value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public InitialValue read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InitialValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InitialValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InitialValue.class)); - /** - * Create an instance of InitialValue given an JSON string - * - * @param jsonString JSON string - * @return An instance of InitialValue - * @throws IOException if the JSON string is invalid with respect to InitialValue - */ - public static InitialValue fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, InitialValue.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InitialValue value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public InitialValue read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InitialValue instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of InitialValue to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of InitialValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of InitialValue + * @throws IOException if the JSON string is invalid with respect to InitialValue + */ + public static InitialValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InitialValue.class); + } + + /** + * Convert an instance of InitialValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkDetail.java b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkDetail.java index 4d6865e..6deca96 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkDetail.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkDetail.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,362 +10,440 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ConfigModel; +import com.configcat.publicapi.java.client.model.EnvironmentModel; +import com.configcat.publicapi.java.client.model.ProductModel; +import com.configcat.publicapi.java.client.model.SettingDataModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** IntegrationLinkDetail */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class IntegrationLinkDetail { - public static final String SERIALIZED_NAME_PRODUCT = "product"; - - @SerializedName(SERIALIZED_NAME_PRODUCT) - private ProductModel product; - - public static final String SERIALIZED_NAME_CONFIG = "config"; - - @SerializedName(SERIALIZED_NAME_CONFIG) - private ConfigModel config; - - public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT) - private EnvironmentModel environment; - - public static final String SERIALIZED_NAME_SETTING = "setting"; - - @SerializedName(SERIALIZED_NAME_SETTING) - private SettingDataModel setting; - - public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; - - @SerializedName(SERIALIZED_NAME_READ_ONLY) - private Boolean readOnly; - - public static final String SERIALIZED_NAME_STATUS = "status"; - - @SerializedName(SERIALIZED_NAME_STATUS) - private String status; - - public IntegrationLinkDetail() {} - - public IntegrationLinkDetail product(ProductModel product) { - this.product = product; - return this; - } - - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public ProductModel getProduct() { - return product; - } - - public void setProduct(ProductModel product) { - this.product = product; - } - - public IntegrationLinkDetail config(ConfigModel config) { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config - */ - @javax.annotation.Nullable - public ConfigModel getConfig() { - return config; - } - - public void setConfig(ConfigModel config) { - this.config = config; - } - - public IntegrationLinkDetail environment(EnvironmentModel environment) { - this.environment = environment; - return this; - } - - /** - * Get environment - * - * @return environment - */ - @javax.annotation.Nullable - public EnvironmentModel getEnvironment() { - return environment; - } - - public void setEnvironment(EnvironmentModel environment) { - this.environment = environment; - } - public IntegrationLinkDetail setting(SettingDataModel setting) { - this.setting = setting; - return this; - } +import com.configcat.publicapi.java.client.JSON; - /** - * Get setting - * - * @return setting - */ - @javax.annotation.Nullable - public SettingDataModel getSetting() { - return setting; +/** + * IntegrationLinkDetail + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class IntegrationLinkDetail { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private ProductModel product; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + @SerializedName(SERIALIZED_NAME_CONFIG) + private ConfigModel config; + + public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT) + private EnvironmentModel environment; + + public static final String SERIALIZED_NAME_SETTING = "setting"; + @SerializedName(SERIALIZED_NAME_SETTING) + private SettingDataModel setting; + + public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; + @SerializedName(SERIALIZED_NAME_READ_ONLY) + private Boolean readOnly; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + + public IntegrationLinkDetail() { + } + + public IntegrationLinkDetail product(ProductModel product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductModel getProduct() { + return product; + } + + public void setProduct(ProductModel product) { + this.product = product; + } + + + public IntegrationLinkDetail config(ConfigModel config) { + this.config = config; + return this; + } + + /** + * Get config + * @return config + */ + @javax.annotation.Nullable + public ConfigModel getConfig() { + return config; + } + + public void setConfig(ConfigModel config) { + this.config = config; + } + + + public IntegrationLinkDetail environment(EnvironmentModel environment) { + this.environment = environment; + return this; + } + + /** + * Get environment + * @return environment + */ + @javax.annotation.Nullable + public EnvironmentModel getEnvironment() { + return environment; + } + + public void setEnvironment(EnvironmentModel environment) { + this.environment = environment; + } + + + public IntegrationLinkDetail setting(SettingDataModel setting) { + this.setting = setting; + return this; + } + + /** + * Get setting + * @return setting + */ + @javax.annotation.Nullable + public SettingDataModel getSetting() { + return setting; + } + + public void setSetting(SettingDataModel setting) { + this.setting = setting; + } + + + public IntegrationLinkDetail readOnly(Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + /** + * Get readOnly + * @return readOnly + */ + @javax.annotation.Nullable + public Boolean getReadOnly() { + return readOnly; + } + + public void setReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + } + + + public IntegrationLinkDetail status(String status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IntegrationLinkDetail instance itself + */ + public IntegrationLinkDetail putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public void setSetting(SettingDataModel setting) { - this.setting = setting; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - public IntegrationLinkDetail readOnly(Boolean readOnly) { - this.readOnly = readOnly; - return this; - } - /** - * Get readOnly - * - * @return readOnly - */ - @javax.annotation.Nullable - public Boolean getReadOnly() { - return readOnly; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public void setReadOnly(Boolean readOnly) { - this.readOnly = readOnly; + if (o == null || getClass() != o.getClass()) { + return false; } - - public IntegrationLinkDetail status(String status) { - this.status = status; - return this; - } - - /** - * Get status - * - * @return status - */ - @javax.annotation.Nullable - public String getStatus() { - return status; + IntegrationLinkDetail integrationLinkDetail = (IntegrationLinkDetail) o; + return Objects.equals(this.product, integrationLinkDetail.product) && + Objects.equals(this.config, integrationLinkDetail.config) && + Objects.equals(this.environment, integrationLinkDetail.environment) && + Objects.equals(this.setting, integrationLinkDetail.setting) && + Objects.equals(this.readOnly, integrationLinkDetail.readOnly) && + Objects.equals(this.status, integrationLinkDetail.status)&& + Objects.equals(this.additionalProperties, integrationLinkDetail.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, config, environment, setting, readOnly, status, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public void setStatus(String status) { - this.status = status; + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationLinkDetail {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); + sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IntegrationLinkDetail integrationLinkDetail = (IntegrationLinkDetail) o; - return Objects.equals(this.product, integrationLinkDetail.product) - && Objects.equals(this.config, integrationLinkDetail.config) - && Objects.equals(this.environment, integrationLinkDetail.environment) - && Objects.equals(this.setting, integrationLinkDetail.setting) - && Objects.equals(this.readOnly, integrationLinkDetail.readOnly) - && Objects.equals(this.status, integrationLinkDetail.status); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(product, config, environment, setting, readOnly, status); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IntegrationLinkDetail {\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); - sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); - sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("product"); - openapiFields.add("config"); - openapiFields.add("environment"); - openapiFields.add("setting"); - openapiFields.add("readOnly"); - openapiFields.add("status"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to IntegrationLinkDetail - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!IntegrationLinkDetail.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in IntegrationLinkDetail is not found in" - + " the empty JSON string", - IntegrationLinkDetail.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IntegrationLinkDetail.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `IntegrationLinkDetail` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("config"); + openapiFields.add("environment"); + openapiFields.add("setting"); + openapiFields.add("readOnly"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegrationLinkDetail + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegrationLinkDetail.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IntegrationLinkDetail is not found in the empty JSON string", IntegrationLinkDetail.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - ProductModel.validateJsonElement(jsonObj.get("product")); - } - // validate the optional field `config` - if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { - ConfigModel.validateJsonElement(jsonObj.get("config")); - } - // validate the optional field `environment` - if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { - EnvironmentModel.validateJsonElement(jsonObj.get("environment")); - } - // validate the optional field `setting` - if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { - SettingDataModel.validateJsonElement(jsonObj.get("setting")); - } - if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) - && !jsonObj.get("status").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `status` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("status").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!IntegrationLinkDetail.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'IntegrationLinkDetail' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(IntegrationLinkDetail.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, IntegrationLinkDetail value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public IntegrationLinkDetail read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of IntegrationLinkDetail given an JSON string - * - * @param jsonString JSON string - * @return An instance of IntegrationLinkDetail - * @throws IOException if the JSON string is invalid with respect to IntegrationLinkDetail - */ - public static IntegrationLinkDetail fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, IntegrationLinkDetail.class); - } - - /** - * Convert an instance of IntegrationLinkDetail to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductModel.validateJsonElement(jsonObj.get("product")); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ConfigModel.validateJsonElement(jsonObj.get("config")); + } + // validate the optional field `environment` + if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { + EnvironmentModel.validateJsonElement(jsonObj.get("environment")); + } + // validate the optional field `setting` + if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { + SettingDataModel.validateJsonElement(jsonObj.get("setting")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegrationLinkDetail.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegrationLinkDetail' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntegrationLinkDetail.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegrationLinkDetail value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public IntegrationLinkDetail read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IntegrationLinkDetail instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of IntegrationLinkDetail given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegrationLinkDetail + * @throws IOException if the JSON string is invalid with respect to IntegrationLinkDetail + */ + public static IntegrationLinkDetail fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegrationLinkDetail.class); + } + + /** + * Convert an instance of IntegrationLinkDetail to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkDetailsModel.java b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkDetailsModel.java index ea64a03..6f5d2fa 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkDetailsModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkDetailsModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,254 +10,329 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.IntegrationLinkDetail; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** IntegrationLinkDetailsModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * IntegrationLinkDetailsModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class IntegrationLinkDetailsModel { - public static final String SERIALIZED_NAME_DETAILS = "details"; + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + private List details; - @SerializedName(SERIALIZED_NAME_DETAILS) - private List details; + public static final String SERIALIZED_NAME_ALL_INTEGRATION_LINK_COUNT = "allIntegrationLinkCount"; + @SerializedName(SERIALIZED_NAME_ALL_INTEGRATION_LINK_COUNT) + private Integer allIntegrationLinkCount; - public static final String SERIALIZED_NAME_ALL_INTEGRATION_LINK_COUNT = - "allIntegrationLinkCount"; + public IntegrationLinkDetailsModel() { + } - @SerializedName(SERIALIZED_NAME_ALL_INTEGRATION_LINK_COUNT) - private Integer allIntegrationLinkCount; + public IntegrationLinkDetailsModel( + List details + ) { + this(); + this.details = details; + } - public IntegrationLinkDetailsModel() {} + /** + * Get details + * @return details + */ + @javax.annotation.Nullable + public List getDetails() { + return details; + } - public IntegrationLinkDetailsModel(List details) { - this(); - this.details = details; - } - /** - * Get details - * - * @return details - */ - @javax.annotation.Nullable - public List getDetails() { - return details; - } - public IntegrationLinkDetailsModel allIntegrationLinkCount(Integer allIntegrationLinkCount) { - this.allIntegrationLinkCount = allIntegrationLinkCount; - return this; - } + public IntegrationLinkDetailsModel allIntegrationLinkCount(Integer allIntegrationLinkCount) { + this.allIntegrationLinkCount = allIntegrationLinkCount; + return this; + } - /** - * Get allIntegrationLinkCount - * - * @return allIntegrationLinkCount - */ - @javax.annotation.Nullable - public Integer getAllIntegrationLinkCount() { - return allIntegrationLinkCount; - } + /** + * Get allIntegrationLinkCount + * @return allIntegrationLinkCount + */ + @javax.annotation.Nullable + public Integer getAllIntegrationLinkCount() { + return allIntegrationLinkCount; + } - public void setAllIntegrationLinkCount(Integer allIntegrationLinkCount) { - this.allIntegrationLinkCount = allIntegrationLinkCount; - } + public void setAllIntegrationLinkCount(Integer allIntegrationLinkCount) { + this.allIntegrationLinkCount = allIntegrationLinkCount; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IntegrationLinkDetailsModel integrationLinkDetailsModel = (IntegrationLinkDetailsModel) o; - return Objects.equals(this.details, integrationLinkDetailsModel.details) - && Objects.equals( - this.allIntegrationLinkCount, - integrationLinkDetailsModel.allIntegrationLinkCount); - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IntegrationLinkDetailsModel instance itself + */ + public IntegrationLinkDetailsModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(details, allIntegrationLinkCount); + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + IntegrationLinkDetailsModel integrationLinkDetailsModel = (IntegrationLinkDetailsModel) o; + return Objects.equals(this.details, integrationLinkDetailsModel.details) && + Objects.equals(this.allIntegrationLinkCount, integrationLinkDetailsModel.allIntegrationLinkCount)&& + Objects.equals(this.additionalProperties, integrationLinkDetailsModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IntegrationLinkDetailsModel {\n"); - sb.append(" details: ").append(toIndentedString(details)).append("\n"); - sb.append(" allIntegrationLinkCount: ") - .append(toIndentedString(allIntegrationLinkCount)) - .append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(details, allIntegrationLinkCount, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationLinkDetailsModel {\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" allIntegrationLinkCount: ").append(toIndentedString(allIntegrationLinkCount)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("details"); - openapiFields.add("allIntegrationLinkCount"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("details"); + openapiFields.add("allIntegrationLinkCount"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * IntegrationLinkDetailsModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!IntegrationLinkDetailsModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in IntegrationLinkDetailsModel is not" - + " found in the empty JSON string", - IntegrationLinkDetailsModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IntegrationLinkDetailsModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `IntegrationLinkDetailsModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegrationLinkDetailsModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegrationLinkDetailsModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IntegrationLinkDetailsModel is not found in the empty JSON string", IntegrationLinkDetailsModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) { - JsonArray jsonArraydetails = jsonObj.getAsJsonArray("details"); - if (jsonArraydetails != null) { - // ensure the json data is an array - if (!jsonObj.get("details").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `details` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("details").toString())); - } - - // validate the optional field `details` (array) - for (int i = 0; i < jsonArraydetails.size(); i++) { - IntegrationLinkDetail.validateJsonElement(jsonArraydetails.get(i)); - } - ; - } - } - } + if (jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull()) { + JsonArray jsonArraydetails = jsonObj.getAsJsonArray("details"); + if (jsonArraydetails != null) { + // ensure the json data is an array + if (!jsonObj.get("details").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be an array in the JSON string but got `%s`", jsonObj.get("details").toString())); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!IntegrationLinkDetailsModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'IntegrationLinkDetailsModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(IntegrationLinkDetailsModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, IntegrationLinkDetailsModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public IntegrationLinkDetailsModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); + // validate the optional field `details` (array) + for (int i = 0; i < jsonArraydetails.size(); i++) { + IntegrationLinkDetail.validateJsonElement(jsonArraydetails.get(i)); + }; } - } + } + } - /** - * Create an instance of IntegrationLinkDetailsModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of IntegrationLinkDetailsModel - * @throws IOException if the JSON string is invalid with respect to IntegrationLinkDetailsModel - */ - public static IntegrationLinkDetailsModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, IntegrationLinkDetailsModel.class); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegrationLinkDetailsModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegrationLinkDetailsModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntegrationLinkDetailsModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegrationLinkDetailsModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public IntegrationLinkDetailsModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IntegrationLinkDetailsModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of IntegrationLinkDetailsModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of IntegrationLinkDetailsModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegrationLinkDetailsModel + * @throws IOException if the JSON string is invalid with respect to IntegrationLinkDetailsModel + */ + public static IntegrationLinkDetailsModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegrationLinkDetailsModel.class); + } + + /** + * Convert an instance of IntegrationLinkDetailsModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkModel.java b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkModel.java index 5b4021c..acd8456 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,316 +10,379 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.IntegrationLinkType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** IntegrationLinkModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class IntegrationLinkModel { - public static final String SERIALIZED_NAME_KEY = "key"; - - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_INTEGRATION_LINK_TYPE = "integrationLinkType"; - - @SerializedName(SERIALIZED_NAME_INTEGRATION_LINK_TYPE) - private IntegrationLinkType integrationLinkType; - - public static final String SERIALIZED_NAME_URL = "url"; - - @SerializedName(SERIALIZED_NAME_URL) - private String url; - - public IntegrationLinkModel() {} - - public IntegrationLinkModel key(String key) { - this.key = key; - return this; - } - - /** - * Get key - * - * @return key - */ - @javax.annotation.Nullable - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public IntegrationLinkModel description(String description) { - this.description = description; - return this; - } - - /** - * Get description - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public IntegrationLinkModel integrationLinkType(IntegrationLinkType integrationLinkType) { - this.integrationLinkType = integrationLinkType; - return this; - } - - /** - * Get integrationLinkType - * - * @return integrationLinkType - */ - @javax.annotation.Nullable - public IntegrationLinkType getIntegrationLinkType() { - return integrationLinkType; - } +import com.configcat.publicapi.java.client.JSON; - public void setIntegrationLinkType(IntegrationLinkType integrationLinkType) { - this.integrationLinkType = integrationLinkType; +/** + * IntegrationLinkModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class IntegrationLinkModel { + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_INTEGRATION_LINK_TYPE = "integrationLinkType"; + @SerializedName(SERIALIZED_NAME_INTEGRATION_LINK_TYPE) + private IntegrationLinkType integrationLinkType; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public IntegrationLinkModel() { + } + + public IntegrationLinkModel key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + + public IntegrationLinkModel description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public IntegrationLinkModel integrationLinkType(IntegrationLinkType integrationLinkType) { + this.integrationLinkType = integrationLinkType; + return this; + } + + /** + * Get integrationLinkType + * @return integrationLinkType + */ + @javax.annotation.Nullable + public IntegrationLinkType getIntegrationLinkType() { + return integrationLinkType; + } + + public void setIntegrationLinkType(IntegrationLinkType integrationLinkType) { + this.integrationLinkType = integrationLinkType; + } + + + public IntegrationLinkModel url(String url) { + this.url = url; + return this; + } + + /** + * Get url + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IntegrationLinkModel instance itself + */ + public IntegrationLinkModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public IntegrationLinkModel url(String url) { - this.url = url; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Get url - * - * @return url - */ - @javax.annotation.Nullable - public String getUrl() { - return url; - } - public void setUrl(String url) { - this.url = url; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IntegrationLinkModel integrationLinkModel = (IntegrationLinkModel) o; - return Objects.equals(this.key, integrationLinkModel.key) - && Objects.equals(this.description, integrationLinkModel.description) - && Objects.equals( - this.integrationLinkType, integrationLinkModel.integrationLinkType) - && Objects.equals(this.url, integrationLinkModel.url); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + IntegrationLinkModel integrationLinkModel = (IntegrationLinkModel) o; + return Objects.equals(this.key, integrationLinkModel.key) && + Objects.equals(this.description, integrationLinkModel.description) && + Objects.equals(this.integrationLinkType, integrationLinkModel.integrationLinkType) && + Objects.equals(this.url, integrationLinkModel.url)&& + Objects.equals(this.additionalProperties, integrationLinkModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(key, description, integrationLinkType, url, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(key, description, integrationLinkType, url); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IntegrationLinkModel {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" integrationLinkType: ") - .append(toIndentedString(integrationLinkType)) - .append("\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append("}"); - return sb.toString(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationLinkModel {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" integrationLinkType: ").append(toIndentedString(integrationLinkType)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("key"); - openapiFields.add("description"); - openapiFields.add("integrationLinkType"); - openapiFields.add("url"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to IntegrationLinkModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!IntegrationLinkModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in IntegrationLinkModel is not found in" - + " the empty JSON string", - IntegrationLinkModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IntegrationLinkModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `IntegrationLinkModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("description"); + openapiFields.add("integrationLinkType"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegrationLinkModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegrationLinkModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IntegrationLinkModel is not found in the empty JSON string", IntegrationLinkModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) - && !jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `key` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("key").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - // validate the optional field `integrationLinkType` - if (jsonObj.get("integrationLinkType") != null - && !jsonObj.get("integrationLinkType").isJsonNull()) { - IntegrationLinkType.validateJsonElement(jsonObj.get("integrationLinkType")); - } - if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) - && !jsonObj.get("url").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `url` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("url").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!IntegrationLinkModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'IntegrationLinkModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(IntegrationLinkModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, IntegrationLinkModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public IntegrationLinkModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of IntegrationLinkModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of IntegrationLinkModel - * @throws IOException if the JSON string is invalid with respect to IntegrationLinkModel - */ - public static IntegrationLinkModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, IntegrationLinkModel.class); - } - - /** - * Convert an instance of IntegrationLinkModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // validate the optional field `integrationLinkType` + if (jsonObj.get("integrationLinkType") != null && !jsonObj.get("integrationLinkType").isJsonNull()) { + IntegrationLinkType.validateJsonElement(jsonObj.get("integrationLinkType")); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegrationLinkModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegrationLinkModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntegrationLinkModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegrationLinkModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public IntegrationLinkModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IntegrationLinkModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of IntegrationLinkModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegrationLinkModel + * @throws IOException if the JSON string is invalid with respect to IntegrationLinkModel + */ + public static IntegrationLinkModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegrationLinkModel.class); + } + + /** + * Convert an instance of IntegrationLinkModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkType.java b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkType.java index 87a451c..e7ab224 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkType.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationLinkType.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,65 +10,71 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Gets or Sets IntegrationLinkType */ +/** + * Gets or Sets IntegrationLinkType + */ @JsonAdapter(IntegrationLinkType.Adapter.class) public enum IntegrationLinkType { - TRELLO("trello"), + + TRELLO("trello"), + + JIRA("jira"), + + MONDAY("monday"); - JIRA("jira"), + private String value; - MONDAY("monday"); + IntegrationLinkType(String value) { + this.value = value; + } - private String value; + public String getValue() { + return value; + } - IntegrationLinkType(String value) { - this.value = value; - } + @Override + public String toString() { + return String.valueOf(value); + } - public String getValue() { - return value; + public static IntegrationLinkType fromValue(String value) { + for (IntegrationLinkType b : IntegrationLinkType.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); + public void write(final JsonWriter jsonWriter, final IntegrationLinkType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static IntegrationLinkType fromValue(String value) { - for (IntegrationLinkType b : IntegrationLinkType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final IntegrationLinkType enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public IntegrationLinkType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return IntegrationLinkType.fromValue(value); - } + @Override + public IntegrationLinkType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return IntegrationLinkType.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - IntegrationLinkType.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + IntegrationLinkType.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationModel.java b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationModel.java index 3817b34..0e6abed 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,447 +10,496 @@ * Do not edit the class manually. */ -package com.configcat.publicapi.java.client.model; +package com.configcat.publicapi.java.client.model; -import com.configcat.publicapi.java.client.JSON; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.IntegrationType; +import com.configcat.publicapi.java.client.model.ProductModel; import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; -import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Set; import java.util.UUID; import org.openapitools.jackson.nullable.JsonNullable; -/** Details of the Integration. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class IntegrationModel { - public static final String SERIALIZED_NAME_PRODUCT = "product"; - - @SerializedName(SERIALIZED_NAME_PRODUCT) - private ProductModel product; - - public static final String SERIALIZED_NAME_INTEGRATION_ID = "integrationId"; - - @SerializedName(SERIALIZED_NAME_INTEGRATION_ID) - private UUID integrationId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_INTEGRATION_TYPE = "integrationType"; - - @SerializedName(SERIALIZED_NAME_INTEGRATION_TYPE) - private IntegrationType integrationType; - - public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; - - @SerializedName(SERIALIZED_NAME_PARAMETERS) - private Map parameters; - - public static final String SERIALIZED_NAME_ENVIRONMENT_IDS = "environmentIds"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_IDS) - private List environmentIds; - - public static final String SERIALIZED_NAME_CONFIG_IDS = "configIds"; - - @SerializedName(SERIALIZED_NAME_CONFIG_IDS) - private List configIds; - - public IntegrationModel() {} - - public IntegrationModel product(ProductModel product) { - this.product = product; - return this; - } - - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public ProductModel getProduct() { - return product; - } - - public void setProduct(ProductModel product) { - this.product = product; - } - - public IntegrationModel integrationId(UUID integrationId) { - this.integrationId = integrationId; - return this; - } - - /** - * Identifier of the Integration. - * - * @return integrationId - */ - @javax.annotation.Nullable - public UUID getIntegrationId() { - return integrationId; - } - - public void setIntegrationId(UUID integrationId) { - this.integrationId = integrationId; - } - - public IntegrationModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Integration. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public IntegrationModel integrationType(IntegrationType integrationType) { - this.integrationType = integrationType; - return this; - } - - /** - * Get integrationType - * - * @return integrationType - */ - @javax.annotation.Nullable - public IntegrationType getIntegrationType() { - return integrationType; - } - - public void setIntegrationType(IntegrationType integrationType) { - this.integrationType = integrationType; - } - - public IntegrationModel parameters(Map parameters) { - this.parameters = parameters; - return this; - } - - public IntegrationModel putParametersItem(String key, String parametersItem) { - if (this.parameters == null) { - this.parameters = new HashMap<>(); - } - this.parameters.put(key, parametersItem); - return this; - } - - /** - * Parameters of the Integration. - * - * @return parameters - */ - @javax.annotation.Nullable - public Map getParameters() { - return parameters; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } - - public IntegrationModel environmentIds(List environmentIds) { - this.environmentIds = environmentIds; - return this; - } - - public IntegrationModel addEnvironmentIdsItem(UUID environmentIdsItem) { - if (this.environmentIds == null) { - this.environmentIds = new ArrayList<>(); - } - this.environmentIds.add(environmentIdsItem); - return this; - } - - /** - * List of Environment IDs that are connected with this Integration. If the list is empty, all - * of the Environments are connected. - * - * @return environmentIds - */ - @javax.annotation.Nullable - public List getEnvironmentIds() { - return environmentIds; - } - - public void setEnvironmentIds(List environmentIds) { - this.environmentIds = environmentIds; - } - - public IntegrationModel configIds(List configIds) { - this.configIds = configIds; - return this; - } - - public IntegrationModel addConfigIdsItem(UUID configIdsItem) { - if (this.configIds == null) { - this.configIds = new ArrayList<>(); - } - this.configIds.add(configIdsItem); - return this; - } - - /** - * List of Config IDs that are connected with this Integration. If the list is empty, all of the - * Configs are connected. - * - * @return configIds - */ - @javax.annotation.Nullable - public List getConfigIds() { - return configIds; - } - - public void setConfigIds(List configIds) { - this.configIds = configIds; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IntegrationModel integrationModel = (IntegrationModel) o; - return Objects.equals(this.product, integrationModel.product) - && Objects.equals(this.integrationId, integrationModel.integrationId) - && Objects.equals(this.name, integrationModel.name) - && Objects.equals(this.integrationType, integrationModel.integrationType) - && Objects.equals(this.parameters, integrationModel.parameters) - && Objects.equals(this.environmentIds, integrationModel.environmentIds) - && Objects.equals(this.configIds, integrationModel.configIds); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - product, - integrationId, - name, - integrationType, - parameters, - environmentIds, - configIds); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IntegrationModel {\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" environmentIds: ").append(toIndentedString(environmentIds)).append("\n"); - sb.append(" configIds: ").append(toIndentedString(configIds)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("product"); - openapiFields.add("integrationId"); - openapiFields.add("name"); - openapiFields.add("integrationType"); - openapiFields.add("parameters"); - openapiFields.add("environmentIds"); - openapiFields.add("configIds"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to IntegrationModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!IntegrationModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in IntegrationModel is not found in the" - + " empty JSON string", - IntegrationModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IntegrationModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `IntegrationModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * Details of the Integration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class IntegrationModel { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private ProductModel product; + + public static final String SERIALIZED_NAME_INTEGRATION_ID = "integrationId"; + @SerializedName(SERIALIZED_NAME_INTEGRATION_ID) + private UUID integrationId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_INTEGRATION_TYPE = "integrationType"; + @SerializedName(SERIALIZED_NAME_INTEGRATION_TYPE) + private IntegrationType integrationType; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + private Map parameters; + + public static final String SERIALIZED_NAME_ENVIRONMENT_IDS = "environmentIds"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_IDS) + private List environmentIds; + + public static final String SERIALIZED_NAME_CONFIG_IDS = "configIds"; + @SerializedName(SERIALIZED_NAME_CONFIG_IDS) + private List configIds; + + public IntegrationModel() { + } + + public IntegrationModel product(ProductModel product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductModel getProduct() { + return product; + } + + public void setProduct(ProductModel product) { + this.product = product; + } + + + public IntegrationModel integrationId(UUID integrationId) { + this.integrationId = integrationId; + return this; + } + + /** + * Identifier of the Integration. + * @return integrationId + */ + @javax.annotation.Nullable + public UUID getIntegrationId() { + return integrationId; + } + + public void setIntegrationId(UUID integrationId) { + this.integrationId = integrationId; + } + + + public IntegrationModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Integration. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public IntegrationModel integrationType(IntegrationType integrationType) { + this.integrationType = integrationType; + return this; + } + + /** + * Get integrationType + * @return integrationType + */ + @javax.annotation.Nullable + public IntegrationType getIntegrationType() { + return integrationType; + } + + public void setIntegrationType(IntegrationType integrationType) { + this.integrationType = integrationType; + } + + + public IntegrationModel parameters(Map parameters) { + this.parameters = parameters; + return this; + } + + public IntegrationModel putParametersItem(String key, String parametersItem) { + if (this.parameters == null) { + this.parameters = new HashMap<>(); + } + this.parameters.put(key, parametersItem); + return this; + } + + /** + * Parameters of the Integration. + * @return parameters + */ + @javax.annotation.Nullable + public Map getParameters() { + return parameters; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + + public IntegrationModel environmentIds(List environmentIds) { + this.environmentIds = environmentIds; + return this; + } + + public IntegrationModel addEnvironmentIdsItem(UUID environmentIdsItem) { + if (this.environmentIds == null) { + this.environmentIds = new ArrayList<>(); + } + this.environmentIds.add(environmentIdsItem); + return this; + } + + /** + * List of Environment IDs that are connected with this Integration. If the list is empty, all of the Environments are connected. + * @return environmentIds + */ + @javax.annotation.Nullable + public List getEnvironmentIds() { + return environmentIds; + } + + public void setEnvironmentIds(List environmentIds) { + this.environmentIds = environmentIds; + } + + + public IntegrationModel configIds(List configIds) { + this.configIds = configIds; + return this; + } + + public IntegrationModel addConfigIdsItem(UUID configIdsItem) { + if (this.configIds == null) { + this.configIds = new ArrayList<>(); + } + this.configIds.add(configIdsItem); + return this; + } + + /** + * List of Config IDs that are connected with this Integration. If the list is empty, all of the Configs are connected. + * @return configIds + */ + @javax.annotation.Nullable + public List getConfigIds() { + return configIds; + } + + public void setConfigIds(List configIds) { + this.configIds = configIds; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IntegrationModel instance itself + */ + public IntegrationModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IntegrationModel integrationModel = (IntegrationModel) o; + return Objects.equals(this.product, integrationModel.product) && + Objects.equals(this.integrationId, integrationModel.integrationId) && + Objects.equals(this.name, integrationModel.name) && + Objects.equals(this.integrationType, integrationModel.integrationType) && + Objects.equals(this.parameters, integrationModel.parameters) && + Objects.equals(this.environmentIds, integrationModel.environmentIds) && + Objects.equals(this.configIds, integrationModel.configIds)&& + Objects.equals(this.additionalProperties, integrationModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, integrationId, name, integrationType, parameters, environmentIds, configIds, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationModel {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" integrationId: ").append(toIndentedString(integrationId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" integrationType: ").append(toIndentedString(integrationType)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" environmentIds: ").append(toIndentedString(environmentIds)).append("\n"); + sb.append(" configIds: ").append(toIndentedString(configIds)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("integrationId"); + openapiFields.add("name"); + openapiFields.add("integrationType"); + openapiFields.add("parameters"); + openapiFields.add("environmentIds"); + openapiFields.add("configIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegrationModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegrationModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IntegrationModel is not found in the empty JSON string", IntegrationModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - ProductModel.validateJsonElement(jsonObj.get("product")); - } - if ((jsonObj.get("integrationId") != null && !jsonObj.get("integrationId").isJsonNull()) - && !jsonObj.get("integrationId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `integrationId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("integrationId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - // validate the optional field `integrationType` - if (jsonObj.get("integrationType") != null - && !jsonObj.get("integrationType").isJsonNull()) { - IntegrationType.validateJsonElement(jsonObj.get("integrationType")); - } - // ensure the optional json data is an array if present - if (jsonObj.get("environmentIds") != null - && !jsonObj.get("environmentIds").isJsonNull() - && !jsonObj.get("environmentIds").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentIds` to be an array in the JSON string" - + " but got `%s`", - jsonObj.get("environmentIds").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("configIds") != null - && !jsonObj.get("configIds").isJsonNull() - && !jsonObj.get("configIds").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configIds` to be an array in the JSON string but" - + " got `%s`", - jsonObj.get("configIds").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!IntegrationModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'IntegrationModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(IntegrationModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, IntegrationModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public IntegrationModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of IntegrationModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of IntegrationModel - * @throws IOException if the JSON string is invalid with respect to IntegrationModel - */ - public static IntegrationModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, IntegrationModel.class); - } - - /** - * Convert an instance of IntegrationModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductModel.validateJsonElement(jsonObj.get("product")); + } + if ((jsonObj.get("integrationId") != null && !jsonObj.get("integrationId").isJsonNull()) && !jsonObj.get("integrationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `integrationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("integrationId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `integrationType` + if (jsonObj.get("integrationType") != null && !jsonObj.get("integrationType").isJsonNull()) { + IntegrationType.validateJsonElement(jsonObj.get("integrationType")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("environmentIds") != null && !jsonObj.get("environmentIds").isJsonNull() && !jsonObj.get("environmentIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentIds` to be an array in the JSON string but got `%s`", jsonObj.get("environmentIds").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("configIds") != null && !jsonObj.get("configIds").isJsonNull() && !jsonObj.get("configIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `configIds` to be an array in the JSON string but got `%s`", jsonObj.get("configIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegrationModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegrationModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntegrationModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegrationModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public IntegrationModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IntegrationModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of IntegrationModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegrationModel + * @throws IOException if the JSON string is invalid with respect to IntegrationModel + */ + public static IntegrationModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegrationModel.class); + } + + /** + * Convert an instance of IntegrationModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationType.java b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationType.java index 3d5ba5e..c4a6e09 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationType.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationType.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,71 +10,77 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Gets or Sets IntegrationType */ +/** + * Gets or Sets IntegrationType + */ @JsonAdapter(IntegrationType.Adapter.class) public enum IntegrationType { - DATA_DOG("dataDog"), - - SLACK("slack"), - - AMPLITUDE("amplitude"), - - MIX_PANEL("mixPanel"), - - SEGMENT("segment"), - - PUB_NUB("pubNub"); - - private String value; - - IntegrationType(String value) { - this.value = value; - } - - public String getValue() { - return value; + + DATA_DOG("dataDog"), + + SLACK("slack"), + + AMPLITUDE("amplitude"), + + MIX_PANEL("mixPanel"), + + SEGMENT("segment"), + + PUB_NUB("pubNub"); + + private String value; + + IntegrationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static IntegrationType fromValue(String value) { + for (IntegrationType b : IntegrationType.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); - } - - public static IntegrationType fromValue(String value) { - for (IntegrationType b : IntegrationType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public void write(final JsonWriter jsonWriter, final IntegrationType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final IntegrationType enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public IntegrationType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return IntegrationType.fromValue(value); - } + @Override + public IntegrationType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return IntegrationType.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - IntegrationType.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + IntegrationType.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationsModel.java b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationsModel.java index 578bb5d..ef1d164 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/IntegrationsModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/IntegrationsModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,233 +10,312 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.IntegrationModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** IntegrationsModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * IntegrationsModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class IntegrationsModel { - public static final String SERIALIZED_NAME_INTEGRATIONS = "integrations"; + public static final String SERIALIZED_NAME_INTEGRATIONS = "integrations"; + @SerializedName(SERIALIZED_NAME_INTEGRATIONS) + private List integrations; - @SerializedName(SERIALIZED_NAME_INTEGRATIONS) - private List integrations; + public IntegrationsModel() { + } - public IntegrationsModel() {} + public IntegrationsModel integrations(List integrations) { + this.integrations = integrations; + return this; + } - public IntegrationsModel integrations(List integrations) { - this.integrations = integrations; - return this; + public IntegrationsModel addIntegrationsItem(IntegrationModel integrationsItem) { + if (this.integrations == null) { + this.integrations = new ArrayList<>(); } + this.integrations.add(integrationsItem); + return this; + } - public IntegrationsModel addIntegrationsItem(IntegrationModel integrationsItem) { - if (this.integrations == null) { - this.integrations = new ArrayList<>(); - } - this.integrations.add(integrationsItem); - return this; - } + /** + * The Integrations of the Product. + * @return integrations + */ + @javax.annotation.Nullable + public List getIntegrations() { + return integrations; + } - /** - * The Integrations of the Product. - * - * @return integrations - */ - @javax.annotation.Nullable - public List getIntegrations() { - return integrations; - } + public void setIntegrations(List integrations) { + this.integrations = integrations; + } - public void setIntegrations(List integrations) { - this.integrations = integrations; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - IntegrationsModel integrationsModel = (IntegrationsModel) o; - return Objects.equals(this.integrations, integrationsModel.integrations); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the IntegrationsModel instance itself + */ + public IntegrationsModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(integrations); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + IntegrationsModel integrationsModel = (IntegrationsModel) o; + return Objects.equals(this.integrations, integrationsModel.integrations)&& + Objects.equals(this.additionalProperties, integrationsModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class IntegrationsModel {\n"); - sb.append(" integrations: ").append(toIndentedString(integrations)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(integrations, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IntegrationsModel {\n"); + sb.append(" integrations: ").append(toIndentedString(integrations)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("integrations"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("integrations"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to IntegrationsModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!IntegrationsModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in IntegrationsModel is not found in the" - + " empty JSON string", - IntegrationsModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!IntegrationsModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `IntegrationsModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to IntegrationsModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!IntegrationsModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in IntegrationsModel is not found in the empty JSON string", IntegrationsModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("integrations") != null && !jsonObj.get("integrations").isJsonNull()) { - JsonArray jsonArrayintegrations = jsonObj.getAsJsonArray("integrations"); - if (jsonArrayintegrations != null) { - // ensure the json data is an array - if (!jsonObj.get("integrations").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `integrations` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("integrations").toString())); - } - - // validate the optional field `integrations` (array) - for (int i = 0; i < jsonArrayintegrations.size(); i++) { - IntegrationModel.validateJsonElement(jsonArrayintegrations.get(i)); - } - ; - } - } - } + if (jsonObj.get("integrations") != null && !jsonObj.get("integrations").isJsonNull()) { + JsonArray jsonArrayintegrations = jsonObj.getAsJsonArray("integrations"); + if (jsonArrayintegrations != null) { + // ensure the json data is an array + if (!jsonObj.get("integrations").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `integrations` to be an array in the JSON string but got `%s`", jsonObj.get("integrations").toString())); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!IntegrationsModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'IntegrationsModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(IntegrationsModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, IntegrationsModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public IntegrationsModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); + // validate the optional field `integrations` (array) + for (int i = 0; i < jsonArrayintegrations.size(); i++) { + IntegrationModel.validateJsonElement(jsonArrayintegrations.get(i)); + }; } - } + } + } - /** - * Create an instance of IntegrationsModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of IntegrationsModel - * @throws IOException if the JSON string is invalid with respect to IntegrationsModel - */ - public static IntegrationsModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, IntegrationsModel.class); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!IntegrationsModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'IntegrationsModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(IntegrationsModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, IntegrationsModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public IntegrationsModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + IntegrationsModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of IntegrationsModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of IntegrationsModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of IntegrationsModel + * @throws IOException if the JSON string is invalid with respect to IntegrationsModel + */ + public static IntegrationsModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, IntegrationsModel.class); + } + + /** + * Convert an instance of IntegrationsModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/InvitationModel.java b/src/main/java/com/configcat/publicapi/java/client/model/InvitationModel.java index cf7684b..1f30b3d 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/InvitationModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/InvitationModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,331 +10,399 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** InvitationModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class InvitationModel { - public static final String SERIALIZED_NAME_INVITATION_ID = "invitationId"; - - @SerializedName(SERIALIZED_NAME_INVITATION_ID) - private UUID invitationId; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; - - public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; - - @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) - private Long permissionGroupId; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private OffsetDateTime createdAt; - - public static final String SERIALIZED_NAME_EXPIRED = "expired"; - - @SerializedName(SERIALIZED_NAME_EXPIRED) - private Boolean expired; - - public InvitationModel() {} - - public InvitationModel invitationId(UUID invitationId) { - this.invitationId = invitationId; - return this; - } - - /** - * The identifier of the Invitation. - * - * @return invitationId - */ - @javax.annotation.Nullable - public UUID getInvitationId() { - return invitationId; - } - - public void setInvitationId(UUID invitationId) { - this.invitationId = invitationId; - } - - public InvitationModel email(String email) { - this.email = email; - return this; - } - - /** - * The invited user's email address. - * - * @return email - */ - @javax.annotation.Nullable - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public InvitationModel permissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - return this; - } - /** - * The identifier of the Permission Group the user was invited to. - * - * @return permissionGroupId - */ - @javax.annotation.Nullable - public Long getPermissionGroupId() { - return permissionGroupId; - } - - public void setPermissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - } - - public InvitationModel createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Creation time of the Invitation. - * - * @return createdAt - */ - @javax.annotation.Nullable - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public InvitationModel expired(Boolean expired) { - this.expired = expired; - return this; - } - - /** - * Determines whether the Invitation is expired. - * - * @return expired - */ - @javax.annotation.Nullable - public Boolean getExpired() { - return expired; - } - - public void setExpired(Boolean expired) { - this.expired = expired; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InvitationModel invitationModel = (InvitationModel) o; - return Objects.equals(this.invitationId, invitationModel.invitationId) - && Objects.equals(this.email, invitationModel.email) - && Objects.equals(this.permissionGroupId, invitationModel.permissionGroupId) - && Objects.equals(this.createdAt, invitationModel.createdAt) - && Objects.equals(this.expired, invitationModel.expired); +/** + * InvitationModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class InvitationModel { + public static final String SERIALIZED_NAME_INVITATION_ID = "invitationId"; + @SerializedName(SERIALIZED_NAME_INVITATION_ID) + private UUID invitationId; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; + @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) + private Long permissionGroupId; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_EXPIRED = "expired"; + @SerializedName(SERIALIZED_NAME_EXPIRED) + private Boolean expired; + + public InvitationModel() { + } + + public InvitationModel invitationId(UUID invitationId) { + this.invitationId = invitationId; + return this; + } + + /** + * The identifier of the Invitation. + * @return invitationId + */ + @javax.annotation.Nullable + public UUID getInvitationId() { + return invitationId; + } + + public void setInvitationId(UUID invitationId) { + this.invitationId = invitationId; + } + + + public InvitationModel email(String email) { + this.email = email; + return this; + } + + /** + * The invited user's email address. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + public InvitationModel permissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + return this; + } + + /** + * The identifier of the Permission Group the user was invited to. + * @return permissionGroupId + */ + @javax.annotation.Nullable + public Long getPermissionGroupId() { + return permissionGroupId; + } + + public void setPermissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + } + + + public InvitationModel createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation time of the Invitation. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public InvitationModel expired(Boolean expired) { + this.expired = expired; + return this; + } + + /** + * Determines whether the Invitation is expired. + * @return expired + */ + @javax.annotation.Nullable + public Boolean getExpired() { + return expired; + } + + public void setExpired(Boolean expired) { + this.expired = expired; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InvitationModel instance itself + */ + public InvitationModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(invitationId, email, permissionGroupId, createdAt, expired); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InvitationModel {\n"); - sb.append(" invitationId: ").append(toIndentedString(invitationId)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" permissionGroupId: ") - .append(toIndentedString(permissionGroupId)) - .append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" expired: ").append(toIndentedString(expired)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + InvitationModel invitationModel = (InvitationModel) o; + return Objects.equals(this.invitationId, invitationModel.invitationId) && + Objects.equals(this.email, invitationModel.email) && + Objects.equals(this.permissionGroupId, invitationModel.permissionGroupId) && + Objects.equals(this.createdAt, invitationModel.createdAt) && + Objects.equals(this.expired, invitationModel.expired)&& + Objects.equals(this.additionalProperties, invitationModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(invitationId, email, permissionGroupId, createdAt, expired, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("invitationId"); - openapiFields.add("email"); - openapiFields.add("permissionGroupId"); - openapiFields.add("createdAt"); - openapiFields.add("expired"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InvitationModel {\n"); + sb.append(" invitationId: ").append(toIndentedString(invitationId)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" permissionGroupId: ").append(toIndentedString(permissionGroupId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" expired: ").append(toIndentedString(expired)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to InvitationModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!InvitationModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in InvitationModel is not found in the" - + " empty JSON string", - InvitationModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!InvitationModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `InvitationModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("invitationId"); + openapiFields.add("email"); + openapiFields.add("permissionGroupId"); + openapiFields.add("createdAt"); + openapiFields.add("expired"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InvitationModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InvitationModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InvitationModel is not found in the empty JSON string", InvitationModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("invitationId") != null && !jsonObj.get("invitationId").isJsonNull()) - && !jsonObj.get("invitationId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `invitationId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("invitationId").toString())); - } - if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) - && !jsonObj.get("email").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `email` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("email").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!InvitationModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'InvitationModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(InvitationModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, InvitationModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public InvitationModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of InvitationModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of InvitationModel - * @throws IOException if the JSON string is invalid with respect to InvitationModel - */ - public static InvitationModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, InvitationModel.class); - } - - /** - * Convert an instance of InvitationModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("invitationId") != null && !jsonObj.get("invitationId").isJsonNull()) && !jsonObj.get("invitationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `invitationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invitationId").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InvitationModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InvitationModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InvitationModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InvitationModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public InvitationModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InvitationModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of InvitationModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of InvitationModel + * @throws IOException if the JSON string is invalid with respect to InvitationModel + */ + public static InvitationModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InvitationModel.class); + } + + /** + * Convert an instance of InvitationModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/InviteMembersRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/InviteMembersRequest.java index 4e325da..f2529c0 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/InviteMembersRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/InviteMembersRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,248 +10,326 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** InviteMembersRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class InviteMembersRequest { - public static final String SERIALIZED_NAME_EMAILS = "emails"; +import com.configcat.publicapi.java.client.JSON; - @SerializedName(SERIALIZED_NAME_EMAILS) - private List emails = new ArrayList<>(); +/** + * InviteMembersRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class InviteMembersRequest { + public static final String SERIALIZED_NAME_EMAILS = "emails"; + @SerializedName(SERIALIZED_NAME_EMAILS) + private List emails = new ArrayList<>(); - public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; + public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; + @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) + private Long permissionGroupId; - @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) - private Long permissionGroupId; + public InviteMembersRequest() { + } - public InviteMembersRequest() {} + public InviteMembersRequest emails(List emails) { + this.emails = emails; + return this; + } - public InviteMembersRequest emails(List emails) { - this.emails = emails; - return this; + public InviteMembersRequest addEmailsItem(String emailsItem) { + if (this.emails == null) { + this.emails = new ArrayList<>(); } + this.emails.add(emailsItem); + return this; + } - public InviteMembersRequest addEmailsItem(String emailsItem) { - if (this.emails == null) { - this.emails = new ArrayList<>(); - } - this.emails.add(emailsItem); - return this; - } + /** + * List of email addresses to invite. + * @return emails + */ + @javax.annotation.Nonnull + public List getEmails() { + return emails; + } - /** - * List of email addresses to invite. - * - * @return emails - */ - @javax.annotation.Nonnull - public List getEmails() { - return emails; - } + public void setEmails(List emails) { + this.emails = emails; + } - public void setEmails(List emails) { - this.emails = emails; - } - public InviteMembersRequest permissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - return this; - } + public InviteMembersRequest permissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + return this; + } - /** - * Identifier of the Permission Group to where the invited users should be added. - * - * @return permissionGroupId - */ - @javax.annotation.Nonnull - public Long getPermissionGroupId() { - return permissionGroupId; - } + /** + * Identifier of the Permission Group to where the invited users should be added. + * @return permissionGroupId + */ + @javax.annotation.Nonnull + public Long getPermissionGroupId() { + return permissionGroupId; + } - public void setPermissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - } + public void setPermissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - InviteMembersRequest inviteMembersRequest = (InviteMembersRequest) o; - return Objects.equals(this.emails, inviteMembersRequest.emails) - && Objects.equals(this.permissionGroupId, inviteMembersRequest.permissionGroupId); - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public int hashCode() { - return Objects.hash(emails, permissionGroupId); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the InviteMembersRequest instance itself + */ + public InviteMembersRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class InviteMembersRequest {\n"); - sb.append(" emails: ").append(toIndentedString(emails)).append("\n"); - sb.append(" permissionGroupId: ") - .append(toIndentedString(permissionGroupId)) - .append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + InviteMembersRequest inviteMembersRequest = (InviteMembersRequest) o; + return Objects.equals(this.emails, inviteMembersRequest.emails) && + Objects.equals(this.permissionGroupId, inviteMembersRequest.permissionGroupId)&& + Objects.equals(this.additionalProperties, inviteMembersRequest.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(emails, permissionGroupId, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("emails"); - openapiFields.add("permissionGroupId"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class InviteMembersRequest {\n"); + sb.append(" emails: ").append(toIndentedString(emails)).append("\n"); + sb.append(" permissionGroupId: ").append(toIndentedString(permissionGroupId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("emails"); - openapiRequiredFields.add("permissionGroupId"); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to InviteMembersRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!InviteMembersRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in InviteMembersRequest is not found in" - + " the empty JSON string", - InviteMembersRequest.openapiRequiredFields.toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!InviteMembersRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `InviteMembersRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("emails"); + openapiFields.add("permissionGroupId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("emails"); + openapiRequiredFields.add("permissionGroupId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to InviteMembersRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!InviteMembersRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in InviteMembersRequest is not found in the empty JSON string", InviteMembersRequest.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : InviteMembersRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : InviteMembersRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // ensure the required json array is present - if (jsonObj.get("emails") == null) { - throw new IllegalArgumentException( - "Expected the field `linkedContent` to be an array in the JSON string but got" - + " `null`"); - } else if (!jsonObj.get("emails").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `emails` to be an array in the JSON string but got" - + " `%s`", - jsonObj.get("emails").toString())); - } - } + // ensure the required json array is present + if (jsonObj.get("emails") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("emails").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `emails` to be an array in the JSON string but got `%s`", jsonObj.get("emails").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!InviteMembersRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'InviteMembersRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(InviteMembersRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, InviteMembersRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public InviteMembersRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!InviteMembersRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'InviteMembersRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(InviteMembersRequest.class)); - /** - * Create an instance of InviteMembersRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of InviteMembersRequest - * @throws IOException if the JSON string is invalid with respect to InviteMembersRequest - */ - public static InviteMembersRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, InviteMembersRequest.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, InviteMembersRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public InviteMembersRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + InviteMembersRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of InviteMembersRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of InviteMembersRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of InviteMembersRequest + * @throws IOException if the JSON string is invalid with respect to InviteMembersRequest + */ + public static InviteMembersRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, InviteMembersRequest.class); + } + + /** + * Convert an instance of InviteMembersRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/JsonPatchOperation.java b/src/main/java/com/configcat/publicapi/java/client/model/JsonPatchOperation.java index 357fb37..3b6cbc1 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/JsonPatchOperation.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/JsonPatchOperation.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,313 +10,383 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.OperationType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** JsonPatchOperation */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class JsonPatchOperation { - public static final String SERIALIZED_NAME_OP = "op"; - - @SerializedName(SERIALIZED_NAME_OP) - private OperationType op; - public static final String SERIALIZED_NAME_PATH = "path"; - - @SerializedName(SERIALIZED_NAME_PATH) - private String path; - - public static final String SERIALIZED_NAME_FROM = "from"; - - @SerializedName(SERIALIZED_NAME_FROM) - private String from; - - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) - private Object value = null; - - public JsonPatchOperation() {} - - public JsonPatchOperation op(OperationType op) { - this.op = op; - return this; - } - - /** - * Get op - * - * @return op - */ - @javax.annotation.Nonnull - public OperationType getOp() { - return op; - } - - public void setOp(OperationType op) { - this.op = op; - } - - public JsonPatchOperation path(String path) { - this.path = path; - return this; - } - - /** - * The source path. - * - * @return path - */ - @javax.annotation.Nonnull - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public JsonPatchOperation from(String from) { - this.from = from; - return this; - } - - /** - * The target path. - * - * @return from - */ - @javax.annotation.Nullable - public String getFrom() { - return from; - } +import com.configcat.publicapi.java.client.JSON; - public void setFrom(String from) { - this.from = from; +/** + * JsonPatchOperation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class JsonPatchOperation { + public static final String SERIALIZED_NAME_OP = "op"; + @SerializedName(SERIALIZED_NAME_OP) + private OperationType op; + + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + private String path; + + public static final String SERIALIZED_NAME_FROM = "from"; + @SerializedName(SERIALIZED_NAME_FROM) + private String from; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; + + public JsonPatchOperation() { + } + + public JsonPatchOperation op(OperationType op) { + this.op = op; + return this; + } + + /** + * Get op + * @return op + */ + @javax.annotation.Nonnull + public OperationType getOp() { + return op; + } + + public void setOp(OperationType op) { + this.op = op; + } + + + public JsonPatchOperation path(String path) { + this.path = path; + return this; + } + + /** + * The source path. + * @return path + */ + @javax.annotation.Nonnull + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + + public JsonPatchOperation from(String from) { + this.from = from; + return this; + } + + /** + * The target path. + * @return from + */ + @javax.annotation.Nullable + public String getFrom() { + return from; + } + + public void setFrom(String from) { + this.from = from; + } + + + public JsonPatchOperation value(Object value) { + this.value = value; + return this; + } + + /** + * The discrete value. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the JsonPatchOperation instance itself + */ + public JsonPatchOperation putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public JsonPatchOperation value(Object value) { - this.value = value; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * The discrete value. - * - * @return value - */ - @javax.annotation.Nullable - public Object getValue() { - return value; - } - public void setValue(Object value) { - this.value = value; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - JsonPatchOperation jsonPatchOperation = (JsonPatchOperation) o; - return Objects.equals(this.op, jsonPatchOperation.op) - && Objects.equals(this.path, jsonPatchOperation.path) - && Objects.equals(this.from, jsonPatchOperation.from) - && Objects.equals(this.value, jsonPatchOperation.value); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + JsonPatchOperation jsonPatchOperation = (JsonPatchOperation) o; + return Objects.equals(this.op, jsonPatchOperation.op) && + Objects.equals(this.path, jsonPatchOperation.path) && + Objects.equals(this.from, jsonPatchOperation.from) && + Objects.equals(this.value, jsonPatchOperation.value)&& + Objects.equals(this.additionalProperties, jsonPatchOperation.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(op, path, from, value, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(op, path, from, value); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JsonPatchOperation {\n"); + sb.append(" op: ").append(toIndentedString(op)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("op"); + openapiFields.add("path"); + openapiFields.add("from"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("op"); + openapiRequiredFields.add("path"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to JsonPatchOperation + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!JsonPatchOperation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in JsonPatchOperation is not found in the empty JSON string", JsonPatchOperation.openapiRequiredFields.toString())); } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class JsonPatchOperation {\n"); - sb.append(" op: ").append(toIndentedString(op)).append("\n"); - sb.append(" path: ").append(toIndentedString(path)).append("\n"); - sb.append(" from: ").append(toIndentedString(from)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("op"); - openapiFields.add("path"); - openapiFields.add("from"); - openapiFields.add("value"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("op"); - openapiRequiredFields.add("path"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to JsonPatchOperation - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!JsonPatchOperation.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in JsonPatchOperation is not found in" - + " the empty JSON string", - JsonPatchOperation.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!JsonPatchOperation.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `JsonPatchOperation` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : JsonPatchOperation.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : JsonPatchOperation.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `op` - OperationType.validateJsonElement(jsonObj.get("op")); - if (!jsonObj.get("path").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `path` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("path").toString())); - } - if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) - && !jsonObj.get("from").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `from` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("from").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!JsonPatchOperation.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'JsonPatchOperation' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(JsonPatchOperation.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, JsonPatchOperation value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public JsonPatchOperation read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of JsonPatchOperation given an JSON string - * - * @param jsonString JSON string - * @return An instance of JsonPatchOperation - * @throws IOException if the JSON string is invalid with respect to JsonPatchOperation - */ - public static JsonPatchOperation fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, JsonPatchOperation.class); - } - - /** - * Convert an instance of JsonPatchOperation to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + // validate the required field `op` + OperationType.validateJsonElement(jsonObj.get("op")); + if (!jsonObj.get("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + if ((jsonObj.get("from") != null && !jsonObj.get("from").isJsonNull()) && !jsonObj.get("from").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `from` to be a primitive type in the JSON string but got `%s`", jsonObj.get("from").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!JsonPatchOperation.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'JsonPatchOperation' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(JsonPatchOperation.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, JsonPatchOperation value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public JsonPatchOperation read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + JsonPatchOperation instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of JsonPatchOperation given an JSON string + * + * @param jsonString JSON string + * @return An instance of JsonPatchOperation + * @throws IOException if the JSON string is invalid with respect to JsonPatchOperation + */ + public static JsonPatchOperation fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, JsonPatchOperation.class); + } + + /** + * Convert an instance of JsonPatchOperation to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/KeyGenerationMode.java b/src/main/java/com/configcat/publicapi/java/client/model/KeyGenerationMode.java index f839528..bbabc69 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/KeyGenerationMode.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/KeyGenerationMode.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,69 +10,75 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Determines the Feature Flag key generation mode. */ +/** + * Determines the Feature Flag key generation mode. + */ @JsonAdapter(KeyGenerationMode.Adapter.class) public enum KeyGenerationMode { - CAMEL_CASE("camelCase"), - - LOWER_CASE("lowerCase"), - - UPPER_CASE("upperCase"), - - PASCAL_CASE("pascalCase"), - - KEBAB_CASE("kebabCase"); - - private String value; - - KeyGenerationMode(String value) { - this.value = value; - } - - public String getValue() { - return value; + + CAMEL_CASE("camelCase"), + + LOWER_CASE("lowerCase"), + + UPPER_CASE("upperCase"), + + PASCAL_CASE("pascalCase"), + + KEBAB_CASE("kebabCase"); + + private String value; + + KeyGenerationMode(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static KeyGenerationMode fromValue(String value) { + for (KeyGenerationMode b : KeyGenerationMode.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); - } - - public static KeyGenerationMode fromValue(String value) { - for (KeyGenerationMode b : KeyGenerationMode.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public void write(final JsonWriter jsonWriter, final KeyGenerationMode enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final KeyGenerationMode enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public KeyGenerationMode read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return KeyGenerationMode.fromValue(value); - } + @Override + public KeyGenerationMode read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return KeyGenerationMode.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - KeyGenerationMode.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + KeyGenerationMode.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/MeModel.java b/src/main/java/com/configcat/publicapi/java/client/model/MeModel.java index 9b76f19..644f843 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/MeModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/MeModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,233 +10,312 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** MeModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * MeModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class MeModel { - public static final String SERIALIZED_NAME_EMAIL = "email"; + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private String fullName; - public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + public MeModel() { + } - @SerializedName(SERIALIZED_NAME_FULL_NAME) - private String fullName; + public MeModel( + String email, + String fullName + ) { + this(); + this.email = email; + this.fullName = fullName; + } - public MeModel() {} + /** + * Get email + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } - public MeModel(String email, String fullName) { - this(); - this.email = email; - this.fullName = fullName; - } - /** - * Get email - * - * @return email - */ - @javax.annotation.Nullable - public String getEmail() { - return email; - } - /** - * Get fullName - * - * @return fullName - */ - @javax.annotation.Nullable - public String getFullName() { - return fullName; - } + /** + * Get fullName + * @return fullName + */ + @javax.annotation.Nullable + public String getFullName() { + return fullName; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MeModel meModel = (MeModel) o; - return Objects.equals(this.email, meModel.email) - && Objects.equals(this.fullName, meModel.fullName); - } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MeModel instance itself + */ + public MeModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(email, fullName); + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + MeModel meModel = (MeModel) o; + return Objects.equals(this.email, meModel.email) && + Objects.equals(this.fullName, meModel.fullName)&& + Objects.equals(this.additionalProperties, meModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MeModel {\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(email, fullName, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MeModel {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("email"); - openapiFields.add("fullName"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("email"); + openapiFields.add("fullName"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MeModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!MeModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in MeModel is not found in the empty" - + " JSON string", - MeModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MeModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the `MeModel`" - + " properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MeModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MeModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MeModel is not found in the empty JSON string", MeModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) - && !jsonObj.get("email").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `email` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("email").toString())); - } - if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) - && !jsonObj.get("fullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `fullName` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("fullName").toString())); - } - } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) && !jsonObj.get("fullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fullName").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!MeModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MeModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(MeModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, MeModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public MeModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MeModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MeModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MeModel.class)); - /** - * Create an instance of MeModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of MeModel - * @throws IOException if the JSON string is invalid with respect to MeModel - */ - public static MeModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MeModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MeModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MeModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MeModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of MeModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of MeModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of MeModel + * @throws IOException if the JSON string is invalid with respect to MeModel + */ + public static MeModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MeModel.class); + } + + /** + * Convert an instance of MeModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/MemberModel.java b/src/main/java/com/configcat/publicapi/java/client/model/MemberModel.java index e15a5ac..5e320e0 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/MemberModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/MemberModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,345 +10,404 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** MemberModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class MemberModel { - public static final String SERIALIZED_NAME_USER_ID = "userId"; - - @SerializedName(SERIALIZED_NAME_USER_ID) - private String userId; - - public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; - - @SerializedName(SERIALIZED_NAME_PRODUCT_ID) - private UUID productId; - - public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; - - @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) - private Long permissionGroupId; - - public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; - - @SerializedName(SERIALIZED_NAME_FULL_NAME) - private String fullName; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; - - public MemberModel() {} - - public MemberModel userId(String userId) { - this.userId = userId; - return this; - } - - /** - * Identifier of the Member. - * - * @return userId - */ - @javax.annotation.Nullable - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public MemberModel productId(UUID productId) { - this.productId = productId; - return this; - } - - /** - * Identifier of the Product where the Member has access. - * - * @return productId - */ - @javax.annotation.Nullable - public UUID getProductId() { - return productId; - } - - public void setProductId(UUID productId) { - this.productId = productId; - } - - public MemberModel permissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - return this; - } - - /** - * Identifier of the Member's Permission Group. - * - * @return permissionGroupId - */ - @javax.annotation.Nullable - public Long getPermissionGroupId() { - return permissionGroupId; - } - public void setPermissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - } - - public MemberModel fullName(String fullName) { - this.fullName = fullName; - return this; - } - - /** - * Name of the Member. - * - * @return fullName - */ - @javax.annotation.Nullable - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public MemberModel email(String email) { - this.email = email; - return this; - } - - /** - * Email of the Member. - * - * @return email - */ - @javax.annotation.Nullable - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - MemberModel memberModel = (MemberModel) o; - return Objects.equals(this.userId, memberModel.userId) - && Objects.equals(this.productId, memberModel.productId) - && Objects.equals(this.permissionGroupId, memberModel.permissionGroupId) - && Objects.equals(this.fullName, memberModel.fullName) - && Objects.equals(this.email, memberModel.email); +/** + * MemberModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class MemberModel { + public static final String SERIALIZED_NAME_USER_ID = "userId"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private String userId; + + public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; + @SerializedName(SERIALIZED_NAME_PRODUCT_ID) + private UUID productId; + + public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; + @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) + private Long permissionGroupId; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private String fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public MemberModel() { + } + + public MemberModel userId(String userId) { + this.userId = userId; + return this; + } + + /** + * Identifier of the Member. + * @return userId + */ + @javax.annotation.Nullable + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + + public MemberModel productId(UUID productId) { + this.productId = productId; + return this; + } + + /** + * Identifier of the Product where the Member has access. + * @return productId + */ + @javax.annotation.Nullable + public UUID getProductId() { + return productId; + } + + public void setProductId(UUID productId) { + this.productId = productId; + } + + + public MemberModel permissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + return this; + } + + /** + * Identifier of the Member's Permission Group. + * @return permissionGroupId + */ + @javax.annotation.Nullable + public Long getPermissionGroupId() { + return permissionGroupId; + } + + public void setPermissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + } + + + public MemberModel fullName(String fullName) { + this.fullName = fullName; + return this; + } + + /** + * Name of the Member. + * @return fullName + */ + @javax.annotation.Nullable + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + + public MemberModel email(String email) { + this.email = email; + return this; + } + + /** + * Email of the Member. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the MemberModel instance itself + */ + public MemberModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(userId, productId, permissionGroupId, fullName, email); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class MemberModel {\n"); - sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); - sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); - sb.append(" permissionGroupId: ") - .append(toIndentedString(permissionGroupId)) - .append("\n"); - sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + MemberModel memberModel = (MemberModel) o; + return Objects.equals(this.userId, memberModel.userId) && + Objects.equals(this.productId, memberModel.productId) && + Objects.equals(this.permissionGroupId, memberModel.permissionGroupId) && + Objects.equals(this.fullName, memberModel.fullName) && + Objects.equals(this.email, memberModel.email)&& + Objects.equals(this.additionalProperties, memberModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(userId, productId, permissionGroupId, fullName, email, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userId"); - openapiFields.add("productId"); - openapiFields.add("permissionGroupId"); - openapiFields.add("fullName"); - openapiFields.add("email"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MemberModel {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" permissionGroupId: ").append(toIndentedString(permissionGroupId)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to MemberModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!MemberModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in MemberModel is not found in the empty" - + " JSON string", - MemberModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!MemberModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `MemberModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userId"); + openapiFields.add("productId"); + openapiFields.add("permissionGroupId"); + openapiFields.add("fullName"); + openapiFields.add("email"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MemberModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MemberModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MemberModel is not found in the empty JSON string", MemberModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) - && !jsonObj.get("userId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `userId` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("userId").toString())); - } - if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) - && !jsonObj.get("productId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `productId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("productId").toString())); - } - if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) - && !jsonObj.get("fullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `fullName` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("fullName").toString())); - } - if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) - && !jsonObj.get("email").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `email` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("email").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!MemberModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'MemberModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(MemberModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, MemberModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public MemberModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of MemberModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of MemberModel - * @throws IOException if the JSON string is invalid with respect to MemberModel - */ - public static MemberModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, MemberModel.class); - } - - /** - * Convert an instance of MemberModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) && !jsonObj.get("userId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userId").toString())); + } + if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) && !jsonObj.get("productId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productId").toString())); + } + if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) && !jsonObj.get("fullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fullName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MemberModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MemberModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MemberModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MemberModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public MemberModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + MemberModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of MemberModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of MemberModel + * @throws IOException if the JSON string is invalid with respect to MemberModel + */ + public static MemberModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MemberModel.class); + } + + /** + * Convert an instance of MemberModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ModifyIntegrationRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/ModifyIntegrationRequest.java index d75445e..69ef07d 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ModifyIntegrationRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ModifyIntegrationRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,342 +10,408 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; + +import java.lang.reflect.Type; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; - -/** ModifyIntegrationRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ModifyIntegrationRequest { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; - - @SerializedName(SERIALIZED_NAME_PARAMETERS) - private Map parameters = new HashMap<>(); - - public static final String SERIALIZED_NAME_ENVIRONMENT_IDS = "environmentIds"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_IDS) - private List environmentIds = new ArrayList<>(); - - public static final String SERIALIZED_NAME_CONFIG_IDS = "configIds"; - - @SerializedName(SERIALIZED_NAME_CONFIG_IDS) - private List configIds = new ArrayList<>(); - - public ModifyIntegrationRequest() {} - - public ModifyIntegrationRequest name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Integration. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public ModifyIntegrationRequest parameters(Map parameters) { - this.parameters = parameters; - return this; - } - - public ModifyIntegrationRequest putParametersItem(String key, String parametersItem) { - if (this.parameters == null) { - this.parameters = new HashMap<>(); - } - this.parameters.put(key, parametersItem); - return this; - } - - /** - * Parameters of the Integration. - * - * @return parameters - */ - @javax.annotation.Nonnull - public Map getParameters() { - return parameters; - } - public void setParameters(Map parameters) { - this.parameters = parameters; - } - - public ModifyIntegrationRequest environmentIds(List environmentIds) { - this.environmentIds = environmentIds; - return this; - } - - public ModifyIntegrationRequest addEnvironmentIdsItem(UUID environmentIdsItem) { - if (this.environmentIds == null) { - this.environmentIds = new ArrayList<>(); - } - this.environmentIds.add(environmentIdsItem); - return this; - } - - /** - * List of Environment IDs that are connected with this Integration. If the list is empty, all - * of the Environments are connected. - * - * @return environmentIds - */ - @javax.annotation.Nonnull - public List getEnvironmentIds() { - return environmentIds; - } - - public void setEnvironmentIds(List environmentIds) { - this.environmentIds = environmentIds; - } +import com.configcat.publicapi.java.client.JSON; - public ModifyIntegrationRequest configIds(List configIds) { - this.configIds = configIds; - return this; +/** + * ModifyIntegrationRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ModifyIntegrationRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + private Map parameters = new HashMap<>(); + + public static final String SERIALIZED_NAME_ENVIRONMENT_IDS = "environmentIds"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_IDS) + private List environmentIds = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CONFIG_IDS = "configIds"; + @SerializedName(SERIALIZED_NAME_CONFIG_IDS) + private List configIds = new ArrayList<>(); + + public ModifyIntegrationRequest() { + } + + public ModifyIntegrationRequest name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Integration. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public ModifyIntegrationRequest parameters(Map parameters) { + this.parameters = parameters; + return this; + } + + public ModifyIntegrationRequest putParametersItem(String key, String parametersItem) { + if (this.parameters == null) { + this.parameters = new HashMap<>(); } - - public ModifyIntegrationRequest addConfigIdsItem(UUID configIdsItem) { - if (this.configIds == null) { - this.configIds = new ArrayList<>(); - } - this.configIds.add(configIdsItem); - return this; + this.parameters.put(key, parametersItem); + return this; + } + + /** + * Parameters of the Integration. + * @return parameters + */ + @javax.annotation.Nonnull + public Map getParameters() { + return parameters; + } + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + + public ModifyIntegrationRequest environmentIds(List environmentIds) { + this.environmentIds = environmentIds; + return this; + } + + public ModifyIntegrationRequest addEnvironmentIdsItem(UUID environmentIdsItem) { + if (this.environmentIds == null) { + this.environmentIds = new ArrayList<>(); } - - /** - * List of Config IDs that are connected with this Integration. If the list is empty, all of the - * Configs are connected. - * - * @return configIds - */ - @javax.annotation.Nonnull - public List getConfigIds() { - return configIds; + this.environmentIds.add(environmentIdsItem); + return this; + } + + /** + * List of Environment IDs that are connected with this Integration. If the list is empty, all of the Environments are connected. + * @return environmentIds + */ + @javax.annotation.Nonnull + public List getEnvironmentIds() { + return environmentIds; + } + + public void setEnvironmentIds(List environmentIds) { + this.environmentIds = environmentIds; + } + + + public ModifyIntegrationRequest configIds(List configIds) { + this.configIds = configIds; + return this; + } + + public ModifyIntegrationRequest addConfigIdsItem(UUID configIdsItem) { + if (this.configIds == null) { + this.configIds = new ArrayList<>(); } - - public void setConfigIds(List configIds) { - this.configIds = configIds; + this.configIds.add(configIdsItem); + return this; + } + + /** + * List of Config IDs that are connected with this Integration. If the list is empty, all of the Configs are connected. + * @return configIds + */ + @javax.annotation.Nonnull + public List getConfigIds() { + return configIds; + } + + public void setConfigIds(List configIds) { + this.configIds = configIds; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModifyIntegrationRequest instance itself + */ + public ModifyIntegrationRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ModifyIntegrationRequest modifyIntegrationRequest = (ModifyIntegrationRequest) o; - return Objects.equals(this.name, modifyIntegrationRequest.name) - && Objects.equals(this.parameters, modifyIntegrationRequest.parameters) - && Objects.equals(this.environmentIds, modifyIntegrationRequest.environmentIds) - && Objects.equals(this.configIds, modifyIntegrationRequest.configIds); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(name, parameters, environmentIds, configIds); - } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ModifyIntegrationRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); - sb.append(" environmentIds: ").append(toIndentedString(environmentIds)).append("\n"); - sb.append(" configIds: ").append(toIndentedString(configIds)).append("\n"); - sb.append("}"); - return sb.toString(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("parameters"); - openapiFields.add("environmentIds"); - openapiFields.add("configIds"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - openapiRequiredFields.add("parameters"); - openapiRequiredFields.add("environmentIds"); - openapiRequiredFields.add("configIds"); + ModifyIntegrationRequest modifyIntegrationRequest = (ModifyIntegrationRequest) o; + return Objects.equals(this.name, modifyIntegrationRequest.name) && + Objects.equals(this.parameters, modifyIntegrationRequest.parameters) && + Objects.equals(this.environmentIds, modifyIntegrationRequest.environmentIds) && + Objects.equals(this.configIds, modifyIntegrationRequest.configIds)&& + Objects.equals(this.additionalProperties, modifyIntegrationRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, parameters, environmentIds, configIds, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModifyIntegrationRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" environmentIds: ").append(toIndentedString(environmentIds)).append("\n"); + sb.append(" configIds: ").append(toIndentedString(configIds)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ModifyIntegrationRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ModifyIntegrationRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ModifyIntegrationRequest is not found" - + " in the empty JSON string", - ModifyIntegrationRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ModifyIntegrationRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ModifyIntegrationRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("parameters"); + openapiFields.add("environmentIds"); + openapiFields.add("configIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("parameters"); + openapiRequiredFields.add("environmentIds"); + openapiRequiredFields.add("configIds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModifyIntegrationRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModifyIntegrationRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModifyIntegrationRequest is not found in the empty JSON string", ModifyIntegrationRequest.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ModifyIntegrationRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModifyIntegrationRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - // ensure the required json array is present - if (jsonObj.get("environmentIds") == null) { - throw new IllegalArgumentException( - "Expected the field `linkedContent` to be an array in the JSON string but got" - + " `null`"); - } else if (!jsonObj.get("environmentIds").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentIds` to be an array in the JSON string" - + " but got `%s`", - jsonObj.get("environmentIds").toString())); - } - // ensure the required json array is present - if (jsonObj.get("configIds") == null) { - throw new IllegalArgumentException( - "Expected the field `linkedContent` to be an array in the JSON string but got" - + " `null`"); - } else if (!jsonObj.get("configIds").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configIds` to be an array in the JSON string but" - + " got `%s`", - jsonObj.get("configIds").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ModifyIntegrationRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ModifyIntegrationRequest' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ModifyIntegrationRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ModifyIntegrationRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ModifyIntegrationRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ModifyIntegrationRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of ModifyIntegrationRequest - * @throws IOException if the JSON string is invalid with respect to ModifyIntegrationRequest - */ - public static ModifyIntegrationRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ModifyIntegrationRequest.class); - } - - /** - * Convert an instance of ModifyIntegrationRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // ensure the required json array is present + if (jsonObj.get("environmentIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("environmentIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentIds` to be an array in the JSON string but got `%s`", jsonObj.get("environmentIds").toString())); + } + // ensure the required json array is present + if (jsonObj.get("configIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("configIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `configIds` to be an array in the JSON string but got `%s`", jsonObj.get("configIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModifyIntegrationRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModifyIntegrationRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModifyIntegrationRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModifyIntegrationRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModifyIntegrationRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModifyIntegrationRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ModifyIntegrationRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModifyIntegrationRequest + * @throws IOException if the JSON string is invalid with respect to ModifyIntegrationRequest + */ + public static ModifyIntegrationRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModifyIntegrationRequest.class); + } + + /** + * Convert an instance of ModifyIntegrationRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OperationType.java b/src/main/java/com/configcat/publicapi/java/client/model/OperationType.java index 5b93f3a..863d827 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OperationType.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OperationType.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,73 +10,79 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Gets or Sets OperationType */ +/** + * Gets or Sets OperationType + */ @JsonAdapter(OperationType.Adapter.class) public enum OperationType { - UNKNOWN("unknown"), - - ADD("add"), - - REMOVE("remove"), - - REPLACE("replace"), - - MOVE("move"), - - COPY("copy"), - - TEST("test"); - - private String value; - - OperationType(String value) { - this.value = value; - } - - public String getValue() { - return value; + + UNKNOWN("unknown"), + + ADD("add"), + + REMOVE("remove"), + + REPLACE("replace"), + + MOVE("move"), + + COPY("copy"), + + TEST("test"); + + private String value; + + OperationType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static OperationType fromValue(String value) { + for (OperationType b : OperationType.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); + public void write(final JsonWriter jsonWriter, final OperationType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static OperationType fromValue(String value) { - for (OperationType b : OperationType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final OperationType enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public OperationType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return OperationType.fromValue(value); - } + @Override + public OperationType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return OperationType.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - OperationType.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + OperationType.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationAdminModel.java b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationAdminModel.java index fcccc67..96954d7 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationAdminModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationAdminModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,308 +10,374 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** Describes an Organization Admin. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class OrganizationAdminModel { - public static final String SERIALIZED_NAME_USER_ID = "userId"; - - @SerializedName(SERIALIZED_NAME_USER_ID) - private String userId; - - public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; - - @SerializedName(SERIALIZED_NAME_FULL_NAME) - private String fullName; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; - - public static final String SERIALIZED_NAME_TWO_FACTOR_ENABLED = "twoFactorEnabled"; - - @SerializedName(SERIALIZED_NAME_TWO_FACTOR_ENABLED) - private Boolean twoFactorEnabled; - - public OrganizationAdminModel() {} - - public OrganizationAdminModel userId(String userId) { - this.userId = userId; - return this; - } - - /** - * Identifier of the Organization Admin. - * - * @return userId - */ - @javax.annotation.Nullable - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public OrganizationAdminModel fullName(String fullName) { - this.fullName = fullName; - return this; - } - - /** - * Name of the Organization Admin. - * - * @return fullName - */ - @javax.annotation.Nullable - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public OrganizationAdminModel email(String email) { - this.email = email; - return this; - } - /** - * Email of the OrganizationAdmin. - * - * @return email - */ - @javax.annotation.Nullable - public String getEmail() { - return email; - } +import com.configcat.publicapi.java.client.JSON; - public void setEmail(String email) { - this.email = email; +/** + * Describes an Organization Admin. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class OrganizationAdminModel { + public static final String SERIALIZED_NAME_USER_ID = "userId"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private String userId; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private String fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_TWO_FACTOR_ENABLED = "twoFactorEnabled"; + @SerializedName(SERIALIZED_NAME_TWO_FACTOR_ENABLED) + private Boolean twoFactorEnabled; + + public OrganizationAdminModel() { + } + + public OrganizationAdminModel userId(String userId) { + this.userId = userId; + return this; + } + + /** + * Identifier of the Organization Admin. + * @return userId + */ + @javax.annotation.Nullable + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + + public OrganizationAdminModel fullName(String fullName) { + this.fullName = fullName; + return this; + } + + /** + * Name of the Organization Admin. + * @return fullName + */ + @javax.annotation.Nullable + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + + public OrganizationAdminModel email(String email) { + this.email = email; + return this; + } + + /** + * Email of the OrganizationAdmin. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + public OrganizationAdminModel twoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + return this; + } + + /** + * Determines whether 2FA is enabled for the Organization Admin. + * @return twoFactorEnabled + */ + @javax.annotation.Nullable + public Boolean getTwoFactorEnabled() { + return twoFactorEnabled; + } + + public void setTwoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OrganizationAdminModel instance itself + */ + public OrganizationAdminModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public OrganizationAdminModel twoFactorEnabled(Boolean twoFactorEnabled) { - this.twoFactorEnabled = twoFactorEnabled; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Determines whether 2FA is enabled for the Organization Admin. - * - * @return twoFactorEnabled - */ - @javax.annotation.Nullable - public Boolean getTwoFactorEnabled() { - return twoFactorEnabled; - } - public void setTwoFactorEnabled(Boolean twoFactorEnabled) { - this.twoFactorEnabled = twoFactorEnabled; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OrganizationAdminModel organizationAdminModel = (OrganizationAdminModel) o; - return Objects.equals(this.userId, organizationAdminModel.userId) - && Objects.equals(this.fullName, organizationAdminModel.fullName) - && Objects.equals(this.email, organizationAdminModel.email) - && Objects.equals(this.twoFactorEnabled, organizationAdminModel.twoFactorEnabled); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + OrganizationAdminModel organizationAdminModel = (OrganizationAdminModel) o; + return Objects.equals(this.userId, organizationAdminModel.userId) && + Objects.equals(this.fullName, organizationAdminModel.fullName) && + Objects.equals(this.email, organizationAdminModel.email) && + Objects.equals(this.twoFactorEnabled, organizationAdminModel.twoFactorEnabled)&& + Objects.equals(this.additionalProperties, organizationAdminModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(userId, fullName, email, twoFactorEnabled, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(userId, fullName, email, twoFactorEnabled); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrganizationAdminModel {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" twoFactorEnabled: ").append(toIndentedString(twoFactorEnabled)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OrganizationAdminModel {\n"); - sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); - sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" twoFactorEnabled: ").append(toIndentedString(twoFactorEnabled)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userId"); - openapiFields.add("fullName"); - openapiFields.add("email"); - openapiFields.add("twoFactorEnabled"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to OrganizationAdminModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!OrganizationAdminModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in OrganizationAdminModel is not found" - + " in the empty JSON string", - OrganizationAdminModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OrganizationAdminModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `OrganizationAdminModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userId"); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("twoFactorEnabled"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrganizationAdminModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrganizationAdminModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrganizationAdminModel is not found in the empty JSON string", OrganizationAdminModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) - && !jsonObj.get("userId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `userId` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("userId").toString())); - } - if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) - && !jsonObj.get("fullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `fullName` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("fullName").toString())); - } - if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) - && !jsonObj.get("email").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `email` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("email").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!OrganizationAdminModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'OrganizationAdminModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(OrganizationAdminModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, OrganizationAdminModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public OrganizationAdminModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of OrganizationAdminModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of OrganizationAdminModel - * @throws IOException if the JSON string is invalid with respect to OrganizationAdminModel - */ - public static OrganizationAdminModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, OrganizationAdminModel.class); - } - - /** - * Convert an instance of OrganizationAdminModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) && !jsonObj.get("userId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userId").toString())); + } + if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) && !jsonObj.get("fullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fullName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrganizationAdminModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrganizationAdminModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrganizationAdminModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrganizationAdminModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OrganizationAdminModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OrganizationAdminModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of OrganizationAdminModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrganizationAdminModel + * @throws IOException if the JSON string is invalid with respect to OrganizationAdminModel + */ + public static OrganizationAdminModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrganizationAdminModel.class); + } + + /** + * Convert an instance of OrganizationAdminModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationInvitationModel.java b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationInvitationModel.java index e9eb385..81065c9 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationInvitationModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationInvitationModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,439 +10,483 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** OrganizationInvitationModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class OrganizationInvitationModel { - public static final String SERIALIZED_NAME_INVITATION_ID = "invitationId"; - - @SerializedName(SERIALIZED_NAME_INVITATION_ID) - private UUID invitationId; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; - - public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; - - @SerializedName(SERIALIZED_NAME_PRODUCT_ID) - private UUID productId; - - public static final String SERIALIZED_NAME_PRODUCT_NAME = "productName"; - - @SerializedName(SERIALIZED_NAME_PRODUCT_NAME) - private String productName; - - public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; - - @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) - private Long permissionGroupId; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private OffsetDateTime createdAt; - - public static final String SERIALIZED_NAME_EXPIRED = "expired"; - - @SerializedName(SERIALIZED_NAME_EXPIRED) - private Boolean expired; - - public static final String SERIALIZED_NAME_EXPIRES = "expires"; - - @SerializedName(SERIALIZED_NAME_EXPIRES) - private OffsetDateTime expires; - - public OrganizationInvitationModel() {} - - public OrganizationInvitationModel invitationId(UUID invitationId) { - this.invitationId = invitationId; - return this; - } - - /** - * The identifier of the Invitation. - * - * @return invitationId - */ - @javax.annotation.Nullable - public UUID getInvitationId() { - return invitationId; - } - - public void setInvitationId(UUID invitationId) { - this.invitationId = invitationId; - } - - public OrganizationInvitationModel email(String email) { - this.email = email; - return this; - } - - /** - * The invited user's email address. - * - * @return email - */ - @javax.annotation.Nullable - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public OrganizationInvitationModel productId(UUID productId) { - this.productId = productId; - return this; - } - - /** - * The identifier of the Product the user was invited to. - * - * @return productId - */ - @javax.annotation.Nullable - public UUID getProductId() { - return productId; - } - - public void setProductId(UUID productId) { - this.productId = productId; - } - - public OrganizationInvitationModel productName(String productName) { - this.productName = productName; - return this; - } - - /** - * The name of the Product the user was invited to. - * - * @return productName - */ - @javax.annotation.Nullable - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - public OrganizationInvitationModel permissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - return this; - } - - /** - * The identifier of the Permission Group the user was invited to. - * - * @return permissionGroupId - */ - @javax.annotation.Nullable - public Long getPermissionGroupId() { - return permissionGroupId; - } - - public void setPermissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - } - - public OrganizationInvitationModel createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * Creation time of the Invitation. - * - * @return createdAt - */ - @javax.annotation.Nullable - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public OrganizationInvitationModel expired(Boolean expired) { - this.expired = expired; - return this; - } - - /** - * Determines whether the Invitation is expired. - * - * @return expired - */ - @javax.annotation.Nullable - public Boolean getExpired() { - return expired; - } - - public void setExpired(Boolean expired) { - this.expired = expired; - } - - public OrganizationInvitationModel expires(OffsetDateTime expires) { - this.expires = expires; - return this; - } - - /** - * Expiration time of the Invitation. - * - * @return expires - */ - @javax.annotation.Nullable - public OffsetDateTime getExpires() { - return expires; - } - - public void setExpires(OffsetDateTime expires) { - this.expires = expires; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OrganizationInvitationModel organizationInvitationModel = (OrganizationInvitationModel) o; - return Objects.equals(this.invitationId, organizationInvitationModel.invitationId) - && Objects.equals(this.email, organizationInvitationModel.email) - && Objects.equals(this.productId, organizationInvitationModel.productId) - && Objects.equals(this.productName, organizationInvitationModel.productName) - && Objects.equals( - this.permissionGroupId, organizationInvitationModel.permissionGroupId) - && Objects.equals(this.createdAt, organizationInvitationModel.createdAt) - && Objects.equals(this.expired, organizationInvitationModel.expired) - && Objects.equals(this.expires, organizationInvitationModel.expires); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - invitationId, - email, - productId, - productName, - permissionGroupId, - createdAt, - expired, - expires); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OrganizationInvitationModel {\n"); - sb.append(" invitationId: ").append(toIndentedString(invitationId)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); - sb.append(" productName: ").append(toIndentedString(productName)).append("\n"); - sb.append(" permissionGroupId: ") - .append(toIndentedString(permissionGroupId)) - .append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" expired: ").append(toIndentedString(expired)).append("\n"); - sb.append(" expires: ").append(toIndentedString(expires)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("invitationId"); - openapiFields.add("email"); - openapiFields.add("productId"); - openapiFields.add("productName"); - openapiFields.add("permissionGroupId"); - openapiFields.add("createdAt"); - openapiFields.add("expired"); - openapiFields.add("expires"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * OrganizationInvitationModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!OrganizationInvitationModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in OrganizationInvitationModel is not" - + " found in the empty JSON string", - OrganizationInvitationModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OrganizationInvitationModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `OrganizationInvitationModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * OrganizationInvitationModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class OrganizationInvitationModel { + public static final String SERIALIZED_NAME_INVITATION_ID = "invitationId"; + @SerializedName(SERIALIZED_NAME_INVITATION_ID) + private UUID invitationId; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; + @SerializedName(SERIALIZED_NAME_PRODUCT_ID) + private UUID productId; + + public static final String SERIALIZED_NAME_PRODUCT_NAME = "productName"; + @SerializedName(SERIALIZED_NAME_PRODUCT_NAME) + private String productName; + + public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; + @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) + private Long permissionGroupId; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_EXPIRED = "expired"; + @SerializedName(SERIALIZED_NAME_EXPIRED) + private Boolean expired; + + public static final String SERIALIZED_NAME_EXPIRES = "expires"; + @SerializedName(SERIALIZED_NAME_EXPIRES) + private OffsetDateTime expires; + + public OrganizationInvitationModel() { + } + + public OrganizationInvitationModel invitationId(UUID invitationId) { + this.invitationId = invitationId; + return this; + } + + /** + * The identifier of the Invitation. + * @return invitationId + */ + @javax.annotation.Nullable + public UUID getInvitationId() { + return invitationId; + } + + public void setInvitationId(UUID invitationId) { + this.invitationId = invitationId; + } + + + public OrganizationInvitationModel email(String email) { + this.email = email; + return this; + } + + /** + * The invited user's email address. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + public OrganizationInvitationModel productId(UUID productId) { + this.productId = productId; + return this; + } + + /** + * The identifier of the Product the user was invited to. + * @return productId + */ + @javax.annotation.Nullable + public UUID getProductId() { + return productId; + } + + public void setProductId(UUID productId) { + this.productId = productId; + } + + + public OrganizationInvitationModel productName(String productName) { + this.productName = productName; + return this; + } + + /** + * The name of the Product the user was invited to. + * @return productName + */ + @javax.annotation.Nullable + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + + public OrganizationInvitationModel permissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + return this; + } + + /** + * The identifier of the Permission Group the user was invited to. + * @return permissionGroupId + */ + @javax.annotation.Nullable + public Long getPermissionGroupId() { + return permissionGroupId; + } + + public void setPermissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + } + + + public OrganizationInvitationModel createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Creation time of the Invitation. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public OrganizationInvitationModel expired(Boolean expired) { + this.expired = expired; + return this; + } + + /** + * Determines whether the Invitation is expired. + * @return expired + */ + @javax.annotation.Nullable + public Boolean getExpired() { + return expired; + } + + public void setExpired(Boolean expired) { + this.expired = expired; + } + + + public OrganizationInvitationModel expires(OffsetDateTime expires) { + this.expires = expires; + return this; + } + + /** + * Expiration time of the Invitation. + * @return expires + */ + @javax.annotation.Nullable + public OffsetDateTime getExpires() { + return expires; + } + + public void setExpires(OffsetDateTime expires) { + this.expires = expires; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OrganizationInvitationModel instance itself + */ + public OrganizationInvitationModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrganizationInvitationModel organizationInvitationModel = (OrganizationInvitationModel) o; + return Objects.equals(this.invitationId, organizationInvitationModel.invitationId) && + Objects.equals(this.email, organizationInvitationModel.email) && + Objects.equals(this.productId, organizationInvitationModel.productId) && + Objects.equals(this.productName, organizationInvitationModel.productName) && + Objects.equals(this.permissionGroupId, organizationInvitationModel.permissionGroupId) && + Objects.equals(this.createdAt, organizationInvitationModel.createdAt) && + Objects.equals(this.expired, organizationInvitationModel.expired) && + Objects.equals(this.expires, organizationInvitationModel.expires)&& + Objects.equals(this.additionalProperties, organizationInvitationModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(invitationId, email, productId, productName, permissionGroupId, createdAt, expired, expires, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrganizationInvitationModel {\n"); + sb.append(" invitationId: ").append(toIndentedString(invitationId)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" productName: ").append(toIndentedString(productName)).append("\n"); + sb.append(" permissionGroupId: ").append(toIndentedString(permissionGroupId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" expired: ").append(toIndentedString(expired)).append("\n"); + sb.append(" expires: ").append(toIndentedString(expires)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("invitationId"); + openapiFields.add("email"); + openapiFields.add("productId"); + openapiFields.add("productName"); + openapiFields.add("permissionGroupId"); + openapiFields.add("createdAt"); + openapiFields.add("expired"); + openapiFields.add("expires"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrganizationInvitationModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrganizationInvitationModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrganizationInvitationModel is not found in the empty JSON string", OrganizationInvitationModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("invitationId") != null && !jsonObj.get("invitationId").isJsonNull()) - && !jsonObj.get("invitationId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `invitationId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("invitationId").toString())); - } - if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) - && !jsonObj.get("email").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `email` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("email").toString())); - } - if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) - && !jsonObj.get("productId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `productId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("productId").toString())); - } - if ((jsonObj.get("productName") != null && !jsonObj.get("productName").isJsonNull()) - && !jsonObj.get("productName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `productName` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("productName").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!OrganizationInvitationModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'OrganizationInvitationModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(OrganizationInvitationModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, OrganizationInvitationModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public OrganizationInvitationModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of OrganizationInvitationModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of OrganizationInvitationModel - * @throws IOException if the JSON string is invalid with respect to OrganizationInvitationModel - */ - public static OrganizationInvitationModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, OrganizationInvitationModel.class); - } - - /** - * Convert an instance of OrganizationInvitationModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + if ((jsonObj.get("invitationId") != null && !jsonObj.get("invitationId").isJsonNull()) && !jsonObj.get("invitationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `invitationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("invitationId").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) && !jsonObj.get("productId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productId").toString())); + } + if ((jsonObj.get("productName") != null && !jsonObj.get("productName").isJsonNull()) && !jsonObj.get("productName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrganizationInvitationModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrganizationInvitationModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrganizationInvitationModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrganizationInvitationModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OrganizationInvitationModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OrganizationInvitationModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of OrganizationInvitationModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrganizationInvitationModel + * @throws IOException if the JSON string is invalid with respect to OrganizationInvitationModel + */ + public static OrganizationInvitationModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrganizationInvitationModel.class); + } + + /** + * Convert an instance of OrganizationInvitationModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationMemberModel.java b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationMemberModel.java index 0fe5814..1ba9ba6 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationMemberModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationMemberModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,366 +10,425 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.OrganizationPermissionModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** Describes an Organization Member. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class OrganizationMemberModel { - public static final String SERIALIZED_NAME_USER_ID = "userId"; - - @SerializedName(SERIALIZED_NAME_USER_ID) - private String userId; - - public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; - - @SerializedName(SERIALIZED_NAME_FULL_NAME) - private String fullName; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; - - public static final String SERIALIZED_NAME_TWO_FACTOR_ENABLED = "twoFactorEnabled"; - - @SerializedName(SERIALIZED_NAME_TWO_FACTOR_ENABLED) - private Boolean twoFactorEnabled; - - public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; - - @SerializedName(SERIALIZED_NAME_PERMISSIONS) - private List permissions; - - public OrganizationMemberModel() {} - - public OrganizationMemberModel userId(String userId) { - this.userId = userId; - return this; - } - - /** - * Identifier of the Organization Admin. - * - * @return userId - */ - @javax.annotation.Nullable - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public OrganizationMemberModel fullName(String fullName) { - this.fullName = fullName; - return this; - } - - /** - * Name of the Organization Admin. - * - * @return fullName - */ - @javax.annotation.Nullable - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public OrganizationMemberModel email(String email) { - this.email = email; - return this; - } - - /** - * Email of the OrganizationAdmin. - * - * @return email - */ - @javax.annotation.Nullable - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - public OrganizationMemberModel twoFactorEnabled(Boolean twoFactorEnabled) { - this.twoFactorEnabled = twoFactorEnabled; - return this; - } - - /** - * Determines whether 2FA is enabled for the Organization Admin. - * - * @return twoFactorEnabled - */ - @javax.annotation.Nullable - public Boolean getTwoFactorEnabled() { - return twoFactorEnabled; - } +import com.configcat.publicapi.java.client.JSON; - public void setTwoFactorEnabled(Boolean twoFactorEnabled) { - this.twoFactorEnabled = twoFactorEnabled; +/** + * Describes an Organization Member. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class OrganizationMemberModel { + public static final String SERIALIZED_NAME_USER_ID = "userId"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private String userId; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private String fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_TWO_FACTOR_ENABLED = "twoFactorEnabled"; + @SerializedName(SERIALIZED_NAME_TWO_FACTOR_ENABLED) + private Boolean twoFactorEnabled; + + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions; + + public OrganizationMemberModel() { + } + + public OrganizationMemberModel userId(String userId) { + this.userId = userId; + return this; + } + + /** + * Identifier of the Organization Admin. + * @return userId + */ + @javax.annotation.Nullable + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + + public OrganizationMemberModel fullName(String fullName) { + this.fullName = fullName; + return this; + } + + /** + * Name of the Organization Admin. + * @return fullName + */ + @javax.annotation.Nullable + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + + public OrganizationMemberModel email(String email) { + this.email = email; + return this; + } + + /** + * Email of the OrganizationAdmin. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + public OrganizationMemberModel twoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + return this; + } + + /** + * Determines whether 2FA is enabled for the Organization Admin. + * @return twoFactorEnabled + */ + @javax.annotation.Nullable + public Boolean getTwoFactorEnabled() { + return twoFactorEnabled; + } + + public void setTwoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + } + + + public OrganizationMemberModel permissions(List permissions) { + this.permissions = permissions; + return this; + } + + public OrganizationMemberModel addPermissionsItem(OrganizationPermissionModel permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); } - - public OrganizationMemberModel permissions(List permissions) { - this.permissions = permissions; - return this; + this.permissions.add(permissionsItem); + return this; + } + + /** + * The permissions of the Member. + * @return permissions + */ + @javax.annotation.Nullable + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OrganizationMemberModel instance itself + */ + public OrganizationMemberModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public OrganizationMemberModel addPermissionsItem(OrganizationPermissionModel permissionsItem) { - if (this.permissions == null) { - this.permissions = new ArrayList<>(); - } - this.permissions.add(permissionsItem); - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * The permissions of the Member. - * - * @return permissions - */ - @javax.annotation.Nullable - public List getPermissions() { - return permissions; - } - public void setPermissions(List permissions) { - this.permissions = permissions; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OrganizationMemberModel organizationMemberModel = (OrganizationMemberModel) o; - return Objects.equals(this.userId, organizationMemberModel.userId) - && Objects.equals(this.fullName, organizationMemberModel.fullName) - && Objects.equals(this.email, organizationMemberModel.email) - && Objects.equals(this.twoFactorEnabled, organizationMemberModel.twoFactorEnabled) - && Objects.equals(this.permissions, organizationMemberModel.permissions); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + OrganizationMemberModel organizationMemberModel = (OrganizationMemberModel) o; + return Objects.equals(this.userId, organizationMemberModel.userId) && + Objects.equals(this.fullName, organizationMemberModel.fullName) && + Objects.equals(this.email, organizationMemberModel.email) && + Objects.equals(this.twoFactorEnabled, organizationMemberModel.twoFactorEnabled) && + Objects.equals(this.permissions, organizationMemberModel.permissions)&& + Objects.equals(this.additionalProperties, organizationMemberModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(userId, fullName, email, twoFactorEnabled, permissions, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(userId, fullName, email, twoFactorEnabled, permissions); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrganizationMemberModel {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" twoFactorEnabled: ").append(toIndentedString(twoFactorEnabled)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OrganizationMemberModel {\n"); - sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); - sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" twoFactorEnabled: ").append(toIndentedString(twoFactorEnabled)).append("\n"); - sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userId"); - openapiFields.add("fullName"); - openapiFields.add("email"); - openapiFields.add("twoFactorEnabled"); - openapiFields.add("permissions"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to OrganizationMemberModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!OrganizationMemberModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in OrganizationMemberModel is not found" - + " in the empty JSON string", - OrganizationMemberModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OrganizationMemberModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `OrganizationMemberModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userId"); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("twoFactorEnabled"); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrganizationMemberModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrganizationMemberModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrganizationMemberModel is not found in the empty JSON string", OrganizationMemberModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) - && !jsonObj.get("userId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `userId` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("userId").toString())); + if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) && !jsonObj.get("userId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userId").toString())); + } + if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) && !jsonObj.get("fullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fullName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { + JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); + if (jsonArraypermissions != null) { + // ensure the json data is an array + if (!jsonObj.get("permissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be an array in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + + // validate the optional field `permissions` (array) + for (int i = 0; i < jsonArraypermissions.size(); i++) { + OrganizationPermissionModel.validateJsonElement(jsonArraypermissions.get(i)); + }; } - if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) - && !jsonObj.get("fullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `fullName` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("fullName").toString())); - } - if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) - && !jsonObj.get("email").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `email` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("email").toString())); - } - if (jsonObj.get("permissions") != null && !jsonObj.get("permissions").isJsonNull()) { - JsonArray jsonArraypermissions = jsonObj.getAsJsonArray("permissions"); - if (jsonArraypermissions != null) { - // ensure the json data is an array - if (!jsonObj.get("permissions").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `permissions` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("permissions").toString())); - } - - // validate the optional field `permissions` (array) - for (int i = 0; i < jsonArraypermissions.size(); i++) { - OrganizationPermissionModel.validateJsonElement(jsonArraypermissions.get(i)); - } - ; - } - } - } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!OrganizationMemberModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'OrganizationMemberModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(OrganizationMemberModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, OrganizationMemberModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public OrganizationMemberModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of OrganizationMemberModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of OrganizationMemberModel - * @throws IOException if the JSON string is invalid with respect to OrganizationMemberModel - */ - public static OrganizationMemberModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, OrganizationMemberModel.class); - } - - /** - * Convert an instance of OrganizationMemberModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrganizationMemberModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrganizationMemberModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrganizationMemberModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrganizationMemberModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OrganizationMemberModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OrganizationMemberModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of OrganizationMemberModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrganizationMemberModel + * @throws IOException if the JSON string is invalid with respect to OrganizationMemberModel + */ + public static OrganizationMemberModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrganizationMemberModel.class); + } + + /** + * Convert an instance of OrganizationMemberModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationMembersModel.java b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationMembersModel.java index cc945db..c24fa22 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationMembersModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationMembersModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,344 +10,409 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.OrganizationAdminModel; +import com.configcat.publicapi.java.client.model.OrganizationMemberModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** OrganizationMembersModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class OrganizationMembersModel { - public static final String SERIALIZED_NAME_ADMINS = "admins"; - - @SerializedName(SERIALIZED_NAME_ADMINS) - private List admins; - - public static final String SERIALIZED_NAME_BILLING_MANAGERS = "billingManagers"; - - @SerializedName(SERIALIZED_NAME_BILLING_MANAGERS) - private List billingManagers; - - public static final String SERIALIZED_NAME_MEMBERS = "members"; - - @SerializedName(SERIALIZED_NAME_MEMBERS) - private List members; - - public OrganizationMembersModel() {} - public OrganizationMembersModel admins(List admins) { - this.admins = admins; - return this; - } - - public OrganizationMembersModel addAdminsItem(OrganizationAdminModel adminsItem) { - if (this.admins == null) { - this.admins = new ArrayList<>(); - } - this.admins.add(adminsItem); - return this; - } - - /** - * List of Organization Admins. - * - * @return admins - */ - @javax.annotation.Nullable - public List getAdmins() { - return admins; - } - - public void setAdmins(List admins) { - this.admins = admins; - } +import com.configcat.publicapi.java.client.JSON; - public OrganizationMembersModel billingManagers(List billingManagers) { - this.billingManagers = billingManagers; - return this; - } +/** + * OrganizationMembersModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class OrganizationMembersModel { + public static final String SERIALIZED_NAME_ADMINS = "admins"; + @SerializedName(SERIALIZED_NAME_ADMINS) + private List admins; - public OrganizationMembersModel addBillingManagersItem( - OrganizationAdminModel billingManagersItem) { - if (this.billingManagers == null) { - this.billingManagers = new ArrayList<>(); - } - this.billingManagers.add(billingManagersItem); - return this; - } + public static final String SERIALIZED_NAME_BILLING_MANAGERS = "billingManagers"; + @SerializedName(SERIALIZED_NAME_BILLING_MANAGERS) + private List billingManagers; - /** - * List of Billing Managers. - * - * @return billingManagers - */ - @javax.annotation.Nullable - public List getBillingManagers() { - return billingManagers; - } + public static final String SERIALIZED_NAME_MEMBERS = "members"; + @SerializedName(SERIALIZED_NAME_MEMBERS) + private List members; - public void setBillingManagers(List billingManagers) { - this.billingManagers = billingManagers; - } + public OrganizationMembersModel() { + } - public OrganizationMembersModel members(List members) { - this.members = members; - return this; - } + public OrganizationMembersModel admins(List admins) { + this.admins = admins; + return this; + } - public OrganizationMembersModel addMembersItem(OrganizationMemberModel membersItem) { - if (this.members == null) { - this.members = new ArrayList<>(); - } - this.members.add(membersItem); - return this; + public OrganizationMembersModel addAdminsItem(OrganizationAdminModel adminsItem) { + if (this.admins == null) { + this.admins = new ArrayList<>(); } - - /** - * List of Organization Members. - * - * @return members - */ - @javax.annotation.Nullable - public List getMembers() { - return members; + this.admins.add(adminsItem); + return this; + } + + /** + * List of Organization Admins. + * @return admins + */ + @javax.annotation.Nullable + public List getAdmins() { + return admins; + } + + public void setAdmins(List admins) { + this.admins = admins; + } + + + public OrganizationMembersModel billingManagers(List billingManagers) { + this.billingManagers = billingManagers; + return this; + } + + public OrganizationMembersModel addBillingManagersItem(OrganizationAdminModel billingManagersItem) { + if (this.billingManagers == null) { + this.billingManagers = new ArrayList<>(); } - - public void setMembers(List members) { - this.members = members; + this.billingManagers.add(billingManagersItem); + return this; + } + + /** + * List of Billing Managers. + * @return billingManagers + */ + @javax.annotation.Nullable + public List getBillingManagers() { + return billingManagers; + } + + public void setBillingManagers(List billingManagers) { + this.billingManagers = billingManagers; + } + + + public OrganizationMembersModel members(List members) { + this.members = members; + return this; + } + + public OrganizationMembersModel addMembersItem(OrganizationMemberModel membersItem) { + if (this.members == null) { + this.members = new ArrayList<>(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OrganizationMembersModel organizationMembersModel = (OrganizationMembersModel) o; - return Objects.equals(this.admins, organizationMembersModel.admins) - && Objects.equals(this.billingManagers, organizationMembersModel.billingManagers) - && Objects.equals(this.members, organizationMembersModel.members); + this.members.add(membersItem); + return this; + } + + /** + * List of Organization Members. + * @return members + */ + @javax.annotation.Nullable + public List getMembers() { + return members; + } + + public void setMembers(List members) { + this.members = members; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OrganizationMembersModel instance itself + */ + public OrganizationMembersModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(admins, billingManagers, members); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OrganizationMembersModel {\n"); - sb.append(" admins: ").append(toIndentedString(admins)).append("\n"); - sb.append(" billingManagers: ").append(toIndentedString(billingManagers)).append("\n"); - sb.append(" members: ").append(toIndentedString(members)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + OrganizationMembersModel organizationMembersModel = (OrganizationMembersModel) o; + return Objects.equals(this.admins, organizationMembersModel.admins) && + Objects.equals(this.billingManagers, organizationMembersModel.billingManagers) && + Objects.equals(this.members, organizationMembersModel.members)&& + Objects.equals(this.additionalProperties, organizationMembersModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(admins, billingManagers, members, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("admins"); - openapiFields.add("billingManagers"); - openapiFields.add("members"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrganizationMembersModel {\n"); + sb.append(" admins: ").append(toIndentedString(admins)).append("\n"); + sb.append(" billingManagers: ").append(toIndentedString(billingManagers)).append("\n"); + sb.append(" members: ").append(toIndentedString(members)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to OrganizationMembersModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!OrganizationMembersModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in OrganizationMembersModel is not found" - + " in the empty JSON string", - OrganizationMembersModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OrganizationMembersModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `OrganizationMembersModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("admins"); + openapiFields.add("billingManagers"); + openapiFields.add("members"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrganizationMembersModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrganizationMembersModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrganizationMembersModel is not found in the empty JSON string", OrganizationMembersModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("admins") != null && !jsonObj.get("admins").isJsonNull()) { - JsonArray jsonArrayadmins = jsonObj.getAsJsonArray("admins"); - if (jsonArrayadmins != null) { - // ensure the json data is an array - if (!jsonObj.get("admins").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `admins` to be an array in the JSON string" - + " but got `%s`", - jsonObj.get("admins").toString())); - } - - // validate the optional field `admins` (array) - for (int i = 0; i < jsonArrayadmins.size(); i++) { - OrganizationAdminModel.validateJsonElement(jsonArrayadmins.get(i)); - } - ; - } + if (jsonObj.get("admins") != null && !jsonObj.get("admins").isJsonNull()) { + JsonArray jsonArrayadmins = jsonObj.getAsJsonArray("admins"); + if (jsonArrayadmins != null) { + // ensure the json data is an array + if (!jsonObj.get("admins").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `admins` to be an array in the JSON string but got `%s`", jsonObj.get("admins").toString())); + } + + // validate the optional field `admins` (array) + for (int i = 0; i < jsonArrayadmins.size(); i++) { + OrganizationAdminModel.validateJsonElement(jsonArrayadmins.get(i)); + }; } - if (jsonObj.get("billingManagers") != null - && !jsonObj.get("billingManagers").isJsonNull()) { - JsonArray jsonArraybillingManagers = jsonObj.getAsJsonArray("billingManagers"); - if (jsonArraybillingManagers != null) { - // ensure the json data is an array - if (!jsonObj.get("billingManagers").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `billingManagers` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("billingManagers").toString())); - } - - // validate the optional field `billingManagers` (array) - for (int i = 0; i < jsonArraybillingManagers.size(); i++) { - OrganizationAdminModel.validateJsonElement(jsonArraybillingManagers.get(i)); - } - ; - } + } + if (jsonObj.get("billingManagers") != null && !jsonObj.get("billingManagers").isJsonNull()) { + JsonArray jsonArraybillingManagers = jsonObj.getAsJsonArray("billingManagers"); + if (jsonArraybillingManagers != null) { + // ensure the json data is an array + if (!jsonObj.get("billingManagers").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `billingManagers` to be an array in the JSON string but got `%s`", jsonObj.get("billingManagers").toString())); + } + + // validate the optional field `billingManagers` (array) + for (int i = 0; i < jsonArraybillingManagers.size(); i++) { + OrganizationAdminModel.validateJsonElement(jsonArraybillingManagers.get(i)); + }; } - if (jsonObj.get("members") != null && !jsonObj.get("members").isJsonNull()) { - JsonArray jsonArraymembers = jsonObj.getAsJsonArray("members"); - if (jsonArraymembers != null) { - // ensure the json data is an array - if (!jsonObj.get("members").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `members` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("members").toString())); - } - - // validate the optional field `members` (array) - for (int i = 0; i < jsonArraymembers.size(); i++) { - OrganizationMemberModel.validateJsonElement(jsonArraymembers.get(i)); - } - ; - } + } + if (jsonObj.get("members") != null && !jsonObj.get("members").isJsonNull()) { + JsonArray jsonArraymembers = jsonObj.getAsJsonArray("members"); + if (jsonArraymembers != null) { + // ensure the json data is an array + if (!jsonObj.get("members").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `members` to be an array in the JSON string but got `%s`", jsonObj.get("members").toString())); + } + + // validate the optional field `members` (array) + for (int i = 0; i < jsonArraymembers.size(); i++) { + OrganizationMemberModel.validateJsonElement(jsonArraymembers.get(i)); + }; } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!OrganizationMembersModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'OrganizationMembersModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(OrganizationMembersModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, OrganizationMembersModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public OrganizationMembersModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + } + } - /** - * Create an instance of OrganizationMembersModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of OrganizationMembersModel - * @throws IOException if the JSON string is invalid with respect to OrganizationMembersModel - */ - public static OrganizationMembersModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, OrganizationMembersModel.class); - } - - /** - * Convert an instance of OrganizationMembersModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrganizationMembersModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrganizationMembersModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrganizationMembersModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrganizationMembersModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OrganizationMembersModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OrganizationMembersModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of OrganizationMembersModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrganizationMembersModel + * @throws IOException if the JSON string is invalid with respect to OrganizationMembersModel + */ + public static OrganizationMembersModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrganizationMembersModel.class); + } + + /** + * Convert an instance of OrganizationMembersModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationModel.java b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationModel.java index da995cc..fd7f38a 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,247 +10,320 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; -/** Details of the Organization. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * Details of the Organization. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class OrganizationModel { - public static final String SERIALIZED_NAME_ORGANIZATION_ID = "organizationId"; + public static final String SERIALIZED_NAME_ORGANIZATION_ID = "organizationId"; + @SerializedName(SERIALIZED_NAME_ORGANIZATION_ID) + private UUID organizationId; - @SerializedName(SERIALIZED_NAME_ORGANIZATION_ID) - private UUID organizationId; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_NAME = "name"; + public OrganizationModel() { + } - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public OrganizationModel organizationId(UUID organizationId) { + this.organizationId = organizationId; + return this; + } - public OrganizationModel() {} + /** + * Identifier of the Organization. + * @return organizationId + */ + @javax.annotation.Nullable + public UUID getOrganizationId() { + return organizationId; + } - public OrganizationModel organizationId(UUID organizationId) { - this.organizationId = organizationId; - return this; - } + public void setOrganizationId(UUID organizationId) { + this.organizationId = organizationId; + } - /** - * Identifier of the Organization. - * - * @return organizationId - */ - @javax.annotation.Nullable - public UUID getOrganizationId() { - return organizationId; - } - public void setOrganizationId(UUID organizationId) { - this.organizationId = organizationId; - } + public OrganizationModel name(String name) { + this.name = name; + return this; + } - public OrganizationModel name(String name) { - this.name = name; - return this; - } + /** + * Name of the Organization. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - /** - * Name of the Organization. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } + public void setName(String name) { + this.name = name; + } - public void setName(String name) { - this.name = name; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OrganizationModel organizationModel = (OrganizationModel) o; - return Objects.equals(this.organizationId, organizationModel.organizationId) - && Objects.equals(this.name, organizationModel.name); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OrganizationModel instance itself + */ + public OrganizationModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(organizationId, name); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + OrganizationModel organizationModel = (OrganizationModel) o; + return Objects.equals(this.organizationId, organizationModel.organizationId) && + Objects.equals(this.name, organizationModel.name)&& + Objects.equals(this.additionalProperties, organizationModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OrganizationModel {\n"); - sb.append(" organizationId: ").append(toIndentedString(organizationId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(organizationId, name, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrganizationModel {\n"); + sb.append(" organizationId: ").append(toIndentedString(organizationId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("organizationId"); - openapiFields.add("name"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("organizationId"); + openapiFields.add("name"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to OrganizationModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!OrganizationModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in OrganizationModel is not found in the" - + " empty JSON string", - OrganizationModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OrganizationModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `OrganizationModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrganizationModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrganizationModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrganizationModel is not found in the empty JSON string", OrganizationModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("organizationId") != null && !jsonObj.get("organizationId").isJsonNull()) - && !jsonObj.get("organizationId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `organizationId` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("organizationId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - } + if ((jsonObj.get("organizationId") != null && !jsonObj.get("organizationId").isJsonNull()) && !jsonObj.get("organizationId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `organizationId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("organizationId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!OrganizationModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'OrganizationModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(OrganizationModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, OrganizationModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public OrganizationModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrganizationModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrganizationModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrganizationModel.class)); - /** - * Create an instance of OrganizationModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of OrganizationModel - * @throws IOException if the JSON string is invalid with respect to OrganizationModel - */ - public static OrganizationModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, OrganizationModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrganizationModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OrganizationModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OrganizationModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of OrganizationModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of OrganizationModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrganizationModel + * @throws IOException if the JSON string is invalid with respect to OrganizationModel + */ + public static OrganizationModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrganizationModel.class); + } + + /** + * Convert an instance of OrganizationModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationPermissionGroupModel.java b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationPermissionGroupModel.java index 4bd97c2..08e98db 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationPermissionGroupModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationPermissionGroupModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,247 +10,316 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** Describes the Member's Permission Group within a Product. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * Describes the Member's Permission Group within a Product. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class OrganizationPermissionGroupModel { - public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; + public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; + @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) + private Long permissionGroupId; - @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) - private Long permissionGroupId; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_NAME = "name"; + public OrganizationPermissionGroupModel() { + } - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public OrganizationPermissionGroupModel permissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + return this; + } - public OrganizationPermissionGroupModel() {} + /** + * Identifier of the Member's Permission Group. + * @return permissionGroupId + */ + @javax.annotation.Nullable + public Long getPermissionGroupId() { + return permissionGroupId; + } - public OrganizationPermissionGroupModel permissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - return this; - } + public void setPermissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + } - /** - * Identifier of the Member's Permission Group. - * - * @return permissionGroupId - */ - @javax.annotation.Nullable - public Long getPermissionGroupId() { - return permissionGroupId; - } - public void setPermissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - } + public OrganizationPermissionGroupModel name(String name) { + this.name = name; + return this; + } - public OrganizationPermissionGroupModel name(String name) { - this.name = name; - return this; - } + /** + * Name of the Member's Permission Group. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - /** - * Name of the Member's Permission Group. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } + public void setName(String name) { + this.name = name; + } - public void setName(String name) { - this.name = name; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OrganizationPermissionGroupModel organizationPermissionGroupModel = - (OrganizationPermissionGroupModel) o; - return Objects.equals( - this.permissionGroupId, organizationPermissionGroupModel.permissionGroupId) - && Objects.equals(this.name, organizationPermissionGroupModel.name); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OrganizationPermissionGroupModel instance itself + */ + public OrganizationPermissionGroupModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(permissionGroupId, name); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + OrganizationPermissionGroupModel organizationPermissionGroupModel = (OrganizationPermissionGroupModel) o; + return Objects.equals(this.permissionGroupId, organizationPermissionGroupModel.permissionGroupId) && + Objects.equals(this.name, organizationPermissionGroupModel.name)&& + Objects.equals(this.additionalProperties, organizationPermissionGroupModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OrganizationPermissionGroupModel {\n"); - sb.append(" permissionGroupId: ") - .append(toIndentedString(permissionGroupId)) - .append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(permissionGroupId, name, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrganizationPermissionGroupModel {\n"); + sb.append(" permissionGroupId: ").append(toIndentedString(permissionGroupId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("permissionGroupId"); - openapiFields.add("name"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permissionGroupId"); + openapiFields.add("name"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * OrganizationPermissionGroupModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!OrganizationPermissionGroupModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in OrganizationPermissionGroupModel is" - + " not found in the empty JSON string", - OrganizationPermissionGroupModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OrganizationPermissionGroupModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `OrganizationPermissionGroupModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrganizationPermissionGroupModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrganizationPermissionGroupModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrganizationPermissionGroupModel is not found in the empty JSON string", OrganizationPermissionGroupModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!OrganizationPermissionGroupModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'OrganizationPermissionGroupModel' and - // its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(OrganizationPermissionGroupModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, OrganizationPermissionGroupModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public OrganizationPermissionGroupModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrganizationPermissionGroupModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrganizationPermissionGroupModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrganizationPermissionGroupModel.class)); - /** - * Create an instance of OrganizationPermissionGroupModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of OrganizationPermissionGroupModel - * @throws IOException if the JSON string is invalid with respect to - * OrganizationPermissionGroupModel - */ - public static OrganizationPermissionGroupModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, OrganizationPermissionGroupModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrganizationPermissionGroupModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OrganizationPermissionGroupModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OrganizationPermissionGroupModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of OrganizationPermissionGroupModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of OrganizationPermissionGroupModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrganizationPermissionGroupModel + * @throws IOException if the JSON string is invalid with respect to OrganizationPermissionGroupModel + */ + public static OrganizationPermissionGroupModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrganizationPermissionGroupModel.class); + } + + /** + * Convert an instance of OrganizationPermissionGroupModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationPermissionModel.java b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationPermissionModel.java index 54529e8..f5134bd 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationPermissionModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationPermissionModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,225 +10,311 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.OrganizationPermissionGroupModel; +import com.configcat.publicapi.java.client.model.OrganizationProductModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** Describes the Member's permission. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * Describes the Member's permission. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class OrganizationPermissionModel { - public static final String SERIALIZED_NAME_PRODUCT = "product"; + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private OrganizationProductModel product; - @SerializedName(SERIALIZED_NAME_PRODUCT) - private OrganizationProductModel product; + public static final String SERIALIZED_NAME_PERMISSION_GROUP = "permissionGroup"; + @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP) + private OrganizationPermissionGroupModel permissionGroup; - public static final String SERIALIZED_NAME_PERMISSION_GROUP = "permissionGroup"; + public OrganizationPermissionModel() { + } - @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP) - private OrganizationPermissionGroupModel permissionGroup; + public OrganizationPermissionModel product(OrganizationProductModel product) { + this.product = product; + return this; + } - public OrganizationPermissionModel() {} + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public OrganizationProductModel getProduct() { + return product; + } - public OrganizationPermissionModel product(OrganizationProductModel product) { - this.product = product; - return this; - } + public void setProduct(OrganizationProductModel product) { + this.product = product; + } - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public OrganizationProductModel getProduct() { - return product; - } - public void setProduct(OrganizationProductModel product) { - this.product = product; - } + public OrganizationPermissionModel permissionGroup(OrganizationPermissionGroupModel permissionGroup) { + this.permissionGroup = permissionGroup; + return this; + } - public OrganizationPermissionModel permissionGroup( - OrganizationPermissionGroupModel permissionGroup) { - this.permissionGroup = permissionGroup; - return this; - } + /** + * Get permissionGroup + * @return permissionGroup + */ + @javax.annotation.Nullable + public OrganizationPermissionGroupModel getPermissionGroup() { + return permissionGroup; + } - /** - * Get permissionGroup - * - * @return permissionGroup - */ - @javax.annotation.Nullable - public OrganizationPermissionGroupModel getPermissionGroup() { - return permissionGroup; - } + public void setPermissionGroup(OrganizationPermissionGroupModel permissionGroup) { + this.permissionGroup = permissionGroup; + } - public void setPermissionGroup(OrganizationPermissionGroupModel permissionGroup) { - this.permissionGroup = permissionGroup; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OrganizationPermissionModel organizationPermissionModel = (OrganizationPermissionModel) o; - return Objects.equals(this.product, organizationPermissionModel.product) - && Objects.equals( - this.permissionGroup, organizationPermissionModel.permissionGroup); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OrganizationPermissionModel instance itself + */ + public OrganizationPermissionModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(product, permissionGroup); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OrganizationPermissionModel {\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" permissionGroup: ").append(toIndentedString(permissionGroup)).append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + OrganizationPermissionModel organizationPermissionModel = (OrganizationPermissionModel) o; + return Objects.equals(this.product, organizationPermissionModel.product) && + Objects.equals(this.permissionGroup, organizationPermissionModel.permissionGroup)&& + Objects.equals(this.additionalProperties, organizationPermissionModel.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(product, permissionGroup, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("product"); - openapiFields.add("permissionGroup"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrganizationPermissionModel {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" permissionGroup: ").append(toIndentedString(permissionGroup)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * OrganizationPermissionModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!OrganizationPermissionModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in OrganizationPermissionModel is not" - + " found in the empty JSON string", - OrganizationPermissionModel.openapiRequiredFields.toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OrganizationPermissionModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `OrganizationPermissionModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("permissionGroup"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrganizationPermissionModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrganizationPermissionModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrganizationPermissionModel is not found in the empty JSON string", OrganizationPermissionModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - OrganizationProductModel.validateJsonElement(jsonObj.get("product")); - } - // validate the optional field `permissionGroup` - if (jsonObj.get("permissionGroup") != null - && !jsonObj.get("permissionGroup").isJsonNull()) { - OrganizationPermissionGroupModel.validateJsonElement(jsonObj.get("permissionGroup")); - } - } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + OrganizationProductModel.validateJsonElement(jsonObj.get("product")); + } + // validate the optional field `permissionGroup` + if (jsonObj.get("permissionGroup") != null && !jsonObj.get("permissionGroup").isJsonNull()) { + OrganizationPermissionGroupModel.validateJsonElement(jsonObj.get("permissionGroup")); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!OrganizationPermissionModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'OrganizationPermissionModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(OrganizationPermissionModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, OrganizationPermissionModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public OrganizationPermissionModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrganizationPermissionModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrganizationPermissionModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrganizationPermissionModel.class)); - /** - * Create an instance of OrganizationPermissionModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of OrganizationPermissionModel - * @throws IOException if the JSON string is invalid with respect to OrganizationPermissionModel - */ - public static OrganizationPermissionModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, OrganizationPermissionModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrganizationPermissionModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OrganizationPermissionModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OrganizationPermissionModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of OrganizationPermissionModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of OrganizationPermissionModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrganizationPermissionModel + * @throws IOException if the JSON string is invalid with respect to OrganizationPermissionModel + */ + public static OrganizationPermissionModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrganizationPermissionModel.class); + } + + /** + * Convert an instance of OrganizationPermissionModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationProductModel.java b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationProductModel.java index 22581fc..71655d1 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/OrganizationProductModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/OrganizationProductModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,248 +10,320 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; -/** Describes the Member's Product. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * Describes the Member's Product. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class OrganizationProductModel { - public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; + public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; + @SerializedName(SERIALIZED_NAME_PRODUCT_ID) + private UUID productId; - @SerializedName(SERIALIZED_NAME_PRODUCT_ID) - private UUID productId; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static final String SERIALIZED_NAME_NAME = "name"; + public OrganizationProductModel() { + } - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public OrganizationProductModel productId(UUID productId) { + this.productId = productId; + return this; + } - public OrganizationProductModel() {} + /** + * Identifier of the Member's Product. + * @return productId + */ + @javax.annotation.Nullable + public UUID getProductId() { + return productId; + } - public OrganizationProductModel productId(UUID productId) { - this.productId = productId; - return this; - } + public void setProductId(UUID productId) { + this.productId = productId; + } - /** - * Identifier of the Member's Product. - * - * @return productId - */ - @javax.annotation.Nullable - public UUID getProductId() { - return productId; - } - public void setProductId(UUID productId) { - this.productId = productId; - } + public OrganizationProductModel name(String name) { + this.name = name; + return this; + } - public OrganizationProductModel name(String name) { - this.name = name; - return this; - } + /** + * Name of the Member's Product. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - /** - * Name of the Member's Product. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } + public void setName(String name) { + this.name = name; + } - public void setName(String name) { - this.name = name; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - OrganizationProductModel organizationProductModel = (OrganizationProductModel) o; - return Objects.equals(this.productId, organizationProductModel.productId) - && Objects.equals(this.name, organizationProductModel.name); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the OrganizationProductModel instance itself + */ + public OrganizationProductModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(productId, name); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + OrganizationProductModel organizationProductModel = (OrganizationProductModel) o; + return Objects.equals(this.productId, organizationProductModel.productId) && + Objects.equals(this.name, organizationProductModel.name)&& + Objects.equals(this.additionalProperties, organizationProductModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class OrganizationProductModel {\n"); - sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(productId, name, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OrganizationProductModel {\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("productId"); - openapiFields.add("name"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("productId"); + openapiFields.add("name"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to OrganizationProductModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!OrganizationProductModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in OrganizationProductModel is not found" - + " in the empty JSON string", - OrganizationProductModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!OrganizationProductModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `OrganizationProductModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OrganizationProductModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OrganizationProductModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OrganizationProductModel is not found in the empty JSON string", OrganizationProductModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) - && !jsonObj.get("productId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `productId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("productId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - } + if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) && !jsonObj.get("productId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!OrganizationProductModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'OrganizationProductModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(OrganizationProductModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, OrganizationProductModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public OrganizationProductModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OrganizationProductModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OrganizationProductModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OrganizationProductModel.class)); - /** - * Create an instance of OrganizationProductModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of OrganizationProductModel - * @throws IOException if the JSON string is invalid with respect to OrganizationProductModel - */ - public static OrganizationProductModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, OrganizationProductModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OrganizationProductModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public OrganizationProductModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + OrganizationProductModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of OrganizationProductModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of OrganizationProductModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of OrganizationProductModel + * @throws IOException if the JSON string is invalid with respect to OrganizationProductModel + */ + public static OrganizationProductModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OrganizationProductModel.class); + } + + /** + * Convert an instance of OrganizationProductModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/PercentageOptionModel.java b/src/main/java/com/configcat/publicapi/java/client/model/PercentageOptionModel.java index c1e3f87..ac8af98 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/PercentageOptionModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/PercentageOptionModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,226 +10,313 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ValueModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** PercentageOptionModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * PercentageOptionModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class PercentageOptionModel { - public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + private Integer percentage; - @SerializedName(SERIALIZED_NAME_PERCENTAGE) - private Integer percentage; + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private ValueModel value; - public static final String SERIALIZED_NAME_VALUE = "value"; + public PercentageOptionModel() { + } - @SerializedName(SERIALIZED_NAME_VALUE) - private ValueModel value; + public PercentageOptionModel percentage(Integer percentage) { + this.percentage = percentage; + return this; + } - public PercentageOptionModel() {} + /** + * A number between 0 and 100 that represents a randomly allocated fraction of the users. + * @return percentage + */ + @javax.annotation.Nonnull + public Integer getPercentage() { + return percentage; + } - public PercentageOptionModel percentage(Integer percentage) { - this.percentage = percentage; - return this; - } + public void setPercentage(Integer percentage) { + this.percentage = percentage; + } - /** - * A number between 0 and 100 that represents a randomly allocated fraction of the users. - * - * @return percentage - */ - @javax.annotation.Nonnull - public Integer getPercentage() { - return percentage; - } - public void setPercentage(Integer percentage) { - this.percentage = percentage; - } + public PercentageOptionModel value(ValueModel value) { + this.value = value; + return this; + } - public PercentageOptionModel value(ValueModel value) { - this.value = value; - return this; - } + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + public ValueModel getValue() { + return value; + } - /** - * Get value - * - * @return value - */ - @javax.annotation.Nonnull - public ValueModel getValue() { - return value; - } + public void setValue(ValueModel value) { + this.value = value; + } - public void setValue(ValueModel value) { - this.value = value; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PercentageOptionModel percentageOptionModel = (PercentageOptionModel) o; - return Objects.equals(this.percentage, percentageOptionModel.percentage) - && Objects.equals(this.value, percentageOptionModel.value); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PercentageOptionModel instance itself + */ + public PercentageOptionModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(percentage, value); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PercentageOptionModel {\n"); - sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + PercentageOptionModel percentageOptionModel = (PercentageOptionModel) o; + return Objects.equals(this.percentage, percentageOptionModel.percentage) && + Objects.equals(this.value, percentageOptionModel.value)&& + Objects.equals(this.additionalProperties, percentageOptionModel.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(percentage, value, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("percentage"); - openapiFields.add("value"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PercentageOptionModel {\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("percentage"); - openapiRequiredFields.add("value"); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to PercentageOptionModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!PercentageOptionModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in PercentageOptionModel is not found in" - + " the empty JSON string", - PercentageOptionModel.openapiRequiredFields.toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PercentageOptionModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `PercentageOptionModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("percentage"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("percentage"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PercentageOptionModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PercentageOptionModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PercentageOptionModel is not found in the empty JSON string", PercentageOptionModel.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : PercentageOptionModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PercentageOptionModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `value` - ValueModel.validateJsonElement(jsonObj.get("value")); - } + // validate the required field `value` + ValueModel.validateJsonElement(jsonObj.get("value")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!PercentageOptionModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'PercentageOptionModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(PercentageOptionModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, PercentageOptionModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public PercentageOptionModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PercentageOptionModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PercentageOptionModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PercentageOptionModel.class)); - /** - * Create an instance of PercentageOptionModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of PercentageOptionModel - * @throws IOException if the JSON string is invalid with respect to PercentageOptionModel - */ - public static PercentageOptionModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, PercentageOptionModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PercentageOptionModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PercentageOptionModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PercentageOptionModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of PercentageOptionModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of PercentageOptionModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of PercentageOptionModel + * @throws IOException if the JSON string is invalid with respect to PercentageOptionModel + */ + public static PercentageOptionModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PercentageOptionModel.class); + } + + /** + * Convert an instance of PercentageOptionModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/PermissionGroupModel.java b/src/main/java/com/configcat/publicapi/java/client/model/PermissionGroupModel.java index d6b1664..12b5589 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/PermissionGroupModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/PermissionGroupModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,1043 +10,1006 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.AccessType; +import com.configcat.publicapi.java.client.model.EnvironmentAccessModel; +import com.configcat.publicapi.java.client.model.EnvironmentAccessType; +import com.configcat.publicapi.java.client.model.ProductModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** PermissionGroupModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class PermissionGroupModel { - public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; - - @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) - private Long permissionGroupId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_CAN_MANAGE_MEMBERS = "canManageMembers"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_MEMBERS) - private Boolean canManageMembers; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG = - "canCreateOrUpdateConfig"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG) - private Boolean canCreateOrUpdateConfig; - - public static final String SERIALIZED_NAME_CAN_DELETE_CONFIG = "canDeleteConfig"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_CONFIG) - private Boolean canDeleteConfig; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT = - "canCreateOrUpdateEnvironment"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT) - private Boolean canCreateOrUpdateEnvironment; - - public static final String SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT = "canDeleteEnvironment"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT) - private Boolean canDeleteEnvironment; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING = - "canCreateOrUpdateSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING) - private Boolean canCreateOrUpdateSetting; - - public static final String SERIALIZED_NAME_CAN_TAG_SETTING = "canTagSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_TAG_SETTING) - private Boolean canTagSetting; - - public static final String SERIALIZED_NAME_CAN_DELETE_SETTING = "canDeleteSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_SETTING) - private Boolean canDeleteSetting; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG = "canCreateOrUpdateTag"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG) - private Boolean canCreateOrUpdateTag; - - public static final String SERIALIZED_NAME_CAN_DELETE_TAG = "canDeleteTag"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_TAG) - private Boolean canDeleteTag; - - public static final String SERIALIZED_NAME_CAN_MANAGE_WEBHOOK = "canManageWebhook"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_WEBHOOK) - private Boolean canManageWebhook; - - public static final String SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT = "canUseExportImport"; - - @SerializedName(SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT) - private Boolean canUseExportImport; - - public static final String SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES = - "canManageProductPreferences"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES) - private Boolean canManageProductPreferences; - - public static final String SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS = "canManageIntegrations"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS) - private Boolean canManageIntegrations; - - public static final String SERIALIZED_NAME_CAN_VIEW_SDK_KEY = "canViewSdkKey"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_SDK_KEY) - private Boolean canViewSdkKey; - - public static final String SERIALIZED_NAME_CAN_ROTATE_SDK_KEY = "canRotateSdkKey"; - - @SerializedName(SERIALIZED_NAME_CAN_ROTATE_SDK_KEY) - private Boolean canRotateSdkKey; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS = - "canCreateOrUpdateSegments"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS) - private Boolean canCreateOrUpdateSegments; - - public static final String SERIALIZED_NAME_CAN_DELETE_SEGMENTS = "canDeleteSegments"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_SEGMENTS) - private Boolean canDeleteSegments; - - public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG = - "canViewProductAuditLog"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG) - private Boolean canViewProductAuditLog; - - public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS = - "canViewProductStatistics"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS) - private Boolean canViewProductStatistics; - - public static final String SERIALIZED_NAME_CAN_DISABLE2_F_A = "canDisable2FA"; - - @SerializedName(SERIALIZED_NAME_CAN_DISABLE2_F_A) - private Boolean canDisable2FA; - - public static final String SERIALIZED_NAME_ACCESS_TYPE = "accessType"; - - @SerializedName(SERIALIZED_NAME_ACCESS_TYPE) - private AccessType accessType; - - public static final String SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE = - "newEnvironmentAccessType"; - - @SerializedName(SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE) - private EnvironmentAccessType newEnvironmentAccessType; - - public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESSES = "environmentAccesses"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESSES) - private List environmentAccesses; - - public static final String SERIALIZED_NAME_PRODUCT = "product"; - - @SerializedName(SERIALIZED_NAME_PRODUCT) - private ProductModel product; - - public PermissionGroupModel() {} - - public PermissionGroupModel permissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - return this; - } - - /** - * Identifier of the Permission Group. - * - * @return permissionGroupId - */ - @javax.annotation.Nullable - public Long getPermissionGroupId() { - return permissionGroupId; - } - - public void setPermissionGroupId(Long permissionGroupId) { - this.permissionGroupId = permissionGroupId; - } - - public PermissionGroupModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Permission Group. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public PermissionGroupModel canManageMembers(Boolean canManageMembers) { - this.canManageMembers = canManageMembers; - return this; - } - - /** - * Group members can manage team members. - * - * @return canManageMembers - */ - @javax.annotation.Nullable - public Boolean getCanManageMembers() { - return canManageMembers; - } - - public void setCanManageMembers(Boolean canManageMembers) { - this.canManageMembers = canManageMembers; - } - - public PermissionGroupModel canCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { - this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; - return this; - } - - /** - * Group members can create/update Configs. - * - * @return canCreateOrUpdateConfig - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateConfig() { - return canCreateOrUpdateConfig; - } - - public void setCanCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { - this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; - } - - public PermissionGroupModel canDeleteConfig(Boolean canDeleteConfig) { - this.canDeleteConfig = canDeleteConfig; - return this; - } - - /** - * Group members can delete Configs. - * - * @return canDeleteConfig - */ - @javax.annotation.Nullable - public Boolean getCanDeleteConfig() { - return canDeleteConfig; - } - - public void setCanDeleteConfig(Boolean canDeleteConfig) { - this.canDeleteConfig = canDeleteConfig; - } - - public PermissionGroupModel canCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { - this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; - return this; - } - - /** - * Group members can create/update Environments. - * - * @return canCreateOrUpdateEnvironment - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateEnvironment() { - return canCreateOrUpdateEnvironment; - } - - public void setCanCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { - this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; - } - - public PermissionGroupModel canDeleteEnvironment(Boolean canDeleteEnvironment) { - this.canDeleteEnvironment = canDeleteEnvironment; - return this; - } - - /** - * Group members can delete Environments. - * - * @return canDeleteEnvironment - */ - @javax.annotation.Nullable - public Boolean getCanDeleteEnvironment() { - return canDeleteEnvironment; - } - - public void setCanDeleteEnvironment(Boolean canDeleteEnvironment) { - this.canDeleteEnvironment = canDeleteEnvironment; - } - - public PermissionGroupModel canCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { - this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; - return this; - } - - /** - * Group members can create/update Feature Flags and Settings. - * - * @return canCreateOrUpdateSetting - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateSetting() { - return canCreateOrUpdateSetting; - } - - public void setCanCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { - this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; - } - - public PermissionGroupModel canTagSetting(Boolean canTagSetting) { - this.canTagSetting = canTagSetting; - return this; - } - - /** - * Group members can attach/detach Tags to Feature Flags and Settings. - * - * @return canTagSetting - */ - @javax.annotation.Nullable - public Boolean getCanTagSetting() { - return canTagSetting; - } - - public void setCanTagSetting(Boolean canTagSetting) { - this.canTagSetting = canTagSetting; - } - - public PermissionGroupModel canDeleteSetting(Boolean canDeleteSetting) { - this.canDeleteSetting = canDeleteSetting; - return this; - } - - /** - * Group members can delete Feature Flags and Settings. - * - * @return canDeleteSetting - */ - @javax.annotation.Nullable - public Boolean getCanDeleteSetting() { - return canDeleteSetting; - } - - public void setCanDeleteSetting(Boolean canDeleteSetting) { - this.canDeleteSetting = canDeleteSetting; - } - - public PermissionGroupModel canCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { - this.canCreateOrUpdateTag = canCreateOrUpdateTag; - return this; - } - /** - * Group members can create/update Tags. - * - * @return canCreateOrUpdateTag - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateTag() { - return canCreateOrUpdateTag; - } - - public void setCanCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { - this.canCreateOrUpdateTag = canCreateOrUpdateTag; - } - - public PermissionGroupModel canDeleteTag(Boolean canDeleteTag) { - this.canDeleteTag = canDeleteTag; - return this; - } - - /** - * Group members can delete Tags. - * - * @return canDeleteTag - */ - @javax.annotation.Nullable - public Boolean getCanDeleteTag() { - return canDeleteTag; - } - - public void setCanDeleteTag(Boolean canDeleteTag) { - this.canDeleteTag = canDeleteTag; - } - - public PermissionGroupModel canManageWebhook(Boolean canManageWebhook) { - this.canManageWebhook = canManageWebhook; - return this; - } - - /** - * Group members can create/update/delete Webhooks. - * - * @return canManageWebhook - */ - @javax.annotation.Nullable - public Boolean getCanManageWebhook() { - return canManageWebhook; - } - - public void setCanManageWebhook(Boolean canManageWebhook) { - this.canManageWebhook = canManageWebhook; - } - - public PermissionGroupModel canUseExportImport(Boolean canUseExportImport) { - this.canUseExportImport = canUseExportImport; - return this; - } - - /** - * Group members can use the export/import feature. - * - * @return canUseExportImport - */ - @javax.annotation.Nullable - public Boolean getCanUseExportImport() { - return canUseExportImport; - } - - public void setCanUseExportImport(Boolean canUseExportImport) { - this.canUseExportImport = canUseExportImport; - } - - public PermissionGroupModel canManageProductPreferences(Boolean canManageProductPreferences) { - this.canManageProductPreferences = canManageProductPreferences; - return this; - } - - /** - * Group members can update Product preferences. - * - * @return canManageProductPreferences - */ - @javax.annotation.Nullable - public Boolean getCanManageProductPreferences() { - return canManageProductPreferences; - } - - public void setCanManageProductPreferences(Boolean canManageProductPreferences) { - this.canManageProductPreferences = canManageProductPreferences; - } - - public PermissionGroupModel canManageIntegrations(Boolean canManageIntegrations) { - this.canManageIntegrations = canManageIntegrations; - return this; - } - - /** - * Group members can add and configure integrations. - * - * @return canManageIntegrations - */ - @javax.annotation.Nullable - public Boolean getCanManageIntegrations() { - return canManageIntegrations; - } - - public void setCanManageIntegrations(Boolean canManageIntegrations) { - this.canManageIntegrations = canManageIntegrations; - } - - public PermissionGroupModel canViewSdkKey(Boolean canViewSdkKey) { - this.canViewSdkKey = canViewSdkKey; - return this; - } - - /** - * Group members has access to SDK keys. - * - * @return canViewSdkKey - */ - @javax.annotation.Nullable - public Boolean getCanViewSdkKey() { - return canViewSdkKey; - } - - public void setCanViewSdkKey(Boolean canViewSdkKey) { - this.canViewSdkKey = canViewSdkKey; - } - - public PermissionGroupModel canRotateSdkKey(Boolean canRotateSdkKey) { - this.canRotateSdkKey = canRotateSdkKey; - return this; - } - - /** - * Group members can rotate SDK keys. - * - * @return canRotateSdkKey - */ - @javax.annotation.Nullable - public Boolean getCanRotateSdkKey() { - return canRotateSdkKey; - } - - public void setCanRotateSdkKey(Boolean canRotateSdkKey) { - this.canRotateSdkKey = canRotateSdkKey; - } - - public PermissionGroupModel canCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { - this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; - return this; - } - - /** - * Group members can create/update Segments. - * - * @return canCreateOrUpdateSegments - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateSegments() { - return canCreateOrUpdateSegments; - } - - public void setCanCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { - this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; - } - - public PermissionGroupModel canDeleteSegments(Boolean canDeleteSegments) { - this.canDeleteSegments = canDeleteSegments; - return this; - } - - /** - * Group members can delete Segments. - * - * @return canDeleteSegments - */ - @javax.annotation.Nullable - public Boolean getCanDeleteSegments() { - return canDeleteSegments; - } - - public void setCanDeleteSegments(Boolean canDeleteSegments) { - this.canDeleteSegments = canDeleteSegments; - } - - public PermissionGroupModel canViewProductAuditLog(Boolean canViewProductAuditLog) { - this.canViewProductAuditLog = canViewProductAuditLog; - return this; - } - - /** - * Group members has access to audit logs. - * - * @return canViewProductAuditLog - */ - @javax.annotation.Nullable - public Boolean getCanViewProductAuditLog() { - return canViewProductAuditLog; - } - - public void setCanViewProductAuditLog(Boolean canViewProductAuditLog) { - this.canViewProductAuditLog = canViewProductAuditLog; - } - - public PermissionGroupModel canViewProductStatistics(Boolean canViewProductStatistics) { - this.canViewProductStatistics = canViewProductStatistics; - return this; - } - - /** - * Group members has access to product statistics. - * - * @return canViewProductStatistics - */ - @javax.annotation.Nullable - public Boolean getCanViewProductStatistics() { - return canViewProductStatistics; - } - - public void setCanViewProductStatistics(Boolean canViewProductStatistics) { - this.canViewProductStatistics = canViewProductStatistics; - } - - public PermissionGroupModel canDisable2FA(Boolean canDisable2FA) { - this.canDisable2FA = canDisable2FA; - return this; - } - - /** - * Group members can disable two-factor authentication for other members. - * - * @return canDisable2FA - */ - @javax.annotation.Nullable - public Boolean getCanDisable2FA() { - return canDisable2FA; - } - - public void setCanDisable2FA(Boolean canDisable2FA) { - this.canDisable2FA = canDisable2FA; - } - - public PermissionGroupModel accessType(AccessType accessType) { - this.accessType = accessType; - return this; - } - - /** - * Get accessType - * - * @return accessType - */ - @javax.annotation.Nullable - public AccessType getAccessType() { - return accessType; - } - - public void setAccessType(AccessType accessType) { - this.accessType = accessType; - } - - public PermissionGroupModel newEnvironmentAccessType( - EnvironmentAccessType newEnvironmentAccessType) { - this.newEnvironmentAccessType = newEnvironmentAccessType; - return this; - } - - /** - * Get newEnvironmentAccessType - * - * @return newEnvironmentAccessType - */ - @javax.annotation.Nullable - public EnvironmentAccessType getNewEnvironmentAccessType() { - return newEnvironmentAccessType; - } - - public void setNewEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { - this.newEnvironmentAccessType = newEnvironmentAccessType; - } - - public PermissionGroupModel environmentAccesses( - List environmentAccesses) { - this.environmentAccesses = environmentAccesses; - return this; - } - - public PermissionGroupModel addEnvironmentAccessesItem( - EnvironmentAccessModel environmentAccessesItem) { - if (this.environmentAccesses == null) { - this.environmentAccesses = new ArrayList<>(); - } - this.environmentAccesses.add(environmentAccessesItem); - return this; - } - - /** - * List of environment specific permissions. - * - * @return environmentAccesses - */ - @javax.annotation.Nullable - public List getEnvironmentAccesses() { - return environmentAccesses; - } - - public void setEnvironmentAccesses(List environmentAccesses) { - this.environmentAccesses = environmentAccesses; - } - - public PermissionGroupModel product(ProductModel product) { - this.product = product; - return this; - } - - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public ProductModel getProduct() { - return product; - } - - public void setProduct(ProductModel product) { - this.product = product; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PermissionGroupModel permissionGroupModel = (PermissionGroupModel) o; - return Objects.equals(this.permissionGroupId, permissionGroupModel.permissionGroupId) - && Objects.equals(this.name, permissionGroupModel.name) - && Objects.equals(this.canManageMembers, permissionGroupModel.canManageMembers) - && Objects.equals( - this.canCreateOrUpdateConfig, permissionGroupModel.canCreateOrUpdateConfig) - && Objects.equals(this.canDeleteConfig, permissionGroupModel.canDeleteConfig) - && Objects.equals( - this.canCreateOrUpdateEnvironment, - permissionGroupModel.canCreateOrUpdateEnvironment) - && Objects.equals( - this.canDeleteEnvironment, permissionGroupModel.canDeleteEnvironment) - && Objects.equals( - this.canCreateOrUpdateSetting, - permissionGroupModel.canCreateOrUpdateSetting) - && Objects.equals(this.canTagSetting, permissionGroupModel.canTagSetting) - && Objects.equals(this.canDeleteSetting, permissionGroupModel.canDeleteSetting) - && Objects.equals( - this.canCreateOrUpdateTag, permissionGroupModel.canCreateOrUpdateTag) - && Objects.equals(this.canDeleteTag, permissionGroupModel.canDeleteTag) - && Objects.equals(this.canManageWebhook, permissionGroupModel.canManageWebhook) - && Objects.equals(this.canUseExportImport, permissionGroupModel.canUseExportImport) - && Objects.equals( - this.canManageProductPreferences, - permissionGroupModel.canManageProductPreferences) - && Objects.equals( - this.canManageIntegrations, permissionGroupModel.canManageIntegrations) - && Objects.equals(this.canViewSdkKey, permissionGroupModel.canViewSdkKey) - && Objects.equals(this.canRotateSdkKey, permissionGroupModel.canRotateSdkKey) - && Objects.equals( - this.canCreateOrUpdateSegments, - permissionGroupModel.canCreateOrUpdateSegments) - && Objects.equals(this.canDeleteSegments, permissionGroupModel.canDeleteSegments) - && Objects.equals( - this.canViewProductAuditLog, permissionGroupModel.canViewProductAuditLog) - && Objects.equals( - this.canViewProductStatistics, - permissionGroupModel.canViewProductStatistics) - && Objects.equals(this.canDisable2FA, permissionGroupModel.canDisable2FA) - && Objects.equals(this.accessType, permissionGroupModel.accessType) - && Objects.equals( - this.newEnvironmentAccessType, - permissionGroupModel.newEnvironmentAccessType) - && Objects.equals( - this.environmentAccesses, permissionGroupModel.environmentAccesses) - && Objects.equals(this.product, permissionGroupModel.product); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - permissionGroupId, - name, - canManageMembers, - canCreateOrUpdateConfig, - canDeleteConfig, - canCreateOrUpdateEnvironment, - canDeleteEnvironment, - canCreateOrUpdateSetting, - canTagSetting, - canDeleteSetting, - canCreateOrUpdateTag, - canDeleteTag, - canManageWebhook, - canUseExportImport, - canManageProductPreferences, - canManageIntegrations, - canViewSdkKey, - canRotateSdkKey, - canCreateOrUpdateSegments, - canDeleteSegments, - canViewProductAuditLog, - canViewProductStatistics, - canDisable2FA, - accessType, - newEnvironmentAccessType, - environmentAccesses, - product); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PermissionGroupModel {\n"); - sb.append(" permissionGroupId: ") - .append(toIndentedString(permissionGroupId)) - .append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" canManageMembers: ").append(toIndentedString(canManageMembers)).append("\n"); - sb.append(" canCreateOrUpdateConfig: ") - .append(toIndentedString(canCreateOrUpdateConfig)) - .append("\n"); - sb.append(" canDeleteConfig: ").append(toIndentedString(canDeleteConfig)).append("\n"); - sb.append(" canCreateOrUpdateEnvironment: ") - .append(toIndentedString(canCreateOrUpdateEnvironment)) - .append("\n"); - sb.append(" canDeleteEnvironment: ") - .append(toIndentedString(canDeleteEnvironment)) - .append("\n"); - sb.append(" canCreateOrUpdateSetting: ") - .append(toIndentedString(canCreateOrUpdateSetting)) - .append("\n"); - sb.append(" canTagSetting: ").append(toIndentedString(canTagSetting)).append("\n"); - sb.append(" canDeleteSetting: ").append(toIndentedString(canDeleteSetting)).append("\n"); - sb.append(" canCreateOrUpdateTag: ") - .append(toIndentedString(canCreateOrUpdateTag)) - .append("\n"); - sb.append(" canDeleteTag: ").append(toIndentedString(canDeleteTag)).append("\n"); - sb.append(" canManageWebhook: ").append(toIndentedString(canManageWebhook)).append("\n"); - sb.append(" canUseExportImport: ") - .append(toIndentedString(canUseExportImport)) - .append("\n"); - sb.append(" canManageProductPreferences: ") - .append(toIndentedString(canManageProductPreferences)) - .append("\n"); - sb.append(" canManageIntegrations: ") - .append(toIndentedString(canManageIntegrations)) - .append("\n"); - sb.append(" canViewSdkKey: ").append(toIndentedString(canViewSdkKey)).append("\n"); - sb.append(" canRotateSdkKey: ").append(toIndentedString(canRotateSdkKey)).append("\n"); - sb.append(" canCreateOrUpdateSegments: ") - .append(toIndentedString(canCreateOrUpdateSegments)) - .append("\n"); - sb.append(" canDeleteSegments: ") - .append(toIndentedString(canDeleteSegments)) - .append("\n"); - sb.append(" canViewProductAuditLog: ") - .append(toIndentedString(canViewProductAuditLog)) - .append("\n"); - sb.append(" canViewProductStatistics: ") - .append(toIndentedString(canViewProductStatistics)) - .append("\n"); - sb.append(" canDisable2FA: ").append(toIndentedString(canDisable2FA)).append("\n"); - sb.append(" accessType: ").append(toIndentedString(accessType)).append("\n"); - sb.append(" newEnvironmentAccessType: ") - .append(toIndentedString(newEnvironmentAccessType)) - .append("\n"); - sb.append(" environmentAccesses: ") - .append(toIndentedString(environmentAccesses)) - .append("\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append("}"); - return sb.toString(); - } +/** + * PermissionGroupModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class PermissionGroupModel { + public static final String SERIALIZED_NAME_PERMISSION_GROUP_ID = "permissionGroupId"; + @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_ID) + private Long permissionGroupId; - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("permissionGroupId"); - openapiFields.add("name"); - openapiFields.add("canManageMembers"); - openapiFields.add("canCreateOrUpdateConfig"); - openapiFields.add("canDeleteConfig"); - openapiFields.add("canCreateOrUpdateEnvironment"); - openapiFields.add("canDeleteEnvironment"); - openapiFields.add("canCreateOrUpdateSetting"); - openapiFields.add("canTagSetting"); - openapiFields.add("canDeleteSetting"); - openapiFields.add("canCreateOrUpdateTag"); - openapiFields.add("canDeleteTag"); - openapiFields.add("canManageWebhook"); - openapiFields.add("canUseExportImport"); - openapiFields.add("canManageProductPreferences"); - openapiFields.add("canManageIntegrations"); - openapiFields.add("canViewSdkKey"); - openapiFields.add("canRotateSdkKey"); - openapiFields.add("canCreateOrUpdateSegments"); - openapiFields.add("canDeleteSegments"); - openapiFields.add("canViewProductAuditLog"); - openapiFields.add("canViewProductStatistics"); - openapiFields.add("canDisable2FA"); - openapiFields.add("accessType"); - openapiFields.add("newEnvironmentAccessType"); - openapiFields.add("environmentAccesses"); - openapiFields.add("product"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + public static final String SERIALIZED_NAME_CAN_MANAGE_MEMBERS = "canManageMembers"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_MEMBERS) + private Boolean canManageMembers; - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to PermissionGroupModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!PermissionGroupModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in PermissionGroupModel is not found in" - + " the empty JSON string", - PermissionGroupModel.openapiRequiredFields.toString())); - } - } + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG = "canCreateOrUpdateConfig"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG) + private Boolean canCreateOrUpdateConfig; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PermissionGroupModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `PermissionGroupModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static final String SERIALIZED_NAME_CAN_DELETE_CONFIG = "canDeleteConfig"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_CONFIG) + private Boolean canDeleteConfig; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT = "canCreateOrUpdateEnvironment"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT) + private Boolean canCreateOrUpdateEnvironment; + + public static final String SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT = "canDeleteEnvironment"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT) + private Boolean canDeleteEnvironment; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING = "canCreateOrUpdateSetting"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING) + private Boolean canCreateOrUpdateSetting; + + public static final String SERIALIZED_NAME_CAN_TAG_SETTING = "canTagSetting"; + @SerializedName(SERIALIZED_NAME_CAN_TAG_SETTING) + private Boolean canTagSetting; + + public static final String SERIALIZED_NAME_CAN_DELETE_SETTING = "canDeleteSetting"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_SETTING) + private Boolean canDeleteSetting; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG = "canCreateOrUpdateTag"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG) + private Boolean canCreateOrUpdateTag; + + public static final String SERIALIZED_NAME_CAN_DELETE_TAG = "canDeleteTag"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_TAG) + private Boolean canDeleteTag; + + public static final String SERIALIZED_NAME_CAN_MANAGE_WEBHOOK = "canManageWebhook"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_WEBHOOK) + private Boolean canManageWebhook; + + public static final String SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT = "canUseExportImport"; + @SerializedName(SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT) + private Boolean canUseExportImport; + + public static final String SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES = "canManageProductPreferences"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES) + private Boolean canManageProductPreferences; + + public static final String SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS = "canManageIntegrations"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS) + private Boolean canManageIntegrations; + + public static final String SERIALIZED_NAME_CAN_VIEW_SDK_KEY = "canViewSdkKey"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_SDK_KEY) + private Boolean canViewSdkKey; + + public static final String SERIALIZED_NAME_CAN_ROTATE_SDK_KEY = "canRotateSdkKey"; + @SerializedName(SERIALIZED_NAME_CAN_ROTATE_SDK_KEY) + private Boolean canRotateSdkKey; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS = "canCreateOrUpdateSegments"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS) + private Boolean canCreateOrUpdateSegments; + + public static final String SERIALIZED_NAME_CAN_DELETE_SEGMENTS = "canDeleteSegments"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_SEGMENTS) + private Boolean canDeleteSegments; + + public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG = "canViewProductAuditLog"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG) + private Boolean canViewProductAuditLog; + + public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS = "canViewProductStatistics"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS) + private Boolean canViewProductStatistics; + + public static final String SERIALIZED_NAME_CAN_DISABLE2_F_A = "canDisable2FA"; + @SerializedName(SERIALIZED_NAME_CAN_DISABLE2_F_A) + private Boolean canDisable2FA; + + public static final String SERIALIZED_NAME_ACCESS_TYPE = "accessType"; + @SerializedName(SERIALIZED_NAME_ACCESS_TYPE) + private AccessType accessType; + + public static final String SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE = "newEnvironmentAccessType"; + @SerializedName(SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE) + private EnvironmentAccessType newEnvironmentAccessType; + + public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESSES = "environmentAccesses"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESSES) + private List environmentAccesses; + + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private ProductModel product; + + public PermissionGroupModel() { + } + + public PermissionGroupModel permissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + return this; + } + + /** + * Identifier of the Permission Group. + * @return permissionGroupId + */ + @javax.annotation.Nullable + public Long getPermissionGroupId() { + return permissionGroupId; + } + + public void setPermissionGroupId(Long permissionGroupId) { + this.permissionGroupId = permissionGroupId; + } + + + public PermissionGroupModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Permission Group. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public PermissionGroupModel canManageMembers(Boolean canManageMembers) { + this.canManageMembers = canManageMembers; + return this; + } + + /** + * Group members can manage team members. + * @return canManageMembers + */ + @javax.annotation.Nullable + public Boolean getCanManageMembers() { + return canManageMembers; + } + + public void setCanManageMembers(Boolean canManageMembers) { + this.canManageMembers = canManageMembers; + } + + + public PermissionGroupModel canCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { + this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; + return this; + } + + /** + * Group members can create/update Configs. + * @return canCreateOrUpdateConfig + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateConfig() { + return canCreateOrUpdateConfig; + } + + public void setCanCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { + this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; + } + + + public PermissionGroupModel canDeleteConfig(Boolean canDeleteConfig) { + this.canDeleteConfig = canDeleteConfig; + return this; + } + + /** + * Group members can delete Configs. + * @return canDeleteConfig + */ + @javax.annotation.Nullable + public Boolean getCanDeleteConfig() { + return canDeleteConfig; + } + + public void setCanDeleteConfig(Boolean canDeleteConfig) { + this.canDeleteConfig = canDeleteConfig; + } + + + public PermissionGroupModel canCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { + this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; + return this; + } + + /** + * Group members can create/update Environments. + * @return canCreateOrUpdateEnvironment + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateEnvironment() { + return canCreateOrUpdateEnvironment; + } + + public void setCanCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { + this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; + } + + + public PermissionGroupModel canDeleteEnvironment(Boolean canDeleteEnvironment) { + this.canDeleteEnvironment = canDeleteEnvironment; + return this; + } + + /** + * Group members can delete Environments. + * @return canDeleteEnvironment + */ + @javax.annotation.Nullable + public Boolean getCanDeleteEnvironment() { + return canDeleteEnvironment; + } + + public void setCanDeleteEnvironment(Boolean canDeleteEnvironment) { + this.canDeleteEnvironment = canDeleteEnvironment; + } + + + public PermissionGroupModel canCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { + this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; + return this; + } + + /** + * Group members can create/update Feature Flags and Settings. + * @return canCreateOrUpdateSetting + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateSetting() { + return canCreateOrUpdateSetting; + } + + public void setCanCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { + this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; + } + + + public PermissionGroupModel canTagSetting(Boolean canTagSetting) { + this.canTagSetting = canTagSetting; + return this; + } + + /** + * Group members can attach/detach Tags to Feature Flags and Settings. + * @return canTagSetting + */ + @javax.annotation.Nullable + public Boolean getCanTagSetting() { + return canTagSetting; + } + + public void setCanTagSetting(Boolean canTagSetting) { + this.canTagSetting = canTagSetting; + } + + + public PermissionGroupModel canDeleteSetting(Boolean canDeleteSetting) { + this.canDeleteSetting = canDeleteSetting; + return this; + } + + /** + * Group members can delete Feature Flags and Settings. + * @return canDeleteSetting + */ + @javax.annotation.Nullable + public Boolean getCanDeleteSetting() { + return canDeleteSetting; + } + + public void setCanDeleteSetting(Boolean canDeleteSetting) { + this.canDeleteSetting = canDeleteSetting; + } + + + public PermissionGroupModel canCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { + this.canCreateOrUpdateTag = canCreateOrUpdateTag; + return this; + } + + /** + * Group members can create/update Tags. + * @return canCreateOrUpdateTag + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateTag() { + return canCreateOrUpdateTag; + } + + public void setCanCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { + this.canCreateOrUpdateTag = canCreateOrUpdateTag; + } + + + public PermissionGroupModel canDeleteTag(Boolean canDeleteTag) { + this.canDeleteTag = canDeleteTag; + return this; + } + + /** + * Group members can delete Tags. + * @return canDeleteTag + */ + @javax.annotation.Nullable + public Boolean getCanDeleteTag() { + return canDeleteTag; + } + + public void setCanDeleteTag(Boolean canDeleteTag) { + this.canDeleteTag = canDeleteTag; + } + + + public PermissionGroupModel canManageWebhook(Boolean canManageWebhook) { + this.canManageWebhook = canManageWebhook; + return this; + } + + /** + * Group members can create/update/delete Webhooks. + * @return canManageWebhook + */ + @javax.annotation.Nullable + public Boolean getCanManageWebhook() { + return canManageWebhook; + } + + public void setCanManageWebhook(Boolean canManageWebhook) { + this.canManageWebhook = canManageWebhook; + } + + + public PermissionGroupModel canUseExportImport(Boolean canUseExportImport) { + this.canUseExportImport = canUseExportImport; + return this; + } + + /** + * Group members can use the export/import feature. + * @return canUseExportImport + */ + @javax.annotation.Nullable + public Boolean getCanUseExportImport() { + return canUseExportImport; + } + + public void setCanUseExportImport(Boolean canUseExportImport) { + this.canUseExportImport = canUseExportImport; + } + + + public PermissionGroupModel canManageProductPreferences(Boolean canManageProductPreferences) { + this.canManageProductPreferences = canManageProductPreferences; + return this; + } + + /** + * Group members can update Product preferences. + * @return canManageProductPreferences + */ + @javax.annotation.Nullable + public Boolean getCanManageProductPreferences() { + return canManageProductPreferences; + } + + public void setCanManageProductPreferences(Boolean canManageProductPreferences) { + this.canManageProductPreferences = canManageProductPreferences; + } + + + public PermissionGroupModel canManageIntegrations(Boolean canManageIntegrations) { + this.canManageIntegrations = canManageIntegrations; + return this; + } + + /** + * Group members can add and configure integrations. + * @return canManageIntegrations + */ + @javax.annotation.Nullable + public Boolean getCanManageIntegrations() { + return canManageIntegrations; + } + + public void setCanManageIntegrations(Boolean canManageIntegrations) { + this.canManageIntegrations = canManageIntegrations; + } + + + public PermissionGroupModel canViewSdkKey(Boolean canViewSdkKey) { + this.canViewSdkKey = canViewSdkKey; + return this; + } + + /** + * Group members has access to SDK keys. + * @return canViewSdkKey + */ + @javax.annotation.Nullable + public Boolean getCanViewSdkKey() { + return canViewSdkKey; + } + + public void setCanViewSdkKey(Boolean canViewSdkKey) { + this.canViewSdkKey = canViewSdkKey; + } + + + public PermissionGroupModel canRotateSdkKey(Boolean canRotateSdkKey) { + this.canRotateSdkKey = canRotateSdkKey; + return this; + } + + /** + * Group members can rotate SDK keys. + * @return canRotateSdkKey + */ + @javax.annotation.Nullable + public Boolean getCanRotateSdkKey() { + return canRotateSdkKey; + } + + public void setCanRotateSdkKey(Boolean canRotateSdkKey) { + this.canRotateSdkKey = canRotateSdkKey; + } + + + public PermissionGroupModel canCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { + this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; + return this; + } + + /** + * Group members can create/update Segments. + * @return canCreateOrUpdateSegments + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateSegments() { + return canCreateOrUpdateSegments; + } + + public void setCanCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { + this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; + } + + + public PermissionGroupModel canDeleteSegments(Boolean canDeleteSegments) { + this.canDeleteSegments = canDeleteSegments; + return this; + } + + /** + * Group members can delete Segments. + * @return canDeleteSegments + */ + @javax.annotation.Nullable + public Boolean getCanDeleteSegments() { + return canDeleteSegments; + } + + public void setCanDeleteSegments(Boolean canDeleteSegments) { + this.canDeleteSegments = canDeleteSegments; + } + + + public PermissionGroupModel canViewProductAuditLog(Boolean canViewProductAuditLog) { + this.canViewProductAuditLog = canViewProductAuditLog; + return this; + } + + /** + * Group members has access to audit logs. + * @return canViewProductAuditLog + */ + @javax.annotation.Nullable + public Boolean getCanViewProductAuditLog() { + return canViewProductAuditLog; + } + + public void setCanViewProductAuditLog(Boolean canViewProductAuditLog) { + this.canViewProductAuditLog = canViewProductAuditLog; + } + + + public PermissionGroupModel canViewProductStatistics(Boolean canViewProductStatistics) { + this.canViewProductStatistics = canViewProductStatistics; + return this; + } + + /** + * Group members has access to product statistics. + * @return canViewProductStatistics + */ + @javax.annotation.Nullable + public Boolean getCanViewProductStatistics() { + return canViewProductStatistics; + } + + public void setCanViewProductStatistics(Boolean canViewProductStatistics) { + this.canViewProductStatistics = canViewProductStatistics; + } + + + public PermissionGroupModel canDisable2FA(Boolean canDisable2FA) { + this.canDisable2FA = canDisable2FA; + return this; + } + + /** + * Group members can disable two-factor authentication for other members. + * @return canDisable2FA + */ + @javax.annotation.Nullable + public Boolean getCanDisable2FA() { + return canDisable2FA; + } + + public void setCanDisable2FA(Boolean canDisable2FA) { + this.canDisable2FA = canDisable2FA; + } + + + public PermissionGroupModel accessType(AccessType accessType) { + this.accessType = accessType; + return this; + } + + /** + * Get accessType + * @return accessType + */ + @javax.annotation.Nullable + public AccessType getAccessType() { + return accessType; + } + + public void setAccessType(AccessType accessType) { + this.accessType = accessType; + } + + + public PermissionGroupModel newEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { + this.newEnvironmentAccessType = newEnvironmentAccessType; + return this; + } + + /** + * Get newEnvironmentAccessType + * @return newEnvironmentAccessType + */ + @javax.annotation.Nullable + public EnvironmentAccessType getNewEnvironmentAccessType() { + return newEnvironmentAccessType; + } + + public void setNewEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { + this.newEnvironmentAccessType = newEnvironmentAccessType; + } + + + public PermissionGroupModel environmentAccesses(List environmentAccesses) { + this.environmentAccesses = environmentAccesses; + return this; + } + + public PermissionGroupModel addEnvironmentAccessesItem(EnvironmentAccessModel environmentAccessesItem) { + if (this.environmentAccesses == null) { + this.environmentAccesses = new ArrayList<>(); + } + this.environmentAccesses.add(environmentAccessesItem); + return this; + } + + /** + * List of environment specific permissions. + * @return environmentAccesses + */ + @javax.annotation.Nullable + public List getEnvironmentAccesses() { + return environmentAccesses; + } + + public void setEnvironmentAccesses(List environmentAccesses) { + this.environmentAccesses = environmentAccesses; + } + + + public PermissionGroupModel product(ProductModel product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductModel getProduct() { + return product; + } + + public void setProduct(ProductModel product) { + this.product = product; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PermissionGroupModel instance itself + */ + public PermissionGroupModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PermissionGroupModel permissionGroupModel = (PermissionGroupModel) o; + return Objects.equals(this.permissionGroupId, permissionGroupModel.permissionGroupId) && + Objects.equals(this.name, permissionGroupModel.name) && + Objects.equals(this.canManageMembers, permissionGroupModel.canManageMembers) && + Objects.equals(this.canCreateOrUpdateConfig, permissionGroupModel.canCreateOrUpdateConfig) && + Objects.equals(this.canDeleteConfig, permissionGroupModel.canDeleteConfig) && + Objects.equals(this.canCreateOrUpdateEnvironment, permissionGroupModel.canCreateOrUpdateEnvironment) && + Objects.equals(this.canDeleteEnvironment, permissionGroupModel.canDeleteEnvironment) && + Objects.equals(this.canCreateOrUpdateSetting, permissionGroupModel.canCreateOrUpdateSetting) && + Objects.equals(this.canTagSetting, permissionGroupModel.canTagSetting) && + Objects.equals(this.canDeleteSetting, permissionGroupModel.canDeleteSetting) && + Objects.equals(this.canCreateOrUpdateTag, permissionGroupModel.canCreateOrUpdateTag) && + Objects.equals(this.canDeleteTag, permissionGroupModel.canDeleteTag) && + Objects.equals(this.canManageWebhook, permissionGroupModel.canManageWebhook) && + Objects.equals(this.canUseExportImport, permissionGroupModel.canUseExportImport) && + Objects.equals(this.canManageProductPreferences, permissionGroupModel.canManageProductPreferences) && + Objects.equals(this.canManageIntegrations, permissionGroupModel.canManageIntegrations) && + Objects.equals(this.canViewSdkKey, permissionGroupModel.canViewSdkKey) && + Objects.equals(this.canRotateSdkKey, permissionGroupModel.canRotateSdkKey) && + Objects.equals(this.canCreateOrUpdateSegments, permissionGroupModel.canCreateOrUpdateSegments) && + Objects.equals(this.canDeleteSegments, permissionGroupModel.canDeleteSegments) && + Objects.equals(this.canViewProductAuditLog, permissionGroupModel.canViewProductAuditLog) && + Objects.equals(this.canViewProductStatistics, permissionGroupModel.canViewProductStatistics) && + Objects.equals(this.canDisable2FA, permissionGroupModel.canDisable2FA) && + Objects.equals(this.accessType, permissionGroupModel.accessType) && + Objects.equals(this.newEnvironmentAccessType, permissionGroupModel.newEnvironmentAccessType) && + Objects.equals(this.environmentAccesses, permissionGroupModel.environmentAccesses) && + Objects.equals(this.product, permissionGroupModel.product)&& + Objects.equals(this.additionalProperties, permissionGroupModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(permissionGroupId, name, canManageMembers, canCreateOrUpdateConfig, canDeleteConfig, canCreateOrUpdateEnvironment, canDeleteEnvironment, canCreateOrUpdateSetting, canTagSetting, canDeleteSetting, canCreateOrUpdateTag, canDeleteTag, canManageWebhook, canUseExportImport, canManageProductPreferences, canManageIntegrations, canViewSdkKey, canRotateSdkKey, canCreateOrUpdateSegments, canDeleteSegments, canViewProductAuditLog, canViewProductStatistics, canDisable2FA, accessType, newEnvironmentAccessType, environmentAccesses, product, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PermissionGroupModel {\n"); + sb.append(" permissionGroupId: ").append(toIndentedString(permissionGroupId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" canManageMembers: ").append(toIndentedString(canManageMembers)).append("\n"); + sb.append(" canCreateOrUpdateConfig: ").append(toIndentedString(canCreateOrUpdateConfig)).append("\n"); + sb.append(" canDeleteConfig: ").append(toIndentedString(canDeleteConfig)).append("\n"); + sb.append(" canCreateOrUpdateEnvironment: ").append(toIndentedString(canCreateOrUpdateEnvironment)).append("\n"); + sb.append(" canDeleteEnvironment: ").append(toIndentedString(canDeleteEnvironment)).append("\n"); + sb.append(" canCreateOrUpdateSetting: ").append(toIndentedString(canCreateOrUpdateSetting)).append("\n"); + sb.append(" canTagSetting: ").append(toIndentedString(canTagSetting)).append("\n"); + sb.append(" canDeleteSetting: ").append(toIndentedString(canDeleteSetting)).append("\n"); + sb.append(" canCreateOrUpdateTag: ").append(toIndentedString(canCreateOrUpdateTag)).append("\n"); + sb.append(" canDeleteTag: ").append(toIndentedString(canDeleteTag)).append("\n"); + sb.append(" canManageWebhook: ").append(toIndentedString(canManageWebhook)).append("\n"); + sb.append(" canUseExportImport: ").append(toIndentedString(canUseExportImport)).append("\n"); + sb.append(" canManageProductPreferences: ").append(toIndentedString(canManageProductPreferences)).append("\n"); + sb.append(" canManageIntegrations: ").append(toIndentedString(canManageIntegrations)).append("\n"); + sb.append(" canViewSdkKey: ").append(toIndentedString(canViewSdkKey)).append("\n"); + sb.append(" canRotateSdkKey: ").append(toIndentedString(canRotateSdkKey)).append("\n"); + sb.append(" canCreateOrUpdateSegments: ").append(toIndentedString(canCreateOrUpdateSegments)).append("\n"); + sb.append(" canDeleteSegments: ").append(toIndentedString(canDeleteSegments)).append("\n"); + sb.append(" canViewProductAuditLog: ").append(toIndentedString(canViewProductAuditLog)).append("\n"); + sb.append(" canViewProductStatistics: ").append(toIndentedString(canViewProductStatistics)).append("\n"); + sb.append(" canDisable2FA: ").append(toIndentedString(canDisable2FA)).append("\n"); + sb.append(" accessType: ").append(toIndentedString(accessType)).append("\n"); + sb.append(" newEnvironmentAccessType: ").append(toIndentedString(newEnvironmentAccessType)).append("\n"); + sb.append(" environmentAccesses: ").append(toIndentedString(environmentAccesses)).append("\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permissionGroupId"); + openapiFields.add("name"); + openapiFields.add("canManageMembers"); + openapiFields.add("canCreateOrUpdateConfig"); + openapiFields.add("canDeleteConfig"); + openapiFields.add("canCreateOrUpdateEnvironment"); + openapiFields.add("canDeleteEnvironment"); + openapiFields.add("canCreateOrUpdateSetting"); + openapiFields.add("canTagSetting"); + openapiFields.add("canDeleteSetting"); + openapiFields.add("canCreateOrUpdateTag"); + openapiFields.add("canDeleteTag"); + openapiFields.add("canManageWebhook"); + openapiFields.add("canUseExportImport"); + openapiFields.add("canManageProductPreferences"); + openapiFields.add("canManageIntegrations"); + openapiFields.add("canViewSdkKey"); + openapiFields.add("canRotateSdkKey"); + openapiFields.add("canCreateOrUpdateSegments"); + openapiFields.add("canDeleteSegments"); + openapiFields.add("canViewProductAuditLog"); + openapiFields.add("canViewProductStatistics"); + openapiFields.add("canDisable2FA"); + openapiFields.add("accessType"); + openapiFields.add("newEnvironmentAccessType"); + openapiFields.add("environmentAccesses"); + openapiFields.add("product"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PermissionGroupModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PermissionGroupModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PermissionGroupModel is not found in the empty JSON string", PermissionGroupModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - // validate the optional field `accessType` - if (jsonObj.get("accessType") != null && !jsonObj.get("accessType").isJsonNull()) { - AccessType.validateJsonElement(jsonObj.get("accessType")); - } - // validate the optional field `newEnvironmentAccessType` - if (jsonObj.get("newEnvironmentAccessType") != null - && !jsonObj.get("newEnvironmentAccessType").isJsonNull()) { - EnvironmentAccessType.validateJsonElement(jsonObj.get("newEnvironmentAccessType")); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `accessType` + if (jsonObj.get("accessType") != null && !jsonObj.get("accessType").isJsonNull()) { + AccessType.validateJsonElement(jsonObj.get("accessType")); + } + // validate the optional field `newEnvironmentAccessType` + if (jsonObj.get("newEnvironmentAccessType") != null && !jsonObj.get("newEnvironmentAccessType").isJsonNull()) { + EnvironmentAccessType.validateJsonElement(jsonObj.get("newEnvironmentAccessType")); + } + if (jsonObj.get("environmentAccesses") != null && !jsonObj.get("environmentAccesses").isJsonNull()) { + JsonArray jsonArrayenvironmentAccesses = jsonObj.getAsJsonArray("environmentAccesses"); + if (jsonArrayenvironmentAccesses != null) { + // ensure the json data is an array + if (!jsonObj.get("environmentAccesses").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentAccesses` to be an array in the JSON string but got `%s`", jsonObj.get("environmentAccesses").toString())); + } + + // validate the optional field `environmentAccesses` (array) + for (int i = 0; i < jsonArrayenvironmentAccesses.size(); i++) { + EnvironmentAccessModel.validateJsonElement(jsonArrayenvironmentAccesses.get(i)); + }; } - if (jsonObj.get("environmentAccesses") != null - && !jsonObj.get("environmentAccesses").isJsonNull()) { - JsonArray jsonArrayenvironmentAccesses = jsonObj.getAsJsonArray("environmentAccesses"); - if (jsonArrayenvironmentAccesses != null) { - // ensure the json data is an array - if (!jsonObj.get("environmentAccesses").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentAccesses` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("environmentAccesses").toString())); - } - - // validate the optional field `environmentAccesses` (array) - for (int i = 0; i < jsonArrayenvironmentAccesses.size(); i++) { - EnvironmentAccessModel.validateJsonElement(jsonArrayenvironmentAccesses.get(i)); - } - ; - } - } - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - ProductModel.validateJsonElement(jsonObj.get("product")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!PermissionGroupModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'PermissionGroupModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(PermissionGroupModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, PermissionGroupModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public PermissionGroupModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of PermissionGroupModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of PermissionGroupModel - * @throws IOException if the JSON string is invalid with respect to PermissionGroupModel - */ - public static PermissionGroupModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, PermissionGroupModel.class); - } - - /** - * Convert an instance of PermissionGroupModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductModel.validateJsonElement(jsonObj.get("product")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PermissionGroupModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PermissionGroupModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PermissionGroupModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PermissionGroupModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PermissionGroupModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PermissionGroupModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PermissionGroupModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of PermissionGroupModel + * @throws IOException if the JSON string is invalid with respect to PermissionGroupModel + */ + public static PermissionGroupModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PermissionGroupModel.class); + } + + /** + * Convert an instance of PermissionGroupModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/PreferencesModel.java b/src/main/java/com/configcat/publicapi/java/client/model/PreferencesModel.java index d0218a5..b56ab8f 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/PreferencesModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/PreferencesModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,366 +10,421 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.KeyGenerationMode; +import com.configcat.publicapi.java.client.model.ReasonRequiredEnvironmentModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** PreferencesModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class PreferencesModel { - public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; - - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) - private Boolean reasonRequired; - - public static final String SERIALIZED_NAME_KEY_GENERATION_MODE = "keyGenerationMode"; - - @SerializedName(SERIALIZED_NAME_KEY_GENERATION_MODE) - private KeyGenerationMode keyGenerationMode; - - public static final String SERIALIZED_NAME_SHOW_VARIATION_ID = "showVariationId"; - - @SerializedName(SERIALIZED_NAME_SHOW_VARIATION_ID) - private Boolean showVariationId; - - public static final String SERIALIZED_NAME_REASON_REQUIRED_ENVIRONMENTS = - "reasonRequiredEnvironments"; - - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED_ENVIRONMENTS) - private List reasonRequiredEnvironments; - - public static final String SERIALIZED_NAME_MANDATORY_SETTING_HINT = "mandatorySettingHint"; - - @SerializedName(SERIALIZED_NAME_MANDATORY_SETTING_HINT) - private Boolean mandatorySettingHint; - - public PreferencesModel() {} - - public PreferencesModel reasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - return this; - } - - /** - * Indicates that a mandatory note required for saving and publishing. - * - * @return reasonRequired - */ - @javax.annotation.Nullable - public Boolean getReasonRequired() { - return reasonRequired; - } - - public void setReasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - } - - public PreferencesModel keyGenerationMode(KeyGenerationMode keyGenerationMode) { - this.keyGenerationMode = keyGenerationMode; - return this; - } - - /** - * Get keyGenerationMode - * - * @return keyGenerationMode - */ - @javax.annotation.Nullable - public KeyGenerationMode getKeyGenerationMode() { - return keyGenerationMode; - } - - public void setKeyGenerationMode(KeyGenerationMode keyGenerationMode) { - this.keyGenerationMode = keyGenerationMode; - } - - public PreferencesModel showVariationId(Boolean showVariationId) { - this.showVariationId = showVariationId; - return this; - } - /** - * Indicates whether a variation ID's must be shown on the ConfigCat Dashboard. - * - * @return showVariationId - */ - @javax.annotation.Nullable - public Boolean getShowVariationId() { - return showVariationId; - } - - public void setShowVariationId(Boolean showVariationId) { - this.showVariationId = showVariationId; - } - - public PreferencesModel reasonRequiredEnvironments( - List reasonRequiredEnvironments) { - this.reasonRequiredEnvironments = reasonRequiredEnvironments; - return this; - } - - public PreferencesModel addReasonRequiredEnvironmentsItem( - ReasonRequiredEnvironmentModel reasonRequiredEnvironmentsItem) { - if (this.reasonRequiredEnvironments == null) { - this.reasonRequiredEnvironments = new ArrayList<>(); - } - this.reasonRequiredEnvironments.add(reasonRequiredEnvironmentsItem); - return this; - } - - /** - * List of Environments where mandatory note must be set before saving and publishing. - * - * @return reasonRequiredEnvironments - */ - @javax.annotation.Nullable - public List getReasonRequiredEnvironments() { - return reasonRequiredEnvironments; - } - - public void setReasonRequiredEnvironments( - List reasonRequiredEnvironments) { - this.reasonRequiredEnvironments = reasonRequiredEnvironments; - } - - public PreferencesModel mandatorySettingHint(Boolean mandatorySettingHint) { - this.mandatorySettingHint = mandatorySettingHint; - return this; - } - - /** - * Indicates whether Feature flags and Settings must have a hint. - * - * @return mandatorySettingHint - */ - @javax.annotation.Nullable - public Boolean getMandatorySettingHint() { - return mandatorySettingHint; - } +import com.configcat.publicapi.java.client.JSON; - public void setMandatorySettingHint(Boolean mandatorySettingHint) { - this.mandatorySettingHint = mandatorySettingHint; +/** + * PreferencesModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class PreferencesModel { + public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) + private Boolean reasonRequired; + + public static final String SERIALIZED_NAME_KEY_GENERATION_MODE = "keyGenerationMode"; + @SerializedName(SERIALIZED_NAME_KEY_GENERATION_MODE) + private KeyGenerationMode keyGenerationMode; + + public static final String SERIALIZED_NAME_SHOW_VARIATION_ID = "showVariationId"; + @SerializedName(SERIALIZED_NAME_SHOW_VARIATION_ID) + private Boolean showVariationId; + + public static final String SERIALIZED_NAME_REASON_REQUIRED_ENVIRONMENTS = "reasonRequiredEnvironments"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED_ENVIRONMENTS) + private List reasonRequiredEnvironments; + + public static final String SERIALIZED_NAME_MANDATORY_SETTING_HINT = "mandatorySettingHint"; + @SerializedName(SERIALIZED_NAME_MANDATORY_SETTING_HINT) + private Boolean mandatorySettingHint; + + public PreferencesModel() { + } + + public PreferencesModel reasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + return this; + } + + /** + * Indicates that a mandatory note required for saving and publishing. + * @return reasonRequired + */ + @javax.annotation.Nullable + public Boolean getReasonRequired() { + return reasonRequired; + } + + public void setReasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + } + + + public PreferencesModel keyGenerationMode(KeyGenerationMode keyGenerationMode) { + this.keyGenerationMode = keyGenerationMode; + return this; + } + + /** + * Get keyGenerationMode + * @return keyGenerationMode + */ + @javax.annotation.Nullable + public KeyGenerationMode getKeyGenerationMode() { + return keyGenerationMode; + } + + public void setKeyGenerationMode(KeyGenerationMode keyGenerationMode) { + this.keyGenerationMode = keyGenerationMode; + } + + + public PreferencesModel showVariationId(Boolean showVariationId) { + this.showVariationId = showVariationId; + return this; + } + + /** + * Indicates whether a variation ID's must be shown on the ConfigCat Dashboard. + * @return showVariationId + */ + @javax.annotation.Nullable + public Boolean getShowVariationId() { + return showVariationId; + } + + public void setShowVariationId(Boolean showVariationId) { + this.showVariationId = showVariationId; + } + + + public PreferencesModel reasonRequiredEnvironments(List reasonRequiredEnvironments) { + this.reasonRequiredEnvironments = reasonRequiredEnvironments; + return this; + } + + public PreferencesModel addReasonRequiredEnvironmentsItem(ReasonRequiredEnvironmentModel reasonRequiredEnvironmentsItem) { + if (this.reasonRequiredEnvironments == null) { + this.reasonRequiredEnvironments = new ArrayList<>(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PreferencesModel preferencesModel = (PreferencesModel) o; - return Objects.equals(this.reasonRequired, preferencesModel.reasonRequired) - && Objects.equals(this.keyGenerationMode, preferencesModel.keyGenerationMode) - && Objects.equals(this.showVariationId, preferencesModel.showVariationId) - && Objects.equals( - this.reasonRequiredEnvironments, - preferencesModel.reasonRequiredEnvironments) - && Objects.equals(this.mandatorySettingHint, preferencesModel.mandatorySettingHint); + this.reasonRequiredEnvironments.add(reasonRequiredEnvironmentsItem); + return this; + } + + /** + * List of Environments where mandatory note must be set before saving and publishing. + * @return reasonRequiredEnvironments + */ + @javax.annotation.Nullable + public List getReasonRequiredEnvironments() { + return reasonRequiredEnvironments; + } + + public void setReasonRequiredEnvironments(List reasonRequiredEnvironments) { + this.reasonRequiredEnvironments = reasonRequiredEnvironments; + } + + + public PreferencesModel mandatorySettingHint(Boolean mandatorySettingHint) { + this.mandatorySettingHint = mandatorySettingHint; + return this; + } + + /** + * Indicates whether Feature flags and Settings must have a hint. + * @return mandatorySettingHint + */ + @javax.annotation.Nullable + public Boolean getMandatorySettingHint() { + return mandatorySettingHint; + } + + public void setMandatorySettingHint(Boolean mandatorySettingHint) { + this.mandatorySettingHint = mandatorySettingHint; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PreferencesModel instance itself + */ + public PreferencesModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash( - reasonRequired, - keyGenerationMode, - showVariationId, - reasonRequiredEnvironments, - mandatorySettingHint); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PreferencesModel {\n"); - sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); - sb.append(" keyGenerationMode: ") - .append(toIndentedString(keyGenerationMode)) - .append("\n"); - sb.append(" showVariationId: ").append(toIndentedString(showVariationId)).append("\n"); - sb.append(" reasonRequiredEnvironments: ") - .append(toIndentedString(reasonRequiredEnvironments)) - .append("\n"); - sb.append(" mandatorySettingHint: ") - .append(toIndentedString(mandatorySettingHint)) - .append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + PreferencesModel preferencesModel = (PreferencesModel) o; + return Objects.equals(this.reasonRequired, preferencesModel.reasonRequired) && + Objects.equals(this.keyGenerationMode, preferencesModel.keyGenerationMode) && + Objects.equals(this.showVariationId, preferencesModel.showVariationId) && + Objects.equals(this.reasonRequiredEnvironments, preferencesModel.reasonRequiredEnvironments) && + Objects.equals(this.mandatorySettingHint, preferencesModel.mandatorySettingHint)&& + Objects.equals(this.additionalProperties, preferencesModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(reasonRequired, keyGenerationMode, showVariationId, reasonRequiredEnvironments, mandatorySettingHint, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("reasonRequired"); - openapiFields.add("keyGenerationMode"); - openapiFields.add("showVariationId"); - openapiFields.add("reasonRequiredEnvironments"); - openapiFields.add("mandatorySettingHint"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PreferencesModel {\n"); + sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); + sb.append(" keyGenerationMode: ").append(toIndentedString(keyGenerationMode)).append("\n"); + sb.append(" showVariationId: ").append(toIndentedString(showVariationId)).append("\n"); + sb.append(" reasonRequiredEnvironments: ").append(toIndentedString(reasonRequiredEnvironments)).append("\n"); + sb.append(" mandatorySettingHint: ").append(toIndentedString(mandatorySettingHint)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to PreferencesModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!PreferencesModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in PreferencesModel is not found in the" - + " empty JSON string", - PreferencesModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PreferencesModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `PreferencesModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reasonRequired"); + openapiFields.add("keyGenerationMode"); + openapiFields.add("showVariationId"); + openapiFields.add("reasonRequiredEnvironments"); + openapiFields.add("mandatorySettingHint"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PreferencesModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PreferencesModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PreferencesModel is not found in the empty JSON string", PreferencesModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `keyGenerationMode` - if (jsonObj.get("keyGenerationMode") != null - && !jsonObj.get("keyGenerationMode").isJsonNull()) { - KeyGenerationMode.validateJsonElement(jsonObj.get("keyGenerationMode")); - } - if (jsonObj.get("reasonRequiredEnvironments") != null - && !jsonObj.get("reasonRequiredEnvironments").isJsonNull()) { - JsonArray jsonArrayreasonRequiredEnvironments = - jsonObj.getAsJsonArray("reasonRequiredEnvironments"); - if (jsonArrayreasonRequiredEnvironments != null) { - // ensure the json data is an array - if (!jsonObj.get("reasonRequiredEnvironments").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `reasonRequiredEnvironments` to be an" - + " array in the JSON string but got `%s`", - jsonObj.get("reasonRequiredEnvironments").toString())); - } - - // validate the optional field `reasonRequiredEnvironments` (array) - for (int i = 0; i < jsonArrayreasonRequiredEnvironments.size(); i++) { - ReasonRequiredEnvironmentModel.validateJsonElement( - jsonArrayreasonRequiredEnvironments.get(i)); - } - ; - } + // validate the optional field `keyGenerationMode` + if (jsonObj.get("keyGenerationMode") != null && !jsonObj.get("keyGenerationMode").isJsonNull()) { + KeyGenerationMode.validateJsonElement(jsonObj.get("keyGenerationMode")); + } + if (jsonObj.get("reasonRequiredEnvironments") != null && !jsonObj.get("reasonRequiredEnvironments").isJsonNull()) { + JsonArray jsonArrayreasonRequiredEnvironments = jsonObj.getAsJsonArray("reasonRequiredEnvironments"); + if (jsonArrayreasonRequiredEnvironments != null) { + // ensure the json data is an array + if (!jsonObj.get("reasonRequiredEnvironments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `reasonRequiredEnvironments` to be an array in the JSON string but got `%s`", jsonObj.get("reasonRequiredEnvironments").toString())); + } + + // validate the optional field `reasonRequiredEnvironments` (array) + for (int i = 0; i < jsonArrayreasonRequiredEnvironments.size(); i++) { + ReasonRequiredEnvironmentModel.validateJsonElement(jsonArrayreasonRequiredEnvironments.get(i)); + }; } - } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!PreferencesModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'PreferencesModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(PreferencesModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, PreferencesModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public PreferencesModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of PreferencesModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of PreferencesModel - * @throws IOException if the JSON string is invalid with respect to PreferencesModel - */ - public static PreferencesModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, PreferencesModel.class); - } - - /** - * Convert an instance of PreferencesModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PreferencesModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PreferencesModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PreferencesModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PreferencesModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PreferencesModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PreferencesModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of PreferencesModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of PreferencesModel + * @throws IOException if the JSON string is invalid with respect to PreferencesModel + */ + public static PreferencesModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PreferencesModel.class); + } + + /** + * Convert an instance of PreferencesModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/PrerequisiteComparator.java b/src/main/java/com/configcat/publicapi/java/client/model/PrerequisiteComparator.java index ac7c163..9c7eaac 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/PrerequisiteComparator.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/PrerequisiteComparator.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,63 +10,69 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Prerequisite flag comparison operator used during the evaluation process. */ +/** + * Prerequisite flag comparison operator used during the evaluation process. + */ @JsonAdapter(PrerequisiteComparator.Adapter.class) public enum PrerequisiteComparator { - EQUALS("equals"), + + EQUALS("equals"), + + DOES_NOT_EQUAL("doesNotEqual"); - DOES_NOT_EQUAL("doesNotEqual"); + private String value; - private String value; + PrerequisiteComparator(String value) { + this.value = value; + } - PrerequisiteComparator(String value) { - this.value = value; - } + public String getValue() { + return value; + } - public String getValue() { - return value; - } + @Override + public String toString() { + return String.valueOf(value); + } - @Override - public String toString() { - return String.valueOf(value); + public static PrerequisiteComparator fromValue(String value) { + for (PrerequisiteComparator b : PrerequisiteComparator.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static PrerequisiteComparator fromValue(String value) { - for (PrerequisiteComparator b : PrerequisiteComparator.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final PrerequisiteComparator enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final PrerequisiteComparator enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public PrerequisiteComparator read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return PrerequisiteComparator.fromValue(value); - } + @Override + public PrerequisiteComparator read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PrerequisiteComparator.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - PrerequisiteComparator.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PrerequisiteComparator.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/PrerequisiteFlagConditionModel.java b/src/main/java/com/configcat/publicapi/java/client/model/PrerequisiteFlagConditionModel.java index 3e3afc2..f134e04 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/PrerequisiteFlagConditionModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/PrerequisiteFlagConditionModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,272 +10,343 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.PrerequisiteComparator; +import com.configcat.publicapi.java.client.model.ValueModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** Describes a condition that is based on a prerequisite flag. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class PrerequisiteFlagConditionModel { - public static final String SERIALIZED_NAME_PREREQUISITE_SETTING_ID = "prerequisiteSettingId"; - - @SerializedName(SERIALIZED_NAME_PREREQUISITE_SETTING_ID) - private Integer prerequisiteSettingId; - - public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; - - @SerializedName(SERIALIZED_NAME_COMPARATOR) - private PrerequisiteComparator comparator; - - public static final String SERIALIZED_NAME_PREREQUISITE_COMPARISON_VALUE = - "prerequisiteComparisonValue"; - - @SerializedName(SERIALIZED_NAME_PREREQUISITE_COMPARISON_VALUE) - private ValueModel prerequisiteComparisonValue; - - public PrerequisiteFlagConditionModel() {} - - public PrerequisiteFlagConditionModel prerequisiteSettingId(Integer prerequisiteSettingId) { - this.prerequisiteSettingId = prerequisiteSettingId; - return this; - } - - /** - * The prerequisite flag's identifier. - * - * @return prerequisiteSettingId - */ - @javax.annotation.Nonnull - public Integer getPrerequisiteSettingId() { - return prerequisiteSettingId; - } - - public void setPrerequisiteSettingId(Integer prerequisiteSettingId) { - this.prerequisiteSettingId = prerequisiteSettingId; - } - - public PrerequisiteFlagConditionModel comparator(PrerequisiteComparator comparator) { - this.comparator = comparator; - return this; - } - - /** - * Get comparator - * - * @return comparator - */ - @javax.annotation.Nonnull - public PrerequisiteComparator getComparator() { - return comparator; - } - - public void setComparator(PrerequisiteComparator comparator) { - this.comparator = comparator; - } +import com.configcat.publicapi.java.client.JSON; - public PrerequisiteFlagConditionModel prerequisiteComparisonValue( - ValueModel prerequisiteComparisonValue) { - this.prerequisiteComparisonValue = prerequisiteComparisonValue; - return this; +/** + * Describes a condition that is based on a prerequisite flag. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class PrerequisiteFlagConditionModel { + public static final String SERIALIZED_NAME_PREREQUISITE_SETTING_ID = "prerequisiteSettingId"; + @SerializedName(SERIALIZED_NAME_PREREQUISITE_SETTING_ID) + private Integer prerequisiteSettingId; + + public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; + @SerializedName(SERIALIZED_NAME_COMPARATOR) + private PrerequisiteComparator comparator; + + public static final String SERIALIZED_NAME_PREREQUISITE_COMPARISON_VALUE = "prerequisiteComparisonValue"; + @SerializedName(SERIALIZED_NAME_PREREQUISITE_COMPARISON_VALUE) + private ValueModel prerequisiteComparisonValue; + + public PrerequisiteFlagConditionModel() { + } + + public PrerequisiteFlagConditionModel prerequisiteSettingId(Integer prerequisiteSettingId) { + this.prerequisiteSettingId = prerequisiteSettingId; + return this; + } + + /** + * The prerequisite flag's identifier. + * @return prerequisiteSettingId + */ + @javax.annotation.Nonnull + public Integer getPrerequisiteSettingId() { + return prerequisiteSettingId; + } + + public void setPrerequisiteSettingId(Integer prerequisiteSettingId) { + this.prerequisiteSettingId = prerequisiteSettingId; + } + + + public PrerequisiteFlagConditionModel comparator(PrerequisiteComparator comparator) { + this.comparator = comparator; + return this; + } + + /** + * Get comparator + * @return comparator + */ + @javax.annotation.Nonnull + public PrerequisiteComparator getComparator() { + return comparator; + } + + public void setComparator(PrerequisiteComparator comparator) { + this.comparator = comparator; + } + + + public PrerequisiteFlagConditionModel prerequisiteComparisonValue(ValueModel prerequisiteComparisonValue) { + this.prerequisiteComparisonValue = prerequisiteComparisonValue; + return this; + } + + /** + * Get prerequisiteComparisonValue + * @return prerequisiteComparisonValue + */ + @javax.annotation.Nonnull + public ValueModel getPrerequisiteComparisonValue() { + return prerequisiteComparisonValue; + } + + public void setPrerequisiteComparisonValue(ValueModel prerequisiteComparisonValue) { + this.prerequisiteComparisonValue = prerequisiteComparisonValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the PrerequisiteFlagConditionModel instance itself + */ + public PrerequisiteFlagConditionModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - /** - * Get prerequisiteComparisonValue - * - * @return prerequisiteComparisonValue - */ - @javax.annotation.Nonnull - public ValueModel getPrerequisiteComparisonValue() { - return prerequisiteComparisonValue; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - public void setPrerequisiteComparisonValue(ValueModel prerequisiteComparisonValue) { - this.prerequisiteComparisonValue = prerequisiteComparisonValue; - } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - PrerequisiteFlagConditionModel prerequisiteFlagConditionModel = - (PrerequisiteFlagConditionModel) o; - return Objects.equals( - this.prerequisiteSettingId, - prerequisiteFlagConditionModel.prerequisiteSettingId) - && Objects.equals(this.comparator, prerequisiteFlagConditionModel.comparator) - && Objects.equals( - this.prerequisiteComparisonValue, - prerequisiteFlagConditionModel.prerequisiteComparisonValue); - } - - @Override - public int hashCode() { - return Objects.hash(prerequisiteSettingId, comparator, prerequisiteComparisonValue); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class PrerequisiteFlagConditionModel {\n"); - sb.append(" prerequisiteSettingId: ") - .append(toIndentedString(prerequisiteSettingId)) - .append("\n"); - sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); - sb.append(" prerequisiteComparisonValue: ") - .append(toIndentedString(prerequisiteComparisonValue)) - .append("\n"); - sb.append("}"); - return sb.toString(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("prerequisiteSettingId"); - openapiFields.add("comparator"); - openapiFields.add("prerequisiteComparisonValue"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("prerequisiteSettingId"); - openapiRequiredFields.add("comparator"); - openapiRequiredFields.add("prerequisiteComparisonValue"); + PrerequisiteFlagConditionModel prerequisiteFlagConditionModel = (PrerequisiteFlagConditionModel) o; + return Objects.equals(this.prerequisiteSettingId, prerequisiteFlagConditionModel.prerequisiteSettingId) && + Objects.equals(this.comparator, prerequisiteFlagConditionModel.comparator) && + Objects.equals(this.prerequisiteComparisonValue, prerequisiteFlagConditionModel.prerequisiteComparisonValue)&& + Objects.equals(this.additionalProperties, prerequisiteFlagConditionModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(prerequisiteSettingId, comparator, prerequisiteComparisonValue, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrerequisiteFlagConditionModel {\n"); + sb.append(" prerequisiteSettingId: ").append(toIndentedString(prerequisiteSettingId)).append("\n"); + sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); + sb.append(" prerequisiteComparisonValue: ").append(toIndentedString(prerequisiteComparisonValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * PrerequisiteFlagConditionModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!PrerequisiteFlagConditionModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in PrerequisiteFlagConditionModel is not" - + " found in the empty JSON string", - PrerequisiteFlagConditionModel.openapiRequiredFields.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("prerequisiteSettingId"); + openapiFields.add("comparator"); + openapiFields.add("prerequisiteComparisonValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("prerequisiteSettingId"); + openapiRequiredFields.add("comparator"); + openapiRequiredFields.add("prerequisiteComparisonValue"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PrerequisiteFlagConditionModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PrerequisiteFlagConditionModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PrerequisiteFlagConditionModel is not found in the empty JSON string", PrerequisiteFlagConditionModel.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!PrerequisiteFlagConditionModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `PrerequisiteFlagConditionModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : PrerequisiteFlagConditionModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PrerequisiteFlagConditionModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `comparator` - PrerequisiteComparator.validateJsonElement(jsonObj.get("comparator")); - // validate the required field `prerequisiteComparisonValue` - ValueModel.validateJsonElement(jsonObj.get("prerequisiteComparisonValue")); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!PrerequisiteFlagConditionModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'PrerequisiteFlagConditionModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(PrerequisiteFlagConditionModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, PrerequisiteFlagConditionModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public PrerequisiteFlagConditionModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of PrerequisiteFlagConditionModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of PrerequisiteFlagConditionModel - * @throws IOException if the JSON string is invalid with respect to - * PrerequisiteFlagConditionModel - */ - public static PrerequisiteFlagConditionModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, PrerequisiteFlagConditionModel.class); - } - - /** - * Convert an instance of PrerequisiteFlagConditionModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + // validate the required field `comparator` + PrerequisiteComparator.validateJsonElement(jsonObj.get("comparator")); + // validate the required field `prerequisiteComparisonValue` + ValueModel.validateJsonElement(jsonObj.get("prerequisiteComparisonValue")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PrerequisiteFlagConditionModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PrerequisiteFlagConditionModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PrerequisiteFlagConditionModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PrerequisiteFlagConditionModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public PrerequisiteFlagConditionModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + PrerequisiteFlagConditionModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of PrerequisiteFlagConditionModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of PrerequisiteFlagConditionModel + * @throws IOException if the JSON string is invalid with respect to PrerequisiteFlagConditionModel + */ + public static PrerequisiteFlagConditionModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PrerequisiteFlagConditionModel.class); + } + + /** + * Convert an instance of PrerequisiteFlagConditionModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ProductModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ProductModel.java index 235a27a..2d69f93 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ProductModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ProductModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,368 +10,432 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.OrganizationModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** Details of the Product. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ProductModel { - public static final String SERIALIZED_NAME_ORGANIZATION = "organization"; - - @SerializedName(SERIALIZED_NAME_ORGANIZATION) - private OrganizationModel organization; - - public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; - - @SerializedName(SERIALIZED_NAME_PRODUCT_ID) - private UUID productId; - - public static final String SERIALIZED_NAME_NAME = "name"; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; - - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) - private Boolean reasonRequired; - - public ProductModel() {} - - public ProductModel organization(OrganizationModel organization) { - this.organization = organization; - return this; - } - - /** - * Get organization - * - * @return organization - */ - @javax.annotation.Nullable - public OrganizationModel getOrganization() { - return organization; - } - - public void setOrganization(OrganizationModel organization) { - this.organization = organization; - } - - public ProductModel productId(UUID productId) { - this.productId = productId; - return this; - } - - /** - * Identifier of the Product. - * - * @return productId - */ - @javax.annotation.Nullable - public UUID getProductId() { - return productId; - } - - public void setProductId(UUID productId) { - this.productId = productId; - } - - public ProductModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Product. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } +import com.configcat.publicapi.java.client.JSON; - public ProductModel description(String description) { - this.description = description; - return this; +/** + * Details of the Product. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ProductModel { + public static final String SERIALIZED_NAME_ORGANIZATION = "organization"; + @SerializedName(SERIALIZED_NAME_ORGANIZATION) + private OrganizationModel organization; + + public static final String SERIALIZED_NAME_PRODUCT_ID = "productId"; + @SerializedName(SERIALIZED_NAME_PRODUCT_ID) + private UUID productId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) + private Boolean reasonRequired; + + public ProductModel() { + } + + public ProductModel organization(OrganizationModel organization) { + this.organization = organization; + return this; + } + + /** + * Get organization + * @return organization + */ + @javax.annotation.Nullable + public OrganizationModel getOrganization() { + return organization; + } + + public void setOrganization(OrganizationModel organization) { + this.organization = organization; + } + + + public ProductModel productId(UUID productId) { + this.productId = productId; + return this; + } + + /** + * Identifier of the Product. + * @return productId + */ + @javax.annotation.Nullable + public UUID getProductId() { + return productId; + } + + public void setProductId(UUID productId) { + this.productId = productId; + } + + + public ProductModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Product. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public ProductModel description(String description) { + this.description = description; + return this; + } + + /** + * Description of the Product. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public ProductModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Product represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public ProductModel reasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + return this; + } + + /** + * Determines whether a mandatory reason must be given every time when the Feature Flags or Settings within a Product are saved. + * @return reasonRequired + */ + @javax.annotation.Nullable + public Boolean getReasonRequired() { + return reasonRequired; + } + + public void setReasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ProductModel instance itself + */ + public ProductModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - /** - * Description of the Product. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - public void setDescription(String description) { - this.description = description; - } - public ProductModel order(Integer order) { - this.order = order; - return this; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - /** - * The order of the Product represented on the ConfigCat Dashboard. Determined from an ascending - * sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; + if (o == null || getClass() != o.getClass()) { + return false; } - - public void setOrder(Integer order) { - this.order = order; + ProductModel productModel = (ProductModel) o; + return Objects.equals(this.organization, productModel.organization) && + Objects.equals(this.productId, productModel.productId) && + Objects.equals(this.name, productModel.name) && + Objects.equals(this.description, productModel.description) && + Objects.equals(this.order, productModel.order) && + Objects.equals(this.reasonRequired, productModel.reasonRequired)&& + Objects.equals(this.additionalProperties, productModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(organization, productId, name, description, order, reasonRequired, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public ProductModel reasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - return this; - } - - /** - * Determines whether a mandatory reason must be given every time when the Feature Flags or - * Settings within a Product are saved. - * - * @return reasonRequired - */ - @javax.annotation.Nullable - public Boolean getReasonRequired() { - return reasonRequired; + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ProductModel {\n"); + sb.append(" organization: ").append(toIndentedString(organization)).append("\n"); + sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - public void setReasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ProductModel productModel = (ProductModel) o; - return Objects.equals(this.organization, productModel.organization) - && Objects.equals(this.productId, productModel.productId) - && Objects.equals(this.name, productModel.name) - && Objects.equals(this.description, productModel.description) - && Objects.equals(this.order, productModel.order) - && Objects.equals(this.reasonRequired, productModel.reasonRequired); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(organization, productId, name, description, order, reasonRequired); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ProductModel {\n"); - sb.append(" organization: ").append(toIndentedString(organization)).append("\n"); - sb.append(" productId: ").append(toIndentedString(productId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("organization"); - openapiFields.add("productId"); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("order"); - openapiFields.add("reasonRequired"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ProductModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ProductModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ProductModel is not found in the" - + " empty JSON string", - ProductModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ProductModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ProductModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("organization"); + openapiFields.add("productId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("order"); + openapiFields.add("reasonRequired"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ProductModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ProductModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ProductModel is not found in the empty JSON string", ProductModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `organization` - if (jsonObj.get("organization") != null && !jsonObj.get("organization").isJsonNull()) { - OrganizationModel.validateJsonElement(jsonObj.get("organization")); - } - if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) - && !jsonObj.get("productId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `productId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("productId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ProductModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ProductModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ProductModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ProductModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ProductModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ProductModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ProductModel - * @throws IOException if the JSON string is invalid with respect to ProductModel - */ - public static ProductModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ProductModel.class); - } - - /** - * Convert an instance of ProductModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + // validate the optional field `organization` + if (jsonObj.get("organization") != null && !jsonObj.get("organization").isJsonNull()) { + OrganizationModel.validateJsonElement(jsonObj.get("organization")); + } + if ((jsonObj.get("productId") != null && !jsonObj.get("productId").isJsonNull()) && !jsonObj.get("productId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `productId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("productId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ProductModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ProductModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ProductModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ProductModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ProductModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ProductModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ProductModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ProductModel + * @throws IOException if the JSON string is invalid with respect to ProductModel + */ + public static ProductModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ProductModel.class); + } + + /** + * Convert an instance of ProductModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ReasonRequiredEnvironmentModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ReasonRequiredEnvironmentModel.java index 3d3a2b8..77c15ec 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ReasonRequiredEnvironmentModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ReasonRequiredEnvironmentModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,282 +10,346 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; -/** ReasonRequiredEnvironmentModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ReasonRequiredEnvironmentModel { - public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) - private UUID environmentId; - - public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; - - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) - private Boolean reasonRequired; - - public static final String SERIALIZED_NAME_ENVIRONMENT_NAME = "environmentName"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_NAME) - private String environmentName; - - public ReasonRequiredEnvironmentModel() {} - - public ReasonRequiredEnvironmentModel environmentId(UUID environmentId) { - this.environmentId = environmentId; - return this; - } - - /** - * Identifier of the Environment. - * - * @return environmentId - */ - @javax.annotation.Nullable - public UUID getEnvironmentId() { - return environmentId; - } - - public void setEnvironmentId(UUID environmentId) { - this.environmentId = environmentId; - } - - public ReasonRequiredEnvironmentModel reasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - return this; - } - - /** - * Indicates that a mandatory note is required in this Environment for saving and publishing. - * - * @return reasonRequired - */ - @javax.annotation.Nullable - public Boolean getReasonRequired() { - return reasonRequired; - } - - public void setReasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - } +import com.configcat.publicapi.java.client.JSON; - public ReasonRequiredEnvironmentModel environmentName(String environmentName) { - this.environmentName = environmentName; - return this; +/** + * ReasonRequiredEnvironmentModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ReasonRequiredEnvironmentModel { + public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) + private UUID environmentId; + + public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) + private Boolean reasonRequired; + + public static final String SERIALIZED_NAME_ENVIRONMENT_NAME = "environmentName"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_NAME) + private String environmentName; + + public ReasonRequiredEnvironmentModel() { + } + + public ReasonRequiredEnvironmentModel environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Identifier of the Environment. + * @return environmentId + */ + @javax.annotation.Nullable + public UUID getEnvironmentId() { + return environmentId; + } + + public void setEnvironmentId(UUID environmentId) { + this.environmentId = environmentId; + } + + + public ReasonRequiredEnvironmentModel reasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + return this; + } + + /** + * Indicates that a mandatory note is required in this Environment for saving and publishing. + * @return reasonRequired + */ + @javax.annotation.Nullable + public Boolean getReasonRequired() { + return reasonRequired; + } + + public void setReasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + } + + + public ReasonRequiredEnvironmentModel environmentName(String environmentName) { + this.environmentName = environmentName; + return this; + } + + /** + * Name of the Environment. + * @return environmentName + */ + @javax.annotation.Nullable + public String getEnvironmentName() { + return environmentName; + } + + public void setEnvironmentName(String environmentName) { + this.environmentName = environmentName; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReasonRequiredEnvironmentModel instance itself + */ + public ReasonRequiredEnvironmentModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - /** - * Name of the Environment. - * - * @return environmentName - */ - @javax.annotation.Nullable - public String getEnvironmentName() { - return environmentName; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - public void setEnvironmentName(String environmentName) { - this.environmentName = environmentName; - } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ReasonRequiredEnvironmentModel reasonRequiredEnvironmentModel = - (ReasonRequiredEnvironmentModel) o; - return Objects.equals(this.environmentId, reasonRequiredEnvironmentModel.environmentId) - && Objects.equals( - this.reasonRequired, reasonRequiredEnvironmentModel.reasonRequired) - && Objects.equals( - this.environmentName, reasonRequiredEnvironmentModel.environmentName); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public int hashCode() { - return Objects.hash(environmentId, reasonRequired, environmentName); + ReasonRequiredEnvironmentModel reasonRequiredEnvironmentModel = (ReasonRequiredEnvironmentModel) o; + return Objects.equals(this.environmentId, reasonRequiredEnvironmentModel.environmentId) && + Objects.equals(this.reasonRequired, reasonRequiredEnvironmentModel.reasonRequired) && + Objects.equals(this.environmentName, reasonRequiredEnvironmentModel.environmentName)&& + Objects.equals(this.additionalProperties, reasonRequiredEnvironmentModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(environmentId, reasonRequired, environmentName, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReasonRequiredEnvironmentModel {\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); + sb.append(" environmentName: ").append(toIndentedString(environmentName)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ReasonRequiredEnvironmentModel {\n"); - sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); - sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); - sb.append(" environmentName: ").append(toIndentedString(environmentName)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("environmentId"); - openapiFields.add("reasonRequired"); - openapiFields.add("environmentName"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * ReasonRequiredEnvironmentModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ReasonRequiredEnvironmentModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ReasonRequiredEnvironmentModel is not" - + " found in the empty JSON string", - ReasonRequiredEnvironmentModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ReasonRequiredEnvironmentModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ReasonRequiredEnvironmentModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("environmentId"); + openapiFields.add("reasonRequired"); + openapiFields.add("environmentName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReasonRequiredEnvironmentModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReasonRequiredEnvironmentModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReasonRequiredEnvironmentModel is not found in the empty JSON string", ReasonRequiredEnvironmentModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) - && !jsonObj.get("environmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("environmentId").toString())); - } - if ((jsonObj.get("environmentName") != null && !jsonObj.get("environmentName").isJsonNull()) - && !jsonObj.get("environmentName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentName` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("environmentName").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ReasonRequiredEnvironmentModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ReasonRequiredEnvironmentModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(ReasonRequiredEnvironmentModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ReasonRequiredEnvironmentModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ReasonRequiredEnvironmentModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ReasonRequiredEnvironmentModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ReasonRequiredEnvironmentModel - * @throws IOException if the JSON string is invalid with respect to - * ReasonRequiredEnvironmentModel - */ - public static ReasonRequiredEnvironmentModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ReasonRequiredEnvironmentModel.class); - } - - /** - * Convert an instance of ReasonRequiredEnvironmentModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) && !jsonObj.get("environmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environmentId").toString())); + } + if ((jsonObj.get("environmentName") != null && !jsonObj.get("environmentName").isJsonNull()) && !jsonObj.get("environmentName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environmentName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReasonRequiredEnvironmentModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReasonRequiredEnvironmentModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReasonRequiredEnvironmentModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReasonRequiredEnvironmentModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ReasonRequiredEnvironmentModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReasonRequiredEnvironmentModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ReasonRequiredEnvironmentModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReasonRequiredEnvironmentModel + * @throws IOException if the JSON string is invalid with respect to ReasonRequiredEnvironmentModel + */ + public static ReasonRequiredEnvironmentModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReasonRequiredEnvironmentModel.class); + } + + /** + * Convert an instance of ReasonRequiredEnvironmentModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ReferenceLine.java b/src/main/java/com/configcat/publicapi/java/client/model/ReferenceLine.java index 5e31d38..58be71a 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ReferenceLine.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ReferenceLine.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,248 +10,324 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** Determines a code reference line. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * Determines a code reference line. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class ReferenceLine { - public static final String SERIALIZED_NAME_LINE_TEXT = "lineText"; + public static final String SERIALIZED_NAME_LINE_TEXT = "lineText"; + @SerializedName(SERIALIZED_NAME_LINE_TEXT) + private String lineText; - @SerializedName(SERIALIZED_NAME_LINE_TEXT) - private String lineText; + public static final String SERIALIZED_NAME_LINE_NUMBER = "lineNumber"; + @SerializedName(SERIALIZED_NAME_LINE_NUMBER) + private Integer lineNumber; - public static final String SERIALIZED_NAME_LINE_NUMBER = "lineNumber"; + public ReferenceLine() { + } - @SerializedName(SERIALIZED_NAME_LINE_NUMBER) - private Integer lineNumber; + public ReferenceLine lineText(String lineText) { + this.lineText = lineText; + return this; + } - public ReferenceLine() {} + /** + * The content of the reference line. + * @return lineText + */ + @javax.annotation.Nullable + public String getLineText() { + return lineText; + } - public ReferenceLine lineText(String lineText) { - this.lineText = lineText; - return this; - } + public void setLineText(String lineText) { + this.lineText = lineText; + } - /** - * The content of the reference line. - * - * @return lineText - */ - @javax.annotation.Nullable - public String getLineText() { - return lineText; - } - public void setLineText(String lineText) { - this.lineText = lineText; - } + public ReferenceLine lineNumber(Integer lineNumber) { + this.lineNumber = lineNumber; + return this; + } - public ReferenceLine lineNumber(Integer lineNumber) { - this.lineNumber = lineNumber; - return this; - } + /** + * The line number. + * @return lineNumber + */ + @javax.annotation.Nonnull + public Integer getLineNumber() { + return lineNumber; + } - /** - * The line number. - * - * @return lineNumber - */ - @javax.annotation.Nonnull - public Integer getLineNumber() { - return lineNumber; - } + public void setLineNumber(Integer lineNumber) { + this.lineNumber = lineNumber; + } - public void setLineNumber(Integer lineNumber) { - this.lineNumber = lineNumber; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ReferenceLine referenceLine = (ReferenceLine) o; - return Objects.equals(this.lineText, referenceLine.lineText) - && Objects.equals(this.lineNumber, referenceLine.lineNumber); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReferenceLine instance itself + */ + public ReferenceLine putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(lineText, lineNumber); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReferenceLine referenceLine = (ReferenceLine) o; + return Objects.equals(this.lineText, referenceLine.lineText) && + Objects.equals(this.lineNumber, referenceLine.lineNumber)&& + Objects.equals(this.additionalProperties, referenceLine.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ReferenceLine {\n"); - sb.append(" lineText: ").append(toIndentedString(lineText)).append("\n"); - sb.append(" lineNumber: ").append(toIndentedString(lineNumber)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(lineText, lineNumber, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferenceLine {\n"); + sb.append(" lineText: ").append(toIndentedString(lineText)).append("\n"); + sb.append(" lineNumber: ").append(toIndentedString(lineNumber)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("lineText"); - openapiFields.add("lineNumber"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("lineNumber"); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lineText"); + openapiFields.add("lineNumber"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ReferenceLine - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ReferenceLine.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ReferenceLine is not found in the" - + " empty JSON string", - ReferenceLine.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("lineNumber"); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ReferenceLine.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ReferenceLine` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferenceLine + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferenceLine.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReferenceLine is not found in the empty JSON string", ReferenceLine.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ReferenceLine.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReferenceLine.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("lineText") != null && !jsonObj.get("lineText").isJsonNull()) - && !jsonObj.get("lineText").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lineText` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("lineText").toString())); - } - } + if ((jsonObj.get("lineText") != null && !jsonObj.get("lineText").isJsonNull()) && !jsonObj.get("lineText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lineText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lineText").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ReferenceLine.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ReferenceLine' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ReferenceLine.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ReferenceLine value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ReferenceLine read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferenceLine.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferenceLine' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReferenceLine.class)); - /** - * Create an instance of ReferenceLine given an JSON string - * - * @param jsonString JSON string - * @return An instance of ReferenceLine - * @throws IOException if the JSON string is invalid with respect to ReferenceLine - */ - public static ReferenceLine fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ReferenceLine.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferenceLine value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ReferenceLine read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReferenceLine instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of ReferenceLine to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of ReferenceLine given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferenceLine + * @throws IOException if the JSON string is invalid with respect to ReferenceLine + */ + public static ReferenceLine fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferenceLine.class); + } + + /** + * Convert an instance of ReferenceLine to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ReferenceLines.java b/src/main/java/com/configcat/publicapi/java/client/model/ReferenceLines.java index f47d38e..c1f1458 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ReferenceLines.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ReferenceLines.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,397 +10,455 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ReferenceLine; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** ReferenceLines */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ReferenceLines { - public static final String SERIALIZED_NAME_FILE = "file"; - - @SerializedName(SERIALIZED_NAME_FILE) - private String _file; - - public static final String SERIALIZED_NAME_FILE_URL = "fileUrl"; - @SerializedName(SERIALIZED_NAME_FILE_URL) - private String fileUrl; - - public static final String SERIALIZED_NAME_PRE_LINES = "preLines"; - - @SerializedName(SERIALIZED_NAME_PRE_LINES) - private List preLines; - - public static final String SERIALIZED_NAME_POST_LINES = "postLines"; - - @SerializedName(SERIALIZED_NAME_POST_LINES) - private List postLines; - - public static final String SERIALIZED_NAME_REFERENCE_LINE = "referenceLine"; - - @SerializedName(SERIALIZED_NAME_REFERENCE_LINE) - private ReferenceLine referenceLine; - - public ReferenceLines() {} - - public ReferenceLines _file(String _file) { - this._file = _file; - return this; - } - - /** - * The file's name in where the code reference has been found. (Appears on the ConfigCat - * Dashboard) - * - * @return _file - */ - @javax.annotation.Nonnull - public String getFile() { - return _file; - } - - public void setFile(String _file) { - this._file = _file; - } - - public ReferenceLines fileUrl(String fileUrl) { - this.fileUrl = fileUrl; - return this; - } - - /** - * The file's url. (Used to point to the file on the repository's website) - * - * @return fileUrl - */ - @javax.annotation.Nullable - public String getFileUrl() { - return fileUrl; - } - - public void setFileUrl(String fileUrl) { - this.fileUrl = fileUrl; - } - - public ReferenceLines preLines(List preLines) { - this.preLines = preLines; - return this; - } - - public ReferenceLines addPreLinesItem(ReferenceLine preLinesItem) { - if (this.preLines == null) { - this.preLines = new ArrayList<>(); - } - this.preLines.add(preLinesItem); - return this; - } - - /** - * The lines before the actual reference line. - * - * @return preLines - */ - @javax.annotation.Nullable - public List getPreLines() { - return preLines; - } - - public void setPreLines(List preLines) { - this.preLines = preLines; - } - - public ReferenceLines postLines(List postLines) { - this.postLines = postLines; - return this; - } - - public ReferenceLines addPostLinesItem(ReferenceLine postLinesItem) { - if (this.postLines == null) { - this.postLines = new ArrayList<>(); - } - this.postLines.add(postLinesItem); - return this; - } - - /** - * The lines after the actual reference line. - * - * @return postLines - */ - @javax.annotation.Nullable - public List getPostLines() { - return postLines; - } - - public void setPostLines(List postLines) { - this.postLines = postLines; - } - - public ReferenceLines referenceLine(ReferenceLine referenceLine) { - this.referenceLine = referenceLine; - return this; - } +import com.configcat.publicapi.java.client.JSON; - /** - * Get referenceLine - * - * @return referenceLine - */ - @javax.annotation.Nonnull - public ReferenceLine getReferenceLine() { - return referenceLine; +/** + * ReferenceLines + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ReferenceLines { + public static final String SERIALIZED_NAME_FILE = "file"; + @SerializedName(SERIALIZED_NAME_FILE) + private String _file; + + public static final String SERIALIZED_NAME_FILE_URL = "fileUrl"; + @SerializedName(SERIALIZED_NAME_FILE_URL) + private String fileUrl; + + public static final String SERIALIZED_NAME_PRE_LINES = "preLines"; + @SerializedName(SERIALIZED_NAME_PRE_LINES) + private List preLines; + + public static final String SERIALIZED_NAME_POST_LINES = "postLines"; + @SerializedName(SERIALIZED_NAME_POST_LINES) + private List postLines; + + public static final String SERIALIZED_NAME_REFERENCE_LINE = "referenceLine"; + @SerializedName(SERIALIZED_NAME_REFERENCE_LINE) + private ReferenceLine referenceLine; + + public ReferenceLines() { + } + + public ReferenceLines _file(String _file) { + this._file = _file; + return this; + } + + /** + * The file's name in where the code reference has been found. (Appears on the ConfigCat Dashboard) + * @return _file + */ + @javax.annotation.Nonnull + public String getFile() { + return _file; + } + + public void setFile(String _file) { + this._file = _file; + } + + + public ReferenceLines fileUrl(String fileUrl) { + this.fileUrl = fileUrl; + return this; + } + + /** + * The file's url. (Used to point to the file on the repository's website) + * @return fileUrl + */ + @javax.annotation.Nullable + public String getFileUrl() { + return fileUrl; + } + + public void setFileUrl(String fileUrl) { + this.fileUrl = fileUrl; + } + + + public ReferenceLines preLines(List preLines) { + this.preLines = preLines; + return this; + } + + public ReferenceLines addPreLinesItem(ReferenceLine preLinesItem) { + if (this.preLines == null) { + this.preLines = new ArrayList<>(); } - - public void setReferenceLine(ReferenceLine referenceLine) { - this.referenceLine = referenceLine; + this.preLines.add(preLinesItem); + return this; + } + + /** + * The lines before the actual reference line. + * @return preLines + */ + @javax.annotation.Nullable + public List getPreLines() { + return preLines; + } + + public void setPreLines(List preLines) { + this.preLines = preLines; + } + + + public ReferenceLines postLines(List postLines) { + this.postLines = postLines; + return this; + } + + public ReferenceLines addPostLinesItem(ReferenceLine postLinesItem) { + if (this.postLines == null) { + this.postLines = new ArrayList<>(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ReferenceLines referenceLines = (ReferenceLines) o; - return Objects.equals(this._file, referenceLines._file) - && Objects.equals(this.fileUrl, referenceLines.fileUrl) - && Objects.equals(this.preLines, referenceLines.preLines) - && Objects.equals(this.postLines, referenceLines.postLines) - && Objects.equals(this.referenceLine, referenceLines.referenceLine); + this.postLines.add(postLinesItem); + return this; + } + + /** + * The lines after the actual reference line. + * @return postLines + */ + @javax.annotation.Nullable + public List getPostLines() { + return postLines; + } + + public void setPostLines(List postLines) { + this.postLines = postLines; + } + + + public ReferenceLines referenceLine(ReferenceLine referenceLine) { + this.referenceLine = referenceLine; + return this; + } + + /** + * Get referenceLine + * @return referenceLine + */ + @javax.annotation.Nonnull + public ReferenceLine getReferenceLine() { + return referenceLine; + } + + public void setReferenceLine(ReferenceLine referenceLine) { + this.referenceLine = referenceLine; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReferenceLines instance itself + */ + public ReferenceLines putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(_file, fileUrl, preLines, postLines, referenceLine); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ReferenceLines {\n"); - sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); - sb.append(" fileUrl: ").append(toIndentedString(fileUrl)).append("\n"); - sb.append(" preLines: ").append(toIndentedString(preLines)).append("\n"); - sb.append(" postLines: ").append(toIndentedString(postLines)).append("\n"); - sb.append(" referenceLine: ").append(toIndentedString(referenceLine)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + ReferenceLines referenceLines = (ReferenceLines) o; + return Objects.equals(this._file, referenceLines._file) && + Objects.equals(this.fileUrl, referenceLines.fileUrl) && + Objects.equals(this.preLines, referenceLines.preLines) && + Objects.equals(this.postLines, referenceLines.postLines) && + Objects.equals(this.referenceLine, referenceLines.referenceLine)&& + Objects.equals(this.additionalProperties, referenceLines.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(_file, fileUrl, preLines, postLines, referenceLine, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("file"); - openapiFields.add("fileUrl"); - openapiFields.add("preLines"); - openapiFields.add("postLines"); - openapiFields.add("referenceLine"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("file"); - openapiRequiredFields.add("referenceLine"); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferenceLines {\n"); + sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); + sb.append(" fileUrl: ").append(toIndentedString(fileUrl)).append("\n"); + sb.append(" preLines: ").append(toIndentedString(preLines)).append("\n"); + sb.append(" postLines: ").append(toIndentedString(postLines)).append("\n"); + sb.append(" referenceLine: ").append(toIndentedString(referenceLine)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ReferenceLines - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ReferenceLines.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ReferenceLines is not found in the" - + " empty JSON string", - ReferenceLines.openapiRequiredFields.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("file"); + openapiFields.add("fileUrl"); + openapiFields.add("preLines"); + openapiFields.add("postLines"); + openapiFields.add("referenceLine"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("file"); + openapiRequiredFields.add("referenceLine"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferenceLines + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferenceLines.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReferenceLines is not found in the empty JSON string", ReferenceLines.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ReferenceLines.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ReferenceLines` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ReferenceLines.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReferenceLines.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("file").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `file` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("file").toString())); - } - if ((jsonObj.get("fileUrl") != null && !jsonObj.get("fileUrl").isJsonNull()) - && !jsonObj.get("fileUrl").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `fileUrl` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("fileUrl").toString())); - } - if (jsonObj.get("preLines") != null && !jsonObj.get("preLines").isJsonNull()) { - JsonArray jsonArraypreLines = jsonObj.getAsJsonArray("preLines"); - if (jsonArraypreLines != null) { - // ensure the json data is an array - if (!jsonObj.get("preLines").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `preLines` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("preLines").toString())); - } - - // validate the optional field `preLines` (array) - for (int i = 0; i < jsonArraypreLines.size(); i++) { - ReferenceLine.validateJsonElement(jsonArraypreLines.get(i)); - } - ; - } + if (!jsonObj.get("file").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `file` to be a primitive type in the JSON string but got `%s`", jsonObj.get("file").toString())); + } + if ((jsonObj.get("fileUrl") != null && !jsonObj.get("fileUrl").isJsonNull()) && !jsonObj.get("fileUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileUrl").toString())); + } + if (jsonObj.get("preLines") != null && !jsonObj.get("preLines").isJsonNull()) { + JsonArray jsonArraypreLines = jsonObj.getAsJsonArray("preLines"); + if (jsonArraypreLines != null) { + // ensure the json data is an array + if (!jsonObj.get("preLines").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `preLines` to be an array in the JSON string but got `%s`", jsonObj.get("preLines").toString())); + } + + // validate the optional field `preLines` (array) + for (int i = 0; i < jsonArraypreLines.size(); i++) { + ReferenceLine.validateJsonElement(jsonArraypreLines.get(i)); + }; } - if (jsonObj.get("postLines") != null && !jsonObj.get("postLines").isJsonNull()) { - JsonArray jsonArraypostLines = jsonObj.getAsJsonArray("postLines"); - if (jsonArraypostLines != null) { - // ensure the json data is an array - if (!jsonObj.get("postLines").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `postLines` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("postLines").toString())); - } - - // validate the optional field `postLines` (array) - for (int i = 0; i < jsonArraypostLines.size(); i++) { - ReferenceLine.validateJsonElement(jsonArraypostLines.get(i)); - } - ; - } + } + if (jsonObj.get("postLines") != null && !jsonObj.get("postLines").isJsonNull()) { + JsonArray jsonArraypostLines = jsonObj.getAsJsonArray("postLines"); + if (jsonArraypostLines != null) { + // ensure the json data is an array + if (!jsonObj.get("postLines").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `postLines` to be an array in the JSON string but got `%s`", jsonObj.get("postLines").toString())); + } + + // validate the optional field `postLines` (array) + for (int i = 0; i < jsonArraypostLines.size(); i++) { + ReferenceLine.validateJsonElement(jsonArraypostLines.get(i)); + }; } - // validate the required field `referenceLine` - ReferenceLine.validateJsonElement(jsonObj.get("referenceLine")); - } + } + // validate the required field `referenceLine` + ReferenceLine.validateJsonElement(jsonObj.get("referenceLine")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ReferenceLines.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ReferenceLines' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ReferenceLines.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ReferenceLines value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ReferenceLines read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ReferenceLines given an JSON string - * - * @param jsonString JSON string - * @return An instance of ReferenceLines - * @throws IOException if the JSON string is invalid with respect to ReferenceLines - */ - public static ReferenceLines fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ReferenceLines.class); - } - - /** - * Convert an instance of ReferenceLines to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferenceLines.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferenceLines' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReferenceLines.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferenceLines value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ReferenceLines read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReferenceLines instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ReferenceLines given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferenceLines + * @throws IOException if the JSON string is invalid with respect to ReferenceLines + */ + public static ReferenceLines fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferenceLines.class); + } + + /** + * Convert an instance of ReferenceLines to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ReplaceSettingModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ReplaceSettingModel.java index 884a50f..5aea8be 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ReplaceSettingModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ReplaceSettingModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,331 +10,393 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** ReplaceSettingModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ReplaceSettingModel { - public static final String SERIALIZED_NAME_HINT = "hint"; - @SerializedName(SERIALIZED_NAME_HINT) - private String hint; - - public static final String SERIALIZED_NAME_TAGS = "tags"; - - @SerializedName(SERIALIZED_NAME_TAGS) - private List tags; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public ReplaceSettingModel() {} - - public ReplaceSettingModel hint(String hint) { - this.hint = hint; - return this; - } - - /** - * A short description for the setting, shown on the Dashboard UI. - * - * @return hint - */ - @javax.annotation.Nullable - public String getHint() { - return hint; - } - - public void setHint(String hint) { - this.hint = hint; - } - - public ReplaceSettingModel tags(List tags) { - this.tags = tags; - return this; - } - - public ReplaceSettingModel addTagsItem(Long tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList<>(); - } - this.tags.add(tagsItem); - return this; - } - - /** - * The IDs of the tags which are attached to the setting. - * - * @return tags - */ - @javax.annotation.Nullable - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } +import com.configcat.publicapi.java.client.JSON; - public ReplaceSettingModel order(Integer order) { - this.order = order; - return this; +/** + * ReplaceSettingModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ReplaceSettingModel { + public static final String SERIALIZED_NAME_HINT = "hint"; + @SerializedName(SERIALIZED_NAME_HINT) + private String hint; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public ReplaceSettingModel() { + } + + public ReplaceSettingModel hint(String hint) { + this.hint = hint; + return this; + } + + /** + * A short description for the setting, shown on the Dashboard UI. + * @return hint + */ + @javax.annotation.Nullable + public String getHint() { + return hint; + } + + public void setHint(String hint) { + this.hint = hint; + } + + + public ReplaceSettingModel tags(List tags) { + this.tags = tags; + return this; + } + + public ReplaceSettingModel addTagsItem(Long tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); } - - /** - * The order of the Setting represented on the ConfigCat Dashboard. Determined from an ascending - * sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; + this.tags.add(tagsItem); + return this; + } + + /** + * The IDs of the tags which are attached to the setting. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + + public ReplaceSettingModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Setting represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public ReplaceSettingModel name(String name) { + this.name = name; + return this; + } + + /** + * The name of the Feature Flag or Setting. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ReplaceSettingModel instance itself + */ + public ReplaceSettingModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public void setOrder(Integer order) { - this.order = order; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - public ReplaceSettingModel name(String name) { - this.name = name; - return this; - } - /** - * The name of the Feature Flag or Setting. - * - * @return name - */ - @javax.annotation.Nonnull - public String getName() { - return name; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public void setName(String name) { - this.name = name; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ReplaceSettingModel replaceSettingModel = (ReplaceSettingModel) o; - return Objects.equals(this.hint, replaceSettingModel.hint) - && Objects.equals(this.tags, replaceSettingModel.tags) - && Objects.equals(this.order, replaceSettingModel.order) - && Objects.equals(this.name, replaceSettingModel.name); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + ReplaceSettingModel replaceSettingModel = (ReplaceSettingModel) o; + return Objects.equals(this.hint, replaceSettingModel.hint) && + Objects.equals(this.tags, replaceSettingModel.tags) && + Objects.equals(this.order, replaceSettingModel.order) && + Objects.equals(this.name, replaceSettingModel.name)&& + Objects.equals(this.additionalProperties, replaceSettingModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(hint, tags, order, name, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(hint, tags, order, name); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReplaceSettingModel {\n"); + sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("hint"); + openapiFields.add("tags"); + openapiFields.add("order"); + openapiFields.add("name"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReplaceSettingModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReplaceSettingModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReplaceSettingModel is not found in the empty JSON string", ReplaceSettingModel.openapiRequiredFields.toString())); } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ReplaceSettingModel {\n"); - sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("hint"); - openapiFields.add("tags"); - openapiFields.add("order"); - openapiFields.add("name"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("name"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ReplaceSettingModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ReplaceSettingModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ReplaceSettingModel is not found in" - + " the empty JSON string", - ReplaceSettingModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ReplaceSettingModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ReplaceSettingModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : ReplaceSettingModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReplaceSettingModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) - && !jsonObj.get("hint").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `hint` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("hint").toString())); - } - // ensure the optional json data is an array if present - if (jsonObj.get("tags") != null - && !jsonObj.get("tags").isJsonNull() - && !jsonObj.get("tags").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `tags` to be an array in the JSON string but got" - + " `%s`", - jsonObj.get("tags").toString())); - } - if (!jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ReplaceSettingModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ReplaceSettingModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ReplaceSettingModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ReplaceSettingModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ReplaceSettingModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of ReplaceSettingModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ReplaceSettingModel - * @throws IOException if the JSON string is invalid with respect to ReplaceSettingModel - */ - public static ReplaceSettingModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ReplaceSettingModel.class); - } - - /** - * Convert an instance of ReplaceSettingModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) && !jsonObj.get("hint").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hint` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hint").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull() && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReplaceSettingModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReplaceSettingModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReplaceSettingModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReplaceSettingModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ReplaceSettingModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReplaceSettingModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ReplaceSettingModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReplaceSettingModel + * @throws IOException if the JSON string is invalid with respect to ReplaceSettingModel + */ + public static ReplaceSettingModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReplaceSettingModel.class); + } + + /** + * Convert an instance of ReplaceSettingModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/RolloutPercentageItemModel.java b/src/main/java/com/configcat/publicapi/java/client/model/RolloutPercentageItemModel.java index 72ea3db..609c4fe 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/RolloutPercentageItemModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/RolloutPercentageItemModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,243 +10,321 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** RolloutPercentageItemModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * RolloutPercentageItemModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class RolloutPercentageItemModel { - public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + public static final String SERIALIZED_NAME_PERCENTAGE = "percentage"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE) + private Long percentage; - @SerializedName(SERIALIZED_NAME_PERCENTAGE) - private Long percentage; + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; - public static final String SERIALIZED_NAME_VALUE = "value"; + public RolloutPercentageItemModel() { + } - @SerializedName(SERIALIZED_NAME_VALUE) - private Object value = null; + public RolloutPercentageItemModel percentage(Long percentage) { + this.percentage = percentage; + return this; + } - public RolloutPercentageItemModel() {} + /** + * The percentage value for the rule. + * @return percentage + */ + @javax.annotation.Nonnull + public Long getPercentage() { + return percentage; + } - public RolloutPercentageItemModel percentage(Long percentage) { - this.percentage = percentage; - return this; - } + public void setPercentage(Long percentage) { + this.percentage = percentage; + } - /** - * The percentage value for the rule. - * - * @return percentage - */ - @javax.annotation.Nonnull - public Long getPercentage() { - return percentage; - } - public void setPercentage(Long percentage) { - this.percentage = percentage; - } + public RolloutPercentageItemModel value(Object value) { + this.value = value; + return this; + } - public RolloutPercentageItemModel value(Object value) { - this.value = value; - return this; - } + /** + * The value to serve when the user falls in the percentage rule. It must respect the setting type. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } - /** - * The value to serve when the user falls in the percentage rule. It must respect the setting - * type. - * - * @return value - */ - @javax.annotation.Nullable - public Object getValue() { - return value; - } + public void setValue(Object value) { + this.value = value; + } - public void setValue(Object value) { - this.value = value; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RolloutPercentageItemModel rolloutPercentageItemModel = (RolloutPercentageItemModel) o; - return Objects.equals(this.percentage, rolloutPercentageItemModel.percentage) - && Objects.equals(this.value, rolloutPercentageItemModel.value); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RolloutPercentageItemModel instance itself + */ + public RolloutPercentageItemModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(percentage, value); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + RolloutPercentageItemModel rolloutPercentageItemModel = (RolloutPercentageItemModel) o; + return Objects.equals(this.percentage, rolloutPercentageItemModel.percentage) && + Objects.equals(this.value, rolloutPercentageItemModel.value)&& + Objects.equals(this.additionalProperties, rolloutPercentageItemModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RolloutPercentageItemModel {\n"); - sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(percentage, value, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RolloutPercentageItemModel {\n"); + sb.append(" percentage: ").append(toIndentedString(percentage)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("percentage"); - openapiFields.add("value"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("percentage"); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("percentage"); + openapiFields.add("value"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to RolloutPercentageItemModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!RolloutPercentageItemModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in RolloutPercentageItemModel is not" - + " found in the empty JSON string", - RolloutPercentageItemModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("percentage"); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RolloutPercentageItemModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `RolloutPercentageItemModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RolloutPercentageItemModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RolloutPercentageItemModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RolloutPercentageItemModel is not found in the empty JSON string", RolloutPercentageItemModel.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : RolloutPercentageItemModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RolloutPercentageItemModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!RolloutPercentageItemModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RolloutPercentageItemModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(RolloutPercentageItemModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, RolloutPercentageItemModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public RolloutPercentageItemModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RolloutPercentageItemModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RolloutPercentageItemModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RolloutPercentageItemModel.class)); - /** - * Create an instance of RolloutPercentageItemModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of RolloutPercentageItemModel - * @throws IOException if the JSON string is invalid with respect to RolloutPercentageItemModel - */ - public static RolloutPercentageItemModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, RolloutPercentageItemModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RolloutPercentageItemModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public RolloutPercentageItemModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RolloutPercentageItemModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of RolloutPercentageItemModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of RolloutPercentageItemModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of RolloutPercentageItemModel + * @throws IOException if the JSON string is invalid with respect to RolloutPercentageItemModel + */ + public static RolloutPercentageItemModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RolloutPercentageItemModel.class); + } + + /** + * Convert an instance of RolloutPercentageItemModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/RolloutRuleComparator.java b/src/main/java/com/configcat/publicapi/java/client/model/RolloutRuleComparator.java index 3a5772c..b7fbb7c 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/RolloutRuleComparator.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/RolloutRuleComparator.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,98 +10,101 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; /** - * The comparison operator the evaluation process must use when it compares the given user - * attribute's value with the comparison value. + * The comparison operator the evaluation process must use when it compares the given user attribute's value with the comparison value. */ @JsonAdapter(RolloutRuleComparator.Adapter.class) public enum RolloutRuleComparator { - IS_ONE_OF("isOneOf"), - - IS_NOT_ONE_OF("isNotOneOf"), - - CONTAINS("contains"), - - DOES_NOT_CONTAIN("doesNotContain"), - - SEM_VER_IS_ONE_OF("semVerIsOneOf"), - - SEM_VER_IS_NOT_ONE_OF("semVerIsNotOneOf"), - - SEM_VER_LESS("semVerLess"), - - SEM_VER_LESS_OR_EQUALS("semVerLessOrEquals"), - - SEM_VER_GREATER("semVerGreater"), - - SEM_VER_GREATER_OR_EQUALS("semVerGreaterOrEquals"), - - NUMBER_EQUALS("numberEquals"), - - NUMBER_DOES_NOT_EQUAL("numberDoesNotEqual"), - - NUMBER_LESS("numberLess"), - - NUMBER_LESS_OR_EQUALS("numberLessOrEquals"), - - NUMBER_GREATER("numberGreater"), - - NUMBER_GREATER_OR_EQUALS("numberGreaterOrEquals"), - - SENSITIVE_IS_ONE_OF("sensitiveIsOneOf"), - - SENSITIVE_IS_NOT_ONE_OF("sensitiveIsNotOneOf"); - - private String value; - - RolloutRuleComparator(String value) { - this.value = value; - } - - public String getValue() { - return value; + + IS_ONE_OF("isOneOf"), + + IS_NOT_ONE_OF("isNotOneOf"), + + CONTAINS("contains"), + + DOES_NOT_CONTAIN("doesNotContain"), + + SEM_VER_IS_ONE_OF("semVerIsOneOf"), + + SEM_VER_IS_NOT_ONE_OF("semVerIsNotOneOf"), + + SEM_VER_LESS("semVerLess"), + + SEM_VER_LESS_OR_EQUALS("semVerLessOrEquals"), + + SEM_VER_GREATER("semVerGreater"), + + SEM_VER_GREATER_OR_EQUALS("semVerGreaterOrEquals"), + + NUMBER_EQUALS("numberEquals"), + + NUMBER_DOES_NOT_EQUAL("numberDoesNotEqual"), + + NUMBER_LESS("numberLess"), + + NUMBER_LESS_OR_EQUALS("numberLessOrEquals"), + + NUMBER_GREATER("numberGreater"), + + NUMBER_GREATER_OR_EQUALS("numberGreaterOrEquals"), + + SENSITIVE_IS_ONE_OF("sensitiveIsOneOf"), + + SENSITIVE_IS_NOT_ONE_OF("sensitiveIsNotOneOf"); + + private String value; + + RolloutRuleComparator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static RolloutRuleComparator fromValue(String value) { + for (RolloutRuleComparator b : RolloutRuleComparator.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); - } - - public static RolloutRuleComparator fromValue(String value) { - for (RolloutRuleComparator b : RolloutRuleComparator.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public void write(final JsonWriter jsonWriter, final RolloutRuleComparator enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final RolloutRuleComparator enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public RolloutRuleComparator read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return RolloutRuleComparator.fromValue(value); - } + @Override + public RolloutRuleComparator read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RolloutRuleComparator.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - RolloutRuleComparator.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RolloutRuleComparator.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/RolloutRuleModel.java b/src/main/java/com/configcat/publicapi/java/client/model/RolloutRuleModel.java index d3d8352..c56ac7c 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/RolloutRuleModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/RolloutRuleModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,383 +10,437 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.RolloutRuleComparator; +import com.configcat.publicapi.java.client.model.SegmentComparator; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** RolloutRuleModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class RolloutRuleModel { - public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) - private String comparisonAttribute; - - public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; - - @SerializedName(SERIALIZED_NAME_COMPARATOR) - private RolloutRuleComparator comparator; - - public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) - private String comparisonValue; - - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) - private Object value = null; - - public static final String SERIALIZED_NAME_SEGMENT_COMPARATOR = "segmentComparator"; - - @SerializedName(SERIALIZED_NAME_SEGMENT_COMPARATOR) - private SegmentComparator segmentComparator; - - public static final String SERIALIZED_NAME_SEGMENT_ID = "segmentId"; - - @SerializedName(SERIALIZED_NAME_SEGMENT_ID) - private UUID segmentId; - - public RolloutRuleModel() {} - - public RolloutRuleModel comparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - return this; - } - - /** - * The user attribute to compare. - * - * @return comparisonAttribute - */ - @javax.annotation.Nullable - public String getComparisonAttribute() { - return comparisonAttribute; - } - - public void setComparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - } - - public RolloutRuleModel comparator(RolloutRuleComparator comparator) { - this.comparator = comparator; - return this; - } - - /** - * Get comparator - * - * @return comparator - */ - @javax.annotation.Nullable - public RolloutRuleComparator getComparator() { - return comparator; - } - - public void setComparator(RolloutRuleComparator comparator) { - this.comparator = comparator; - } - - public RolloutRuleModel comparisonValue(String comparisonValue) { - this.comparisonValue = comparisonValue; - return this; - } - - /** - * The value to compare against. - * - * @return comparisonValue - */ - @javax.annotation.Nullable - public String getComparisonValue() { - return comparisonValue; - } - - public void setComparisonValue(String comparisonValue) { - this.comparisonValue = comparisonValue; - } - - public RolloutRuleModel value(Object value) { - this.value = value; - return this; - } - - /** - * The value to serve when the comparison matches. It must respect the setting type. - * - * @return value - */ - @javax.annotation.Nullable - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - public RolloutRuleModel segmentComparator(SegmentComparator segmentComparator) { - this.segmentComparator = segmentComparator; - return this; - } - - /** - * Get segmentComparator - * - * @return segmentComparator - */ - @javax.annotation.Nullable - public SegmentComparator getSegmentComparator() { - return segmentComparator; - } - - public void setSegmentComparator(SegmentComparator segmentComparator) { - this.segmentComparator = segmentComparator; - } - public RolloutRuleModel segmentId(UUID segmentId) { - this.segmentId = segmentId; - return this; - } - - /** - * The segment to compare against. - * - * @return segmentId - */ - @javax.annotation.Nullable - public UUID getSegmentId() { - return segmentId; - } - - public void setSegmentId(UUID segmentId) { - this.segmentId = segmentId; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RolloutRuleModel rolloutRuleModel = (RolloutRuleModel) o; - return Objects.equals(this.comparisonAttribute, rolloutRuleModel.comparisonAttribute) - && Objects.equals(this.comparator, rolloutRuleModel.comparator) - && Objects.equals(this.comparisonValue, rolloutRuleModel.comparisonValue) - && Objects.equals(this.value, rolloutRuleModel.value) - && Objects.equals(this.segmentComparator, rolloutRuleModel.segmentComparator) - && Objects.equals(this.segmentId, rolloutRuleModel.segmentId); +/** + * RolloutRuleModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class RolloutRuleModel { + public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; + @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) + private String comparisonAttribute; + + public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; + @SerializedName(SERIALIZED_NAME_COMPARATOR) + private RolloutRuleComparator comparator; + + public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; + @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) + private String comparisonValue; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; + + public static final String SERIALIZED_NAME_SEGMENT_COMPARATOR = "segmentComparator"; + @SerializedName(SERIALIZED_NAME_SEGMENT_COMPARATOR) + private SegmentComparator segmentComparator; + + public static final String SERIALIZED_NAME_SEGMENT_ID = "segmentId"; + @SerializedName(SERIALIZED_NAME_SEGMENT_ID) + private UUID segmentId; + + public RolloutRuleModel() { + } + + public RolloutRuleModel comparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + return this; + } + + /** + * The user attribute to compare. + * @return comparisonAttribute + */ + @javax.annotation.Nullable + public String getComparisonAttribute() { + return comparisonAttribute; + } + + public void setComparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + } + + + public RolloutRuleModel comparator(RolloutRuleComparator comparator) { + this.comparator = comparator; + return this; + } + + /** + * Get comparator + * @return comparator + */ + @javax.annotation.Nullable + public RolloutRuleComparator getComparator() { + return comparator; + } + + public void setComparator(RolloutRuleComparator comparator) { + this.comparator = comparator; + } + + + public RolloutRuleModel comparisonValue(String comparisonValue) { + this.comparisonValue = comparisonValue; + return this; + } + + /** + * The value to compare against. + * @return comparisonValue + */ + @javax.annotation.Nullable + public String getComparisonValue() { + return comparisonValue; + } + + public void setComparisonValue(String comparisonValue) { + this.comparisonValue = comparisonValue; + } + + + public RolloutRuleModel value(Object value) { + this.value = value; + return this; + } + + /** + * The value to serve when the comparison matches. It must respect the setting type. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + + public RolloutRuleModel segmentComparator(SegmentComparator segmentComparator) { + this.segmentComparator = segmentComparator; + return this; + } + + /** + * Get segmentComparator + * @return segmentComparator + */ + @javax.annotation.Nullable + public SegmentComparator getSegmentComparator() { + return segmentComparator; + } + + public void setSegmentComparator(SegmentComparator segmentComparator) { + this.segmentComparator = segmentComparator; + } + + + public RolloutRuleModel segmentId(UUID segmentId) { + this.segmentId = segmentId; + return this; + } + + /** + * The segment to compare against. + * @return segmentId + */ + @javax.annotation.Nullable + public UUID getSegmentId() { + return segmentId; + } + + public void setSegmentId(UUID segmentId) { + this.segmentId = segmentId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RolloutRuleModel instance itself + */ + public RolloutRuleModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash( - comparisonAttribute, - comparator, - comparisonValue, - value, - segmentComparator, - segmentId); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RolloutRuleModel {\n"); - sb.append(" comparisonAttribute: ") - .append(toIndentedString(comparisonAttribute)) - .append("\n"); - sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); - sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" segmentComparator: ") - .append(toIndentedString(segmentComparator)) - .append("\n"); - sb.append(" segmentId: ").append(toIndentedString(segmentId)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + RolloutRuleModel rolloutRuleModel = (RolloutRuleModel) o; + return Objects.equals(this.comparisonAttribute, rolloutRuleModel.comparisonAttribute) && + Objects.equals(this.comparator, rolloutRuleModel.comparator) && + Objects.equals(this.comparisonValue, rolloutRuleModel.comparisonValue) && + Objects.equals(this.value, rolloutRuleModel.value) && + Objects.equals(this.segmentComparator, rolloutRuleModel.segmentComparator) && + Objects.equals(this.segmentId, rolloutRuleModel.segmentId)&& + Objects.equals(this.additionalProperties, rolloutRuleModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(comparisonAttribute, comparator, comparisonValue, value, segmentComparator, segmentId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("comparisonAttribute"); - openapiFields.add("comparator"); - openapiFields.add("comparisonValue"); - openapiFields.add("value"); - openapiFields.add("segmentComparator"); - openapiFields.add("segmentId"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RolloutRuleModel {\n"); + sb.append(" comparisonAttribute: ").append(toIndentedString(comparisonAttribute)).append("\n"); + sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); + sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" segmentComparator: ").append(toIndentedString(segmentComparator)).append("\n"); + sb.append(" segmentId: ").append(toIndentedString(segmentId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to RolloutRuleModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!RolloutRuleModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in RolloutRuleModel is not found in the" - + " empty JSON string", - RolloutRuleModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!RolloutRuleModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `RolloutRuleModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("comparisonAttribute"); + openapiFields.add("comparator"); + openapiFields.add("comparisonValue"); + openapiFields.add("value"); + openapiFields.add("segmentComparator"); + openapiFields.add("segmentId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RolloutRuleModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RolloutRuleModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RolloutRuleModel is not found in the empty JSON string", RolloutRuleModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("comparisonAttribute") != null - && !jsonObj.get("comparisonAttribute").isJsonNull()) - && !jsonObj.get("comparisonAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonAttribute` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("comparisonAttribute").toString())); - } - // validate the optional field `comparator` - if (jsonObj.get("comparator") != null && !jsonObj.get("comparator").isJsonNull()) { - RolloutRuleComparator.validateJsonElement(jsonObj.get("comparator")); - } - if ((jsonObj.get("comparisonValue") != null && !jsonObj.get("comparisonValue").isJsonNull()) - && !jsonObj.get("comparisonValue").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonValue` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("comparisonValue").toString())); - } - // validate the optional field `segmentComparator` - if (jsonObj.get("segmentComparator") != null - && !jsonObj.get("segmentComparator").isJsonNull()) { - SegmentComparator.validateJsonElement(jsonObj.get("segmentComparator")); - } - if ((jsonObj.get("segmentId") != null && !jsonObj.get("segmentId").isJsonNull()) - && !jsonObj.get("segmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `segmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("segmentId").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!RolloutRuleModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'RolloutRuleModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(RolloutRuleModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, RolloutRuleModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public RolloutRuleModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of RolloutRuleModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of RolloutRuleModel - * @throws IOException if the JSON string is invalid with respect to RolloutRuleModel - */ - public static RolloutRuleModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, RolloutRuleModel.class); - } - - /** - * Convert an instance of RolloutRuleModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("comparisonAttribute") != null && !jsonObj.get("comparisonAttribute").isJsonNull()) && !jsonObj.get("comparisonAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonAttribute").toString())); + } + // validate the optional field `comparator` + if (jsonObj.get("comparator") != null && !jsonObj.get("comparator").isJsonNull()) { + RolloutRuleComparator.validateJsonElement(jsonObj.get("comparator")); + } + if ((jsonObj.get("comparisonValue") != null && !jsonObj.get("comparisonValue").isJsonNull()) && !jsonObj.get("comparisonValue").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonValue` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonValue").toString())); + } + // validate the optional field `segmentComparator` + if (jsonObj.get("segmentComparator") != null && !jsonObj.get("segmentComparator").isJsonNull()) { + SegmentComparator.validateJsonElement(jsonObj.get("segmentComparator")); + } + if ((jsonObj.get("segmentId") != null && !jsonObj.get("segmentId").isJsonNull()) && !jsonObj.get("segmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `segmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("segmentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RolloutRuleModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RolloutRuleModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RolloutRuleModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RolloutRuleModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public RolloutRuleModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RolloutRuleModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of RolloutRuleModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of RolloutRuleModel + * @throws IOException if the JSON string is invalid with respect to RolloutRuleModel + */ + public static RolloutRuleModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RolloutRuleModel.class); + } + + /** + * Convert an instance of RolloutRuleModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SdkKeysModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SdkKeysModel.java index 5eaed89..86cb5f2 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SdkKeysModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SdkKeysModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,245 +10,319 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** SdkKeysModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * SdkKeysModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class SdkKeysModel { - public static final String SERIALIZED_NAME_PRIMARY = "primary"; + public static final String SERIALIZED_NAME_PRIMARY = "primary"; + @SerializedName(SERIALIZED_NAME_PRIMARY) + private String primary; - @SerializedName(SERIALIZED_NAME_PRIMARY) - private String primary; + public static final String SERIALIZED_NAME_SECONDARY = "secondary"; + @SerializedName(SERIALIZED_NAME_SECONDARY) + private String secondary; - public static final String SERIALIZED_NAME_SECONDARY = "secondary"; + public SdkKeysModel() { + } - @SerializedName(SERIALIZED_NAME_SECONDARY) - private String secondary; + public SdkKeysModel primary(String primary) { + this.primary = primary; + return this; + } - public SdkKeysModel() {} + /** + * The primary SDK key. + * @return primary + */ + @javax.annotation.Nullable + public String getPrimary() { + return primary; + } - public SdkKeysModel primary(String primary) { - this.primary = primary; - return this; - } + public void setPrimary(String primary) { + this.primary = primary; + } - /** - * The primary SDK key. - * - * @return primary - */ - @javax.annotation.Nullable - public String getPrimary() { - return primary; - } - public void setPrimary(String primary) { - this.primary = primary; - } + public SdkKeysModel secondary(String secondary) { + this.secondary = secondary; + return this; + } - public SdkKeysModel secondary(String secondary) { - this.secondary = secondary; - return this; - } + /** + * The secondary SDK key. + * @return secondary + */ + @javax.annotation.Nullable + public String getSecondary() { + return secondary; + } - /** - * The secondary SDK key. - * - * @return secondary - */ - @javax.annotation.Nullable - public String getSecondary() { - return secondary; - } + public void setSecondary(String secondary) { + this.secondary = secondary; + } - public void setSecondary(String secondary) { - this.secondary = secondary; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SdkKeysModel sdkKeysModel = (SdkKeysModel) o; - return Objects.equals(this.primary, sdkKeysModel.primary) - && Objects.equals(this.secondary, sdkKeysModel.secondary); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SdkKeysModel instance itself + */ + public SdkKeysModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(primary, secondary); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + SdkKeysModel sdkKeysModel = (SdkKeysModel) o; + return Objects.equals(this.primary, sdkKeysModel.primary) && + Objects.equals(this.secondary, sdkKeysModel.secondary)&& + Objects.equals(this.additionalProperties, sdkKeysModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SdkKeysModel {\n"); - sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); - sb.append(" secondary: ").append(toIndentedString(secondary)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(primary, secondary, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SdkKeysModel {\n"); + sb.append(" primary: ").append(toIndentedString(primary)).append("\n"); + sb.append(" secondary: ").append(toIndentedString(secondary)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("primary"); - openapiFields.add("secondary"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("primary"); + openapiFields.add("secondary"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SdkKeysModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SdkKeysModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SdkKeysModel is not found in the" - + " empty JSON string", - SdkKeysModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SdkKeysModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SdkKeysModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SdkKeysModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SdkKeysModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SdkKeysModel is not found in the empty JSON string", SdkKeysModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("primary") != null && !jsonObj.get("primary").isJsonNull()) - && !jsonObj.get("primary").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `primary` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("primary").toString())); - } - if ((jsonObj.get("secondary") != null && !jsonObj.get("secondary").isJsonNull()) - && !jsonObj.get("secondary").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `secondary` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("secondary").toString())); - } - } + if ((jsonObj.get("primary") != null && !jsonObj.get("primary").isJsonNull()) && !jsonObj.get("primary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `primary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("primary").toString())); + } + if ((jsonObj.get("secondary") != null && !jsonObj.get("secondary").isJsonNull()) && !jsonObj.get("secondary").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `secondary` to be a primitive type in the JSON string but got `%s`", jsonObj.get("secondary").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SdkKeysModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SdkKeysModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SdkKeysModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SdkKeysModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SdkKeysModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SdkKeysModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SdkKeysModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SdkKeysModel.class)); - /** - * Create an instance of SdkKeysModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SdkKeysModel - * @throws IOException if the JSON string is invalid with respect to SdkKeysModel - */ - public static SdkKeysModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SdkKeysModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SdkKeysModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SdkKeysModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SdkKeysModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of SdkKeysModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of SdkKeysModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SdkKeysModel + * @throws IOException if the JSON string is invalid with respect to SdkKeysModel + */ + public static SdkKeysModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SdkKeysModel.class); + } + + /** + * Convert an instance of SdkKeysModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SegmentComparator.java b/src/main/java/com/configcat/publicapi/java/client/model/SegmentComparator.java index 4b9be25..23e3626 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SegmentComparator.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SegmentComparator.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,63 +10,69 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** The segment comparison operator used during the evaluation process. */ +/** + * The segment comparison operator used during the evaluation process. + */ @JsonAdapter(SegmentComparator.Adapter.class) public enum SegmentComparator { - IS_IN("isIn"), + + IS_IN("isIn"), + + IS_NOT_IN("isNotIn"); - IS_NOT_IN("isNotIn"); + private String value; - private String value; + SegmentComparator(String value) { + this.value = value; + } - SegmentComparator(String value) { - this.value = value; - } + public String getValue() { + return value; + } - public String getValue() { - return value; - } + @Override + public String toString() { + return String.valueOf(value); + } - @Override - public String toString() { - return String.valueOf(value); + public static SegmentComparator fromValue(String value) { + for (SegmentComparator b : SegmentComparator.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static SegmentComparator fromValue(String value) { - for (SegmentComparator b : SegmentComparator.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SegmentComparator enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final SegmentComparator enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public SegmentComparator read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return SegmentComparator.fromValue(value); - } + @Override + public SegmentComparator read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SegmentComparator.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - SegmentComparator.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SegmentComparator.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SegmentConditionModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SegmentConditionModel.java index 19f0d9c..6018f51 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SegmentConditionModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SegmentConditionModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,234 +10,317 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.SegmentComparator; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -/** Describes a condition that is based on a segment. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * Describes a condition that is based on a segment. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class SegmentConditionModel { - public static final String SERIALIZED_NAME_SEGMENT_ID = "segmentId"; + public static final String SERIALIZED_NAME_SEGMENT_ID = "segmentId"; + @SerializedName(SERIALIZED_NAME_SEGMENT_ID) + private UUID segmentId; - @SerializedName(SERIALIZED_NAME_SEGMENT_ID) - private UUID segmentId; + public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; + @SerializedName(SERIALIZED_NAME_COMPARATOR) + private SegmentComparator comparator; - public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; + public SegmentConditionModel() { + } - @SerializedName(SERIALIZED_NAME_COMPARATOR) - private SegmentComparator comparator; + public SegmentConditionModel segmentId(UUID segmentId) { + this.segmentId = segmentId; + return this; + } - public SegmentConditionModel() {} + /** + * The segment's identifier. + * @return segmentId + */ + @javax.annotation.Nonnull + public UUID getSegmentId() { + return segmentId; + } - public SegmentConditionModel segmentId(UUID segmentId) { - this.segmentId = segmentId; - return this; - } + public void setSegmentId(UUID segmentId) { + this.segmentId = segmentId; + } - /** - * The segment's identifier. - * - * @return segmentId - */ - @javax.annotation.Nonnull - public UUID getSegmentId() { - return segmentId; - } - public void setSegmentId(UUID segmentId) { - this.segmentId = segmentId; - } + public SegmentConditionModel comparator(SegmentComparator comparator) { + this.comparator = comparator; + return this; + } - public SegmentConditionModel comparator(SegmentComparator comparator) { - this.comparator = comparator; - return this; - } + /** + * Get comparator + * @return comparator + */ + @javax.annotation.Nonnull + public SegmentComparator getComparator() { + return comparator; + } - /** - * Get comparator - * - * @return comparator - */ - @javax.annotation.Nonnull - public SegmentComparator getComparator() { - return comparator; - } + public void setComparator(SegmentComparator comparator) { + this.comparator = comparator; + } - public void setComparator(SegmentComparator comparator) { - this.comparator = comparator; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SegmentConditionModel segmentConditionModel = (SegmentConditionModel) o; - return Objects.equals(this.segmentId, segmentConditionModel.segmentId) - && Objects.equals(this.comparator, segmentConditionModel.comparator); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SegmentConditionModel instance itself + */ + public SegmentConditionModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(segmentId, comparator); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SegmentConditionModel {\n"); - sb.append(" segmentId: ").append(toIndentedString(segmentId)).append("\n"); - sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + SegmentConditionModel segmentConditionModel = (SegmentConditionModel) o; + return Objects.equals(this.segmentId, segmentConditionModel.segmentId) && + Objects.equals(this.comparator, segmentConditionModel.comparator)&& + Objects.equals(this.additionalProperties, segmentConditionModel.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(segmentId, comparator, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("segmentId"); - openapiFields.add("comparator"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SegmentConditionModel {\n"); + sb.append(" segmentId: ").append(toIndentedString(segmentId)).append("\n"); + sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("segmentId"); - openapiRequiredFields.add("comparator"); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SegmentConditionModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SegmentConditionModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SegmentConditionModel is not found in" - + " the empty JSON string", - SegmentConditionModel.openapiRequiredFields.toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SegmentConditionModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SegmentConditionModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("segmentId"); + openapiFields.add("comparator"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("segmentId"); + openapiRequiredFields.add("comparator"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SegmentConditionModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SegmentConditionModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SegmentConditionModel is not found in the empty JSON string", SegmentConditionModel.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : SegmentConditionModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SegmentConditionModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("segmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `segmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("segmentId").toString())); - } - // validate the required field `comparator` - SegmentComparator.validateJsonElement(jsonObj.get("comparator")); - } + if (!jsonObj.get("segmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `segmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("segmentId").toString())); + } + // validate the required field `comparator` + SegmentComparator.validateJsonElement(jsonObj.get("comparator")); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SegmentConditionModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SegmentConditionModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SegmentConditionModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SegmentConditionModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SegmentConditionModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SegmentConditionModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SegmentConditionModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SegmentConditionModel.class)); - /** - * Create an instance of SegmentConditionModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SegmentConditionModel - * @throws IOException if the JSON string is invalid with respect to SegmentConditionModel - */ - public static SegmentConditionModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SegmentConditionModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SegmentConditionModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SegmentConditionModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SegmentConditionModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of SegmentConditionModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of SegmentConditionModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SegmentConditionModel + * @throws IOException if the JSON string is invalid with respect to SegmentConditionModel + */ + public static SegmentConditionModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SegmentConditionModel.class); + } + + /** + * Convert an instance of SegmentConditionModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SegmentListModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SegmentListModel.java index 2df4824..f417c76 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SegmentListModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SegmentListModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,550 +10,575 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ProductModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** SegmentListModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class SegmentListModel { - public static final String SERIALIZED_NAME_PRODUCT = "product"; - - @SerializedName(SERIALIZED_NAME_PRODUCT) - private ProductModel product; - - public static final String SERIALIZED_NAME_SEGMENT_ID = "segmentId"; - - @SerializedName(SERIALIZED_NAME_SEGMENT_ID) - private UUID segmentId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_CREATOR_EMAIL = "creatorEmail"; - - @SerializedName(SERIALIZED_NAME_CREATOR_EMAIL) - private String creatorEmail; - - public static final String SERIALIZED_NAME_CREATOR_FULL_NAME = "creatorFullName"; - - @SerializedName(SERIALIZED_NAME_CREATOR_FULL_NAME) - private String creatorFullName; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private OffsetDateTime createdAt; - - public static final String SERIALIZED_NAME_LAST_UPDATER_EMAIL = "lastUpdaterEmail"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_EMAIL) - private String lastUpdaterEmail; - - public static final String SERIALIZED_NAME_LAST_UPDATER_FULL_NAME = "lastUpdaterFullName"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_FULL_NAME) - private String lastUpdaterFullName; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public static final String SERIALIZED_NAME_USAGE = "usage"; - - @SerializedName(SERIALIZED_NAME_USAGE) - private Integer usage; - - public SegmentListModel() {} - - public SegmentListModel product(ProductModel product) { - this.product = product; - return this; - } - - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public ProductModel getProduct() { - return product; - } - - public void setProduct(ProductModel product) { - this.product = product; - } - - public SegmentListModel segmentId(UUID segmentId) { - this.segmentId = segmentId; - return this; - } - - /** - * Identifier of the Segment. - * - * @return segmentId - */ - @javax.annotation.Nullable - public UUID getSegmentId() { - return segmentId; - } - - public void setSegmentId(UUID segmentId) { - this.segmentId = segmentId; - } - - public SegmentListModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Segment. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public SegmentListModel description(String description) { - this.description = description; - return this; - } - - /** - * Description of the Segment. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public SegmentListModel creatorEmail(String creatorEmail) { - this.creatorEmail = creatorEmail; - return this; - } - - /** - * The email of the user who created the Segment. - * - * @return creatorEmail - */ - @javax.annotation.Nullable - public String getCreatorEmail() { - return creatorEmail; - } - - public void setCreatorEmail(String creatorEmail) { - this.creatorEmail = creatorEmail; - } - - public SegmentListModel creatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - return this; - } - /** - * The name of the user who created the Segment. - * - * @return creatorFullName - */ - @javax.annotation.Nullable - public String getCreatorFullName() { - return creatorFullName; - } - - public void setCreatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - } - - public SegmentListModel createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * The date and time when the Segment was created. - * - * @return createdAt - */ - @javax.annotation.Nullable - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public SegmentListModel lastUpdaterEmail(String lastUpdaterEmail) { - this.lastUpdaterEmail = lastUpdaterEmail; - return this; - } - - /** - * The email of the user who last updated the Segment. - * - * @return lastUpdaterEmail - */ - @javax.annotation.Nullable - public String getLastUpdaterEmail() { - return lastUpdaterEmail; - } - - public void setLastUpdaterEmail(String lastUpdaterEmail) { - this.lastUpdaterEmail = lastUpdaterEmail; - } - - public SegmentListModel lastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - return this; - } - - /** - * The name of the user who last updated the Segment. - * - * @return lastUpdaterFullName - */ - @javax.annotation.Nullable - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public SegmentListModel updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * The date and time when the Segment was last updated. - * - * @return updatedAt - */ - @javax.annotation.Nullable - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public SegmentListModel usage(Integer usage) { - this.usage = usage; - return this; - } - - /** - * Determines how many Feature Flags and Settings are using the Segment. - * - * @return usage - */ - @javax.annotation.Nullable - public Integer getUsage() { - return usage; - } - - public void setUsage(Integer usage) { - this.usage = usage; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SegmentListModel segmentListModel = (SegmentListModel) o; - return Objects.equals(this.product, segmentListModel.product) - && Objects.equals(this.segmentId, segmentListModel.segmentId) - && Objects.equals(this.name, segmentListModel.name) - && Objects.equals(this.description, segmentListModel.description) - && Objects.equals(this.creatorEmail, segmentListModel.creatorEmail) - && Objects.equals(this.creatorFullName, segmentListModel.creatorFullName) - && Objects.equals(this.createdAt, segmentListModel.createdAt) - && Objects.equals(this.lastUpdaterEmail, segmentListModel.lastUpdaterEmail) - && Objects.equals(this.lastUpdaterFullName, segmentListModel.lastUpdaterFullName) - && Objects.equals(this.updatedAt, segmentListModel.updatedAt) - && Objects.equals(this.usage, segmentListModel.usage); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - product, - segmentId, - name, - description, - creatorEmail, - creatorFullName, - createdAt, - lastUpdaterEmail, - lastUpdaterFullName, - updatedAt, - usage); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SegmentListModel {\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" segmentId: ").append(toIndentedString(segmentId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" creatorEmail: ").append(toIndentedString(creatorEmail)).append("\n"); - sb.append(" creatorFullName: ").append(toIndentedString(creatorFullName)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" lastUpdaterEmail: ").append(toIndentedString(lastUpdaterEmail)).append("\n"); - sb.append(" lastUpdaterFullName: ") - .append(toIndentedString(lastUpdaterFullName)) - .append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" usage: ").append(toIndentedString(usage)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("product"); - openapiFields.add("segmentId"); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("creatorEmail"); - openapiFields.add("creatorFullName"); - openapiFields.add("createdAt"); - openapiFields.add("lastUpdaterEmail"); - openapiFields.add("lastUpdaterFullName"); - openapiFields.add("updatedAt"); - openapiFields.add("usage"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SegmentListModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SegmentListModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SegmentListModel is not found in the" - + " empty JSON string", - SegmentListModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SegmentListModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SegmentListModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * SegmentListModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class SegmentListModel { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private ProductModel product; + + public static final String SERIALIZED_NAME_SEGMENT_ID = "segmentId"; + @SerializedName(SERIALIZED_NAME_SEGMENT_ID) + private UUID segmentId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_CREATOR_EMAIL = "creatorEmail"; + @SerializedName(SERIALIZED_NAME_CREATOR_EMAIL) + private String creatorEmail; + + public static final String SERIALIZED_NAME_CREATOR_FULL_NAME = "creatorFullName"; + @SerializedName(SERIALIZED_NAME_CREATOR_FULL_NAME) + private String creatorFullName; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_LAST_UPDATER_EMAIL = "lastUpdaterEmail"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_EMAIL) + private String lastUpdaterEmail; + + public static final String SERIALIZED_NAME_LAST_UPDATER_FULL_NAME = "lastUpdaterFullName"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_FULL_NAME) + private String lastUpdaterFullName; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_USAGE = "usage"; + @SerializedName(SERIALIZED_NAME_USAGE) + private Integer usage; + + public SegmentListModel() { + } + + public SegmentListModel product(ProductModel product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductModel getProduct() { + return product; + } + + public void setProduct(ProductModel product) { + this.product = product; + } + + + public SegmentListModel segmentId(UUID segmentId) { + this.segmentId = segmentId; + return this; + } + + /** + * Identifier of the Segment. + * @return segmentId + */ + @javax.annotation.Nullable + public UUID getSegmentId() { + return segmentId; + } + + public void setSegmentId(UUID segmentId) { + this.segmentId = segmentId; + } + + + public SegmentListModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Segment. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public SegmentListModel description(String description) { + this.description = description; + return this; + } + + /** + * Description of the Segment. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public SegmentListModel creatorEmail(String creatorEmail) { + this.creatorEmail = creatorEmail; + return this; + } + + /** + * The email of the user who created the Segment. + * @return creatorEmail + */ + @javax.annotation.Nullable + public String getCreatorEmail() { + return creatorEmail; + } + + public void setCreatorEmail(String creatorEmail) { + this.creatorEmail = creatorEmail; + } + + + public SegmentListModel creatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + return this; + } + + /** + * The name of the user who created the Segment. + * @return creatorFullName + */ + @javax.annotation.Nullable + public String getCreatorFullName() { + return creatorFullName; + } + + public void setCreatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + } + + + public SegmentListModel createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time when the Segment was created. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SegmentListModel lastUpdaterEmail(String lastUpdaterEmail) { + this.lastUpdaterEmail = lastUpdaterEmail; + return this; + } + + /** + * The email of the user who last updated the Segment. + * @return lastUpdaterEmail + */ + @javax.annotation.Nullable + public String getLastUpdaterEmail() { + return lastUpdaterEmail; + } + + public void setLastUpdaterEmail(String lastUpdaterEmail) { + this.lastUpdaterEmail = lastUpdaterEmail; + } + + + public SegmentListModel lastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + return this; + } + + /** + * The name of the user who last updated the Segment. + * @return lastUpdaterFullName + */ + @javax.annotation.Nullable + public String getLastUpdaterFullName() { + return lastUpdaterFullName; + } + + public void setLastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + } + + + public SegmentListModel updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date and time when the Segment was last updated. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public SegmentListModel usage(Integer usage) { + this.usage = usage; + return this; + } + + /** + * Determines how many Feature Flags and Settings are using the Segment. + * @return usage + */ + @javax.annotation.Nullable + public Integer getUsage() { + return usage; + } + + public void setUsage(Integer usage) { + this.usage = usage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SegmentListModel instance itself + */ + public SegmentListModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SegmentListModel segmentListModel = (SegmentListModel) o; + return Objects.equals(this.product, segmentListModel.product) && + Objects.equals(this.segmentId, segmentListModel.segmentId) && + Objects.equals(this.name, segmentListModel.name) && + Objects.equals(this.description, segmentListModel.description) && + Objects.equals(this.creatorEmail, segmentListModel.creatorEmail) && + Objects.equals(this.creatorFullName, segmentListModel.creatorFullName) && + Objects.equals(this.createdAt, segmentListModel.createdAt) && + Objects.equals(this.lastUpdaterEmail, segmentListModel.lastUpdaterEmail) && + Objects.equals(this.lastUpdaterFullName, segmentListModel.lastUpdaterFullName) && + Objects.equals(this.updatedAt, segmentListModel.updatedAt) && + Objects.equals(this.usage, segmentListModel.usage)&& + Objects.equals(this.additionalProperties, segmentListModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, segmentId, name, description, creatorEmail, creatorFullName, createdAt, lastUpdaterEmail, lastUpdaterFullName, updatedAt, usage, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SegmentListModel {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" segmentId: ").append(toIndentedString(segmentId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" creatorEmail: ").append(toIndentedString(creatorEmail)).append("\n"); + sb.append(" creatorFullName: ").append(toIndentedString(creatorFullName)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" lastUpdaterEmail: ").append(toIndentedString(lastUpdaterEmail)).append("\n"); + sb.append(" lastUpdaterFullName: ").append(toIndentedString(lastUpdaterFullName)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("segmentId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("creatorEmail"); + openapiFields.add("creatorFullName"); + openapiFields.add("createdAt"); + openapiFields.add("lastUpdaterEmail"); + openapiFields.add("lastUpdaterFullName"); + openapiFields.add("updatedAt"); + openapiFields.add("usage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SegmentListModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SegmentListModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SegmentListModel is not found in the empty JSON string", SegmentListModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - ProductModel.validateJsonElement(jsonObj.get("product")); - } - if ((jsonObj.get("segmentId") != null && !jsonObj.get("segmentId").isJsonNull()) - && !jsonObj.get("segmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `segmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("segmentId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - if ((jsonObj.get("creatorEmail") != null && !jsonObj.get("creatorEmail").isJsonNull()) - && !jsonObj.get("creatorEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `creatorEmail` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("creatorEmail").toString())); - } - if ((jsonObj.get("creatorFullName") != null && !jsonObj.get("creatorFullName").isJsonNull()) - && !jsonObj.get("creatorFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `creatorFullName` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("creatorFullName").toString())); - } - if ((jsonObj.get("lastUpdaterEmail") != null - && !jsonObj.get("lastUpdaterEmail").isJsonNull()) - && !jsonObj.get("lastUpdaterEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterEmail` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("lastUpdaterEmail").toString())); - } - if ((jsonObj.get("lastUpdaterFullName") != null - && !jsonObj.get("lastUpdaterFullName").isJsonNull()) - && !jsonObj.get("lastUpdaterFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterFullName` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("lastUpdaterFullName").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SegmentListModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SegmentListModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SegmentListModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SegmentListModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SegmentListModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of SegmentListModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SegmentListModel - * @throws IOException if the JSON string is invalid with respect to SegmentListModel - */ - public static SegmentListModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SegmentListModel.class); - } - - /** - * Convert an instance of SegmentListModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductModel.validateJsonElement(jsonObj.get("product")); + } + if ((jsonObj.get("segmentId") != null && !jsonObj.get("segmentId").isJsonNull()) && !jsonObj.get("segmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `segmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("segmentId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("creatorEmail") != null && !jsonObj.get("creatorEmail").isJsonNull()) && !jsonObj.get("creatorEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creatorEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creatorEmail").toString())); + } + if ((jsonObj.get("creatorFullName") != null && !jsonObj.get("creatorFullName").isJsonNull()) && !jsonObj.get("creatorFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creatorFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creatorFullName").toString())); + } + if ((jsonObj.get("lastUpdaterEmail") != null && !jsonObj.get("lastUpdaterEmail").isJsonNull()) && !jsonObj.get("lastUpdaterEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterEmail").toString())); + } + if ((jsonObj.get("lastUpdaterFullName") != null && !jsonObj.get("lastUpdaterFullName").isJsonNull()) && !jsonObj.get("lastUpdaterFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterFullName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SegmentListModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SegmentListModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SegmentListModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SegmentListModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SegmentListModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SegmentListModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SegmentListModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SegmentListModel + * @throws IOException if the JSON string is invalid with respect to SegmentListModel + */ + public static SegmentListModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SegmentListModel.class); + } + + /** + * Convert an instance of SegmentListModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SegmentModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SegmentModel.java index a68704e..a9d1ec6 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SegmentModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SegmentModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,628 +10,638 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ProductModel; +import com.configcat.publicapi.java.client.model.RolloutRuleComparator; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** SegmentModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class SegmentModel { - public static final String SERIALIZED_NAME_PRODUCT = "product"; - - @SerializedName(SERIALIZED_NAME_PRODUCT) - private ProductModel product; - - public static final String SERIALIZED_NAME_SEGMENT_ID = "segmentId"; - - @SerializedName(SERIALIZED_NAME_SEGMENT_ID) - private UUID segmentId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_CREATOR_EMAIL = "creatorEmail"; - - @SerializedName(SERIALIZED_NAME_CREATOR_EMAIL) - private String creatorEmail; - - public static final String SERIALIZED_NAME_CREATOR_FULL_NAME = "creatorFullName"; - - @SerializedName(SERIALIZED_NAME_CREATOR_FULL_NAME) - private String creatorFullName; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private OffsetDateTime createdAt; - - public static final String SERIALIZED_NAME_LAST_UPDATER_EMAIL = "lastUpdaterEmail"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_EMAIL) - private String lastUpdaterEmail; - - public static final String SERIALIZED_NAME_LAST_UPDATER_FULL_NAME = "lastUpdaterFullName"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_FULL_NAME) - private String lastUpdaterFullName; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) - private String comparisonAttribute; - - public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; - - @SerializedName(SERIALIZED_NAME_COMPARATOR) - private RolloutRuleComparator comparator; - - public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) - private String comparisonValue; - - public SegmentModel() {} - - public SegmentModel product(ProductModel product) { - this.product = product; - return this; - } - - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public ProductModel getProduct() { - return product; - } - - public void setProduct(ProductModel product) { - this.product = product; - } - - public SegmentModel segmentId(UUID segmentId) { - this.segmentId = segmentId; - return this; - } - - /** - * Identifier of the Segment. - * - * @return segmentId - */ - @javax.annotation.Nullable - public UUID getSegmentId() { - return segmentId; - } - - public void setSegmentId(UUID segmentId) { - this.segmentId = segmentId; - } - - public SegmentModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Segment. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public SegmentModel description(String description) { - this.description = description; - return this; - } - - /** - * Description of the Segment. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public SegmentModel creatorEmail(String creatorEmail) { - this.creatorEmail = creatorEmail; - return this; - } - - /** - * The email of the user who created the Segment. - * - * @return creatorEmail - */ - @javax.annotation.Nullable - public String getCreatorEmail() { - return creatorEmail; - } - - public void setCreatorEmail(String creatorEmail) { - this.creatorEmail = creatorEmail; - } - - public SegmentModel creatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - return this; - } - - /** - * The name of the user who created the Segment. - * - * @return creatorFullName - */ - @javax.annotation.Nullable - public String getCreatorFullName() { - return creatorFullName; - } - - public void setCreatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - } - - public SegmentModel createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - /** - * The date and time when the Segment was created. - * - * @return createdAt - */ - @javax.annotation.Nullable - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public SegmentModel lastUpdaterEmail(String lastUpdaterEmail) { - this.lastUpdaterEmail = lastUpdaterEmail; - return this; - } - - /** - * The email of the user who last updated the Segment. - * - * @return lastUpdaterEmail - */ - @javax.annotation.Nullable - public String getLastUpdaterEmail() { - return lastUpdaterEmail; - } - - public void setLastUpdaterEmail(String lastUpdaterEmail) { - this.lastUpdaterEmail = lastUpdaterEmail; - } - - public SegmentModel lastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - return this; - } - - /** - * The name of the user who last updated the Segment. - * - * @return lastUpdaterFullName - */ - @javax.annotation.Nullable - public String getLastUpdaterFullName() { - return lastUpdaterFullName; - } - - public void setLastUpdaterFullName(String lastUpdaterFullName) { - this.lastUpdaterFullName = lastUpdaterFullName; - } - - public SegmentModel updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * The date and time when the Segment was last updated. - * - * @return updatedAt - */ - @javax.annotation.Nullable - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public SegmentModel comparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - return this; - } - - /** - * The user's attribute the evaluation process must take into account. - * - * @return comparisonAttribute - */ - @javax.annotation.Nullable - public String getComparisonAttribute() { - return comparisonAttribute; - } - - public void setComparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - } - - public SegmentModel comparator(RolloutRuleComparator comparator) { - this.comparator = comparator; - return this; - } - - /** - * Get comparator - * - * @return comparator - */ - @javax.annotation.Nullable - public RolloutRuleComparator getComparator() { - return comparator; - } - - public void setComparator(RolloutRuleComparator comparator) { - this.comparator = comparator; - } - - public SegmentModel comparisonValue(String comparisonValue) { - this.comparisonValue = comparisonValue; - return this; - } - - /** - * The value to compare with the given user attribute's value. - * - * @return comparisonValue - */ - @javax.annotation.Nullable - public String getComparisonValue() { - return comparisonValue; - } - - public void setComparisonValue(String comparisonValue) { - this.comparisonValue = comparisonValue; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SegmentModel segmentModel = (SegmentModel) o; - return Objects.equals(this.product, segmentModel.product) - && Objects.equals(this.segmentId, segmentModel.segmentId) - && Objects.equals(this.name, segmentModel.name) - && Objects.equals(this.description, segmentModel.description) - && Objects.equals(this.creatorEmail, segmentModel.creatorEmail) - && Objects.equals(this.creatorFullName, segmentModel.creatorFullName) - && Objects.equals(this.createdAt, segmentModel.createdAt) - && Objects.equals(this.lastUpdaterEmail, segmentModel.lastUpdaterEmail) - && Objects.equals(this.lastUpdaterFullName, segmentModel.lastUpdaterFullName) - && Objects.equals(this.updatedAt, segmentModel.updatedAt) - && Objects.equals(this.comparisonAttribute, segmentModel.comparisonAttribute) - && Objects.equals(this.comparator, segmentModel.comparator) - && Objects.equals(this.comparisonValue, segmentModel.comparisonValue); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - product, - segmentId, - name, - description, - creatorEmail, - creatorFullName, - createdAt, - lastUpdaterEmail, - lastUpdaterFullName, - updatedAt, - comparisonAttribute, - comparator, - comparisonValue); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SegmentModel {\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" segmentId: ").append(toIndentedString(segmentId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" creatorEmail: ").append(toIndentedString(creatorEmail)).append("\n"); - sb.append(" creatorFullName: ").append(toIndentedString(creatorFullName)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" lastUpdaterEmail: ").append(toIndentedString(lastUpdaterEmail)).append("\n"); - sb.append(" lastUpdaterFullName: ") - .append(toIndentedString(lastUpdaterFullName)) - .append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" comparisonAttribute: ") - .append(toIndentedString(comparisonAttribute)) - .append("\n"); - sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); - sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("product"); - openapiFields.add("segmentId"); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("creatorEmail"); - openapiFields.add("creatorFullName"); - openapiFields.add("createdAt"); - openapiFields.add("lastUpdaterEmail"); - openapiFields.add("lastUpdaterFullName"); - openapiFields.add("updatedAt"); - openapiFields.add("comparisonAttribute"); - openapiFields.add("comparator"); - openapiFields.add("comparisonValue"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SegmentModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SegmentModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SegmentModel is not found in the" - + " empty JSON string", - SegmentModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SegmentModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SegmentModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * SegmentModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class SegmentModel { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private ProductModel product; + + public static final String SERIALIZED_NAME_SEGMENT_ID = "segmentId"; + @SerializedName(SERIALIZED_NAME_SEGMENT_ID) + private UUID segmentId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_CREATOR_EMAIL = "creatorEmail"; + @SerializedName(SERIALIZED_NAME_CREATOR_EMAIL) + private String creatorEmail; + + public static final String SERIALIZED_NAME_CREATOR_FULL_NAME = "creatorFullName"; + @SerializedName(SERIALIZED_NAME_CREATOR_FULL_NAME) + private String creatorFullName; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_LAST_UPDATER_EMAIL = "lastUpdaterEmail"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_EMAIL) + private String lastUpdaterEmail; + + public static final String SERIALIZED_NAME_LAST_UPDATER_FULL_NAME = "lastUpdaterFullName"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_FULL_NAME) + private String lastUpdaterFullName; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; + @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) + private String comparisonAttribute; + + public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; + @SerializedName(SERIALIZED_NAME_COMPARATOR) + private RolloutRuleComparator comparator; + + public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; + @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) + private String comparisonValue; + + public SegmentModel() { + } + + public SegmentModel product(ProductModel product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductModel getProduct() { + return product; + } + + public void setProduct(ProductModel product) { + this.product = product; + } + + + public SegmentModel segmentId(UUID segmentId) { + this.segmentId = segmentId; + return this; + } + + /** + * Identifier of the Segment. + * @return segmentId + */ + @javax.annotation.Nullable + public UUID getSegmentId() { + return segmentId; + } + + public void setSegmentId(UUID segmentId) { + this.segmentId = segmentId; + } + + + public SegmentModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Segment. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public SegmentModel description(String description) { + this.description = description; + return this; + } + + /** + * Description of the Segment. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public SegmentModel creatorEmail(String creatorEmail) { + this.creatorEmail = creatorEmail; + return this; + } + + /** + * The email of the user who created the Segment. + * @return creatorEmail + */ + @javax.annotation.Nullable + public String getCreatorEmail() { + return creatorEmail; + } + + public void setCreatorEmail(String creatorEmail) { + this.creatorEmail = creatorEmail; + } + + + public SegmentModel creatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + return this; + } + + /** + * The name of the user who created the Segment. + * @return creatorFullName + */ + @javax.annotation.Nullable + public String getCreatorFullName() { + return creatorFullName; + } + + public void setCreatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + } + + + public SegmentModel createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The date and time when the Segment was created. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SegmentModel lastUpdaterEmail(String lastUpdaterEmail) { + this.lastUpdaterEmail = lastUpdaterEmail; + return this; + } + + /** + * The email of the user who last updated the Segment. + * @return lastUpdaterEmail + */ + @javax.annotation.Nullable + public String getLastUpdaterEmail() { + return lastUpdaterEmail; + } + + public void setLastUpdaterEmail(String lastUpdaterEmail) { + this.lastUpdaterEmail = lastUpdaterEmail; + } + + + public SegmentModel lastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + return this; + } + + /** + * The name of the user who last updated the Segment. + * @return lastUpdaterFullName + */ + @javax.annotation.Nullable + public String getLastUpdaterFullName() { + return lastUpdaterFullName; + } + + public void setLastUpdaterFullName(String lastUpdaterFullName) { + this.lastUpdaterFullName = lastUpdaterFullName; + } + + + public SegmentModel updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The date and time when the Segment was last updated. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public SegmentModel comparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + return this; + } + + /** + * The user's attribute the evaluation process must take into account. + * @return comparisonAttribute + */ + @javax.annotation.Nullable + public String getComparisonAttribute() { + return comparisonAttribute; + } + + public void setComparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + } + + + public SegmentModel comparator(RolloutRuleComparator comparator) { + this.comparator = comparator; + return this; + } + + /** + * Get comparator + * @return comparator + */ + @javax.annotation.Nullable + public RolloutRuleComparator getComparator() { + return comparator; + } + + public void setComparator(RolloutRuleComparator comparator) { + this.comparator = comparator; + } + + + public SegmentModel comparisonValue(String comparisonValue) { + this.comparisonValue = comparisonValue; + return this; + } + + /** + * The value to compare with the given user attribute's value. + * @return comparisonValue + */ + @javax.annotation.Nullable + public String getComparisonValue() { + return comparisonValue; + } + + public void setComparisonValue(String comparisonValue) { + this.comparisonValue = comparisonValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SegmentModel instance itself + */ + public SegmentModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SegmentModel segmentModel = (SegmentModel) o; + return Objects.equals(this.product, segmentModel.product) && + Objects.equals(this.segmentId, segmentModel.segmentId) && + Objects.equals(this.name, segmentModel.name) && + Objects.equals(this.description, segmentModel.description) && + Objects.equals(this.creatorEmail, segmentModel.creatorEmail) && + Objects.equals(this.creatorFullName, segmentModel.creatorFullName) && + Objects.equals(this.createdAt, segmentModel.createdAt) && + Objects.equals(this.lastUpdaterEmail, segmentModel.lastUpdaterEmail) && + Objects.equals(this.lastUpdaterFullName, segmentModel.lastUpdaterFullName) && + Objects.equals(this.updatedAt, segmentModel.updatedAt) && + Objects.equals(this.comparisonAttribute, segmentModel.comparisonAttribute) && + Objects.equals(this.comparator, segmentModel.comparator) && + Objects.equals(this.comparisonValue, segmentModel.comparisonValue)&& + Objects.equals(this.additionalProperties, segmentModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, segmentId, name, description, creatorEmail, creatorFullName, createdAt, lastUpdaterEmail, lastUpdaterFullName, updatedAt, comparisonAttribute, comparator, comparisonValue, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SegmentModel {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" segmentId: ").append(toIndentedString(segmentId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" creatorEmail: ").append(toIndentedString(creatorEmail)).append("\n"); + sb.append(" creatorFullName: ").append(toIndentedString(creatorFullName)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" lastUpdaterEmail: ").append(toIndentedString(lastUpdaterEmail)).append("\n"); + sb.append(" lastUpdaterFullName: ").append(toIndentedString(lastUpdaterFullName)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" comparisonAttribute: ").append(toIndentedString(comparisonAttribute)).append("\n"); + sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); + sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("segmentId"); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("creatorEmail"); + openapiFields.add("creatorFullName"); + openapiFields.add("createdAt"); + openapiFields.add("lastUpdaterEmail"); + openapiFields.add("lastUpdaterFullName"); + openapiFields.add("updatedAt"); + openapiFields.add("comparisonAttribute"); + openapiFields.add("comparator"); + openapiFields.add("comparisonValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SegmentModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SegmentModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SegmentModel is not found in the empty JSON string", SegmentModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - ProductModel.validateJsonElement(jsonObj.get("product")); - } - if ((jsonObj.get("segmentId") != null && !jsonObj.get("segmentId").isJsonNull()) - && !jsonObj.get("segmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `segmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("segmentId").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - if ((jsonObj.get("creatorEmail") != null && !jsonObj.get("creatorEmail").isJsonNull()) - && !jsonObj.get("creatorEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `creatorEmail` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("creatorEmail").toString())); - } - if ((jsonObj.get("creatorFullName") != null && !jsonObj.get("creatorFullName").isJsonNull()) - && !jsonObj.get("creatorFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `creatorFullName` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("creatorFullName").toString())); - } - if ((jsonObj.get("lastUpdaterEmail") != null - && !jsonObj.get("lastUpdaterEmail").isJsonNull()) - && !jsonObj.get("lastUpdaterEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterEmail` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("lastUpdaterEmail").toString())); - } - if ((jsonObj.get("lastUpdaterFullName") != null - && !jsonObj.get("lastUpdaterFullName").isJsonNull()) - && !jsonObj.get("lastUpdaterFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterFullName` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("lastUpdaterFullName").toString())); - } - if ((jsonObj.get("comparisonAttribute") != null - && !jsonObj.get("comparisonAttribute").isJsonNull()) - && !jsonObj.get("comparisonAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonAttribute` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("comparisonAttribute").toString())); - } - // validate the optional field `comparator` - if (jsonObj.get("comparator") != null && !jsonObj.get("comparator").isJsonNull()) { - RolloutRuleComparator.validateJsonElement(jsonObj.get("comparator")); - } - if ((jsonObj.get("comparisonValue") != null && !jsonObj.get("comparisonValue").isJsonNull()) - && !jsonObj.get("comparisonValue").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonValue` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("comparisonValue").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SegmentModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SegmentModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SegmentModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SegmentModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SegmentModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of SegmentModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SegmentModel - * @throws IOException if the JSON string is invalid with respect to SegmentModel - */ - public static SegmentModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SegmentModel.class); - } - - /** - * Convert an instance of SegmentModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductModel.validateJsonElement(jsonObj.get("product")); + } + if ((jsonObj.get("segmentId") != null && !jsonObj.get("segmentId").isJsonNull()) && !jsonObj.get("segmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `segmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("segmentId").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("creatorEmail") != null && !jsonObj.get("creatorEmail").isJsonNull()) && !jsonObj.get("creatorEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creatorEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creatorEmail").toString())); + } + if ((jsonObj.get("creatorFullName") != null && !jsonObj.get("creatorFullName").isJsonNull()) && !jsonObj.get("creatorFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creatorFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creatorFullName").toString())); + } + if ((jsonObj.get("lastUpdaterEmail") != null && !jsonObj.get("lastUpdaterEmail").isJsonNull()) && !jsonObj.get("lastUpdaterEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterEmail").toString())); + } + if ((jsonObj.get("lastUpdaterFullName") != null && !jsonObj.get("lastUpdaterFullName").isJsonNull()) && !jsonObj.get("lastUpdaterFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterFullName").toString())); + } + if ((jsonObj.get("comparisonAttribute") != null && !jsonObj.get("comparisonAttribute").isJsonNull()) && !jsonObj.get("comparisonAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonAttribute").toString())); + } + // validate the optional field `comparator` + if (jsonObj.get("comparator") != null && !jsonObj.get("comparator").isJsonNull()) { + RolloutRuleComparator.validateJsonElement(jsonObj.get("comparator")); + } + if ((jsonObj.get("comparisonValue") != null && !jsonObj.get("comparisonValue").isJsonNull()) && !jsonObj.get("comparisonValue").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonValue` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonValue").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SegmentModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SegmentModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SegmentModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SegmentModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SegmentModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SegmentModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SegmentModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SegmentModel + * @throws IOException if the JSON string is invalid with respect to SegmentModel + */ + public static SegmentModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SegmentModel.class); + } + + /** + * Convert an instance of SegmentModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SettingDataModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SettingDataModel.java index b30346c..e0673a7 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SettingDataModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SettingDataModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,501 +10,542 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.SettingType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** Metadata of a Feature Flag or Setting. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class SettingDataModel { - public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; - - @SerializedName(SERIALIZED_NAME_SETTING_ID) - private Integer settingId; - - public static final String SERIALIZED_NAME_KEY = "key"; - - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_HINT = "hint"; - - @SerializedName(SERIALIZED_NAME_HINT) - private String hint; - - public static final String SERIALIZED_NAME_SETTING_TYPE = "settingType"; - - @SerializedName(SERIALIZED_NAME_SETTING_TYPE) - private SettingType settingType; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; - - @SerializedName(SERIALIZED_NAME_CREATED_AT) - private OffsetDateTime createdAt; - - public static final String SERIALIZED_NAME_CREATOR_EMAIL = "creatorEmail"; - - @SerializedName(SERIALIZED_NAME_CREATOR_EMAIL) - private String creatorEmail; - - public static final String SERIALIZED_NAME_CREATOR_FULL_NAME = "creatorFullName"; - - @SerializedName(SERIALIZED_NAME_CREATOR_FULL_NAME) - private String creatorFullName; - - public static final String SERIALIZED_NAME_IS_WATCHING = "isWatching"; - - @SerializedName(SERIALIZED_NAME_IS_WATCHING) - private Boolean isWatching; - - public SettingDataModel() {} - - public SettingDataModel settingId(Integer settingId) { - this.settingId = settingId; - return this; - } - - /** - * Identifier of the Feature Flag or Setting. - * - * @return settingId - */ - @javax.annotation.Nullable - public Integer getSettingId() { - return settingId; - } - - public void setSettingId(Integer settingId) { - this.settingId = settingId; - } - - public SettingDataModel key(String key) { - this.key = key; - return this; - } - - /** - * Key of the Feature Flag or Setting. - * - * @return key - */ - @javax.annotation.Nullable - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public SettingDataModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Feature Flag or Setting. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public SettingDataModel hint(String hint) { - this.hint = hint; - return this; - } - - /** - * Description of the Feature Flag or Setting. - * - * @return hint - */ - @javax.annotation.Nullable - public String getHint() { - return hint; - } - - public void setHint(String hint) { - this.hint = hint; - } - - public SettingDataModel settingType(SettingType settingType) { - this.settingType = settingType; - return this; - } - - /** - * Get settingType - * - * @return settingType - */ - @javax.annotation.Nullable - public SettingType getSettingType() { - return settingType; - } - - public void setSettingType(SettingType settingType) { - this.settingType = settingType; - } - public SettingDataModel order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Feature Flag or Setting represented on the ConfigCat Dashboard. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } - - public SettingDataModel createdAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - return this; - } - - /** - * The creation time of the Feature Flag or Setting. - * - * @return createdAt - */ - @javax.annotation.Nullable - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public void setCreatedAt(OffsetDateTime createdAt) { - this.createdAt = createdAt; - } - - public SettingDataModel creatorEmail(String creatorEmail) { - this.creatorEmail = creatorEmail; - return this; - } - - /** - * The user's email address who created the Feature Flag or Setting. - * - * @return creatorEmail - */ - @javax.annotation.Nullable - public String getCreatorEmail() { - return creatorEmail; - } - - public void setCreatorEmail(String creatorEmail) { - this.creatorEmail = creatorEmail; - } - - public SettingDataModel creatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - return this; - } - - /** - * The user's name who created the Feature Flag or Setting. - * - * @return creatorFullName - */ - @javax.annotation.Nullable - public String getCreatorFullName() { - return creatorFullName; - } - - public void setCreatorFullName(String creatorFullName) { - this.creatorFullName = creatorFullName; - } - - public SettingDataModel isWatching(Boolean isWatching) { - this.isWatching = isWatching; - return this; - } - - /** - * Get isWatching - * - * @return isWatching - */ - @javax.annotation.Nullable - public Boolean getIsWatching() { - return isWatching; - } - - public void setIsWatching(Boolean isWatching) { - this.isWatching = isWatching; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SettingDataModel settingDataModel = (SettingDataModel) o; - return Objects.equals(this.settingId, settingDataModel.settingId) - && Objects.equals(this.key, settingDataModel.key) - && Objects.equals(this.name, settingDataModel.name) - && Objects.equals(this.hint, settingDataModel.hint) - && Objects.equals(this.settingType, settingDataModel.settingType) - && Objects.equals(this.order, settingDataModel.order) - && Objects.equals(this.createdAt, settingDataModel.createdAt) - && Objects.equals(this.creatorEmail, settingDataModel.creatorEmail) - && Objects.equals(this.creatorFullName, settingDataModel.creatorFullName) - && Objects.equals(this.isWatching, settingDataModel.isWatching); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - settingId, - key, - name, - hint, - settingType, - order, - createdAt, - creatorEmail, - creatorFullName, - isWatching); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SettingDataModel {\n"); - sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); - sb.append(" settingType: ").append(toIndentedString(settingType)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); - sb.append(" creatorEmail: ").append(toIndentedString(creatorEmail)).append("\n"); - sb.append(" creatorFullName: ").append(toIndentedString(creatorFullName)).append("\n"); - sb.append(" isWatching: ").append(toIndentedString(isWatching)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("settingId"); - openapiFields.add("key"); - openapiFields.add("name"); - openapiFields.add("hint"); - openapiFields.add("settingType"); - openapiFields.add("order"); - openapiFields.add("createdAt"); - openapiFields.add("creatorEmail"); - openapiFields.add("creatorFullName"); - openapiFields.add("isWatching"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SettingDataModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SettingDataModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SettingDataModel is not found in the" - + " empty JSON string", - SettingDataModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SettingDataModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SettingDataModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * Metadata of a Feature Flag or Setting. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class SettingDataModel { + public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; + @SerializedName(SERIALIZED_NAME_SETTING_ID) + private Integer settingId; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_HINT = "hint"; + @SerializedName(SERIALIZED_NAME_HINT) + private String hint; + + public static final String SERIALIZED_NAME_SETTING_TYPE = "settingType"; + @SerializedName(SERIALIZED_NAME_SETTING_TYPE) + private SettingType settingType; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_CREATOR_EMAIL = "creatorEmail"; + @SerializedName(SERIALIZED_NAME_CREATOR_EMAIL) + private String creatorEmail; + + public static final String SERIALIZED_NAME_CREATOR_FULL_NAME = "creatorFullName"; + @SerializedName(SERIALIZED_NAME_CREATOR_FULL_NAME) + private String creatorFullName; + + public static final String SERIALIZED_NAME_IS_WATCHING = "isWatching"; + @SerializedName(SERIALIZED_NAME_IS_WATCHING) + private Boolean isWatching; + + public SettingDataModel() { + } + + public SettingDataModel settingId(Integer settingId) { + this.settingId = settingId; + return this; + } + + /** + * Identifier of the Feature Flag or Setting. + * @return settingId + */ + @javax.annotation.Nullable + public Integer getSettingId() { + return settingId; + } + + public void setSettingId(Integer settingId) { + this.settingId = settingId; + } + + + public SettingDataModel key(String key) { + this.key = key; + return this; + } + + /** + * Key of the Feature Flag or Setting. + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + + public SettingDataModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Feature Flag or Setting. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public SettingDataModel hint(String hint) { + this.hint = hint; + return this; + } + + /** + * Description of the Feature Flag or Setting. + * @return hint + */ + @javax.annotation.Nullable + public String getHint() { + return hint; + } + + public void setHint(String hint) { + this.hint = hint; + } + + + public SettingDataModel settingType(SettingType settingType) { + this.settingType = settingType; + return this; + } + + /** + * Get settingType + * @return settingType + */ + @javax.annotation.Nullable + public SettingType getSettingType() { + return settingType; + } + + public void setSettingType(SettingType settingType) { + this.settingType = settingType; + } + + + public SettingDataModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Feature Flag or Setting represented on the ConfigCat Dashboard. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public SettingDataModel createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The creation time of the Feature Flag or Setting. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SettingDataModel creatorEmail(String creatorEmail) { + this.creatorEmail = creatorEmail; + return this; + } + + /** + * The user's email address who created the Feature Flag or Setting. + * @return creatorEmail + */ + @javax.annotation.Nullable + public String getCreatorEmail() { + return creatorEmail; + } + + public void setCreatorEmail(String creatorEmail) { + this.creatorEmail = creatorEmail; + } + + + public SettingDataModel creatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + return this; + } + + /** + * The user's name who created the Feature Flag or Setting. + * @return creatorFullName + */ + @javax.annotation.Nullable + public String getCreatorFullName() { + return creatorFullName; + } + + public void setCreatorFullName(String creatorFullName) { + this.creatorFullName = creatorFullName; + } + + + public SettingDataModel isWatching(Boolean isWatching) { + this.isWatching = isWatching; + return this; + } + + /** + * Get isWatching + * @return isWatching + */ + @javax.annotation.Nullable + public Boolean getIsWatching() { + return isWatching; + } + + public void setIsWatching(Boolean isWatching) { + this.isWatching = isWatching; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SettingDataModel instance itself + */ + public SettingDataModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingDataModel settingDataModel = (SettingDataModel) o; + return Objects.equals(this.settingId, settingDataModel.settingId) && + Objects.equals(this.key, settingDataModel.key) && + Objects.equals(this.name, settingDataModel.name) && + Objects.equals(this.hint, settingDataModel.hint) && + Objects.equals(this.settingType, settingDataModel.settingType) && + Objects.equals(this.order, settingDataModel.order) && + Objects.equals(this.createdAt, settingDataModel.createdAt) && + Objects.equals(this.creatorEmail, settingDataModel.creatorEmail) && + Objects.equals(this.creatorFullName, settingDataModel.creatorFullName) && + Objects.equals(this.isWatching, settingDataModel.isWatching)&& + Objects.equals(this.additionalProperties, settingDataModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(settingId, key, name, hint, settingType, order, createdAt, creatorEmail, creatorFullName, isWatching, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingDataModel {\n"); + sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); + sb.append(" settingType: ").append(toIndentedString(settingType)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" creatorEmail: ").append(toIndentedString(creatorEmail)).append("\n"); + sb.append(" creatorFullName: ").append(toIndentedString(creatorFullName)).append("\n"); + sb.append(" isWatching: ").append(toIndentedString(isWatching)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("settingId"); + openapiFields.add("key"); + openapiFields.add("name"); + openapiFields.add("hint"); + openapiFields.add("settingType"); + openapiFields.add("order"); + openapiFields.add("createdAt"); + openapiFields.add("creatorEmail"); + openapiFields.add("creatorFullName"); + openapiFields.add("isWatching"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettingDataModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettingDataModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SettingDataModel is not found in the empty JSON string", SettingDataModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) - && !jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `key` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("key").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) - && !jsonObj.get("hint").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `hint` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("hint").toString())); - } - // validate the optional field `settingType` - if (jsonObj.get("settingType") != null && !jsonObj.get("settingType").isJsonNull()) { - SettingType.validateJsonElement(jsonObj.get("settingType")); - } - if ((jsonObj.get("creatorEmail") != null && !jsonObj.get("creatorEmail").isJsonNull()) - && !jsonObj.get("creatorEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `creatorEmail` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("creatorEmail").toString())); - } - if ((jsonObj.get("creatorFullName") != null && !jsonObj.get("creatorFullName").isJsonNull()) - && !jsonObj.get("creatorFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `creatorFullName` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("creatorFullName").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SettingDataModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SettingDataModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SettingDataModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SettingDataModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SettingDataModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of SettingDataModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SettingDataModel - * @throws IOException if the JSON string is invalid with respect to SettingDataModel - */ - public static SettingDataModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SettingDataModel.class); - } - - /** - * Convert an instance of SettingDataModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) && !jsonObj.get("hint").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hint` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hint").toString())); + } + // validate the optional field `settingType` + if (jsonObj.get("settingType") != null && !jsonObj.get("settingType").isJsonNull()) { + SettingType.validateJsonElement(jsonObj.get("settingType")); + } + if ((jsonObj.get("creatorEmail") != null && !jsonObj.get("creatorEmail").isJsonNull()) && !jsonObj.get("creatorEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creatorEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creatorEmail").toString())); + } + if ((jsonObj.get("creatorFullName") != null && !jsonObj.get("creatorFullName").isJsonNull()) && !jsonObj.get("creatorFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `creatorFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("creatorFullName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettingDataModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettingDataModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SettingDataModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SettingDataModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SettingDataModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SettingDataModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SettingDataModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettingDataModel + * @throws IOException if the JSON string is invalid with respect to SettingDataModel + */ + public static SettingDataModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettingDataModel.class); + } + + /** + * Convert an instance of SettingDataModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SettingFormulaModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SettingFormulaModel.java index 3b0d0f0..6d7d3d9 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SettingFormulaModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SettingFormulaModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,782 +10,773 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ConfigModel; +import com.configcat.publicapi.java.client.model.EnvironmentModel; +import com.configcat.publicapi.java.client.model.FeatureFlagLimitations; +import com.configcat.publicapi.java.client.model.IntegrationLinkModel; +import com.configcat.publicapi.java.client.model.SettingDataModel; +import com.configcat.publicapi.java.client.model.SettingTagModel; +import com.configcat.publicapi.java.client.model.TargetingRuleModel; +import com.configcat.publicapi.java.client.model.ValueModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** SettingFormulaModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class SettingFormulaModel { - public static final String SERIALIZED_NAME_LAST_VERSION_ID = "lastVersionId"; - - @SerializedName(SERIALIZED_NAME_LAST_VERSION_ID) - private UUID lastVersionId; - - public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; - - @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) - private ValueModel defaultValue; - - public static final String SERIALIZED_NAME_TARGETING_RULES = "targetingRules"; - - @SerializedName(SERIALIZED_NAME_TARGETING_RULES) - private List targetingRules; - - public static final String SERIALIZED_NAME_SETTING = "setting"; - - @SerializedName(SERIALIZED_NAME_SETTING) - private SettingDataModel setting; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public static final String SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE = - "percentageEvaluationAttribute"; - - @SerializedName(SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE) - private String percentageEvaluationAttribute; - - public static final String SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL = "lastUpdaterUserEmail"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL) - private String lastUpdaterUserEmail; - - public static final String SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME = - "lastUpdaterUserFullName"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME) - private String lastUpdaterUserFullName; - - public static final String SERIALIZED_NAME_INTEGRATION_LINKS = "integrationLinks"; - - @SerializedName(SERIALIZED_NAME_INTEGRATION_LINKS) - private List integrationLinks; - - public static final String SERIALIZED_NAME_SETTING_TAGS = "settingTags"; - - @SerializedName(SERIALIZED_NAME_SETTING_TAGS) - private List settingTags; - - public static final String SERIALIZED_NAME_SETTING_IDS_WHERE_PREREQUISITE = - "settingIdsWherePrerequisite"; - - @SerializedName(SERIALIZED_NAME_SETTING_IDS_WHERE_PREREQUISITE) - private List settingIdsWherePrerequisite; - - public static final String SERIALIZED_NAME_CONFIG = "config"; - - @SerializedName(SERIALIZED_NAME_CONFIG) - private ConfigModel config; - - public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT) - private EnvironmentModel environment; - public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; - - @SerializedName(SERIALIZED_NAME_READ_ONLY) - private Boolean readOnly; - - public static final String SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS = "featureFlagLimitations"; - - @SerializedName(SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS) - private FeatureFlagLimitations featureFlagLimitations; - - public SettingFormulaModel() {} - - public SettingFormulaModel lastVersionId(UUID lastVersionId) { - this.lastVersionId = lastVersionId; - return this; - } - - /** - * Get lastVersionId - * - * @return lastVersionId - */ - @javax.annotation.Nullable - public UUID getLastVersionId() { - return lastVersionId; - } - - public void setLastVersionId(UUID lastVersionId) { - this.lastVersionId = lastVersionId; - } - - public SettingFormulaModel defaultValue(ValueModel defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - /** - * Get defaultValue - * - * @return defaultValue - */ - @javax.annotation.Nullable - public ValueModel getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(ValueModel defaultValue) { - this.defaultValue = defaultValue; - } - - public SettingFormulaModel targetingRules(List targetingRules) { - this.targetingRules = targetingRules; - return this; - } - - public SettingFormulaModel addTargetingRulesItem(TargetingRuleModel targetingRulesItem) { - if (this.targetingRules == null) { - this.targetingRules = new ArrayList<>(); - } - this.targetingRules.add(targetingRulesItem); - return this; - } - - /** - * The targeting rules of the Feature Flag or Setting. - * - * @return targetingRules - */ - @javax.annotation.Nullable - public List getTargetingRules() { - return targetingRules; - } - - public void setTargetingRules(List targetingRules) { - this.targetingRules = targetingRules; - } - - public SettingFormulaModel setting(SettingDataModel setting) { - this.setting = setting; - return this; - } - - /** - * Get setting - * - * @return setting - */ - @javax.annotation.Nullable - public SettingDataModel getSetting() { - return setting; - } - - public void setSetting(SettingDataModel setting) { - this.setting = setting; - } - - public SettingFormulaModel updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * The last updated date and time when the Feature Flag or Setting. - * - * @return updatedAt - */ - @javax.annotation.Nullable - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public SettingFormulaModel percentageEvaluationAttribute(String percentageEvaluationAttribute) { - this.percentageEvaluationAttribute = percentageEvaluationAttribute; - return this; - } - - /** - * The user attribute used for percentage evaluation. If not set, it defaults to the - * `Identifier` user object attribute. - * - * @return percentageEvaluationAttribute - */ - @javax.annotation.Nullable - public String getPercentageEvaluationAttribute() { - return percentageEvaluationAttribute; - } - - public void setPercentageEvaluationAttribute(String percentageEvaluationAttribute) { - this.percentageEvaluationAttribute = percentageEvaluationAttribute; - } - - public SettingFormulaModel lastUpdaterUserEmail(String lastUpdaterUserEmail) { - this.lastUpdaterUserEmail = lastUpdaterUserEmail; - return this; - } - - /** - * The email of the user who last updated the Feature Flag or Setting. - * - * @return lastUpdaterUserEmail - */ - @javax.annotation.Nullable - public String getLastUpdaterUserEmail() { - return lastUpdaterUserEmail; - } - - public void setLastUpdaterUserEmail(String lastUpdaterUserEmail) { - this.lastUpdaterUserEmail = lastUpdaterUserEmail; - } - - public SettingFormulaModel lastUpdaterUserFullName(String lastUpdaterUserFullName) { - this.lastUpdaterUserFullName = lastUpdaterUserFullName; - return this; - } - - /** - * The name of the user who last updated the Feature Flag or Setting. - * - * @return lastUpdaterUserFullName - */ - @javax.annotation.Nullable - public String getLastUpdaterUserFullName() { - return lastUpdaterUserFullName; - } - - public void setLastUpdaterUserFullName(String lastUpdaterUserFullName) { - this.lastUpdaterUserFullName = lastUpdaterUserFullName; - } - - public SettingFormulaModel integrationLinks(List integrationLinks) { - this.integrationLinks = integrationLinks; - return this; - } - - public SettingFormulaModel addIntegrationLinksItem(IntegrationLinkModel integrationLinksItem) { - if (this.integrationLinks == null) { - this.integrationLinks = new ArrayList<>(); - } - this.integrationLinks.add(integrationLinksItem); - return this; - } - - /** - * The integration links attached to the Feature Flag or Setting. - * - * @return integrationLinks - */ - @javax.annotation.Nullable - public List getIntegrationLinks() { - return integrationLinks; - } - - public void setIntegrationLinks(List integrationLinks) { - this.integrationLinks = integrationLinks; - } - - public SettingFormulaModel settingTags(List settingTags) { - this.settingTags = settingTags; - return this; - } - - public SettingFormulaModel addSettingTagsItem(SettingTagModel settingTagsItem) { - if (this.settingTags == null) { - this.settingTags = new ArrayList<>(); - } - this.settingTags.add(settingTagsItem); - return this; - } - - /** - * The tags attached to the Feature Flag or Setting. - * - * @return settingTags - */ - @javax.annotation.Nullable - public List getSettingTags() { - return settingTags; - } - - public void setSettingTags(List settingTags) { - this.settingTags = settingTags; - } - - public SettingFormulaModel settingIdsWherePrerequisite( - List settingIdsWherePrerequisite) { - this.settingIdsWherePrerequisite = settingIdsWherePrerequisite; - return this; - } - - public SettingFormulaModel addSettingIdsWherePrerequisiteItem( - Integer settingIdsWherePrerequisiteItem) { - if (this.settingIdsWherePrerequisite == null) { - this.settingIdsWherePrerequisite = new ArrayList<>(); - } - this.settingIdsWherePrerequisite.add(settingIdsWherePrerequisiteItem); - return this; - } - - /** - * List of Feature Flag and Setting IDs where the actual Feature Flag or Setting is - * prerequisite. - * - * @return settingIdsWherePrerequisite - */ - @javax.annotation.Nullable - public List getSettingIdsWherePrerequisite() { - return settingIdsWherePrerequisite; - } - - public void setSettingIdsWherePrerequisite(List settingIdsWherePrerequisite) { - this.settingIdsWherePrerequisite = settingIdsWherePrerequisite; - } - - public SettingFormulaModel config(ConfigModel config) { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config - */ - @javax.annotation.Nullable - public ConfigModel getConfig() { - return config; - } - - public void setConfig(ConfigModel config) { - this.config = config; - } - - public SettingFormulaModel environment(EnvironmentModel environment) { - this.environment = environment; - return this; - } - - /** - * Get environment - * - * @return environment - */ - @javax.annotation.Nullable - public EnvironmentModel getEnvironment() { - return environment; - } - - public void setEnvironment(EnvironmentModel environment) { - this.environment = environment; - } - - public SettingFormulaModel readOnly(Boolean readOnly) { - this.readOnly = readOnly; - return this; - } - - /** - * Get readOnly - * - * @return readOnly - */ - @javax.annotation.Nullable - public Boolean getReadOnly() { - return readOnly; - } - - public void setReadOnly(Boolean readOnly) { - this.readOnly = readOnly; - } - - public SettingFormulaModel featureFlagLimitations( - FeatureFlagLimitations featureFlagLimitations) { - this.featureFlagLimitations = featureFlagLimitations; - return this; - } - - /** - * Get featureFlagLimitations - * - * @return featureFlagLimitations - */ - @javax.annotation.Nullable - public FeatureFlagLimitations getFeatureFlagLimitations() { - return featureFlagLimitations; - } - - public void setFeatureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { - this.featureFlagLimitations = featureFlagLimitations; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SettingFormulaModel settingFormulaModel = (SettingFormulaModel) o; - return Objects.equals(this.lastVersionId, settingFormulaModel.lastVersionId) - && Objects.equals(this.defaultValue, settingFormulaModel.defaultValue) - && Objects.equals(this.targetingRules, settingFormulaModel.targetingRules) - && Objects.equals(this.setting, settingFormulaModel.setting) - && Objects.equals(this.updatedAt, settingFormulaModel.updatedAt) - && Objects.equals( - this.percentageEvaluationAttribute, - settingFormulaModel.percentageEvaluationAttribute) - && Objects.equals( - this.lastUpdaterUserEmail, settingFormulaModel.lastUpdaterUserEmail) - && Objects.equals( - this.lastUpdaterUserFullName, settingFormulaModel.lastUpdaterUserFullName) - && Objects.equals(this.integrationLinks, settingFormulaModel.integrationLinks) - && Objects.equals(this.settingTags, settingFormulaModel.settingTags) - && Objects.equals( - this.settingIdsWherePrerequisite, - settingFormulaModel.settingIdsWherePrerequisite) - && Objects.equals(this.config, settingFormulaModel.config) - && Objects.equals(this.environment, settingFormulaModel.environment) - && Objects.equals(this.readOnly, settingFormulaModel.readOnly) - && Objects.equals( - this.featureFlagLimitations, settingFormulaModel.featureFlagLimitations); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - lastVersionId, - defaultValue, - targetingRules, - setting, - updatedAt, - percentageEvaluationAttribute, - lastUpdaterUserEmail, - lastUpdaterUserFullName, - integrationLinks, - settingTags, - settingIdsWherePrerequisite, - config, - environment, - readOnly, - featureFlagLimitations); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SettingFormulaModel {\n"); - sb.append(" lastVersionId: ").append(toIndentedString(lastVersionId)).append("\n"); - sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); - sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); - sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" percentageEvaluationAttribute: ") - .append(toIndentedString(percentageEvaluationAttribute)) - .append("\n"); - sb.append(" lastUpdaterUserEmail: ") - .append(toIndentedString(lastUpdaterUserEmail)) - .append("\n"); - sb.append(" lastUpdaterUserFullName: ") - .append(toIndentedString(lastUpdaterUserFullName)) - .append("\n"); - sb.append(" integrationLinks: ").append(toIndentedString(integrationLinks)).append("\n"); - sb.append(" settingTags: ").append(toIndentedString(settingTags)).append("\n"); - sb.append(" settingIdsWherePrerequisite: ") - .append(toIndentedString(settingIdsWherePrerequisite)) - .append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); - sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); - sb.append(" featureFlagLimitations: ") - .append(toIndentedString(featureFlagLimitations)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("lastVersionId"); - openapiFields.add("defaultValue"); - openapiFields.add("targetingRules"); - openapiFields.add("setting"); - openapiFields.add("updatedAt"); - openapiFields.add("percentageEvaluationAttribute"); - openapiFields.add("lastUpdaterUserEmail"); - openapiFields.add("lastUpdaterUserFullName"); - openapiFields.add("integrationLinks"); - openapiFields.add("settingTags"); - openapiFields.add("settingIdsWherePrerequisite"); - openapiFields.add("config"); - openapiFields.add("environment"); - openapiFields.add("readOnly"); - openapiFields.add("featureFlagLimitations"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SettingFormulaModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SettingFormulaModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SettingFormulaModel is not found in" - + " the empty JSON string", - SettingFormulaModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SettingFormulaModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SettingFormulaModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * SettingFormulaModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class SettingFormulaModel { + public static final String SERIALIZED_NAME_LAST_VERSION_ID = "lastVersionId"; + @SerializedName(SERIALIZED_NAME_LAST_VERSION_ID) + private UUID lastVersionId; + + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private ValueModel defaultValue; + + public static final String SERIALIZED_NAME_TARGETING_RULES = "targetingRules"; + @SerializedName(SERIALIZED_NAME_TARGETING_RULES) + private List targetingRules; + + public static final String SERIALIZED_NAME_SETTING = "setting"; + @SerializedName(SERIALIZED_NAME_SETTING) + private SettingDataModel setting; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE = "percentageEvaluationAttribute"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE) + private String percentageEvaluationAttribute; + + public static final String SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL = "lastUpdaterUserEmail"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL) + private String lastUpdaterUserEmail; + + public static final String SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME = "lastUpdaterUserFullName"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME) + private String lastUpdaterUserFullName; + + public static final String SERIALIZED_NAME_INTEGRATION_LINKS = "integrationLinks"; + @SerializedName(SERIALIZED_NAME_INTEGRATION_LINKS) + private List integrationLinks; + + public static final String SERIALIZED_NAME_SETTING_TAGS = "settingTags"; + @SerializedName(SERIALIZED_NAME_SETTING_TAGS) + private List settingTags; + + public static final String SERIALIZED_NAME_SETTING_IDS_WHERE_PREREQUISITE = "settingIdsWherePrerequisite"; + @SerializedName(SERIALIZED_NAME_SETTING_IDS_WHERE_PREREQUISITE) + private List settingIdsWherePrerequisite; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + @SerializedName(SERIALIZED_NAME_CONFIG) + private ConfigModel config; + + public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT) + private EnvironmentModel environment; + + public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; + @SerializedName(SERIALIZED_NAME_READ_ONLY) + private Boolean readOnly; + + public static final String SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS = "featureFlagLimitations"; + @SerializedName(SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS) + private FeatureFlagLimitations featureFlagLimitations; + + public SettingFormulaModel() { + } + + public SettingFormulaModel lastVersionId(UUID lastVersionId) { + this.lastVersionId = lastVersionId; + return this; + } + + /** + * Get lastVersionId + * @return lastVersionId + */ + @javax.annotation.Nullable + public UUID getLastVersionId() { + return lastVersionId; + } + + public void setLastVersionId(UUID lastVersionId) { + this.lastVersionId = lastVersionId; + } + + + public SettingFormulaModel defaultValue(ValueModel defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * Get defaultValue + * @return defaultValue + */ + @javax.annotation.Nullable + public ValueModel getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(ValueModel defaultValue) { + this.defaultValue = defaultValue; + } + + + public SettingFormulaModel targetingRules(List targetingRules) { + this.targetingRules = targetingRules; + return this; + } + + public SettingFormulaModel addTargetingRulesItem(TargetingRuleModel targetingRulesItem) { + if (this.targetingRules == null) { + this.targetingRules = new ArrayList<>(); + } + this.targetingRules.add(targetingRulesItem); + return this; + } + + /** + * The targeting rules of the Feature Flag or Setting. + * @return targetingRules + */ + @javax.annotation.Nullable + public List getTargetingRules() { + return targetingRules; + } + + public void setTargetingRules(List targetingRules) { + this.targetingRules = targetingRules; + } + + + public SettingFormulaModel setting(SettingDataModel setting) { + this.setting = setting; + return this; + } + + /** + * Get setting + * @return setting + */ + @javax.annotation.Nullable + public SettingDataModel getSetting() { + return setting; + } + + public void setSetting(SettingDataModel setting) { + this.setting = setting; + } + + + public SettingFormulaModel updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The last updated date and time when the Feature Flag or Setting. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public SettingFormulaModel percentageEvaluationAttribute(String percentageEvaluationAttribute) { + this.percentageEvaluationAttribute = percentageEvaluationAttribute; + return this; + } + + /** + * The user attribute used for percentage evaluation. If not set, it defaults to the `Identifier` user object attribute. + * @return percentageEvaluationAttribute + */ + @javax.annotation.Nullable + public String getPercentageEvaluationAttribute() { + return percentageEvaluationAttribute; + } + + public void setPercentageEvaluationAttribute(String percentageEvaluationAttribute) { + this.percentageEvaluationAttribute = percentageEvaluationAttribute; + } + + + public SettingFormulaModel lastUpdaterUserEmail(String lastUpdaterUserEmail) { + this.lastUpdaterUserEmail = lastUpdaterUserEmail; + return this; + } + + /** + * The email of the user who last updated the Feature Flag or Setting. + * @return lastUpdaterUserEmail + */ + @javax.annotation.Nullable + public String getLastUpdaterUserEmail() { + return lastUpdaterUserEmail; + } + + public void setLastUpdaterUserEmail(String lastUpdaterUserEmail) { + this.lastUpdaterUserEmail = lastUpdaterUserEmail; + } + + + public SettingFormulaModel lastUpdaterUserFullName(String lastUpdaterUserFullName) { + this.lastUpdaterUserFullName = lastUpdaterUserFullName; + return this; + } + + /** + * The name of the user who last updated the Feature Flag or Setting. + * @return lastUpdaterUserFullName + */ + @javax.annotation.Nullable + public String getLastUpdaterUserFullName() { + return lastUpdaterUserFullName; + } + + public void setLastUpdaterUserFullName(String lastUpdaterUserFullName) { + this.lastUpdaterUserFullName = lastUpdaterUserFullName; + } + + + public SettingFormulaModel integrationLinks(List integrationLinks) { + this.integrationLinks = integrationLinks; + return this; + } + + public SettingFormulaModel addIntegrationLinksItem(IntegrationLinkModel integrationLinksItem) { + if (this.integrationLinks == null) { + this.integrationLinks = new ArrayList<>(); + } + this.integrationLinks.add(integrationLinksItem); + return this; + } + + /** + * The integration links attached to the Feature Flag or Setting. + * @return integrationLinks + */ + @javax.annotation.Nullable + public List getIntegrationLinks() { + return integrationLinks; + } + + public void setIntegrationLinks(List integrationLinks) { + this.integrationLinks = integrationLinks; + } + + + public SettingFormulaModel settingTags(List settingTags) { + this.settingTags = settingTags; + return this; + } + + public SettingFormulaModel addSettingTagsItem(SettingTagModel settingTagsItem) { + if (this.settingTags == null) { + this.settingTags = new ArrayList<>(); + } + this.settingTags.add(settingTagsItem); + return this; + } + + /** + * The tags attached to the Feature Flag or Setting. + * @return settingTags + */ + @javax.annotation.Nullable + public List getSettingTags() { + return settingTags; + } + + public void setSettingTags(List settingTags) { + this.settingTags = settingTags; + } + + + public SettingFormulaModel settingIdsWherePrerequisite(List settingIdsWherePrerequisite) { + this.settingIdsWherePrerequisite = settingIdsWherePrerequisite; + return this; + } + + public SettingFormulaModel addSettingIdsWherePrerequisiteItem(Integer settingIdsWherePrerequisiteItem) { + if (this.settingIdsWherePrerequisite == null) { + this.settingIdsWherePrerequisite = new ArrayList<>(); + } + this.settingIdsWherePrerequisite.add(settingIdsWherePrerequisiteItem); + return this; + } + + /** + * List of Feature Flag and Setting IDs where the actual Feature Flag or Setting is prerequisite. + * @return settingIdsWherePrerequisite + */ + @javax.annotation.Nullable + public List getSettingIdsWherePrerequisite() { + return settingIdsWherePrerequisite; + } + + public void setSettingIdsWherePrerequisite(List settingIdsWherePrerequisite) { + this.settingIdsWherePrerequisite = settingIdsWherePrerequisite; + } + + + public SettingFormulaModel config(ConfigModel config) { + this.config = config; + return this; + } + + /** + * Get config + * @return config + */ + @javax.annotation.Nullable + public ConfigModel getConfig() { + return config; + } + + public void setConfig(ConfigModel config) { + this.config = config; + } + + + public SettingFormulaModel environment(EnvironmentModel environment) { + this.environment = environment; + return this; + } + + /** + * Get environment + * @return environment + */ + @javax.annotation.Nullable + public EnvironmentModel getEnvironment() { + return environment; + } + + public void setEnvironment(EnvironmentModel environment) { + this.environment = environment; + } + + + public SettingFormulaModel readOnly(Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + /** + * Get readOnly + * @return readOnly + */ + @javax.annotation.Nullable + public Boolean getReadOnly() { + return readOnly; + } + + public void setReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + } + + + public SettingFormulaModel featureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { + this.featureFlagLimitations = featureFlagLimitations; + return this; + } + + /** + * Get featureFlagLimitations + * @return featureFlagLimitations + */ + @javax.annotation.Nullable + public FeatureFlagLimitations getFeatureFlagLimitations() { + return featureFlagLimitations; + } + + public void setFeatureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { + this.featureFlagLimitations = featureFlagLimitations; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SettingFormulaModel instance itself + */ + public SettingFormulaModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingFormulaModel settingFormulaModel = (SettingFormulaModel) o; + return Objects.equals(this.lastVersionId, settingFormulaModel.lastVersionId) && + Objects.equals(this.defaultValue, settingFormulaModel.defaultValue) && + Objects.equals(this.targetingRules, settingFormulaModel.targetingRules) && + Objects.equals(this.setting, settingFormulaModel.setting) && + Objects.equals(this.updatedAt, settingFormulaModel.updatedAt) && + Objects.equals(this.percentageEvaluationAttribute, settingFormulaModel.percentageEvaluationAttribute) && + Objects.equals(this.lastUpdaterUserEmail, settingFormulaModel.lastUpdaterUserEmail) && + Objects.equals(this.lastUpdaterUserFullName, settingFormulaModel.lastUpdaterUserFullName) && + Objects.equals(this.integrationLinks, settingFormulaModel.integrationLinks) && + Objects.equals(this.settingTags, settingFormulaModel.settingTags) && + Objects.equals(this.settingIdsWherePrerequisite, settingFormulaModel.settingIdsWherePrerequisite) && + Objects.equals(this.config, settingFormulaModel.config) && + Objects.equals(this.environment, settingFormulaModel.environment) && + Objects.equals(this.readOnly, settingFormulaModel.readOnly) && + Objects.equals(this.featureFlagLimitations, settingFormulaModel.featureFlagLimitations)&& + Objects.equals(this.additionalProperties, settingFormulaModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(lastVersionId, defaultValue, targetingRules, setting, updatedAt, percentageEvaluationAttribute, lastUpdaterUserEmail, lastUpdaterUserFullName, integrationLinks, settingTags, settingIdsWherePrerequisite, config, environment, readOnly, featureFlagLimitations, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingFormulaModel {\n"); + sb.append(" lastVersionId: ").append(toIndentedString(lastVersionId)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); + sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" percentageEvaluationAttribute: ").append(toIndentedString(percentageEvaluationAttribute)).append("\n"); + sb.append(" lastUpdaterUserEmail: ").append(toIndentedString(lastUpdaterUserEmail)).append("\n"); + sb.append(" lastUpdaterUserFullName: ").append(toIndentedString(lastUpdaterUserFullName)).append("\n"); + sb.append(" integrationLinks: ").append(toIndentedString(integrationLinks)).append("\n"); + sb.append(" settingTags: ").append(toIndentedString(settingTags)).append("\n"); + sb.append(" settingIdsWherePrerequisite: ").append(toIndentedString(settingIdsWherePrerequisite)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); + sb.append(" featureFlagLimitations: ").append(toIndentedString(featureFlagLimitations)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("lastVersionId"); + openapiFields.add("defaultValue"); + openapiFields.add("targetingRules"); + openapiFields.add("setting"); + openapiFields.add("updatedAt"); + openapiFields.add("percentageEvaluationAttribute"); + openapiFields.add("lastUpdaterUserEmail"); + openapiFields.add("lastUpdaterUserFullName"); + openapiFields.add("integrationLinks"); + openapiFields.add("settingTags"); + openapiFields.add("settingIdsWherePrerequisite"); + openapiFields.add("config"); + openapiFields.add("environment"); + openapiFields.add("readOnly"); + openapiFields.add("featureFlagLimitations"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettingFormulaModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettingFormulaModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SettingFormulaModel is not found in the empty JSON string", SettingFormulaModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("lastVersionId") != null && !jsonObj.get("lastVersionId").isJsonNull()) - && !jsonObj.get("lastVersionId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastVersionId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("lastVersionId").toString())); - } - // validate the optional field `defaultValue` - if (jsonObj.get("defaultValue") != null && !jsonObj.get("defaultValue").isJsonNull()) { - ValueModel.validateJsonElement(jsonObj.get("defaultValue")); - } - if (jsonObj.get("targetingRules") != null && !jsonObj.get("targetingRules").isJsonNull()) { - JsonArray jsonArraytargetingRules = jsonObj.getAsJsonArray("targetingRules"); - if (jsonArraytargetingRules != null) { - // ensure the json data is an array - if (!jsonObj.get("targetingRules").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `targetingRules` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("targetingRules").toString())); - } - - // validate the optional field `targetingRules` (array) - for (int i = 0; i < jsonArraytargetingRules.size(); i++) { - TargetingRuleModel.validateJsonElement(jsonArraytargetingRules.get(i)); - } - ; - } - } - // validate the optional field `setting` - if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { - SettingDataModel.validateJsonElement(jsonObj.get("setting")); - } - if ((jsonObj.get("percentageEvaluationAttribute") != null - && !jsonObj.get("percentageEvaluationAttribute").isJsonNull()) - && !jsonObj.get("percentageEvaluationAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `percentageEvaluationAttribute` to be a primitive" - + " type in the JSON string but got `%s`", - jsonObj.get("percentageEvaluationAttribute").toString())); - } - if ((jsonObj.get("lastUpdaterUserEmail") != null - && !jsonObj.get("lastUpdaterUserEmail").isJsonNull()) - && !jsonObj.get("lastUpdaterUserEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterUserEmail` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("lastUpdaterUserEmail").toString())); - } - if ((jsonObj.get("lastUpdaterUserFullName") != null - && !jsonObj.get("lastUpdaterUserFullName").isJsonNull()) - && !jsonObj.get("lastUpdaterUserFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterUserFullName` to be a primitive type" - + " in the JSON string but got `%s`", - jsonObj.get("lastUpdaterUserFullName").toString())); - } - if (jsonObj.get("integrationLinks") != null - && !jsonObj.get("integrationLinks").isJsonNull()) { - JsonArray jsonArrayintegrationLinks = jsonObj.getAsJsonArray("integrationLinks"); - if (jsonArrayintegrationLinks != null) { - // ensure the json data is an array - if (!jsonObj.get("integrationLinks").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `integrationLinks` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("integrationLinks").toString())); - } - - // validate the optional field `integrationLinks` (array) - for (int i = 0; i < jsonArrayintegrationLinks.size(); i++) { - IntegrationLinkModel.validateJsonElement(jsonArrayintegrationLinks.get(i)); - } - ; - } - } - if (jsonObj.get("settingTags") != null && !jsonObj.get("settingTags").isJsonNull()) { - JsonArray jsonArraysettingTags = jsonObj.getAsJsonArray("settingTags"); - if (jsonArraysettingTags != null) { - // ensure the json data is an array - if (!jsonObj.get("settingTags").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingTags` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("settingTags").toString())); - } - - // validate the optional field `settingTags` (array) - for (int i = 0; i < jsonArraysettingTags.size(); i++) { - SettingTagModel.validateJsonElement(jsonArraysettingTags.get(i)); - } - ; - } + if ((jsonObj.get("lastVersionId") != null && !jsonObj.get("lastVersionId").isJsonNull()) && !jsonObj.get("lastVersionId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastVersionId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastVersionId").toString())); + } + // validate the optional field `defaultValue` + if (jsonObj.get("defaultValue") != null && !jsonObj.get("defaultValue").isJsonNull()) { + ValueModel.validateJsonElement(jsonObj.get("defaultValue")); + } + if (jsonObj.get("targetingRules") != null && !jsonObj.get("targetingRules").isJsonNull()) { + JsonArray jsonArraytargetingRules = jsonObj.getAsJsonArray("targetingRules"); + if (jsonArraytargetingRules != null) { + // ensure the json data is an array + if (!jsonObj.get("targetingRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `targetingRules` to be an array in the JSON string but got `%s`", jsonObj.get("targetingRules").toString())); + } + + // validate the optional field `targetingRules` (array) + for (int i = 0; i < jsonArraytargetingRules.size(); i++) { + TargetingRuleModel.validateJsonElement(jsonArraytargetingRules.get(i)); + }; } - // ensure the optional json data is an array if present - if (jsonObj.get("settingIdsWherePrerequisite") != null - && !jsonObj.get("settingIdsWherePrerequisite").isJsonNull() - && !jsonObj.get("settingIdsWherePrerequisite").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingIdsWherePrerequisite` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("settingIdsWherePrerequisite").toString())); + } + // validate the optional field `setting` + if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { + SettingDataModel.validateJsonElement(jsonObj.get("setting")); + } + if ((jsonObj.get("percentageEvaluationAttribute") != null && !jsonObj.get("percentageEvaluationAttribute").isJsonNull()) && !jsonObj.get("percentageEvaluationAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentageEvaluationAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentageEvaluationAttribute").toString())); + } + if ((jsonObj.get("lastUpdaterUserEmail") != null && !jsonObj.get("lastUpdaterUserEmail").isJsonNull()) && !jsonObj.get("lastUpdaterUserEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterUserEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterUserEmail").toString())); + } + if ((jsonObj.get("lastUpdaterUserFullName") != null && !jsonObj.get("lastUpdaterUserFullName").isJsonNull()) && !jsonObj.get("lastUpdaterUserFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterUserFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterUserFullName").toString())); + } + if (jsonObj.get("integrationLinks") != null && !jsonObj.get("integrationLinks").isJsonNull()) { + JsonArray jsonArrayintegrationLinks = jsonObj.getAsJsonArray("integrationLinks"); + if (jsonArrayintegrationLinks != null) { + // ensure the json data is an array + if (!jsonObj.get("integrationLinks").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `integrationLinks` to be an array in the JSON string but got `%s`", jsonObj.get("integrationLinks").toString())); + } + + // validate the optional field `integrationLinks` (array) + for (int i = 0; i < jsonArrayintegrationLinks.size(); i++) { + IntegrationLinkModel.validateJsonElement(jsonArrayintegrationLinks.get(i)); + }; } - // validate the optional field `config` - if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { - ConfigModel.validateJsonElement(jsonObj.get("config")); + } + if (jsonObj.get("settingTags") != null && !jsonObj.get("settingTags").isJsonNull()) { + JsonArray jsonArraysettingTags = jsonObj.getAsJsonArray("settingTags"); + if (jsonArraysettingTags != null) { + // ensure the json data is an array + if (!jsonObj.get("settingTags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingTags` to be an array in the JSON string but got `%s`", jsonObj.get("settingTags").toString())); + } + + // validate the optional field `settingTags` (array) + for (int i = 0; i < jsonArraysettingTags.size(); i++) { + SettingTagModel.validateJsonElement(jsonArraysettingTags.get(i)); + }; } - // validate the optional field `environment` - if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { - EnvironmentModel.validateJsonElement(jsonObj.get("environment")); - } - // validate the optional field `featureFlagLimitations` - if (jsonObj.get("featureFlagLimitations") != null - && !jsonObj.get("featureFlagLimitations").isJsonNull()) { - FeatureFlagLimitations.validateJsonElement(jsonObj.get("featureFlagLimitations")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SettingFormulaModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SettingFormulaModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SettingFormulaModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SettingFormulaModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SettingFormulaModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of SettingFormulaModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SettingFormulaModel - * @throws IOException if the JSON string is invalid with respect to SettingFormulaModel - */ - public static SettingFormulaModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SettingFormulaModel.class); - } - - /** - * Convert an instance of SettingFormulaModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + } + // ensure the optional json data is an array if present + if (jsonObj.get("settingIdsWherePrerequisite") != null && !jsonObj.get("settingIdsWherePrerequisite").isJsonNull() && !jsonObj.get("settingIdsWherePrerequisite").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingIdsWherePrerequisite` to be an array in the JSON string but got `%s`", jsonObj.get("settingIdsWherePrerequisite").toString())); + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ConfigModel.validateJsonElement(jsonObj.get("config")); + } + // validate the optional field `environment` + if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { + EnvironmentModel.validateJsonElement(jsonObj.get("environment")); + } + // validate the optional field `featureFlagLimitations` + if (jsonObj.get("featureFlagLimitations") != null && !jsonObj.get("featureFlagLimitations").isJsonNull()) { + FeatureFlagLimitations.validateJsonElement(jsonObj.get("featureFlagLimitations")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettingFormulaModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettingFormulaModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SettingFormulaModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SettingFormulaModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SettingFormulaModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SettingFormulaModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SettingFormulaModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettingFormulaModel + * @throws IOException if the JSON string is invalid with respect to SettingFormulaModel + */ + public static SettingFormulaModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettingFormulaModel.class); + } + + /** + * Convert an instance of SettingFormulaModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SettingModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SettingModel.java index a130355..047dae8 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SettingModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SettingModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,494 +10,568 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.SettingType; +import com.configcat.publicapi.java.client.model.TagModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; - -/** Metadata of a Feature Flag or Setting. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class SettingModel { - public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; - - @SerializedName(SERIALIZED_NAME_SETTING_ID) - private Integer settingId; - - public static final String SERIALIZED_NAME_KEY = "key"; - - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_HINT = "hint"; - - @SerializedName(SERIALIZED_NAME_HINT) - private String hint; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public static final String SERIALIZED_NAME_SETTING_TYPE = "settingType"; - - @SerializedName(SERIALIZED_NAME_SETTING_TYPE) - private SettingType settingType; - - public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; - - @SerializedName(SERIALIZED_NAME_CONFIG_ID) - private UUID configId; - - public static final String SERIALIZED_NAME_CONFIG_NAME = "configName"; - - @SerializedName(SERIALIZED_NAME_CONFIG_NAME) - private String configName; - - public static final String SERIALIZED_NAME_TAGS = "tags"; - - @SerializedName(SERIALIZED_NAME_TAGS) - private List tags; - - public SettingModel() {} - - public SettingModel settingId(Integer settingId) { - this.settingId = settingId; - return this; - } - - /** - * Identifier of the Feature Flag or Setting. - * - * @return settingId - */ - @javax.annotation.Nullable - public Integer getSettingId() { - return settingId; - } - - public void setSettingId(Integer settingId) { - this.settingId = settingId; - } - - public SettingModel key(String key) { - this.key = key; - return this; - } - - /** - * Key of the Feature Flag or Setting. - * - * @return key - */ - @javax.annotation.Nullable - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public SettingModel name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Feature Flag or Setting. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public SettingModel hint(String hint) { - this.hint = hint; - return this; - } - - /** - * Description of the Feature Flag or Setting. - * - * @return hint - */ - @javax.annotation.Nullable - public String getHint() { - return hint; - } - - public void setHint(String hint) { - this.hint = hint; - } - - public SettingModel order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Feature Flag or Setting represented on the ConfigCat Dashboard. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - public void setOrder(Integer order) { - this.order = order; - } - - public SettingModel settingType(SettingType settingType) { - this.settingType = settingType; - return this; - } - - /** - * Get settingType - * - * @return settingType - */ - @javax.annotation.Nullable - public SettingType getSettingType() { - return settingType; - } - - public void setSettingType(SettingType settingType) { - this.settingType = settingType; - } - - public SettingModel configId(UUID configId) { - this.configId = configId; - return this; - } - - /** - * Identifier of the Feature Flag's Config. - * - * @return configId - */ - @javax.annotation.Nullable - public UUID getConfigId() { - return configId; - } - - public void setConfigId(UUID configId) { - this.configId = configId; - } - - public SettingModel configName(String configName) { - this.configName = configName; - return this; - } - - /** - * Name of the Feature Flag's Config. - * - * @return configName - */ - @javax.annotation.Nullable - public String getConfigName() { - return configName; - } - - public void setConfigName(String configName) { - this.configName = configName; - } - - public SettingModel tags(List tags) { - this.tags = tags; - return this; - } - - public SettingModel addTagsItem(TagModel tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList<>(); - } - this.tags.add(tagsItem); - return this; - } - - /** - * The tags attached to the Feature Flag or Setting. - * - * @return tags - */ - @javax.annotation.Nullable - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SettingModel settingModel = (SettingModel) o; - return Objects.equals(this.settingId, settingModel.settingId) - && Objects.equals(this.key, settingModel.key) - && Objects.equals(this.name, settingModel.name) - && Objects.equals(this.hint, settingModel.hint) - && Objects.equals(this.order, settingModel.order) - && Objects.equals(this.settingType, settingModel.settingType) - && Objects.equals(this.configId, settingModel.configId) - && Objects.equals(this.configName, settingModel.configName) - && Objects.equals(this.tags, settingModel.tags); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - settingId, key, name, hint, order, settingType, configId, configName, tags); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SettingModel {\n"); - sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append(" settingType: ").append(toIndentedString(settingType)).append("\n"); - sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); - sb.append(" configName: ").append(toIndentedString(configName)).append("\n"); - sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("settingId"); - openapiFields.add("key"); - openapiFields.add("name"); - openapiFields.add("hint"); - openapiFields.add("order"); - openapiFields.add("settingType"); - openapiFields.add("configId"); - openapiFields.add("configName"); - openapiFields.add("tags"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SettingModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SettingModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SettingModel is not found in the" - + " empty JSON string", - SettingModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SettingModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SettingModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * Metadata of a Feature Flag or Setting. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class SettingModel { + public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; + @SerializedName(SERIALIZED_NAME_SETTING_ID) + private Integer settingId; + + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_HINT = "hint"; + @SerializedName(SERIALIZED_NAME_HINT) + private String hint; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public static final String SERIALIZED_NAME_SETTING_TYPE = "settingType"; + @SerializedName(SERIALIZED_NAME_SETTING_TYPE) + private SettingType settingType; + + public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; + @SerializedName(SERIALIZED_NAME_CONFIG_ID) + private UUID configId; + + public static final String SERIALIZED_NAME_CONFIG_NAME = "configName"; + @SerializedName(SERIALIZED_NAME_CONFIG_NAME) + private String configName; + + public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + + public SettingModel() { + } + + public SettingModel settingId(Integer settingId) { + this.settingId = settingId; + return this; + } + + /** + * Identifier of the Feature Flag or Setting. + * @return settingId + */ + @javax.annotation.Nullable + public Integer getSettingId() { + return settingId; + } + + public void setSettingId(Integer settingId) { + this.settingId = settingId; + } + + + public SettingModel key(String key) { + this.key = key; + return this; + } + + /** + * Key of the Feature Flag or Setting. + * @return key + */ + @javax.annotation.Nullable + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + + public SettingModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Feature Flag or Setting. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public SettingModel hint(String hint) { + this.hint = hint; + return this; + } + + /** + * Description of the Feature Flag or Setting. + * @return hint + */ + @javax.annotation.Nullable + public String getHint() { + return hint; + } + + public void setHint(String hint) { + this.hint = hint; + } + + + public SettingModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Feature Flag or Setting represented on the ConfigCat Dashboard. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + + public SettingModel settingType(SettingType settingType) { + this.settingType = settingType; + return this; + } + + /** + * Get settingType + * @return settingType + */ + @javax.annotation.Nullable + public SettingType getSettingType() { + return settingType; + } + + public void setSettingType(SettingType settingType) { + this.settingType = settingType; + } + + + public SettingModel configId(UUID configId) { + this.configId = configId; + return this; + } + + /** + * Identifier of the Feature Flag's Config. + * @return configId + */ + @javax.annotation.Nullable + public UUID getConfigId() { + return configId; + } + + public void setConfigId(UUID configId) { + this.configId = configId; + } + + + public SettingModel configName(String configName) { + this.configName = configName; + return this; + } + + /** + * Name of the Feature Flag's Config. + * @return configName + */ + @javax.annotation.Nullable + public String getConfigName() { + return configName; + } + + public void setConfigName(String configName) { + this.configName = configName; + } + + + public SettingModel createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The creation time of the Feature Flag or Setting. + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public SettingModel tags(List tags) { + this.tags = tags; + return this; + } + + public SettingModel addTagsItem(TagModel tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The tags attached to the Feature Flag or Setting. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SettingModel instance itself + */ + public SettingModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingModel settingModel = (SettingModel) o; + return Objects.equals(this.settingId, settingModel.settingId) && + Objects.equals(this.key, settingModel.key) && + Objects.equals(this.name, settingModel.name) && + Objects.equals(this.hint, settingModel.hint) && + Objects.equals(this.order, settingModel.order) && + Objects.equals(this.settingType, settingModel.settingType) && + Objects.equals(this.configId, settingModel.configId) && + Objects.equals(this.configName, settingModel.configName) && + Objects.equals(this.createdAt, settingModel.createdAt) && + Objects.equals(this.tags, settingModel.tags)&& + Objects.equals(this.additionalProperties, settingModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(settingId, key, name, hint, order, settingType, configId, configName, createdAt, tags, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingModel {\n"); + sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" hint: ").append(toIndentedString(hint)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" settingType: ").append(toIndentedString(settingType)).append("\n"); + sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); + sb.append(" configName: ").append(toIndentedString(configName)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("settingId"); + openapiFields.add("key"); + openapiFields.add("name"); + openapiFields.add("hint"); + openapiFields.add("order"); + openapiFields.add("settingType"); + openapiFields.add("configId"); + openapiFields.add("configName"); + openapiFields.add("createdAt"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettingModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettingModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SettingModel is not found in the empty JSON string", SettingModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) - && !jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `key` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("key").toString())); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) - && !jsonObj.get("hint").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `hint` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("hint").toString())); - } - // validate the optional field `settingType` - if (jsonObj.get("settingType") != null && !jsonObj.get("settingType").isJsonNull()) { - SettingType.validateJsonElement(jsonObj.get("settingType")); + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("hint") != null && !jsonObj.get("hint").isJsonNull()) && !jsonObj.get("hint").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hint` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hint").toString())); + } + // validate the optional field `settingType` + if (jsonObj.get("settingType") != null && !jsonObj.get("settingType").isJsonNull()) { + SettingType.validateJsonElement(jsonObj.get("settingType")); + } + if ((jsonObj.get("configId") != null && !jsonObj.get("configId").isJsonNull()) && !jsonObj.get("configId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `configId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("configId").toString())); + } + if ((jsonObj.get("configName") != null && !jsonObj.get("configName").isJsonNull()) && !jsonObj.get("configName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `configName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("configName").toString())); + } + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { + JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); + if (jsonArraytags != null) { + // ensure the json data is an array + if (!jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + + // validate the optional field `tags` (array) + for (int i = 0; i < jsonArraytags.size(); i++) { + TagModel.validateJsonElement(jsonArraytags.get(i)); + }; } - if ((jsonObj.get("configId") != null && !jsonObj.get("configId").isJsonNull()) - && !jsonObj.get("configId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("configId").toString())); - } - if ((jsonObj.get("configName") != null && !jsonObj.get("configName").isJsonNull()) - && !jsonObj.get("configName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configName` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("configName").toString())); - } - if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull()) { - JsonArray jsonArraytags = jsonObj.getAsJsonArray("tags"); - if (jsonArraytags != null) { - // ensure the json data is an array - if (!jsonObj.get("tags").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `tags` to be an array in the JSON string" - + " but got `%s`", - jsonObj.get("tags").toString())); - } - - // validate the optional field `tags` (array) - for (int i = 0; i < jsonArraytags.size(); i++) { - TagModel.validateJsonElement(jsonArraytags.get(i)); - } - ; - } - } - } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SettingModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SettingModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SettingModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SettingModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SettingModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of SettingModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SettingModel - * @throws IOException if the JSON string is invalid with respect to SettingModel - */ - public static SettingModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SettingModel.class); - } - - /** - * Convert an instance of SettingModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettingModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettingModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SettingModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SettingModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SettingModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SettingModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SettingModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettingModel + * @throws IOException if the JSON string is invalid with respect to SettingModel + */ + public static SettingModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettingModel.class); + } + + /** + * Convert an instance of SettingModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SettingTagModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SettingTagModel.java index 9ae34f7..ade46fa 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SettingTagModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SettingTagModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,300 +10,371 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** SettingTagModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class SettingTagModel { - public static final String SERIALIZED_NAME_SETTING_TAG_ID = "settingTagId"; - - @SerializedName(SERIALIZED_NAME_SETTING_TAG_ID) - private Long settingTagId; - - public static final String SERIALIZED_NAME_TAG_ID = "tagId"; - - @SerializedName(SERIALIZED_NAME_TAG_ID) - private Long tagId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_COLOR = "color"; - - @SerializedName(SERIALIZED_NAME_COLOR) - private String color; - - public SettingTagModel() {} - - public SettingTagModel settingTagId(Long settingTagId) { - this.settingTagId = settingTagId; - return this; - } - - /** - * Get settingTagId - * - * @return settingTagId - */ - @javax.annotation.Nullable - public Long getSettingTagId() { - return settingTagId; - } - - public void setSettingTagId(Long settingTagId) { - this.settingTagId = settingTagId; - } - - public SettingTagModel tagId(Long tagId) { - this.tagId = tagId; - return this; - } - - /** - * Get tagId - * - * @return tagId - */ - @javax.annotation.Nullable - public Long getTagId() { - return tagId; - } - - public void setTagId(Long tagId) { - this.tagId = tagId; - } - - public SettingTagModel name(String name) { - this.name = name; - return this; - } - /** - * Get name - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public SettingTagModel color(String color) { - this.color = color; - return this; - } - - /** - * Get color - * - * @return color - */ - @javax.annotation.Nullable - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SettingTagModel settingTagModel = (SettingTagModel) o; - return Objects.equals(this.settingTagId, settingTagModel.settingTagId) - && Objects.equals(this.tagId, settingTagModel.tagId) - && Objects.equals(this.name, settingTagModel.name) - && Objects.equals(this.color, settingTagModel.color); +/** + * SettingTagModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class SettingTagModel { + public static final String SERIALIZED_NAME_SETTING_TAG_ID = "settingTagId"; + @SerializedName(SERIALIZED_NAME_SETTING_TAG_ID) + private Long settingTagId; + + public static final String SERIALIZED_NAME_TAG_ID = "tagId"; + @SerializedName(SERIALIZED_NAME_TAG_ID) + private Long tagId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + + public SettingTagModel() { + } + + public SettingTagModel settingTagId(Long settingTagId) { + this.settingTagId = settingTagId; + return this; + } + + /** + * Get settingTagId + * @return settingTagId + */ + @javax.annotation.Nullable + public Long getSettingTagId() { + return settingTagId; + } + + public void setSettingTagId(Long settingTagId) { + this.settingTagId = settingTagId; + } + + + public SettingTagModel tagId(Long tagId) { + this.tagId = tagId; + return this; + } + + /** + * Get tagId + * @return tagId + */ + @javax.annotation.Nullable + public Long getTagId() { + return tagId; + } + + public void setTagId(Long tagId) { + this.tagId = tagId; + } + + + public SettingTagModel name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public SettingTagModel color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SettingTagModel instance itself + */ + public SettingTagModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(settingTagId, tagId, name, color); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SettingTagModel {\n"); - sb.append(" settingTagId: ").append(toIndentedString(settingTagId)).append("\n"); - sb.append(" tagId: ").append(toIndentedString(tagId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + SettingTagModel settingTagModel = (SettingTagModel) o; + return Objects.equals(this.settingTagId, settingTagModel.settingTagId) && + Objects.equals(this.tagId, settingTagModel.tagId) && + Objects.equals(this.name, settingTagModel.name) && + Objects.equals(this.color, settingTagModel.color)&& + Objects.equals(this.additionalProperties, settingTagModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(settingTagId, tagId, name, color, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("settingTagId"); - openapiFields.add("tagId"); - openapiFields.add("name"); - openapiFields.add("color"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingTagModel {\n"); + sb.append(" settingTagId: ").append(toIndentedString(settingTagId)).append("\n"); + sb.append(" tagId: ").append(toIndentedString(tagId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SettingTagModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SettingTagModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SettingTagModel is not found in the" - + " empty JSON string", - SettingTagModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SettingTagModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SettingTagModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("settingTagId"); + openapiFields.add("tagId"); + openapiFields.add("name"); + openapiFields.add("color"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettingTagModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettingTagModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SettingTagModel is not found in the empty JSON string", SettingTagModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) - && !jsonObj.get("color").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `color` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("color").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SettingTagModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SettingTagModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SettingTagModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SettingTagModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SettingTagModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of SettingTagModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SettingTagModel - * @throws IOException if the JSON string is invalid with respect to SettingTagModel - */ - public static SettingTagModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SettingTagModel.class); - } - - /** - * Convert an instance of SettingTagModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettingTagModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettingTagModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SettingTagModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SettingTagModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SettingTagModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SettingTagModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of SettingTagModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettingTagModel + * @throws IOException if the JSON string is invalid with respect to SettingTagModel + */ + public static SettingTagModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettingTagModel.class); + } + + /** + * Convert an instance of SettingTagModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SettingType.java b/src/main/java/com/configcat/publicapi/java/client/model/SettingType.java index b60ce47..b78ac4b 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SettingType.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SettingType.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,67 +10,73 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** The type of the Feature Flag or Setting. */ +/** + * The type of the Feature Flag or Setting. + */ @JsonAdapter(SettingType.Adapter.class) public enum SettingType { - BOOLEAN("boolean"), - - STRING("string"), + + BOOLEAN("boolean"), + + STRING("string"), + + INT("int"), + + DOUBLE("double"); - INT("int"), + private String value; - DOUBLE("double"); + SettingType(String value) { + this.value = value; + } - private String value; + public String getValue() { + return value; + } - SettingType(String value) { - this.value = value; - } + @Override + public String toString() { + return String.valueOf(value); + } - public String getValue() { - return value; + public static SettingType fromValue(String value) { + for (SettingType b : SettingType.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); - } - - public static SettingType fromValue(String value) { - for (SettingType b : SettingType.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public void write(final JsonWriter jsonWriter, final SettingType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final SettingType enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public SettingType read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return SettingType.fromValue(value); - } + @Override + public SettingType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SettingType.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - SettingType.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SettingType.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/SettingValueModel.java b/src/main/java/com/configcat/publicapi/java/client/model/SettingValueModel.java index be56aee..ccfa672 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/SettingValueModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/SettingValueModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,705 +10,720 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ConfigModel; +import com.configcat.publicapi.java.client.model.EnvironmentModel; +import com.configcat.publicapi.java.client.model.FeatureFlagLimitations; +import com.configcat.publicapi.java.client.model.IntegrationLinkModel; +import com.configcat.publicapi.java.client.model.RolloutPercentageItemModel; +import com.configcat.publicapi.java.client.model.RolloutRuleModel; +import com.configcat.publicapi.java.client.model.SettingDataModel; +import com.configcat.publicapi.java.client.model.SettingTagModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** SettingValueModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class SettingValueModel { - public static final String SERIALIZED_NAME_ROLLOUT_RULES = "rolloutRules"; - - @SerializedName(SERIALIZED_NAME_ROLLOUT_RULES) - private List rolloutRules; - - public static final String SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS = "rolloutPercentageItems"; - - @SerializedName(SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS) - private List rolloutPercentageItems; - - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) - private Object value = null; - - public static final String SERIALIZED_NAME_SETTING = "setting"; - - @SerializedName(SERIALIZED_NAME_SETTING) - private SettingDataModel setting; - - public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; - - @SerializedName(SERIALIZED_NAME_UPDATED_AT) - private OffsetDateTime updatedAt; - - public static final String SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL = "lastUpdaterUserEmail"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL) - private String lastUpdaterUserEmail; - - public static final String SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME = - "lastUpdaterUserFullName"; - - @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME) - private String lastUpdaterUserFullName; - - public static final String SERIALIZED_NAME_INTEGRATION_LINKS = "integrationLinks"; - - @SerializedName(SERIALIZED_NAME_INTEGRATION_LINKS) - private List integrationLinks; - - public static final String SERIALIZED_NAME_SETTING_TAGS = "settingTags"; - - @SerializedName(SERIALIZED_NAME_SETTING_TAGS) - private List settingTags; - - public static final String SERIALIZED_NAME_CONFIG = "config"; - - @SerializedName(SERIALIZED_NAME_CONFIG) - private ConfigModel config; - - public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT) - private EnvironmentModel environment; - - public static final String SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS = "featureFlagLimitations"; - @SerializedName(SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS) - private FeatureFlagLimitations featureFlagLimitations; - - public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; - - @SerializedName(SERIALIZED_NAME_READ_ONLY) - private Boolean readOnly; - - public SettingValueModel() {} - - public SettingValueModel rolloutRules(List rolloutRules) { - this.rolloutRules = rolloutRules; - return this; - } - - public SettingValueModel addRolloutRulesItem(RolloutRuleModel rolloutRulesItem) { - if (this.rolloutRules == null) { - this.rolloutRules = new ArrayList<>(); - } - this.rolloutRules.add(rolloutRulesItem); - return this; - } - - /** - * The targeting rule collection. - * - * @return rolloutRules - */ - @javax.annotation.Nullable - public List getRolloutRules() { - return rolloutRules; - } - - public void setRolloutRules(List rolloutRules) { - this.rolloutRules = rolloutRules; - } - - public SettingValueModel rolloutPercentageItems( - List rolloutPercentageItems) { - this.rolloutPercentageItems = rolloutPercentageItems; - return this; - } - - public SettingValueModel addRolloutPercentageItemsItem( - RolloutPercentageItemModel rolloutPercentageItemsItem) { - if (this.rolloutPercentageItems == null) { - this.rolloutPercentageItems = new ArrayList<>(); - } - this.rolloutPercentageItems.add(rolloutPercentageItemsItem); - return this; - } - - /** - * The percentage rule collection. - * - * @return rolloutPercentageItems - */ - @javax.annotation.Nullable - public List getRolloutPercentageItems() { - return rolloutPercentageItems; - } - - public void setRolloutPercentageItems(List rolloutPercentageItems) { - this.rolloutPercentageItems = rolloutPercentageItems; - } - - public SettingValueModel value(Object value) { - this.value = value; - return this; - } - - /** - * The value to serve. It must respect the setting type. - * - * @return value - */ - @javax.annotation.Nullable - public Object getValue() { - return value; - } - - public void setValue(Object value) { - this.value = value; - } - - public SettingValueModel setting(SettingDataModel setting) { - this.setting = setting; - return this; - } - - /** - * Get setting - * - * @return setting - */ - @javax.annotation.Nullable - public SettingDataModel getSetting() { - return setting; - } - - public void setSetting(SettingDataModel setting) { - this.setting = setting; - } - - public SettingValueModel updatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - /** - * The last updated date and time when the Feature Flag or Setting. - * - * @return updatedAt - */ - @javax.annotation.Nullable - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - public void setUpdatedAt(OffsetDateTime updatedAt) { - this.updatedAt = updatedAt; - } - - public SettingValueModel lastUpdaterUserEmail(String lastUpdaterUserEmail) { - this.lastUpdaterUserEmail = lastUpdaterUserEmail; - return this; - } - - /** - * The email of the user who last updated the Feature Flag or Setting. - * - * @return lastUpdaterUserEmail - */ - @javax.annotation.Nullable - public String getLastUpdaterUserEmail() { - return lastUpdaterUserEmail; - } - - public void setLastUpdaterUserEmail(String lastUpdaterUserEmail) { - this.lastUpdaterUserEmail = lastUpdaterUserEmail; - } - - public SettingValueModel lastUpdaterUserFullName(String lastUpdaterUserFullName) { - this.lastUpdaterUserFullName = lastUpdaterUserFullName; - return this; - } - - /** - * The name of the user who last updated the Feature Flag or Setting. - * - * @return lastUpdaterUserFullName - */ - @javax.annotation.Nullable - public String getLastUpdaterUserFullName() { - return lastUpdaterUserFullName; - } - - public void setLastUpdaterUserFullName(String lastUpdaterUserFullName) { - this.lastUpdaterUserFullName = lastUpdaterUserFullName; - } - - public SettingValueModel integrationLinks(List integrationLinks) { - this.integrationLinks = integrationLinks; - return this; - } - - public SettingValueModel addIntegrationLinksItem(IntegrationLinkModel integrationLinksItem) { - if (this.integrationLinks == null) { - this.integrationLinks = new ArrayList<>(); - } - this.integrationLinks.add(integrationLinksItem); - return this; - } - - /** - * The integration links attached to the Feature Flag or Setting. - * - * @return integrationLinks - */ - @javax.annotation.Nullable - public List getIntegrationLinks() { - return integrationLinks; - } - - public void setIntegrationLinks(List integrationLinks) { - this.integrationLinks = integrationLinks; - } - - public SettingValueModel settingTags(List settingTags) { - this.settingTags = settingTags; - return this; - } - - public SettingValueModel addSettingTagsItem(SettingTagModel settingTagsItem) { - if (this.settingTags == null) { - this.settingTags = new ArrayList<>(); - } - this.settingTags.add(settingTagsItem); - return this; - } - - /** - * The tags attached to the Feature Flag or Setting. - * - * @return settingTags - */ - @javax.annotation.Nullable - public List getSettingTags() { - return settingTags; - } - - public void setSettingTags(List settingTags) { - this.settingTags = settingTags; - } - - public SettingValueModel config(ConfigModel config) { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config - */ - @javax.annotation.Nullable - public ConfigModel getConfig() { - return config; - } - - public void setConfig(ConfigModel config) { - this.config = config; - } - - public SettingValueModel environment(EnvironmentModel environment) { - this.environment = environment; - return this; - } - - /** - * Get environment - * - * @return environment - */ - @javax.annotation.Nullable - public EnvironmentModel getEnvironment() { - return environment; - } - - public void setEnvironment(EnvironmentModel environment) { - this.environment = environment; - } - - public SettingValueModel featureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { - this.featureFlagLimitations = featureFlagLimitations; - return this; - } - - /** - * Get featureFlagLimitations - * - * @return featureFlagLimitations - */ - @javax.annotation.Nullable - public FeatureFlagLimitations getFeatureFlagLimitations() { - return featureFlagLimitations; - } - - public void setFeatureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { - this.featureFlagLimitations = featureFlagLimitations; - } - - public SettingValueModel readOnly(Boolean readOnly) { - this.readOnly = readOnly; - return this; - } - - /** - * Get readOnly - * - * @return readOnly - */ - @javax.annotation.Nullable - public Boolean getReadOnly() { - return readOnly; - } - - public void setReadOnly(Boolean readOnly) { - this.readOnly = readOnly; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SettingValueModel settingValueModel = (SettingValueModel) o; - return Objects.equals(this.rolloutRules, settingValueModel.rolloutRules) - && Objects.equals( - this.rolloutPercentageItems, settingValueModel.rolloutPercentageItems) - && Objects.equals(this.value, settingValueModel.value) - && Objects.equals(this.setting, settingValueModel.setting) - && Objects.equals(this.updatedAt, settingValueModel.updatedAt) - && Objects.equals(this.lastUpdaterUserEmail, settingValueModel.lastUpdaterUserEmail) - && Objects.equals( - this.lastUpdaterUserFullName, settingValueModel.lastUpdaterUserFullName) - && Objects.equals(this.integrationLinks, settingValueModel.integrationLinks) - && Objects.equals(this.settingTags, settingValueModel.settingTags) - && Objects.equals(this.config, settingValueModel.config) - && Objects.equals(this.environment, settingValueModel.environment) - && Objects.equals( - this.featureFlagLimitations, settingValueModel.featureFlagLimitations) - && Objects.equals(this.readOnly, settingValueModel.readOnly); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - rolloutRules, - rolloutPercentageItems, - value, - setting, - updatedAt, - lastUpdaterUserEmail, - lastUpdaterUserFullName, - integrationLinks, - settingTags, - config, - environment, - featureFlagLimitations, - readOnly); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SettingValueModel {\n"); - sb.append(" rolloutRules: ").append(toIndentedString(rolloutRules)).append("\n"); - sb.append(" rolloutPercentageItems: ") - .append(toIndentedString(rolloutPercentageItems)) - .append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); - sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); - sb.append(" lastUpdaterUserEmail: ") - .append(toIndentedString(lastUpdaterUserEmail)) - .append("\n"); - sb.append(" lastUpdaterUserFullName: ") - .append(toIndentedString(lastUpdaterUserFullName)) - .append("\n"); - sb.append(" integrationLinks: ").append(toIndentedString(integrationLinks)).append("\n"); - sb.append(" settingTags: ").append(toIndentedString(settingTags)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); - sb.append(" featureFlagLimitations: ") - .append(toIndentedString(featureFlagLimitations)) - .append("\n"); - sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("rolloutRules"); - openapiFields.add("rolloutPercentageItems"); - openapiFields.add("value"); - openapiFields.add("setting"); - openapiFields.add("updatedAt"); - openapiFields.add("lastUpdaterUserEmail"); - openapiFields.add("lastUpdaterUserFullName"); - openapiFields.add("integrationLinks"); - openapiFields.add("settingTags"); - openapiFields.add("config"); - openapiFields.add("environment"); - openapiFields.add("featureFlagLimitations"); - openapiFields.add("readOnly"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to SettingValueModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!SettingValueModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in SettingValueModel is not found in the" - + " empty JSON string", - SettingValueModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!SettingValueModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `SettingValueModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * SettingValueModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class SettingValueModel { + public static final String SERIALIZED_NAME_ROLLOUT_RULES = "rolloutRules"; + @SerializedName(SERIALIZED_NAME_ROLLOUT_RULES) + private List rolloutRules; + + public static final String SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS = "rolloutPercentageItems"; + @SerializedName(SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS) + private List rolloutPercentageItems; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; + + public static final String SERIALIZED_NAME_SETTING = "setting"; + @SerializedName(SERIALIZED_NAME_SETTING) + private SettingDataModel setting; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL = "lastUpdaterUserEmail"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_EMAIL) + private String lastUpdaterUserEmail; + + public static final String SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME = "lastUpdaterUserFullName"; + @SerializedName(SERIALIZED_NAME_LAST_UPDATER_USER_FULL_NAME) + private String lastUpdaterUserFullName; + + public static final String SERIALIZED_NAME_INTEGRATION_LINKS = "integrationLinks"; + @SerializedName(SERIALIZED_NAME_INTEGRATION_LINKS) + private List integrationLinks; + + public static final String SERIALIZED_NAME_SETTING_TAGS = "settingTags"; + @SerializedName(SERIALIZED_NAME_SETTING_TAGS) + private List settingTags; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + @SerializedName(SERIALIZED_NAME_CONFIG) + private ConfigModel config; + + public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT) + private EnvironmentModel environment; + + public static final String SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS = "featureFlagLimitations"; + @SerializedName(SERIALIZED_NAME_FEATURE_FLAG_LIMITATIONS) + private FeatureFlagLimitations featureFlagLimitations; + + public static final String SERIALIZED_NAME_READ_ONLY = "readOnly"; + @SerializedName(SERIALIZED_NAME_READ_ONLY) + private Boolean readOnly; + + public SettingValueModel() { + } + + public SettingValueModel rolloutRules(List rolloutRules) { + this.rolloutRules = rolloutRules; + return this; + } + + public SettingValueModel addRolloutRulesItem(RolloutRuleModel rolloutRulesItem) { + if (this.rolloutRules == null) { + this.rolloutRules = new ArrayList<>(); + } + this.rolloutRules.add(rolloutRulesItem); + return this; + } + + /** + * The targeting rule collection. + * @return rolloutRules + */ + @javax.annotation.Nullable + public List getRolloutRules() { + return rolloutRules; + } + + public void setRolloutRules(List rolloutRules) { + this.rolloutRules = rolloutRules; + } + + + public SettingValueModel rolloutPercentageItems(List rolloutPercentageItems) { + this.rolloutPercentageItems = rolloutPercentageItems; + return this; + } + + public SettingValueModel addRolloutPercentageItemsItem(RolloutPercentageItemModel rolloutPercentageItemsItem) { + if (this.rolloutPercentageItems == null) { + this.rolloutPercentageItems = new ArrayList<>(); + } + this.rolloutPercentageItems.add(rolloutPercentageItemsItem); + return this; + } + + /** + * The percentage rule collection. + * @return rolloutPercentageItems + */ + @javax.annotation.Nullable + public List getRolloutPercentageItems() { + return rolloutPercentageItems; + } + + public void setRolloutPercentageItems(List rolloutPercentageItems) { + this.rolloutPercentageItems = rolloutPercentageItems; + } + + + public SettingValueModel value(Object value) { + this.value = value; + return this; + } + + /** + * The value to serve. It must respect the setting type. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + + public SettingValueModel setting(SettingDataModel setting) { + this.setting = setting; + return this; + } + + /** + * Get setting + * @return setting + */ + @javax.annotation.Nullable + public SettingDataModel getSetting() { + return setting; + } + + public void setSetting(SettingDataModel setting) { + this.setting = setting; + } + + + public SettingValueModel updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The last updated date and time when the Feature Flag or Setting. + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public SettingValueModel lastUpdaterUserEmail(String lastUpdaterUserEmail) { + this.lastUpdaterUserEmail = lastUpdaterUserEmail; + return this; + } + + /** + * The email of the user who last updated the Feature Flag or Setting. + * @return lastUpdaterUserEmail + */ + @javax.annotation.Nullable + public String getLastUpdaterUserEmail() { + return lastUpdaterUserEmail; + } + + public void setLastUpdaterUserEmail(String lastUpdaterUserEmail) { + this.lastUpdaterUserEmail = lastUpdaterUserEmail; + } + + + public SettingValueModel lastUpdaterUserFullName(String lastUpdaterUserFullName) { + this.lastUpdaterUserFullName = lastUpdaterUserFullName; + return this; + } + + /** + * The name of the user who last updated the Feature Flag or Setting. + * @return lastUpdaterUserFullName + */ + @javax.annotation.Nullable + public String getLastUpdaterUserFullName() { + return lastUpdaterUserFullName; + } + + public void setLastUpdaterUserFullName(String lastUpdaterUserFullName) { + this.lastUpdaterUserFullName = lastUpdaterUserFullName; + } + + + public SettingValueModel integrationLinks(List integrationLinks) { + this.integrationLinks = integrationLinks; + return this; + } + + public SettingValueModel addIntegrationLinksItem(IntegrationLinkModel integrationLinksItem) { + if (this.integrationLinks == null) { + this.integrationLinks = new ArrayList<>(); + } + this.integrationLinks.add(integrationLinksItem); + return this; + } + + /** + * The integration links attached to the Feature Flag or Setting. + * @return integrationLinks + */ + @javax.annotation.Nullable + public List getIntegrationLinks() { + return integrationLinks; + } + + public void setIntegrationLinks(List integrationLinks) { + this.integrationLinks = integrationLinks; + } + + + public SettingValueModel settingTags(List settingTags) { + this.settingTags = settingTags; + return this; + } + + public SettingValueModel addSettingTagsItem(SettingTagModel settingTagsItem) { + if (this.settingTags == null) { + this.settingTags = new ArrayList<>(); + } + this.settingTags.add(settingTagsItem); + return this; + } + + /** + * The tags attached to the Feature Flag or Setting. + * @return settingTags + */ + @javax.annotation.Nullable + public List getSettingTags() { + return settingTags; + } + + public void setSettingTags(List settingTags) { + this.settingTags = settingTags; + } + + + public SettingValueModel config(ConfigModel config) { + this.config = config; + return this; + } + + /** + * Get config + * @return config + */ + @javax.annotation.Nullable + public ConfigModel getConfig() { + return config; + } + + public void setConfig(ConfigModel config) { + this.config = config; + } + + + public SettingValueModel environment(EnvironmentModel environment) { + this.environment = environment; + return this; + } + + /** + * Get environment + * @return environment + */ + @javax.annotation.Nullable + public EnvironmentModel getEnvironment() { + return environment; + } + + public void setEnvironment(EnvironmentModel environment) { + this.environment = environment; + } + + + public SettingValueModel featureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { + this.featureFlagLimitations = featureFlagLimitations; + return this; + } + + /** + * Get featureFlagLimitations + * @return featureFlagLimitations + */ + @javax.annotation.Nullable + public FeatureFlagLimitations getFeatureFlagLimitations() { + return featureFlagLimitations; + } + + public void setFeatureFlagLimitations(FeatureFlagLimitations featureFlagLimitations) { + this.featureFlagLimitations = featureFlagLimitations; + } + + + public SettingValueModel readOnly(Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + /** + * Get readOnly + * @return readOnly + */ + @javax.annotation.Nullable + public Boolean getReadOnly() { + return readOnly; + } + + public void setReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SettingValueModel instance itself + */ + public SettingValueModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SettingValueModel settingValueModel = (SettingValueModel) o; + return Objects.equals(this.rolloutRules, settingValueModel.rolloutRules) && + Objects.equals(this.rolloutPercentageItems, settingValueModel.rolloutPercentageItems) && + Objects.equals(this.value, settingValueModel.value) && + Objects.equals(this.setting, settingValueModel.setting) && + Objects.equals(this.updatedAt, settingValueModel.updatedAt) && + Objects.equals(this.lastUpdaterUserEmail, settingValueModel.lastUpdaterUserEmail) && + Objects.equals(this.lastUpdaterUserFullName, settingValueModel.lastUpdaterUserFullName) && + Objects.equals(this.integrationLinks, settingValueModel.integrationLinks) && + Objects.equals(this.settingTags, settingValueModel.settingTags) && + Objects.equals(this.config, settingValueModel.config) && + Objects.equals(this.environment, settingValueModel.environment) && + Objects.equals(this.featureFlagLimitations, settingValueModel.featureFlagLimitations) && + Objects.equals(this.readOnly, settingValueModel.readOnly)&& + Objects.equals(this.additionalProperties, settingValueModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(rolloutRules, rolloutPercentageItems, value, setting, updatedAt, lastUpdaterUserEmail, lastUpdaterUserFullName, integrationLinks, settingTags, config, environment, featureFlagLimitations, readOnly, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SettingValueModel {\n"); + sb.append(" rolloutRules: ").append(toIndentedString(rolloutRules)).append("\n"); + sb.append(" rolloutPercentageItems: ").append(toIndentedString(rolloutPercentageItems)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" setting: ").append(toIndentedString(setting)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" lastUpdaterUserEmail: ").append(toIndentedString(lastUpdaterUserEmail)).append("\n"); + sb.append(" lastUpdaterUserFullName: ").append(toIndentedString(lastUpdaterUserFullName)).append("\n"); + sb.append(" integrationLinks: ").append(toIndentedString(integrationLinks)).append("\n"); + sb.append(" settingTags: ").append(toIndentedString(settingTags)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" featureFlagLimitations: ").append(toIndentedString(featureFlagLimitations)).append("\n"); + sb.append(" readOnly: ").append(toIndentedString(readOnly)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rolloutRules"); + openapiFields.add("rolloutPercentageItems"); + openapiFields.add("value"); + openapiFields.add("setting"); + openapiFields.add("updatedAt"); + openapiFields.add("lastUpdaterUserEmail"); + openapiFields.add("lastUpdaterUserFullName"); + openapiFields.add("integrationLinks"); + openapiFields.add("settingTags"); + openapiFields.add("config"); + openapiFields.add("environment"); + openapiFields.add("featureFlagLimitations"); + openapiFields.add("readOnly"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SettingValueModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SettingValueModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SettingValueModel is not found in the empty JSON string", SettingValueModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("rolloutRules") != null && !jsonObj.get("rolloutRules").isJsonNull()) { - JsonArray jsonArrayrolloutRules = jsonObj.getAsJsonArray("rolloutRules"); - if (jsonArrayrolloutRules != null) { - // ensure the json data is an array - if (!jsonObj.get("rolloutRules").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `rolloutRules` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("rolloutRules").toString())); - } - - // validate the optional field `rolloutRules` (array) - for (int i = 0; i < jsonArrayrolloutRules.size(); i++) { - RolloutRuleModel.validateJsonElement(jsonArrayrolloutRules.get(i)); - } - ; - } - } - if (jsonObj.get("rolloutPercentageItems") != null - && !jsonObj.get("rolloutPercentageItems").isJsonNull()) { - JsonArray jsonArrayrolloutPercentageItems = - jsonObj.getAsJsonArray("rolloutPercentageItems"); - if (jsonArrayrolloutPercentageItems != null) { - // ensure the json data is an array - if (!jsonObj.get("rolloutPercentageItems").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `rolloutPercentageItems` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("rolloutPercentageItems").toString())); - } - - // validate the optional field `rolloutPercentageItems` (array) - for (int i = 0; i < jsonArrayrolloutPercentageItems.size(); i++) { - RolloutPercentageItemModel.validateJsonElement( - jsonArrayrolloutPercentageItems.get(i)); - } - ; - } - } - // validate the optional field `setting` - if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { - SettingDataModel.validateJsonElement(jsonObj.get("setting")); - } - if ((jsonObj.get("lastUpdaterUserEmail") != null - && !jsonObj.get("lastUpdaterUserEmail").isJsonNull()) - && !jsonObj.get("lastUpdaterUserEmail").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterUserEmail` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("lastUpdaterUserEmail").toString())); - } - if ((jsonObj.get("lastUpdaterUserFullName") != null - && !jsonObj.get("lastUpdaterUserFullName").isJsonNull()) - && !jsonObj.get("lastUpdaterUserFullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `lastUpdaterUserFullName` to be a primitive type" - + " in the JSON string but got `%s`", - jsonObj.get("lastUpdaterUserFullName").toString())); - } - if (jsonObj.get("integrationLinks") != null - && !jsonObj.get("integrationLinks").isJsonNull()) { - JsonArray jsonArrayintegrationLinks = jsonObj.getAsJsonArray("integrationLinks"); - if (jsonArrayintegrationLinks != null) { - // ensure the json data is an array - if (!jsonObj.get("integrationLinks").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `integrationLinks` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("integrationLinks").toString())); - } - - // validate the optional field `integrationLinks` (array) - for (int i = 0; i < jsonArrayintegrationLinks.size(); i++) { - IntegrationLinkModel.validateJsonElement(jsonArrayintegrationLinks.get(i)); - } - ; - } + if (jsonObj.get("rolloutRules") != null && !jsonObj.get("rolloutRules").isJsonNull()) { + JsonArray jsonArrayrolloutRules = jsonObj.getAsJsonArray("rolloutRules"); + if (jsonArrayrolloutRules != null) { + // ensure the json data is an array + if (!jsonObj.get("rolloutRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rolloutRules` to be an array in the JSON string but got `%s`", jsonObj.get("rolloutRules").toString())); + } + + // validate the optional field `rolloutRules` (array) + for (int i = 0; i < jsonArrayrolloutRules.size(); i++) { + RolloutRuleModel.validateJsonElement(jsonArrayrolloutRules.get(i)); + }; } - if (jsonObj.get("settingTags") != null && !jsonObj.get("settingTags").isJsonNull()) { - JsonArray jsonArraysettingTags = jsonObj.getAsJsonArray("settingTags"); - if (jsonArraysettingTags != null) { - // ensure the json data is an array - if (!jsonObj.get("settingTags").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingTags` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("settingTags").toString())); - } - - // validate the optional field `settingTags` (array) - for (int i = 0; i < jsonArraysettingTags.size(); i++) { - SettingTagModel.validateJsonElement(jsonArraysettingTags.get(i)); - } - ; - } + } + if (jsonObj.get("rolloutPercentageItems") != null && !jsonObj.get("rolloutPercentageItems").isJsonNull()) { + JsonArray jsonArrayrolloutPercentageItems = jsonObj.getAsJsonArray("rolloutPercentageItems"); + if (jsonArrayrolloutPercentageItems != null) { + // ensure the json data is an array + if (!jsonObj.get("rolloutPercentageItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rolloutPercentageItems` to be an array in the JSON string but got `%s`", jsonObj.get("rolloutPercentageItems").toString())); + } + + // validate the optional field `rolloutPercentageItems` (array) + for (int i = 0; i < jsonArrayrolloutPercentageItems.size(); i++) { + RolloutPercentageItemModel.validateJsonElement(jsonArrayrolloutPercentageItems.get(i)); + }; } - // validate the optional field `config` - if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { - ConfigModel.validateJsonElement(jsonObj.get("config")); + } + // validate the optional field `setting` + if (jsonObj.get("setting") != null && !jsonObj.get("setting").isJsonNull()) { + SettingDataModel.validateJsonElement(jsonObj.get("setting")); + } + if ((jsonObj.get("lastUpdaterUserEmail") != null && !jsonObj.get("lastUpdaterUserEmail").isJsonNull()) && !jsonObj.get("lastUpdaterUserEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterUserEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterUserEmail").toString())); + } + if ((jsonObj.get("lastUpdaterUserFullName") != null && !jsonObj.get("lastUpdaterUserFullName").isJsonNull()) && !jsonObj.get("lastUpdaterUserFullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastUpdaterUserFullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastUpdaterUserFullName").toString())); + } + if (jsonObj.get("integrationLinks") != null && !jsonObj.get("integrationLinks").isJsonNull()) { + JsonArray jsonArrayintegrationLinks = jsonObj.getAsJsonArray("integrationLinks"); + if (jsonArrayintegrationLinks != null) { + // ensure the json data is an array + if (!jsonObj.get("integrationLinks").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `integrationLinks` to be an array in the JSON string but got `%s`", jsonObj.get("integrationLinks").toString())); + } + + // validate the optional field `integrationLinks` (array) + for (int i = 0; i < jsonArrayintegrationLinks.size(); i++) { + IntegrationLinkModel.validateJsonElement(jsonArrayintegrationLinks.get(i)); + }; } - // validate the optional field `environment` - if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { - EnvironmentModel.validateJsonElement(jsonObj.get("environment")); + } + if (jsonObj.get("settingTags") != null && !jsonObj.get("settingTags").isJsonNull()) { + JsonArray jsonArraysettingTags = jsonObj.getAsJsonArray("settingTags"); + if (jsonArraysettingTags != null) { + // ensure the json data is an array + if (!jsonObj.get("settingTags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingTags` to be an array in the JSON string but got `%s`", jsonObj.get("settingTags").toString())); + } + + // validate the optional field `settingTags` (array) + for (int i = 0; i < jsonArraysettingTags.size(); i++) { + SettingTagModel.validateJsonElement(jsonArraysettingTags.get(i)); + }; } - // validate the optional field `featureFlagLimitations` - if (jsonObj.get("featureFlagLimitations") != null - && !jsonObj.get("featureFlagLimitations").isJsonNull()) { - FeatureFlagLimitations.validateJsonElement(jsonObj.get("featureFlagLimitations")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!SettingValueModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'SettingValueModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(SettingValueModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, SettingValueModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public SettingValueModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of SettingValueModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of SettingValueModel - * @throws IOException if the JSON string is invalid with respect to SettingValueModel - */ - public static SettingValueModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, SettingValueModel.class); - } - - /** - * Convert an instance of SettingValueModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + ConfigModel.validateJsonElement(jsonObj.get("config")); + } + // validate the optional field `environment` + if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { + EnvironmentModel.validateJsonElement(jsonObj.get("environment")); + } + // validate the optional field `featureFlagLimitations` + if (jsonObj.get("featureFlagLimitations") != null && !jsonObj.get("featureFlagLimitations").isJsonNull()) { + FeatureFlagLimitations.validateJsonElement(jsonObj.get("featureFlagLimitations")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SettingValueModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SettingValueModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SettingValueModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SettingValueModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SettingValueModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SettingValueModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SettingValueModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of SettingValueModel + * @throws IOException if the JSON string is invalid with respect to SettingValueModel + */ + public static SettingValueModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SettingValueModel.class); + } + + /** + * Convert an instance of SettingValueModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/TagModel.java b/src/main/java/com/configcat/publicapi/java/client/model/TagModel.java index 3be3ce2..e56cccd 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/TagModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/TagModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,303 +10,376 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ProductModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** TagModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class TagModel { - public static final String SERIALIZED_NAME_PRODUCT = "product"; - - @SerializedName(SERIALIZED_NAME_PRODUCT) - private ProductModel product; - - public static final String SERIALIZED_NAME_TAG_ID = "tagId"; - - @SerializedName(SERIALIZED_NAME_TAG_ID) - private Long tagId; - - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_COLOR = "color"; - - @SerializedName(SERIALIZED_NAME_COLOR) - private String color; - - public TagModel() {} - - public TagModel product(ProductModel product) { - this.product = product; - return this; - } - - /** - * Get product - * - * @return product - */ - @javax.annotation.Nullable - public ProductModel getProduct() { - return product; - } - - public void setProduct(ProductModel product) { - this.product = product; - } - - public TagModel tagId(Long tagId) { - this.tagId = tagId; - return this; - } - - /** - * Identifier of the Tag. - * - * @return tagId - */ - @javax.annotation.Nullable - public Long getTagId() { - return tagId; - } - - public void setTagId(Long tagId) { - this.tagId = tagId; - } - - public TagModel name(String name) { - this.name = name; - return this; - } - /** - * Name of the Tag. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } +import com.configcat.publicapi.java.client.JSON; - public void setName(String name) { - this.name = name; +/** + * TagModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class TagModel { + public static final String SERIALIZED_NAME_PRODUCT = "product"; + @SerializedName(SERIALIZED_NAME_PRODUCT) + private ProductModel product; + + public static final String SERIALIZED_NAME_TAG_ID = "tagId"; + @SerializedName(SERIALIZED_NAME_TAG_ID) + private Long tagId; + + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + + public TagModel() { + } + + public TagModel product(ProductModel product) { + this.product = product; + return this; + } + + /** + * Get product + * @return product + */ + @javax.annotation.Nullable + public ProductModel getProduct() { + return product; + } + + public void setProduct(ProductModel product) { + this.product = product; + } + + + public TagModel tagId(Long tagId) { + this.tagId = tagId; + return this; + } + + /** + * Identifier of the Tag. + * @return tagId + */ + @javax.annotation.Nullable + public Long getTagId() { + return tagId; + } + + public void setTagId(Long tagId) { + this.tagId = tagId; + } + + + public TagModel name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Tag. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public TagModel color(String color) { + this.color = color; + return this; + } + + /** + * The configured color of the Tag. + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TagModel instance itself + */ + public TagModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public TagModel color(String color) { - this.color = color; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * The configured color of the Tag. - * - * @return color - */ - @javax.annotation.Nullable - public String getColor() { - return color; - } - public void setColor(String color) { - this.color = color; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TagModel tagModel = (TagModel) o; - return Objects.equals(this.product, tagModel.product) - && Objects.equals(this.tagId, tagModel.tagId) - && Objects.equals(this.name, tagModel.name) - && Objects.equals(this.color, tagModel.color); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + TagModel tagModel = (TagModel) o; + return Objects.equals(this.product, tagModel.product) && + Objects.equals(this.tagId, tagModel.tagId) && + Objects.equals(this.name, tagModel.name) && + Objects.equals(this.color, tagModel.color)&& + Objects.equals(this.additionalProperties, tagModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(product, tagId, name, color, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(product, tagId, name, color); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagModel {\n"); + sb.append(" product: ").append(toIndentedString(product)).append("\n"); + sb.append(" tagId: ").append(toIndentedString(tagId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TagModel {\n"); - sb.append(" product: ").append(toIndentedString(product)).append("\n"); - sb.append(" tagId: ").append(toIndentedString(tagId)).append("\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("product"); - openapiFields.add("tagId"); - openapiFields.add("name"); - openapiFields.add("color"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to TagModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!TagModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in TagModel is not found in the empty" - + " JSON string", - TagModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TagModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `TagModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("product"); + openapiFields.add("tagId"); + openapiFields.add("name"); + openapiFields.add("color"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TagModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TagModel is not found in the empty JSON string", TagModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `product` - if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { - ProductModel.validateJsonElement(jsonObj.get("product")); - } - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) - && !jsonObj.get("color").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `color` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("color").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TagModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TagModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(TagModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, TagModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public TagModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of TagModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of TagModel - * @throws IOException if the JSON string is invalid with respect to TagModel - */ - public static TagModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TagModel.class); - } - - /** - * Convert an instance of TagModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + // validate the optional field `product` + if (jsonObj.get("product") != null && !jsonObj.get("product").isJsonNull()) { + ProductModel.validateJsonElement(jsonObj.get("product")); + } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TagModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TagModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of TagModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagModel + * @throws IOException if the JSON string is invalid with respect to TagModel + */ + public static TagModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagModel.class); + } + + /** + * Convert an instance of TagModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/TargetingRuleModel.java b/src/main/java/com/configcat/publicapi/java/client/model/TargetingRuleModel.java index 1bcb08f..6c9a448 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/TargetingRuleModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/TargetingRuleModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,324 +10,392 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ConditionModel; +import com.configcat.publicapi.java.client.model.PercentageOptionModel; +import com.configcat.publicapi.java.client.model.ValueModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** TargetingRuleModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class TargetingRuleModel { - public static final String SERIALIZED_NAME_CONDITIONS = "conditions"; - - @SerializedName(SERIALIZED_NAME_CONDITIONS) - private List conditions; - - public static final String SERIALIZED_NAME_PERCENTAGE_OPTIONS = "percentageOptions"; - - @SerializedName(SERIALIZED_NAME_PERCENTAGE_OPTIONS) - private List percentageOptions; - - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) - private ValueModel value; - - public TargetingRuleModel() {} - public TargetingRuleModel conditions(List conditions) { - this.conditions = conditions; - return this; - } - - public TargetingRuleModel addConditionsItem(ConditionModel conditionsItem) { - if (this.conditions == null) { - this.conditions = new ArrayList<>(); - } - this.conditions.add(conditionsItem); - return this; - } - - /** - * The list of conditions that are combined with logical AND operators. It can be one of the - * following: - User condition - Segment condition - Prerequisite flag condition - * - * @return conditions - */ - @javax.annotation.Nullable - public List getConditions() { - return conditions; - } - - public void setConditions(List conditions) { - this.conditions = conditions; - } +import com.configcat.publicapi.java.client.JSON; - public TargetingRuleModel percentageOptions(List percentageOptions) { - this.percentageOptions = percentageOptions; - return this; - } +/** + * TargetingRuleModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class TargetingRuleModel { + public static final String SERIALIZED_NAME_CONDITIONS = "conditions"; + @SerializedName(SERIALIZED_NAME_CONDITIONS) + private List conditions; - public TargetingRuleModel addPercentageOptionsItem( - PercentageOptionModel percentageOptionsItem) { - if (this.percentageOptions == null) { - this.percentageOptions = new ArrayList<>(); - } - this.percentageOptions.add(percentageOptionsItem); - return this; - } + public static final String SERIALIZED_NAME_PERCENTAGE_OPTIONS = "percentageOptions"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE_OPTIONS) + private List percentageOptions; - /** - * The percentage options from where the evaluation process will choose a value based on the - * flag's percentage evaluation attribute. - * - * @return percentageOptions - */ - @javax.annotation.Nullable - public List getPercentageOptions() { - return percentageOptions; - } + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private ValueModel value; - public void setPercentageOptions(List percentageOptions) { - this.percentageOptions = percentageOptions; - } + public TargetingRuleModel() { + } - public TargetingRuleModel value(ValueModel value) { - this.value = value; - return this; - } + public TargetingRuleModel conditions(List conditions) { + this.conditions = conditions; + return this; + } - /** - * Get value - * - * @return value - */ - @javax.annotation.Nullable - public ValueModel getValue() { - return value; + public TargetingRuleModel addConditionsItem(ConditionModel conditionsItem) { + if (this.conditions == null) { + this.conditions = new ArrayList<>(); } - - public void setValue(ValueModel value) { - this.value = value; + this.conditions.add(conditionsItem); + return this; + } + + /** + * The list of conditions that are combined with logical AND operators. It can be one of the following: - User condition - Segment condition - Prerequisite flag condition + * @return conditions + */ + @javax.annotation.Nullable + public List getConditions() { + return conditions; + } + + public void setConditions(List conditions) { + this.conditions = conditions; + } + + + public TargetingRuleModel percentageOptions(List percentageOptions) { + this.percentageOptions = percentageOptions; + return this; + } + + public TargetingRuleModel addPercentageOptionsItem(PercentageOptionModel percentageOptionsItem) { + if (this.percentageOptions == null) { + this.percentageOptions = new ArrayList<>(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TargetingRuleModel targetingRuleModel = (TargetingRuleModel) o; - return Objects.equals(this.conditions, targetingRuleModel.conditions) - && Objects.equals(this.percentageOptions, targetingRuleModel.percentageOptions) - && Objects.equals(this.value, targetingRuleModel.value); + this.percentageOptions.add(percentageOptionsItem); + return this; + } + + /** + * The percentage options from where the evaluation process will choose a value based on the flag's percentage evaluation attribute. + * @return percentageOptions + */ + @javax.annotation.Nullable + public List getPercentageOptions() { + return percentageOptions; + } + + public void setPercentageOptions(List percentageOptions) { + this.percentageOptions = percentageOptions; + } + + + public TargetingRuleModel value(ValueModel value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nullable + public ValueModel getValue() { + return value; + } + + public void setValue(ValueModel value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the TargetingRuleModel instance itself + */ + public TargetingRuleModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(conditions, percentageOptions, value); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class TargetingRuleModel {\n"); - sb.append(" conditions: ").append(toIndentedString(conditions)).append("\n"); - sb.append(" percentageOptions: ") - .append(toIndentedString(percentageOptions)) - .append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + TargetingRuleModel targetingRuleModel = (TargetingRuleModel) o; + return Objects.equals(this.conditions, targetingRuleModel.conditions) && + Objects.equals(this.percentageOptions, targetingRuleModel.percentageOptions) && + Objects.equals(this.value, targetingRuleModel.value)&& + Objects.equals(this.additionalProperties, targetingRuleModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(conditions, percentageOptions, value, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("conditions"); - openapiFields.add("percentageOptions"); - openapiFields.add("value"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TargetingRuleModel {\n"); + sb.append(" conditions: ").append(toIndentedString(conditions)).append("\n"); + sb.append(" percentageOptions: ").append(toIndentedString(percentageOptions)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to TargetingRuleModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!TargetingRuleModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in TargetingRuleModel is not found in" - + " the empty JSON string", - TargetingRuleModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!TargetingRuleModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `TargetingRuleModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("conditions"); + openapiFields.add("percentageOptions"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TargetingRuleModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TargetingRuleModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TargetingRuleModel is not found in the empty JSON string", TargetingRuleModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("conditions") != null && !jsonObj.get("conditions").isJsonNull()) { - JsonArray jsonArrayconditions = jsonObj.getAsJsonArray("conditions"); - if (jsonArrayconditions != null) { - // ensure the json data is an array - if (!jsonObj.get("conditions").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `conditions` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("conditions").toString())); - } - - // validate the optional field `conditions` (array) - for (int i = 0; i < jsonArrayconditions.size(); i++) { - ConditionModel.validateJsonElement(jsonArrayconditions.get(i)); - } - ; - } - } - if (jsonObj.get("percentageOptions") != null - && !jsonObj.get("percentageOptions").isJsonNull()) { - JsonArray jsonArraypercentageOptions = jsonObj.getAsJsonArray("percentageOptions"); - if (jsonArraypercentageOptions != null) { - // ensure the json data is an array - if (!jsonObj.get("percentageOptions").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `percentageOptions` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("percentageOptions").toString())); - } - - // validate the optional field `percentageOptions` (array) - for (int i = 0; i < jsonArraypercentageOptions.size(); i++) { - PercentageOptionModel.validateJsonElement(jsonArraypercentageOptions.get(i)); - } - ; - } + if (jsonObj.get("conditions") != null && !jsonObj.get("conditions").isJsonNull()) { + JsonArray jsonArrayconditions = jsonObj.getAsJsonArray("conditions"); + if (jsonArrayconditions != null) { + // ensure the json data is an array + if (!jsonObj.get("conditions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `conditions` to be an array in the JSON string but got `%s`", jsonObj.get("conditions").toString())); + } + + // validate the optional field `conditions` (array) + for (int i = 0; i < jsonArrayconditions.size(); i++) { + ConditionModel.validateJsonElement(jsonArrayconditions.get(i)); + }; } - // validate the optional field `value` - if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { - ValueModel.validateJsonElement(jsonObj.get("value")); + } + if (jsonObj.get("percentageOptions") != null && !jsonObj.get("percentageOptions").isJsonNull()) { + JsonArray jsonArraypercentageOptions = jsonObj.getAsJsonArray("percentageOptions"); + if (jsonArraypercentageOptions != null) { + // ensure the json data is an array + if (!jsonObj.get("percentageOptions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `percentageOptions` to be an array in the JSON string but got `%s`", jsonObj.get("percentageOptions").toString())); + } + + // validate the optional field `percentageOptions` (array) + for (int i = 0; i < jsonArraypercentageOptions.size(); i++) { + PercentageOptionModel.validateJsonElement(jsonArraypercentageOptions.get(i)); + }; } + } + // validate the optional field `value` + if (jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) { + ValueModel.validateJsonElement(jsonObj.get("value")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TargetingRuleModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TargetingRuleModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TargetingRuleModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TargetingRuleModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public TargetingRuleModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + TargetingRuleModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!TargetingRuleModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'TargetingRuleModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(TargetingRuleModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, TargetingRuleModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public TargetingRuleModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of TargetingRuleModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of TargetingRuleModel - * @throws IOException if the JSON string is invalid with respect to TargetingRuleModel - */ - public static TargetingRuleModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, TargetingRuleModel.class); - } - - /** - * Convert an instance of TargetingRuleModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + } + + /** + * Create an instance of TargetingRuleModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of TargetingRuleModel + * @throws IOException if the JSON string is invalid with respect to TargetingRuleModel + */ + public static TargetingRuleModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TargetingRuleModel.class); + } + + /** + * Convert an instance of TargetingRuleModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateConfigRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateConfigRequest.java index 5f186b2..a493157 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateConfigRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateConfigRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,274 +10,345 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdateConfigRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateConfigRequest { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public UpdateConfigRequest() {} - - public UpdateConfigRequest name(String name) { - this.name = name; - return this; - } - - /** - * The name of the Config. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public UpdateConfigRequest description(String description) { - this.description = description; - return this; - } - - /** - * The description of the Config. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public UpdateConfigRequest order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Config represented on the ConfigCat Dashboard. Determined from an ascending - * sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateConfigRequest updateConfigRequest = (UpdateConfigRequest) o; - return Objects.equals(this.name, updateConfigRequest.name) - && Objects.equals(this.description, updateConfigRequest.description) - && Objects.equals(this.order, updateConfigRequest.order); +/** + * UpdateConfigRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateConfigRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public UpdateConfigRequest() { + } + + public UpdateConfigRequest name(String name) { + this.name = name; + return this; + } + + /** + * The name of the Config. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public UpdateConfigRequest description(String description) { + this.description = description; + return this; + } + + /** + * The description of the Config. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public UpdateConfigRequest order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Config represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateConfigRequest instance itself + */ + public UpdateConfigRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(name, description, order); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateConfigRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + UpdateConfigRequest updateConfigRequest = (UpdateConfigRequest) o; + return Objects.equals(this.name, updateConfigRequest.name) && + Objects.equals(this.description, updateConfigRequest.description) && + Objects.equals(this.order, updateConfigRequest.order)&& + Objects.equals(this.additionalProperties, updateConfigRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, order, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("order"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateConfigRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdateConfigRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateConfigRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateConfigRequest is not found in" - + " the empty JSON string", - UpdateConfigRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateConfigRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateConfigRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("order"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateConfigRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateConfigRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateConfigRequest is not found in the empty JSON string", UpdateConfigRequest.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateConfigRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateConfigRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateConfigRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateConfigRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateConfigRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateConfigRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateConfigRequest - * @throws IOException if the JSON string is invalid with respect to UpdateConfigRequest - */ - public static UpdateConfigRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateConfigRequest.class); - } - - /** - * Convert an instance of UpdateConfigRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateConfigRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateConfigRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateConfigRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateConfigRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateConfigRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateConfigRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateConfigRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateConfigRequest + * @throws IOException if the JSON string is invalid with respect to UpdateConfigRequest + */ + public static UpdateConfigRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateConfigRequest.class); + } + + /** + * Convert an instance of UpdateConfigRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateEnvironmentModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateEnvironmentModel.java index 7161152..622daab 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateEnvironmentModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateEnvironmentModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,309 +10,374 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdateEnvironmentModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateEnvironmentModel { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_COLOR = "color"; - - @SerializedName(SERIALIZED_NAME_COLOR) - private String color; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public UpdateEnvironmentModel() {} - - public UpdateEnvironmentModel name(String name) { - this.name = name; - return this; - } - - /** - * The name of the Environment. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public UpdateEnvironmentModel color(String color) { - this.color = color; - return this; - } - - /** - * The color of the Environment. RGB or HTML color codes are allowed. - * - * @return color - */ - @javax.annotation.Nullable - public String getColor() { - return color; - } - - public void setColor(String color) { - this.color = color; - } - - public UpdateEnvironmentModel description(String description) { - this.description = description; - return this; - } - /** - * The description of the Environment. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } +import com.configcat.publicapi.java.client.JSON; - public void setDescription(String description) { - this.description = description; +/** + * UpdateEnvironmentModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateEnvironmentModel { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public UpdateEnvironmentModel() { + } + + public UpdateEnvironmentModel name(String name) { + this.name = name; + return this; + } + + /** + * The name of the Environment. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public UpdateEnvironmentModel color(String color) { + this.color = color; + return this; + } + + /** + * The color of the Environment. RGB or HTML color codes are allowed. + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + public UpdateEnvironmentModel description(String description) { + this.description = description; + return this; + } + + /** + * The description of the Environment. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public UpdateEnvironmentModel order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Environment represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateEnvironmentModel instance itself + */ + public UpdateEnvironmentModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public UpdateEnvironmentModel order(Integer order) { - this.order = order; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * The order of the Environment represented on the ConfigCat Dashboard. Determined from an - * ascending sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - public void setOrder(Integer order) { - this.order = order; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateEnvironmentModel updateEnvironmentModel = (UpdateEnvironmentModel) o; - return Objects.equals(this.name, updateEnvironmentModel.name) - && Objects.equals(this.color, updateEnvironmentModel.color) - && Objects.equals(this.description, updateEnvironmentModel.description) - && Objects.equals(this.order, updateEnvironmentModel.order); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + UpdateEnvironmentModel updateEnvironmentModel = (UpdateEnvironmentModel) o; + return Objects.equals(this.name, updateEnvironmentModel.name) && + Objects.equals(this.color, updateEnvironmentModel.color) && + Objects.equals(this.description, updateEnvironmentModel.description) && + Objects.equals(this.order, updateEnvironmentModel.order)&& + Objects.equals(this.additionalProperties, updateEnvironmentModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, color, description, order, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(name, color, description, order); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateEnvironmentModel {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateEnvironmentModel {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("color"); - openapiFields.add("description"); - openapiFields.add("order"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdateEnvironmentModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateEnvironmentModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateEnvironmentModel is not found" - + " in the empty JSON string", - UpdateEnvironmentModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateEnvironmentModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateEnvironmentModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("color"); + openapiFields.add("description"); + openapiFields.add("order"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateEnvironmentModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateEnvironmentModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateEnvironmentModel is not found in the empty JSON string", UpdateEnvironmentModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) - && !jsonObj.get("color").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `color` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("color").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateEnvironmentModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateEnvironmentModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateEnvironmentModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateEnvironmentModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateEnvironmentModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateEnvironmentModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateEnvironmentModel - * @throws IOException if the JSON string is invalid with respect to UpdateEnvironmentModel - */ - public static UpdateEnvironmentModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateEnvironmentModel.class); - } - - /** - * Convert an instance of UpdateEnvironmentModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateEnvironmentModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateEnvironmentModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateEnvironmentModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateEnvironmentModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateEnvironmentModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateEnvironmentModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateEnvironmentModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateEnvironmentModel + * @throws IOException if the JSON string is invalid with respect to UpdateEnvironmentModel + */ + public static UpdateEnvironmentModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateEnvironmentModel.class); + } + + /** + * Convert an instance of UpdateEnvironmentModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulaModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulaModel.java index dba37e4..8f0421a 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulaModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulaModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,322 +10,378 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.TargetingRuleModel; +import com.configcat.publicapi.java.client.model.ValueModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdateEvaluationFormulaModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateEvaluationFormulaModel { - public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; - - @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) - private ValueModel defaultValue; - - public static final String SERIALIZED_NAME_TARGETING_RULES = "targetingRules"; - - @SerializedName(SERIALIZED_NAME_TARGETING_RULES) - private List targetingRules; - - public static final String SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE = - "percentageEvaluationAttribute"; - - @SerializedName(SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE) - private String percentageEvaluationAttribute; - - public UpdateEvaluationFormulaModel() {} - - public UpdateEvaluationFormulaModel defaultValue(ValueModel defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - /** - * Get defaultValue - * - * @return defaultValue - */ - @javax.annotation.Nonnull - public ValueModel getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(ValueModel defaultValue) { - this.defaultValue = defaultValue; - } - - public UpdateEvaluationFormulaModel targetingRules(List targetingRules) { - this.targetingRules = targetingRules; - return this; - } - - public UpdateEvaluationFormulaModel addTargetingRulesItem( - TargetingRuleModel targetingRulesItem) { - if (this.targetingRules == null) { - this.targetingRules = new ArrayList<>(); - } - this.targetingRules.add(targetingRulesItem); - return this; - } - /** - * The targeting rules of the Feature Flag or Setting. - * - * @return targetingRules - */ - @javax.annotation.Nullable - public List getTargetingRules() { - return targetingRules; - } +import com.configcat.publicapi.java.client.JSON; - public void setTargetingRules(List targetingRules) { - this.targetingRules = targetingRules; +/** + * UpdateEvaluationFormulaModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateEvaluationFormulaModel { + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private ValueModel defaultValue; + + public static final String SERIALIZED_NAME_TARGETING_RULES = "targetingRules"; + @SerializedName(SERIALIZED_NAME_TARGETING_RULES) + private List targetingRules; + + public static final String SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE = "percentageEvaluationAttribute"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE) + private String percentageEvaluationAttribute; + + public UpdateEvaluationFormulaModel() { + } + + public UpdateEvaluationFormulaModel defaultValue(ValueModel defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * Get defaultValue + * @return defaultValue + */ + @javax.annotation.Nonnull + public ValueModel getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(ValueModel defaultValue) { + this.defaultValue = defaultValue; + } + + + public UpdateEvaluationFormulaModel targetingRules(List targetingRules) { + this.targetingRules = targetingRules; + return this; + } + + public UpdateEvaluationFormulaModel addTargetingRulesItem(TargetingRuleModel targetingRulesItem) { + if (this.targetingRules == null) { + this.targetingRules = new ArrayList<>(); } - - public UpdateEvaluationFormulaModel percentageEvaluationAttribute( - String percentageEvaluationAttribute) { - this.percentageEvaluationAttribute = percentageEvaluationAttribute; - return this; + this.targetingRules.add(targetingRulesItem); + return this; + } + + /** + * The targeting rules of the Feature Flag or Setting. + * @return targetingRules + */ + @javax.annotation.Nullable + public List getTargetingRules() { + return targetingRules; + } + + public void setTargetingRules(List targetingRules) { + this.targetingRules = targetingRules; + } + + + public UpdateEvaluationFormulaModel percentageEvaluationAttribute(String percentageEvaluationAttribute) { + this.percentageEvaluationAttribute = percentageEvaluationAttribute; + return this; + } + + /** + * The user attribute used for percentage evaluation. If not set, it defaults to the `Identifier` user object attribute. + * @return percentageEvaluationAttribute + */ + @javax.annotation.Nullable + public String getPercentageEvaluationAttribute() { + return percentageEvaluationAttribute; + } + + public void setPercentageEvaluationAttribute(String percentageEvaluationAttribute) { + this.percentageEvaluationAttribute = percentageEvaluationAttribute; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateEvaluationFormulaModel instance itself + */ + public UpdateEvaluationFormulaModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - /** - * The user attribute used for percentage evaluation. If not set, it defaults to the - * `Identifier` user object attribute. - * - * @return percentageEvaluationAttribute - */ - @javax.annotation.Nullable - public String getPercentageEvaluationAttribute() { - return percentageEvaluationAttribute; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - public void setPercentageEvaluationAttribute(String percentageEvaluationAttribute) { - this.percentageEvaluationAttribute = percentageEvaluationAttribute; - } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateEvaluationFormulaModel updateEvaluationFormulaModel = - (UpdateEvaluationFormulaModel) o; - return Objects.equals(this.defaultValue, updateEvaluationFormulaModel.defaultValue) - && Objects.equals(this.targetingRules, updateEvaluationFormulaModel.targetingRules) - && Objects.equals( - this.percentageEvaluationAttribute, - updateEvaluationFormulaModel.percentageEvaluationAttribute); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash(defaultValue, targetingRules, percentageEvaluationAttribute); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateEvaluationFormulaModel {\n"); - sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); - sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); - sb.append(" percentageEvaluationAttribute: ") - .append(toIndentedString(percentageEvaluationAttribute)) - .append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + UpdateEvaluationFormulaModel updateEvaluationFormulaModel = (UpdateEvaluationFormulaModel) o; + return Objects.equals(this.defaultValue, updateEvaluationFormulaModel.defaultValue) && + Objects.equals(this.targetingRules, updateEvaluationFormulaModel.targetingRules) && + Objects.equals(this.percentageEvaluationAttribute, updateEvaluationFormulaModel.percentageEvaluationAttribute)&& + Objects.equals(this.additionalProperties, updateEvaluationFormulaModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(defaultValue, targetingRules, percentageEvaluationAttribute, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("defaultValue"); - openapiFields.add("targetingRules"); - openapiFields.add("percentageEvaluationAttribute"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("defaultValue"); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateEvaluationFormulaModel {\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); + sb.append(" percentageEvaluationAttribute: ").append(toIndentedString(percentageEvaluationAttribute)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateEvaluationFormulaModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateEvaluationFormulaModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateEvaluationFormulaModel is not" - + " found in the empty JSON string", - UpdateEvaluationFormulaModel.openapiRequiredFields.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("defaultValue"); + openapiFields.add("targetingRules"); + openapiFields.add("percentageEvaluationAttribute"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("defaultValue"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateEvaluationFormulaModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateEvaluationFormulaModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateEvaluationFormulaModel is not found in the empty JSON string", UpdateEvaluationFormulaModel.openapiRequiredFields.toString())); } + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateEvaluationFormulaModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateEvaluationFormulaModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateEvaluationFormulaModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateEvaluationFormulaModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `defaultValue` - ValueModel.validateJsonElement(jsonObj.get("defaultValue")); - if (jsonObj.get("targetingRules") != null && !jsonObj.get("targetingRules").isJsonNull()) { - JsonArray jsonArraytargetingRules = jsonObj.getAsJsonArray("targetingRules"); - if (jsonArraytargetingRules != null) { - // ensure the json data is an array - if (!jsonObj.get("targetingRules").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `targetingRules` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("targetingRules").toString())); - } - - // validate the optional field `targetingRules` (array) - for (int i = 0; i < jsonArraytargetingRules.size(); i++) { - TargetingRuleModel.validateJsonElement(jsonArraytargetingRules.get(i)); - } - ; - } - } - if ((jsonObj.get("percentageEvaluationAttribute") != null - && !jsonObj.get("percentageEvaluationAttribute").isJsonNull()) - && !jsonObj.get("percentageEvaluationAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `percentageEvaluationAttribute` to be a primitive" - + " type in the JSON string but got `%s`", - jsonObj.get("percentageEvaluationAttribute").toString())); + // validate the required field `defaultValue` + ValueModel.validateJsonElement(jsonObj.get("defaultValue")); + if (jsonObj.get("targetingRules") != null && !jsonObj.get("targetingRules").isJsonNull()) { + JsonArray jsonArraytargetingRules = jsonObj.getAsJsonArray("targetingRules"); + if (jsonArraytargetingRules != null) { + // ensure the json data is an array + if (!jsonObj.get("targetingRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `targetingRules` to be an array in the JSON string but got `%s`", jsonObj.get("targetingRules").toString())); + } + + // validate the optional field `targetingRules` (array) + for (int i = 0; i < jsonArraytargetingRules.size(); i++) { + TargetingRuleModel.validateJsonElement(jsonArraytargetingRules.get(i)); + }; } + } + if ((jsonObj.get("percentageEvaluationAttribute") != null && !jsonObj.get("percentageEvaluationAttribute").isJsonNull()) && !jsonObj.get("percentageEvaluationAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentageEvaluationAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentageEvaluationAttribute").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateEvaluationFormulaModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateEvaluationFormulaModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateEvaluationFormulaModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateEvaluationFormulaModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateEvaluationFormulaModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateEvaluationFormulaModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateEvaluationFormulaModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateEvaluationFormulaModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(UpdateEvaluationFormulaModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateEvaluationFormulaModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateEvaluationFormulaModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateEvaluationFormulaModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateEvaluationFormulaModel - * @throws IOException if the JSON string is invalid with respect to - * UpdateEvaluationFormulaModel - */ - public static UpdateEvaluationFormulaModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateEvaluationFormulaModel.class); - } - - /** - * Convert an instance of UpdateEvaluationFormulaModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + } + + /** + * Create an instance of UpdateEvaluationFormulaModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateEvaluationFormulaModel + * @throws IOException if the JSON string is invalid with respect to UpdateEvaluationFormulaModel + */ + public static UpdateEvaluationFormulaModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateEvaluationFormulaModel.class); + } + + /** + * Convert an instance of UpdateEvaluationFormulaModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulaWithIdModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulaWithIdModel.java index 5593081..1cdd9af 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulaWithIdModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulaWithIdModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,354 +10,404 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.TargetingRuleModel; +import com.configcat.publicapi.java.client.model.ValueModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdateEvaluationFormulaWithIdModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateEvaluationFormulaWithIdModel { - public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; - - @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) - private ValueModel defaultValue; - - public static final String SERIALIZED_NAME_TARGETING_RULES = "targetingRules"; - - @SerializedName(SERIALIZED_NAME_TARGETING_RULES) - private List targetingRules; - - public static final String SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE = - "percentageEvaluationAttribute"; - - @SerializedName(SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE) - private String percentageEvaluationAttribute; - - public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; - - @SerializedName(SERIALIZED_NAME_SETTING_ID) - private Integer settingId; - - public UpdateEvaluationFormulaWithIdModel() {} - - public UpdateEvaluationFormulaWithIdModel defaultValue(ValueModel defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - /** - * Get defaultValue - * - * @return defaultValue - */ - @javax.annotation.Nonnull - public ValueModel getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(ValueModel defaultValue) { - this.defaultValue = defaultValue; - } - - public UpdateEvaluationFormulaWithIdModel targetingRules( - List targetingRules) { - this.targetingRules = targetingRules; - return this; - } - - public UpdateEvaluationFormulaWithIdModel addTargetingRulesItem( - TargetingRuleModel targetingRulesItem) { - if (this.targetingRules == null) { - this.targetingRules = new ArrayList<>(); - } - this.targetingRules.add(targetingRulesItem); - return this; - } - - /** - * The targeting rules of the Feature Flag or Setting. - * - * @return targetingRules - */ - @javax.annotation.Nullable - public List getTargetingRules() { - return targetingRules; - } - public void setTargetingRules(List targetingRules) { - this.targetingRules = targetingRules; - } - - public UpdateEvaluationFormulaWithIdModel percentageEvaluationAttribute( - String percentageEvaluationAttribute) { - this.percentageEvaluationAttribute = percentageEvaluationAttribute; - return this; - } - - /** - * The user attribute used for percentage evaluation. If not set, it defaults to the - * `Identifier` user object attribute. - * - * @return percentageEvaluationAttribute - */ - @javax.annotation.Nullable - public String getPercentageEvaluationAttribute() { - return percentageEvaluationAttribute; - } - - public void setPercentageEvaluationAttribute(String percentageEvaluationAttribute) { - this.percentageEvaluationAttribute = percentageEvaluationAttribute; - } - - public UpdateEvaluationFormulaWithIdModel settingId(Integer settingId) { - this.settingId = settingId; - return this; - } - - /** - * The identifier of the feature flag or setting. - * - * @return settingId - */ - @javax.annotation.Nullable - public Integer getSettingId() { - return settingId; - } +import com.configcat.publicapi.java.client.JSON; - public void setSettingId(Integer settingId) { - this.settingId = settingId; +/** + * UpdateEvaluationFormulaWithIdModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateEvaluationFormulaWithIdModel { + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private ValueModel defaultValue; + + public static final String SERIALIZED_NAME_TARGETING_RULES = "targetingRules"; + @SerializedName(SERIALIZED_NAME_TARGETING_RULES) + private List targetingRules; + + public static final String SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE = "percentageEvaluationAttribute"; + @SerializedName(SERIALIZED_NAME_PERCENTAGE_EVALUATION_ATTRIBUTE) + private String percentageEvaluationAttribute; + + public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; + @SerializedName(SERIALIZED_NAME_SETTING_ID) + private Integer settingId; + + public UpdateEvaluationFormulaWithIdModel() { + } + + public UpdateEvaluationFormulaWithIdModel defaultValue(ValueModel defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * Get defaultValue + * @return defaultValue + */ + @javax.annotation.Nonnull + public ValueModel getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(ValueModel defaultValue) { + this.defaultValue = defaultValue; + } + + + public UpdateEvaluationFormulaWithIdModel targetingRules(List targetingRules) { + this.targetingRules = targetingRules; + return this; + } + + public UpdateEvaluationFormulaWithIdModel addTargetingRulesItem(TargetingRuleModel targetingRulesItem) { + if (this.targetingRules == null) { + this.targetingRules = new ArrayList<>(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateEvaluationFormulaWithIdModel updateEvaluationFormulaWithIdModel = - (UpdateEvaluationFormulaWithIdModel) o; - return Objects.equals(this.defaultValue, updateEvaluationFormulaWithIdModel.defaultValue) - && Objects.equals( - this.targetingRules, updateEvaluationFormulaWithIdModel.targetingRules) - && Objects.equals( - this.percentageEvaluationAttribute, - updateEvaluationFormulaWithIdModel.percentageEvaluationAttribute) - && Objects.equals(this.settingId, updateEvaluationFormulaWithIdModel.settingId); + this.targetingRules.add(targetingRulesItem); + return this; + } + + /** + * The targeting rules of the Feature Flag or Setting. + * @return targetingRules + */ + @javax.annotation.Nullable + public List getTargetingRules() { + return targetingRules; + } + + public void setTargetingRules(List targetingRules) { + this.targetingRules = targetingRules; + } + + + public UpdateEvaluationFormulaWithIdModel percentageEvaluationAttribute(String percentageEvaluationAttribute) { + this.percentageEvaluationAttribute = percentageEvaluationAttribute; + return this; + } + + /** + * The user attribute used for percentage evaluation. If not set, it defaults to the `Identifier` user object attribute. + * @return percentageEvaluationAttribute + */ + @javax.annotation.Nullable + public String getPercentageEvaluationAttribute() { + return percentageEvaluationAttribute; + } + + public void setPercentageEvaluationAttribute(String percentageEvaluationAttribute) { + this.percentageEvaluationAttribute = percentageEvaluationAttribute; + } + + + public UpdateEvaluationFormulaWithIdModel settingId(Integer settingId) { + this.settingId = settingId; + return this; + } + + /** + * The identifier of the feature flag or setting. + * @return settingId + */ + @javax.annotation.Nullable + public Integer getSettingId() { + return settingId; + } + + public void setSettingId(Integer settingId) { + this.settingId = settingId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateEvaluationFormulaWithIdModel instance itself + */ + public UpdateEvaluationFormulaWithIdModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(defaultValue, targetingRules, percentageEvaluationAttribute, settingId); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateEvaluationFormulaWithIdModel {\n"); - sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); - sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); - sb.append(" percentageEvaluationAttribute: ") - .append(toIndentedString(percentageEvaluationAttribute)) - .append("\n"); - sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + UpdateEvaluationFormulaWithIdModel updateEvaluationFormulaWithIdModel = (UpdateEvaluationFormulaWithIdModel) o; + return Objects.equals(this.defaultValue, updateEvaluationFormulaWithIdModel.defaultValue) && + Objects.equals(this.targetingRules, updateEvaluationFormulaWithIdModel.targetingRules) && + Objects.equals(this.percentageEvaluationAttribute, updateEvaluationFormulaWithIdModel.percentageEvaluationAttribute) && + Objects.equals(this.settingId, updateEvaluationFormulaWithIdModel.settingId)&& + Objects.equals(this.additionalProperties, updateEvaluationFormulaWithIdModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(defaultValue, targetingRules, percentageEvaluationAttribute, settingId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("defaultValue"); - openapiFields.add("targetingRules"); - openapiFields.add("percentageEvaluationAttribute"); - openapiFields.add("settingId"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("defaultValue"); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateEvaluationFormulaWithIdModel {\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); + sb.append(" percentageEvaluationAttribute: ").append(toIndentedString(percentageEvaluationAttribute)).append("\n"); + sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateEvaluationFormulaWithIdModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateEvaluationFormulaWithIdModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateEvaluationFormulaWithIdModel is" - + " not found in the empty JSON string", - UpdateEvaluationFormulaWithIdModel.openapiRequiredFields - .toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateEvaluationFormulaWithIdModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateEvaluationFormulaWithIdModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("defaultValue"); + openapiFields.add("targetingRules"); + openapiFields.add("percentageEvaluationAttribute"); + openapiFields.add("settingId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("defaultValue"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateEvaluationFormulaWithIdModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateEvaluationFormulaWithIdModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateEvaluationFormulaWithIdModel is not found in the empty JSON string", UpdateEvaluationFormulaWithIdModel.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UpdateEvaluationFormulaWithIdModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateEvaluationFormulaWithIdModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the required field `defaultValue` - ValueModel.validateJsonElement(jsonObj.get("defaultValue")); - if (jsonObj.get("targetingRules") != null && !jsonObj.get("targetingRules").isJsonNull()) { - JsonArray jsonArraytargetingRules = jsonObj.getAsJsonArray("targetingRules"); - if (jsonArraytargetingRules != null) { - // ensure the json data is an array - if (!jsonObj.get("targetingRules").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `targetingRules` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("targetingRules").toString())); - } - - // validate the optional field `targetingRules` (array) - for (int i = 0; i < jsonArraytargetingRules.size(); i++) { - TargetingRuleModel.validateJsonElement(jsonArraytargetingRules.get(i)); - } - ; - } + // validate the required field `defaultValue` + ValueModel.validateJsonElement(jsonObj.get("defaultValue")); + if (jsonObj.get("targetingRules") != null && !jsonObj.get("targetingRules").isJsonNull()) { + JsonArray jsonArraytargetingRules = jsonObj.getAsJsonArray("targetingRules"); + if (jsonArraytargetingRules != null) { + // ensure the json data is an array + if (!jsonObj.get("targetingRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `targetingRules` to be an array in the JSON string but got `%s`", jsonObj.get("targetingRules").toString())); + } + + // validate the optional field `targetingRules` (array) + for (int i = 0; i < jsonArraytargetingRules.size(); i++) { + TargetingRuleModel.validateJsonElement(jsonArraytargetingRules.get(i)); + }; } - if ((jsonObj.get("percentageEvaluationAttribute") != null - && !jsonObj.get("percentageEvaluationAttribute").isJsonNull()) - && !jsonObj.get("percentageEvaluationAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `percentageEvaluationAttribute` to be a primitive" - + " type in the JSON string but got `%s`", - jsonObj.get("percentageEvaluationAttribute").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateEvaluationFormulaWithIdModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateEvaluationFormulaWithIdModel' and - // its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(UpdateEvaluationFormulaWithIdModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateEvaluationFormulaWithIdModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateEvaluationFormulaWithIdModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateEvaluationFormulaWithIdModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateEvaluationFormulaWithIdModel - * @throws IOException if the JSON string is invalid with respect to - * UpdateEvaluationFormulaWithIdModel - */ - public static UpdateEvaluationFormulaWithIdModel fromJson(String jsonString) - throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateEvaluationFormulaWithIdModel.class); - } - - /** - * Convert an instance of UpdateEvaluationFormulaWithIdModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + } + if ((jsonObj.get("percentageEvaluationAttribute") != null && !jsonObj.get("percentageEvaluationAttribute").isJsonNull()) && !jsonObj.get("percentageEvaluationAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `percentageEvaluationAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("percentageEvaluationAttribute").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateEvaluationFormulaWithIdModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateEvaluationFormulaWithIdModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateEvaluationFormulaWithIdModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateEvaluationFormulaWithIdModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateEvaluationFormulaWithIdModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateEvaluationFormulaWithIdModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateEvaluationFormulaWithIdModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateEvaluationFormulaWithIdModel + * @throws IOException if the JSON string is invalid with respect to UpdateEvaluationFormulaWithIdModel + */ + public static UpdateEvaluationFormulaWithIdModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateEvaluationFormulaWithIdModel.class); + } + + /** + * Convert an instance of UpdateEvaluationFormulaWithIdModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulasModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulasModel.java index ed49737..1e0b555 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulasModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateEvaluationFormulasModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,242 +10,312 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.UpdateEvaluationFormulaWithIdModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** UpdateEvaluationFormulasModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * UpdateEvaluationFormulasModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class UpdateEvaluationFormulasModel { - public static final String SERIALIZED_NAME_UPDATE_FORMULAS = "updateFormulas"; + public static final String SERIALIZED_NAME_UPDATE_FORMULAS = "updateFormulas"; + @SerializedName(SERIALIZED_NAME_UPDATE_FORMULAS) + private List updateFormulas; - @SerializedName(SERIALIZED_NAME_UPDATE_FORMULAS) - private List updateFormulas; + public UpdateEvaluationFormulasModel() { + } - public UpdateEvaluationFormulasModel() {} + public UpdateEvaluationFormulasModel updateFormulas(List updateFormulas) { + this.updateFormulas = updateFormulas; + return this; + } - public UpdateEvaluationFormulasModel updateFormulas( - List updateFormulas) { - this.updateFormulas = updateFormulas; - return this; + public UpdateEvaluationFormulasModel addUpdateFormulasItem(UpdateEvaluationFormulaWithIdModel updateFormulasItem) { + if (this.updateFormulas == null) { + this.updateFormulas = new ArrayList<>(); } + this.updateFormulas.add(updateFormulasItem); + return this; + } - public UpdateEvaluationFormulasModel addUpdateFormulasItem( - UpdateEvaluationFormulaWithIdModel updateFormulasItem) { - if (this.updateFormulas == null) { - this.updateFormulas = new ArrayList<>(); - } - this.updateFormulas.add(updateFormulasItem); - return this; - } + /** + * Evaluation descriptors of each updated Feature Flag and Setting. + * @return updateFormulas + */ + @javax.annotation.Nullable + public List getUpdateFormulas() { + return updateFormulas; + } - /** - * Evaluation descriptors of each updated Feature Flag and Setting. - * - * @return updateFormulas - */ - @javax.annotation.Nullable - public List getUpdateFormulas() { - return updateFormulas; - } + public void setUpdateFormulas(List updateFormulas) { + this.updateFormulas = updateFormulas; + } - public void setUpdateFormulas(List updateFormulas) { - this.updateFormulas = updateFormulas; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateEvaluationFormulasModel updateEvaluationFormulasModel = - (UpdateEvaluationFormulasModel) o; - return Objects.equals(this.updateFormulas, updateEvaluationFormulasModel.updateFormulas); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateEvaluationFormulasModel instance itself + */ + public UpdateEvaluationFormulasModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(updateFormulas); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + UpdateEvaluationFormulasModel updateEvaluationFormulasModel = (UpdateEvaluationFormulasModel) o; + return Objects.equals(this.updateFormulas, updateEvaluationFormulasModel.updateFormulas)&& + Objects.equals(this.additionalProperties, updateEvaluationFormulasModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateEvaluationFormulasModel {\n"); - sb.append(" updateFormulas: ").append(toIndentedString(updateFormulas)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(updateFormulas, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateEvaluationFormulasModel {\n"); + sb.append(" updateFormulas: ").append(toIndentedString(updateFormulas)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("updateFormulas"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("updateFormulas"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateEvaluationFormulasModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateEvaluationFormulasModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateEvaluationFormulasModel is not" - + " found in the empty JSON string", - UpdateEvaluationFormulasModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateEvaluationFormulasModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateEvaluationFormulasModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateEvaluationFormulasModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateEvaluationFormulasModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateEvaluationFormulasModel is not found in the empty JSON string", UpdateEvaluationFormulasModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("updateFormulas") != null && !jsonObj.get("updateFormulas").isJsonNull()) { - JsonArray jsonArrayupdateFormulas = jsonObj.getAsJsonArray("updateFormulas"); - if (jsonArrayupdateFormulas != null) { - // ensure the json data is an array - if (!jsonObj.get("updateFormulas").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `updateFormulas` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("updateFormulas").toString())); - } - - // validate the optional field `updateFormulas` (array) - for (int i = 0; i < jsonArrayupdateFormulas.size(); i++) { - UpdateEvaluationFormulaWithIdModel.validateJsonElement( - jsonArrayupdateFormulas.get(i)); - } - ; - } - } - } + if (jsonObj.get("updateFormulas") != null && !jsonObj.get("updateFormulas").isJsonNull()) { + JsonArray jsonArrayupdateFormulas = jsonObj.getAsJsonArray("updateFormulas"); + if (jsonArrayupdateFormulas != null) { + // ensure the json data is an array + if (!jsonObj.get("updateFormulas").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `updateFormulas` to be an array in the JSON string but got `%s`", jsonObj.get("updateFormulas").toString())); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateEvaluationFormulasModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateEvaluationFormulasModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(UpdateEvaluationFormulasModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateEvaluationFormulasModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateEvaluationFormulasModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); + // validate the optional field `updateFormulas` (array) + for (int i = 0; i < jsonArrayupdateFormulas.size(); i++) { + UpdateEvaluationFormulaWithIdModel.validateJsonElement(jsonArrayupdateFormulas.get(i)); + }; } - } + } + } - /** - * Create an instance of UpdateEvaluationFormulasModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateEvaluationFormulasModel - * @throws IOException if the JSON string is invalid with respect to - * UpdateEvaluationFormulasModel - */ - public static UpdateEvaluationFormulasModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateEvaluationFormulasModel.class); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateEvaluationFormulasModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateEvaluationFormulasModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateEvaluationFormulasModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateEvaluationFormulasModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateEvaluationFormulasModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateEvaluationFormulasModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of UpdateEvaluationFormulasModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of UpdateEvaluationFormulasModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateEvaluationFormulasModel + * @throws IOException if the JSON string is invalid with respect to UpdateEvaluationFormulasModel + */ + public static UpdateEvaluationFormulasModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateEvaluationFormulasModel.class); + } + + /** + * Convert an instance of UpdateEvaluationFormulasModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateMemberPermissionsRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateMemberPermissionsRequest.java index b121b5f..4689ab5 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateMemberPermissionsRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateMemberPermissionsRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,326 +10,379 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** UpdateMemberPermissionsRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateMemberPermissionsRequest { - public static final String SERIALIZED_NAME_PERMISSION_GROUP_IDS = "permissionGroupIds"; - - @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_IDS) - private List permissionGroupIds; - - public static final String SERIALIZED_NAME_IS_ADMIN = "isAdmin"; - - @SerializedName(SERIALIZED_NAME_IS_ADMIN) - private Boolean isAdmin; - - public static final String SERIALIZED_NAME_IS_BILLING_MANAGER = "isBillingManager"; - - @SerializedName(SERIALIZED_NAME_IS_BILLING_MANAGER) - private Boolean isBillingManager; - - public static final String SERIALIZED_NAME_REMOVE_FROM_PERMISSION_GROUPS_WHERE_ID_NOT_SET = - "removeFromPermissionGroupsWhereIdNotSet"; - - @SerializedName(SERIALIZED_NAME_REMOVE_FROM_PERMISSION_GROUPS_WHERE_ID_NOT_SET) - private Boolean removeFromPermissionGroupsWhereIdNotSet; - - public UpdateMemberPermissionsRequest() {} - - public UpdateMemberPermissionsRequest permissionGroupIds(List permissionGroupIds) { - this.permissionGroupIds = permissionGroupIds; - return this; - } - - public UpdateMemberPermissionsRequest addPermissionGroupIdsItem(Long permissionGroupIdsItem) { - if (this.permissionGroupIds == null) { - this.permissionGroupIds = new ArrayList<>(); - } - this.permissionGroupIds.add(permissionGroupIdsItem); - return this; - } - - /** - * List of Permission Group identifiers to where the Member should be added. - * - * @return permissionGroupIds - */ - @javax.annotation.Nullable - public List getPermissionGroupIds() { - return permissionGroupIds; - } - - public void setPermissionGroupIds(List permissionGroupIds) { - this.permissionGroupIds = permissionGroupIds; - } - - public UpdateMemberPermissionsRequest isAdmin(Boolean isAdmin) { - this.isAdmin = isAdmin; - return this; - } +import com.configcat.publicapi.java.client.JSON; - /** - * Indicates that the member must be Organization Admin. - * - * @return isAdmin - */ - @javax.annotation.Nullable - public Boolean getIsAdmin() { - return isAdmin; - } +/** + * UpdateMemberPermissionsRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateMemberPermissionsRequest { + public static final String SERIALIZED_NAME_PERMISSION_GROUP_IDS = "permissionGroupIds"; + @SerializedName(SERIALIZED_NAME_PERMISSION_GROUP_IDS) + private List permissionGroupIds; - public void setIsAdmin(Boolean isAdmin) { - this.isAdmin = isAdmin; - } + public static final String SERIALIZED_NAME_IS_ADMIN = "isAdmin"; + @SerializedName(SERIALIZED_NAME_IS_ADMIN) + private Boolean isAdmin; - public UpdateMemberPermissionsRequest isBillingManager(Boolean isBillingManager) { - this.isBillingManager = isBillingManager; - return this; - } + public static final String SERIALIZED_NAME_IS_BILLING_MANAGER = "isBillingManager"; + @SerializedName(SERIALIZED_NAME_IS_BILLING_MANAGER) + private Boolean isBillingManager; - /** - * Indicates that the member must be Billing Manager. - * - * @return isBillingManager - */ - @javax.annotation.Nullable - public Boolean getIsBillingManager() { - return isBillingManager; - } + public static final String SERIALIZED_NAME_REMOVE_FROM_PERMISSION_GROUPS_WHERE_ID_NOT_SET = "removeFromPermissionGroupsWhereIdNotSet"; + @SerializedName(SERIALIZED_NAME_REMOVE_FROM_PERMISSION_GROUPS_WHERE_ID_NOT_SET) + private Boolean removeFromPermissionGroupsWhereIdNotSet; - public void setIsBillingManager(Boolean isBillingManager) { - this.isBillingManager = isBillingManager; - } + public UpdateMemberPermissionsRequest() { + } - public UpdateMemberPermissionsRequest removeFromPermissionGroupsWhereIdNotSet( - Boolean removeFromPermissionGroupsWhereIdNotSet) { - this.removeFromPermissionGroupsWhereIdNotSet = removeFromPermissionGroupsWhereIdNotSet; - return this; - } + public UpdateMemberPermissionsRequest permissionGroupIds(List permissionGroupIds) { + this.permissionGroupIds = permissionGroupIds; + return this; + } - /** - * When `true`, the member will be removed from those Permission Groups that are not - * listed in the `permissionGroupIds` field. - * - * @return removeFromPermissionGroupsWhereIdNotSet - */ - @javax.annotation.Nullable - public Boolean getRemoveFromPermissionGroupsWhereIdNotSet() { - return removeFromPermissionGroupsWhereIdNotSet; + public UpdateMemberPermissionsRequest addPermissionGroupIdsItem(Long permissionGroupIdsItem) { + if (this.permissionGroupIds == null) { + this.permissionGroupIds = new ArrayList<>(); } - - public void setRemoveFromPermissionGroupsWhereIdNotSet( - Boolean removeFromPermissionGroupsWhereIdNotSet) { - this.removeFromPermissionGroupsWhereIdNotSet = removeFromPermissionGroupsWhereIdNotSet; + this.permissionGroupIds.add(permissionGroupIdsItem); + return this; + } + + /** + * List of Permission Group identifiers to where the Member should be added. + * @return permissionGroupIds + */ + @javax.annotation.Nullable + public List getPermissionGroupIds() { + return permissionGroupIds; + } + + public void setPermissionGroupIds(List permissionGroupIds) { + this.permissionGroupIds = permissionGroupIds; + } + + + public UpdateMemberPermissionsRequest isAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + return this; + } + + /** + * Indicates that the member must be Organization Admin. + * @return isAdmin + */ + @javax.annotation.Nullable + public Boolean getIsAdmin() { + return isAdmin; + } + + public void setIsAdmin(Boolean isAdmin) { + this.isAdmin = isAdmin; + } + + + public UpdateMemberPermissionsRequest isBillingManager(Boolean isBillingManager) { + this.isBillingManager = isBillingManager; + return this; + } + + /** + * Indicates that the member must be Billing Manager. + * @return isBillingManager + */ + @javax.annotation.Nullable + public Boolean getIsBillingManager() { + return isBillingManager; + } + + public void setIsBillingManager(Boolean isBillingManager) { + this.isBillingManager = isBillingManager; + } + + + public UpdateMemberPermissionsRequest removeFromPermissionGroupsWhereIdNotSet(Boolean removeFromPermissionGroupsWhereIdNotSet) { + this.removeFromPermissionGroupsWhereIdNotSet = removeFromPermissionGroupsWhereIdNotSet; + return this; + } + + /** + * When `true`, the member will be removed from those Permission Groups that are not listed in the `permissionGroupIds` field. + * @return removeFromPermissionGroupsWhereIdNotSet + */ + @javax.annotation.Nullable + public Boolean getRemoveFromPermissionGroupsWhereIdNotSet() { + return removeFromPermissionGroupsWhereIdNotSet; + } + + public void setRemoveFromPermissionGroupsWhereIdNotSet(Boolean removeFromPermissionGroupsWhereIdNotSet) { + this.removeFromPermissionGroupsWhereIdNotSet = removeFromPermissionGroupsWhereIdNotSet; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateMemberPermissionsRequest instance itself + */ + public UpdateMemberPermissionsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateMemberPermissionsRequest updateMemberPermissionsRequest = - (UpdateMemberPermissionsRequest) o; - return Objects.equals( - this.permissionGroupIds, updateMemberPermissionsRequest.permissionGroupIds) - && Objects.equals(this.isAdmin, updateMemberPermissionsRequest.isAdmin) - && Objects.equals( - this.isBillingManager, updateMemberPermissionsRequest.isBillingManager) - && Objects.equals( - this.removeFromPermissionGroupsWhereIdNotSet, - updateMemberPermissionsRequest.removeFromPermissionGroupsWhereIdNotSet); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - @Override - public int hashCode() { - return Objects.hash( - permissionGroupIds, - isAdmin, - isBillingManager, - removeFromPermissionGroupsWhereIdNotSet); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateMemberPermissionsRequest {\n"); - sb.append(" permissionGroupIds: ") - .append(toIndentedString(permissionGroupIds)) - .append("\n"); - sb.append(" isAdmin: ").append(toIndentedString(isAdmin)).append("\n"); - sb.append(" isBillingManager: ").append(toIndentedString(isBillingManager)).append("\n"); - sb.append(" removeFromPermissionGroupsWhereIdNotSet: ") - .append(toIndentedString(removeFromPermissionGroupsWhereIdNotSet)) - .append("\n"); - sb.append("}"); - return sb.toString(); + UpdateMemberPermissionsRequest updateMemberPermissionsRequest = (UpdateMemberPermissionsRequest) o; + return Objects.equals(this.permissionGroupIds, updateMemberPermissionsRequest.permissionGroupIds) && + Objects.equals(this.isAdmin, updateMemberPermissionsRequest.isAdmin) && + Objects.equals(this.isBillingManager, updateMemberPermissionsRequest.isBillingManager) && + Objects.equals(this.removeFromPermissionGroupsWhereIdNotSet, updateMemberPermissionsRequest.removeFromPermissionGroupsWhereIdNotSet)&& + Objects.equals(this.additionalProperties, updateMemberPermissionsRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(permissionGroupIds, isAdmin, isBillingManager, removeFromPermissionGroupsWhereIdNotSet, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("permissionGroupIds"); - openapiFields.add("isAdmin"); - openapiFields.add("isBillingManager"); - openapiFields.add("removeFromPermissionGroupsWhereIdNotSet"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateMemberPermissionsRequest {\n"); + sb.append(" permissionGroupIds: ").append(toIndentedString(permissionGroupIds)).append("\n"); + sb.append(" isAdmin: ").append(toIndentedString(isAdmin)).append("\n"); + sb.append(" isBillingManager: ").append(toIndentedString(isBillingManager)).append("\n"); + sb.append(" removeFromPermissionGroupsWhereIdNotSet: ").append(toIndentedString(removeFromPermissionGroupsWhereIdNotSet)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateMemberPermissionsRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateMemberPermissionsRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateMemberPermissionsRequest is not" - + " found in the empty JSON string", - UpdateMemberPermissionsRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateMemberPermissionsRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateMemberPermissionsRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("permissionGroupIds"); + openapiFields.add("isAdmin"); + openapiFields.add("isBillingManager"); + openapiFields.add("removeFromPermissionGroupsWhereIdNotSet"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateMemberPermissionsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateMemberPermissionsRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateMemberPermissionsRequest is not found in the empty JSON string", UpdateMemberPermissionsRequest.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // ensure the optional json data is an array if present - if (jsonObj.get("permissionGroupIds") != null - && !jsonObj.get("permissionGroupIds").isJsonNull() - && !jsonObj.get("permissionGroupIds").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `permissionGroupIds` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("permissionGroupIds").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateMemberPermissionsRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateMemberPermissionsRequest' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(UpdateMemberPermissionsRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateMemberPermissionsRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateMemberPermissionsRequest read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateMemberPermissionsRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateMemberPermissionsRequest - * @throws IOException if the JSON string is invalid with respect to - * UpdateMemberPermissionsRequest - */ - public static UpdateMemberPermissionsRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateMemberPermissionsRequest.class); - } - - /** - * Convert an instance of UpdateMemberPermissionsRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + // ensure the optional json data is an array if present + if (jsonObj.get("permissionGroupIds") != null && !jsonObj.get("permissionGroupIds").isJsonNull() && !jsonObj.get("permissionGroupIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissionGroupIds` to be an array in the JSON string but got `%s`", jsonObj.get("permissionGroupIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateMemberPermissionsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateMemberPermissionsRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateMemberPermissionsRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateMemberPermissionsRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateMemberPermissionsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateMemberPermissionsRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateMemberPermissionsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateMemberPermissionsRequest + * @throws IOException if the JSON string is invalid with respect to UpdateMemberPermissionsRequest + */ + public static UpdateMemberPermissionsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateMemberPermissionsRequest.class); + } + + /** + * Convert an instance of UpdateMemberPermissionsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdatePermissionGroupRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdatePermissionGroupRequest.java index 09f01bc..459ffb5 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdatePermissionGroupRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdatePermissionGroupRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,1003 +10,949 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.AccessType; +import com.configcat.publicapi.java.client.model.CreateOrUpdateEnvironmentAccessModel; +import com.configcat.publicapi.java.client.model.EnvironmentAccessType; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdatePermissionGroupRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdatePermissionGroupRequest { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_CAN_MANAGE_MEMBERS = "canManageMembers"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_MEMBERS) - private Boolean canManageMembers; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG = - "canCreateOrUpdateConfig"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG) - private Boolean canCreateOrUpdateConfig; - - public static final String SERIALIZED_NAME_CAN_DELETE_CONFIG = "canDeleteConfig"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_CONFIG) - private Boolean canDeleteConfig; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT = - "canCreateOrUpdateEnvironment"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT) - private Boolean canCreateOrUpdateEnvironment; - - public static final String SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT = "canDeleteEnvironment"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT) - private Boolean canDeleteEnvironment; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING = - "canCreateOrUpdateSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING) - private Boolean canCreateOrUpdateSetting; - - public static final String SERIALIZED_NAME_CAN_TAG_SETTING = "canTagSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_TAG_SETTING) - private Boolean canTagSetting; - - public static final String SERIALIZED_NAME_CAN_DELETE_SETTING = "canDeleteSetting"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_SETTING) - private Boolean canDeleteSetting; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG = "canCreateOrUpdateTag"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG) - private Boolean canCreateOrUpdateTag; - - public static final String SERIALIZED_NAME_CAN_DELETE_TAG = "canDeleteTag"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_TAG) - private Boolean canDeleteTag; - - public static final String SERIALIZED_NAME_CAN_MANAGE_WEBHOOK = "canManageWebhook"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_WEBHOOK) - private Boolean canManageWebhook; - - public static final String SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT = "canUseExportImport"; - - @SerializedName(SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT) - private Boolean canUseExportImport; - - public static final String SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES = - "canManageProductPreferences"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES) - private Boolean canManageProductPreferences; - - public static final String SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS = "canManageIntegrations"; - - @SerializedName(SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS) - private Boolean canManageIntegrations; - - public static final String SERIALIZED_NAME_CAN_VIEW_SDK_KEY = "canViewSdkKey"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_SDK_KEY) - private Boolean canViewSdkKey; - - public static final String SERIALIZED_NAME_CAN_ROTATE_SDK_KEY = "canRotateSdkKey"; - - @SerializedName(SERIALIZED_NAME_CAN_ROTATE_SDK_KEY) - private Boolean canRotateSdkKey; - - public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS = - "canCreateOrUpdateSegments"; - - @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS) - private Boolean canCreateOrUpdateSegments; - - public static final String SERIALIZED_NAME_CAN_DELETE_SEGMENTS = "canDeleteSegments"; - - @SerializedName(SERIALIZED_NAME_CAN_DELETE_SEGMENTS) - private Boolean canDeleteSegments; - - public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG = - "canViewProductAuditLog"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG) - private Boolean canViewProductAuditLog; - - public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS = - "canViewProductStatistics"; - - @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS) - private Boolean canViewProductStatistics; - - public static final String SERIALIZED_NAME_CAN_DISABLE2_F_A = "canDisable2FA"; - - @SerializedName(SERIALIZED_NAME_CAN_DISABLE2_F_A) - private Boolean canDisable2FA; - - public static final String SERIALIZED_NAME_ACCESS_TYPE = "accessType"; - - @SerializedName(SERIALIZED_NAME_ACCESS_TYPE) - private AccessType accessType; - - public static final String SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE = - "newEnvironmentAccessType"; - - @SerializedName(SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE) - private EnvironmentAccessType newEnvironmentAccessType; - - public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESSES = "environmentAccesses"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESSES) - private List environmentAccesses; - - public UpdatePermissionGroupRequest() {} - - public UpdatePermissionGroupRequest name(String name) { - this.name = name; - return this; - } - - /** - * Name of the Permission Group. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public UpdatePermissionGroupRequest canManageMembers(Boolean canManageMembers) { - this.canManageMembers = canManageMembers; - return this; - } - - /** - * Group members can manage team members. - * - * @return canManageMembers - */ - @javax.annotation.Nullable - public Boolean getCanManageMembers() { - return canManageMembers; - } - - public void setCanManageMembers(Boolean canManageMembers) { - this.canManageMembers = canManageMembers; - } - - public UpdatePermissionGroupRequest canCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { - this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; - return this; - } - - /** - * Group members can create/update Configs. - * - * @return canCreateOrUpdateConfig - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateConfig() { - return canCreateOrUpdateConfig; - } - - public void setCanCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { - this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; - } - - public UpdatePermissionGroupRequest canDeleteConfig(Boolean canDeleteConfig) { - this.canDeleteConfig = canDeleteConfig; - return this; - } - - /** - * Group members can delete Configs. - * - * @return canDeleteConfig - */ - @javax.annotation.Nullable - public Boolean getCanDeleteConfig() { - return canDeleteConfig; - } - - public void setCanDeleteConfig(Boolean canDeleteConfig) { - this.canDeleteConfig = canDeleteConfig; - } - - public UpdatePermissionGroupRequest canCreateOrUpdateEnvironment( - Boolean canCreateOrUpdateEnvironment) { - this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; - return this; - } - - /** - * Group members can create/update Environments. - * - * @return canCreateOrUpdateEnvironment - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateEnvironment() { - return canCreateOrUpdateEnvironment; - } - - public void setCanCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { - this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; - } - - public UpdatePermissionGroupRequest canDeleteEnvironment(Boolean canDeleteEnvironment) { - this.canDeleteEnvironment = canDeleteEnvironment; - return this; - } - - /** - * Group members can delete Environments. - * - * @return canDeleteEnvironment - */ - @javax.annotation.Nullable - public Boolean getCanDeleteEnvironment() { - return canDeleteEnvironment; - } - - public void setCanDeleteEnvironment(Boolean canDeleteEnvironment) { - this.canDeleteEnvironment = canDeleteEnvironment; - } - - public UpdatePermissionGroupRequest canCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { - this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; - return this; - } - - /** - * Group members can create/update Feature Flags and Settings. - * - * @return canCreateOrUpdateSetting - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateSetting() { - return canCreateOrUpdateSetting; - } - - public void setCanCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { - this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; - } - - public UpdatePermissionGroupRequest canTagSetting(Boolean canTagSetting) { - this.canTagSetting = canTagSetting; - return this; - } - - /** - * Group members can attach/detach Tags to Feature Flags and Settings. - * - * @return canTagSetting - */ - @javax.annotation.Nullable - public Boolean getCanTagSetting() { - return canTagSetting; - } - - public void setCanTagSetting(Boolean canTagSetting) { - this.canTagSetting = canTagSetting; - } - - public UpdatePermissionGroupRequest canDeleteSetting(Boolean canDeleteSetting) { - this.canDeleteSetting = canDeleteSetting; - return this; - } - - /** - * Group members can delete Feature Flags and Settings. - * - * @return canDeleteSetting - */ - @javax.annotation.Nullable - public Boolean getCanDeleteSetting() { - return canDeleteSetting; - } - - public void setCanDeleteSetting(Boolean canDeleteSetting) { - this.canDeleteSetting = canDeleteSetting; - } - - public UpdatePermissionGroupRequest canCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { - this.canCreateOrUpdateTag = canCreateOrUpdateTag; - return this; - } - - /** - * Group members can create/update Tags. - * - * @return canCreateOrUpdateTag - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateTag() { - return canCreateOrUpdateTag; - } - public void setCanCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { - this.canCreateOrUpdateTag = canCreateOrUpdateTag; - } - - public UpdatePermissionGroupRequest canDeleteTag(Boolean canDeleteTag) { - this.canDeleteTag = canDeleteTag; - return this; - } - - /** - * Group members can delete Tags. - * - * @return canDeleteTag - */ - @javax.annotation.Nullable - public Boolean getCanDeleteTag() { - return canDeleteTag; - } - - public void setCanDeleteTag(Boolean canDeleteTag) { - this.canDeleteTag = canDeleteTag; - } - - public UpdatePermissionGroupRequest canManageWebhook(Boolean canManageWebhook) { - this.canManageWebhook = canManageWebhook; - return this; - } - - /** - * Group members can create/update/delete Webhooks. - * - * @return canManageWebhook - */ - @javax.annotation.Nullable - public Boolean getCanManageWebhook() { - return canManageWebhook; - } - - public void setCanManageWebhook(Boolean canManageWebhook) { - this.canManageWebhook = canManageWebhook; - } - - public UpdatePermissionGroupRequest canUseExportImport(Boolean canUseExportImport) { - this.canUseExportImport = canUseExportImport; - return this; - } - - /** - * Group members can use the export/import feature. - * - * @return canUseExportImport - */ - @javax.annotation.Nullable - public Boolean getCanUseExportImport() { - return canUseExportImport; - } - - public void setCanUseExportImport(Boolean canUseExportImport) { - this.canUseExportImport = canUseExportImport; - } - - public UpdatePermissionGroupRequest canManageProductPreferences( - Boolean canManageProductPreferences) { - this.canManageProductPreferences = canManageProductPreferences; - return this; - } - - /** - * Group members can update Product preferences. - * - * @return canManageProductPreferences - */ - @javax.annotation.Nullable - public Boolean getCanManageProductPreferences() { - return canManageProductPreferences; - } - - public void setCanManageProductPreferences(Boolean canManageProductPreferences) { - this.canManageProductPreferences = canManageProductPreferences; - } - - public UpdatePermissionGroupRequest canManageIntegrations(Boolean canManageIntegrations) { - this.canManageIntegrations = canManageIntegrations; - return this; - } - - /** - * Group members can add and configure integrations. - * - * @return canManageIntegrations - */ - @javax.annotation.Nullable - public Boolean getCanManageIntegrations() { - return canManageIntegrations; - } - - public void setCanManageIntegrations(Boolean canManageIntegrations) { - this.canManageIntegrations = canManageIntegrations; - } - - public UpdatePermissionGroupRequest canViewSdkKey(Boolean canViewSdkKey) { - this.canViewSdkKey = canViewSdkKey; - return this; - } - - /** - * Group members has access to SDK keys. - * - * @return canViewSdkKey - */ - @javax.annotation.Nullable - public Boolean getCanViewSdkKey() { - return canViewSdkKey; - } - - public void setCanViewSdkKey(Boolean canViewSdkKey) { - this.canViewSdkKey = canViewSdkKey; - } - - public UpdatePermissionGroupRequest canRotateSdkKey(Boolean canRotateSdkKey) { - this.canRotateSdkKey = canRotateSdkKey; - return this; - } - - /** - * Group members can rotate SDK keys. - * - * @return canRotateSdkKey - */ - @javax.annotation.Nullable - public Boolean getCanRotateSdkKey() { - return canRotateSdkKey; - } - - public void setCanRotateSdkKey(Boolean canRotateSdkKey) { - this.canRotateSdkKey = canRotateSdkKey; - } - - public UpdatePermissionGroupRequest canCreateOrUpdateSegments( - Boolean canCreateOrUpdateSegments) { - this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; - return this; - } - - /** - * Group members can create/update Segments. - * - * @return canCreateOrUpdateSegments - */ - @javax.annotation.Nullable - public Boolean getCanCreateOrUpdateSegments() { - return canCreateOrUpdateSegments; - } - - public void setCanCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { - this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; - } - - public UpdatePermissionGroupRequest canDeleteSegments(Boolean canDeleteSegments) { - this.canDeleteSegments = canDeleteSegments; - return this; - } - - /** - * Group members can delete Segments. - * - * @return canDeleteSegments - */ - @javax.annotation.Nullable - public Boolean getCanDeleteSegments() { - return canDeleteSegments; - } - - public void setCanDeleteSegments(Boolean canDeleteSegments) { - this.canDeleteSegments = canDeleteSegments; - } - - public UpdatePermissionGroupRequest canViewProductAuditLog(Boolean canViewProductAuditLog) { - this.canViewProductAuditLog = canViewProductAuditLog; - return this; - } - - /** - * Group members has access to audit logs. - * - * @return canViewProductAuditLog - */ - @javax.annotation.Nullable - public Boolean getCanViewProductAuditLog() { - return canViewProductAuditLog; - } - - public void setCanViewProductAuditLog(Boolean canViewProductAuditLog) { - this.canViewProductAuditLog = canViewProductAuditLog; - } - - public UpdatePermissionGroupRequest canViewProductStatistics(Boolean canViewProductStatistics) { - this.canViewProductStatistics = canViewProductStatistics; - return this; - } - - /** - * Group members has access to product statistics. - * - * @return canViewProductStatistics - */ - @javax.annotation.Nullable - public Boolean getCanViewProductStatistics() { - return canViewProductStatistics; - } - - public void setCanViewProductStatistics(Boolean canViewProductStatistics) { - this.canViewProductStatistics = canViewProductStatistics; - } - - public UpdatePermissionGroupRequest canDisable2FA(Boolean canDisable2FA) { - this.canDisable2FA = canDisable2FA; - return this; - } - - /** - * Group members can disable two-factor authentication for other members. - * - * @return canDisable2FA - */ - @javax.annotation.Nullable - public Boolean getCanDisable2FA() { - return canDisable2FA; - } - - public void setCanDisable2FA(Boolean canDisable2FA) { - this.canDisable2FA = canDisable2FA; - } - - public UpdatePermissionGroupRequest accessType(AccessType accessType) { - this.accessType = accessType; - return this; - } - - /** - * Get accessType - * - * @return accessType - */ - @javax.annotation.Nullable - public AccessType getAccessType() { - return accessType; - } - - public void setAccessType(AccessType accessType) { - this.accessType = accessType; - } - - public UpdatePermissionGroupRequest newEnvironmentAccessType( - EnvironmentAccessType newEnvironmentAccessType) { - this.newEnvironmentAccessType = newEnvironmentAccessType; - return this; - } - - /** - * Get newEnvironmentAccessType - * - * @return newEnvironmentAccessType - */ - @javax.annotation.Nullable - public EnvironmentAccessType getNewEnvironmentAccessType() { - return newEnvironmentAccessType; - } - - public void setNewEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { - this.newEnvironmentAccessType = newEnvironmentAccessType; - } - - public UpdatePermissionGroupRequest environmentAccesses( - List environmentAccesses) { - this.environmentAccesses = environmentAccesses; - return this; - } - - public UpdatePermissionGroupRequest addEnvironmentAccessesItem( - CreateOrUpdateEnvironmentAccessModel environmentAccessesItem) { - if (this.environmentAccesses == null) { - this.environmentAccesses = new ArrayList<>(); - } - this.environmentAccesses.add(environmentAccessesItem); - return this; - } - - /** - * List of environment specific permissions. - * - * @return environmentAccesses - */ - @javax.annotation.Nullable - public List getEnvironmentAccesses() { - return environmentAccesses; - } - - public void setEnvironmentAccesses( - List environmentAccesses) { - this.environmentAccesses = environmentAccesses; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdatePermissionGroupRequest updatePermissionGroupRequest = - (UpdatePermissionGroupRequest) o; - return Objects.equals(this.name, updatePermissionGroupRequest.name) - && Objects.equals( - this.canManageMembers, updatePermissionGroupRequest.canManageMembers) - && Objects.equals( - this.canCreateOrUpdateConfig, - updatePermissionGroupRequest.canCreateOrUpdateConfig) - && Objects.equals( - this.canDeleteConfig, updatePermissionGroupRequest.canDeleteConfig) - && Objects.equals( - this.canCreateOrUpdateEnvironment, - updatePermissionGroupRequest.canCreateOrUpdateEnvironment) - && Objects.equals( - this.canDeleteEnvironment, - updatePermissionGroupRequest.canDeleteEnvironment) - && Objects.equals( - this.canCreateOrUpdateSetting, - updatePermissionGroupRequest.canCreateOrUpdateSetting) - && Objects.equals(this.canTagSetting, updatePermissionGroupRequest.canTagSetting) - && Objects.equals( - this.canDeleteSetting, updatePermissionGroupRequest.canDeleteSetting) - && Objects.equals( - this.canCreateOrUpdateTag, - updatePermissionGroupRequest.canCreateOrUpdateTag) - && Objects.equals(this.canDeleteTag, updatePermissionGroupRequest.canDeleteTag) - && Objects.equals( - this.canManageWebhook, updatePermissionGroupRequest.canManageWebhook) - && Objects.equals( - this.canUseExportImport, updatePermissionGroupRequest.canUseExportImport) - && Objects.equals( - this.canManageProductPreferences, - updatePermissionGroupRequest.canManageProductPreferences) - && Objects.equals( - this.canManageIntegrations, - updatePermissionGroupRequest.canManageIntegrations) - && Objects.equals(this.canViewSdkKey, updatePermissionGroupRequest.canViewSdkKey) - && Objects.equals( - this.canRotateSdkKey, updatePermissionGroupRequest.canRotateSdkKey) - && Objects.equals( - this.canCreateOrUpdateSegments, - updatePermissionGroupRequest.canCreateOrUpdateSegments) - && Objects.equals( - this.canDeleteSegments, updatePermissionGroupRequest.canDeleteSegments) - && Objects.equals( - this.canViewProductAuditLog, - updatePermissionGroupRequest.canViewProductAuditLog) - && Objects.equals( - this.canViewProductStatistics, - updatePermissionGroupRequest.canViewProductStatistics) - && Objects.equals(this.canDisable2FA, updatePermissionGroupRequest.canDisable2FA) - && Objects.equals(this.accessType, updatePermissionGroupRequest.accessType) - && Objects.equals( - this.newEnvironmentAccessType, - updatePermissionGroupRequest.newEnvironmentAccessType) - && Objects.equals( - this.environmentAccesses, updatePermissionGroupRequest.environmentAccesses); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - name, - canManageMembers, - canCreateOrUpdateConfig, - canDeleteConfig, - canCreateOrUpdateEnvironment, - canDeleteEnvironment, - canCreateOrUpdateSetting, - canTagSetting, - canDeleteSetting, - canCreateOrUpdateTag, - canDeleteTag, - canManageWebhook, - canUseExportImport, - canManageProductPreferences, - canManageIntegrations, - canViewSdkKey, - canRotateSdkKey, - canCreateOrUpdateSegments, - canDeleteSegments, - canViewProductAuditLog, - canViewProductStatistics, - canDisable2FA, - accessType, - newEnvironmentAccessType, - environmentAccesses); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdatePermissionGroupRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" canManageMembers: ").append(toIndentedString(canManageMembers)).append("\n"); - sb.append(" canCreateOrUpdateConfig: ") - .append(toIndentedString(canCreateOrUpdateConfig)) - .append("\n"); - sb.append(" canDeleteConfig: ").append(toIndentedString(canDeleteConfig)).append("\n"); - sb.append(" canCreateOrUpdateEnvironment: ") - .append(toIndentedString(canCreateOrUpdateEnvironment)) - .append("\n"); - sb.append(" canDeleteEnvironment: ") - .append(toIndentedString(canDeleteEnvironment)) - .append("\n"); - sb.append(" canCreateOrUpdateSetting: ") - .append(toIndentedString(canCreateOrUpdateSetting)) - .append("\n"); - sb.append(" canTagSetting: ").append(toIndentedString(canTagSetting)).append("\n"); - sb.append(" canDeleteSetting: ").append(toIndentedString(canDeleteSetting)).append("\n"); - sb.append(" canCreateOrUpdateTag: ") - .append(toIndentedString(canCreateOrUpdateTag)) - .append("\n"); - sb.append(" canDeleteTag: ").append(toIndentedString(canDeleteTag)).append("\n"); - sb.append(" canManageWebhook: ").append(toIndentedString(canManageWebhook)).append("\n"); - sb.append(" canUseExportImport: ") - .append(toIndentedString(canUseExportImport)) - .append("\n"); - sb.append(" canManageProductPreferences: ") - .append(toIndentedString(canManageProductPreferences)) - .append("\n"); - sb.append(" canManageIntegrations: ") - .append(toIndentedString(canManageIntegrations)) - .append("\n"); - sb.append(" canViewSdkKey: ").append(toIndentedString(canViewSdkKey)).append("\n"); - sb.append(" canRotateSdkKey: ").append(toIndentedString(canRotateSdkKey)).append("\n"); - sb.append(" canCreateOrUpdateSegments: ") - .append(toIndentedString(canCreateOrUpdateSegments)) - .append("\n"); - sb.append(" canDeleteSegments: ") - .append(toIndentedString(canDeleteSegments)) - .append("\n"); - sb.append(" canViewProductAuditLog: ") - .append(toIndentedString(canViewProductAuditLog)) - .append("\n"); - sb.append(" canViewProductStatistics: ") - .append(toIndentedString(canViewProductStatistics)) - .append("\n"); - sb.append(" canDisable2FA: ").append(toIndentedString(canDisable2FA)).append("\n"); - sb.append(" accessType: ").append(toIndentedString(accessType)).append("\n"); - sb.append(" newEnvironmentAccessType: ") - .append(toIndentedString(newEnvironmentAccessType)) - .append("\n"); - sb.append(" environmentAccesses: ") - .append(toIndentedString(environmentAccesses)) - .append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } +import com.configcat.publicapi.java.client.JSON; - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("canManageMembers"); - openapiFields.add("canCreateOrUpdateConfig"); - openapiFields.add("canDeleteConfig"); - openapiFields.add("canCreateOrUpdateEnvironment"); - openapiFields.add("canDeleteEnvironment"); - openapiFields.add("canCreateOrUpdateSetting"); - openapiFields.add("canTagSetting"); - openapiFields.add("canDeleteSetting"); - openapiFields.add("canCreateOrUpdateTag"); - openapiFields.add("canDeleteTag"); - openapiFields.add("canManageWebhook"); - openapiFields.add("canUseExportImport"); - openapiFields.add("canManageProductPreferences"); - openapiFields.add("canManageIntegrations"); - openapiFields.add("canViewSdkKey"); - openapiFields.add("canRotateSdkKey"); - openapiFields.add("canCreateOrUpdateSegments"); - openapiFields.add("canDeleteSegments"); - openapiFields.add("canViewProductAuditLog"); - openapiFields.add("canViewProductStatistics"); - openapiFields.add("canDisable2FA"); - openapiFields.add("accessType"); - openapiFields.add("newEnvironmentAccessType"); - openapiFields.add("environmentAccesses"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } +/** + * UpdatePermissionGroupRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdatePermissionGroupRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdatePermissionGroupRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdatePermissionGroupRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdatePermissionGroupRequest is not" - + " found in the empty JSON string", - UpdatePermissionGroupRequest.openapiRequiredFields.toString())); - } - } + public static final String SERIALIZED_NAME_CAN_MANAGE_MEMBERS = "canManageMembers"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_MEMBERS) + private Boolean canManageMembers; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdatePermissionGroupRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdatePermissionGroupRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG = "canCreateOrUpdateConfig"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_CONFIG) + private Boolean canCreateOrUpdateConfig; + + public static final String SERIALIZED_NAME_CAN_DELETE_CONFIG = "canDeleteConfig"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_CONFIG) + private Boolean canDeleteConfig; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT = "canCreateOrUpdateEnvironment"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_ENVIRONMENT) + private Boolean canCreateOrUpdateEnvironment; + + public static final String SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT = "canDeleteEnvironment"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_ENVIRONMENT) + private Boolean canDeleteEnvironment; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING = "canCreateOrUpdateSetting"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SETTING) + private Boolean canCreateOrUpdateSetting; + + public static final String SERIALIZED_NAME_CAN_TAG_SETTING = "canTagSetting"; + @SerializedName(SERIALIZED_NAME_CAN_TAG_SETTING) + private Boolean canTagSetting; + + public static final String SERIALIZED_NAME_CAN_DELETE_SETTING = "canDeleteSetting"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_SETTING) + private Boolean canDeleteSetting; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG = "canCreateOrUpdateTag"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_TAG) + private Boolean canCreateOrUpdateTag; + + public static final String SERIALIZED_NAME_CAN_DELETE_TAG = "canDeleteTag"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_TAG) + private Boolean canDeleteTag; + + public static final String SERIALIZED_NAME_CAN_MANAGE_WEBHOOK = "canManageWebhook"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_WEBHOOK) + private Boolean canManageWebhook; + + public static final String SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT = "canUseExportImport"; + @SerializedName(SERIALIZED_NAME_CAN_USE_EXPORT_IMPORT) + private Boolean canUseExportImport; + + public static final String SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES = "canManageProductPreferences"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_PRODUCT_PREFERENCES) + private Boolean canManageProductPreferences; + + public static final String SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS = "canManageIntegrations"; + @SerializedName(SERIALIZED_NAME_CAN_MANAGE_INTEGRATIONS) + private Boolean canManageIntegrations; + + public static final String SERIALIZED_NAME_CAN_VIEW_SDK_KEY = "canViewSdkKey"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_SDK_KEY) + private Boolean canViewSdkKey; + + public static final String SERIALIZED_NAME_CAN_ROTATE_SDK_KEY = "canRotateSdkKey"; + @SerializedName(SERIALIZED_NAME_CAN_ROTATE_SDK_KEY) + private Boolean canRotateSdkKey; + + public static final String SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS = "canCreateOrUpdateSegments"; + @SerializedName(SERIALIZED_NAME_CAN_CREATE_OR_UPDATE_SEGMENTS) + private Boolean canCreateOrUpdateSegments; + + public static final String SERIALIZED_NAME_CAN_DELETE_SEGMENTS = "canDeleteSegments"; + @SerializedName(SERIALIZED_NAME_CAN_DELETE_SEGMENTS) + private Boolean canDeleteSegments; + + public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG = "canViewProductAuditLog"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_AUDIT_LOG) + private Boolean canViewProductAuditLog; + + public static final String SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS = "canViewProductStatistics"; + @SerializedName(SERIALIZED_NAME_CAN_VIEW_PRODUCT_STATISTICS) + private Boolean canViewProductStatistics; + + public static final String SERIALIZED_NAME_CAN_DISABLE2_F_A = "canDisable2FA"; + @SerializedName(SERIALIZED_NAME_CAN_DISABLE2_F_A) + private Boolean canDisable2FA; + + public static final String SERIALIZED_NAME_ACCESS_TYPE = "accessType"; + @SerializedName(SERIALIZED_NAME_ACCESS_TYPE) + private AccessType accessType; + + public static final String SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE = "newEnvironmentAccessType"; + @SerializedName(SERIALIZED_NAME_NEW_ENVIRONMENT_ACCESS_TYPE) + private EnvironmentAccessType newEnvironmentAccessType; + + public static final String SERIALIZED_NAME_ENVIRONMENT_ACCESSES = "environmentAccesses"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ACCESSES) + private List environmentAccesses; + + public UpdatePermissionGroupRequest() { + } + + public UpdatePermissionGroupRequest name(String name) { + this.name = name; + return this; + } + + /** + * Name of the Permission Group. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public UpdatePermissionGroupRequest canManageMembers(Boolean canManageMembers) { + this.canManageMembers = canManageMembers; + return this; + } + + /** + * Group members can manage team members. + * @return canManageMembers + */ + @javax.annotation.Nullable + public Boolean getCanManageMembers() { + return canManageMembers; + } + + public void setCanManageMembers(Boolean canManageMembers) { + this.canManageMembers = canManageMembers; + } + + + public UpdatePermissionGroupRequest canCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { + this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; + return this; + } + + /** + * Group members can create/update Configs. + * @return canCreateOrUpdateConfig + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateConfig() { + return canCreateOrUpdateConfig; + } + + public void setCanCreateOrUpdateConfig(Boolean canCreateOrUpdateConfig) { + this.canCreateOrUpdateConfig = canCreateOrUpdateConfig; + } + + + public UpdatePermissionGroupRequest canDeleteConfig(Boolean canDeleteConfig) { + this.canDeleteConfig = canDeleteConfig; + return this; + } + + /** + * Group members can delete Configs. + * @return canDeleteConfig + */ + @javax.annotation.Nullable + public Boolean getCanDeleteConfig() { + return canDeleteConfig; + } + + public void setCanDeleteConfig(Boolean canDeleteConfig) { + this.canDeleteConfig = canDeleteConfig; + } + + + public UpdatePermissionGroupRequest canCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { + this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; + return this; + } + + /** + * Group members can create/update Environments. + * @return canCreateOrUpdateEnvironment + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateEnvironment() { + return canCreateOrUpdateEnvironment; + } + + public void setCanCreateOrUpdateEnvironment(Boolean canCreateOrUpdateEnvironment) { + this.canCreateOrUpdateEnvironment = canCreateOrUpdateEnvironment; + } + + + public UpdatePermissionGroupRequest canDeleteEnvironment(Boolean canDeleteEnvironment) { + this.canDeleteEnvironment = canDeleteEnvironment; + return this; + } + + /** + * Group members can delete Environments. + * @return canDeleteEnvironment + */ + @javax.annotation.Nullable + public Boolean getCanDeleteEnvironment() { + return canDeleteEnvironment; + } + + public void setCanDeleteEnvironment(Boolean canDeleteEnvironment) { + this.canDeleteEnvironment = canDeleteEnvironment; + } + + + public UpdatePermissionGroupRequest canCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { + this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; + return this; + } + + /** + * Group members can create/update Feature Flags and Settings. + * @return canCreateOrUpdateSetting + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateSetting() { + return canCreateOrUpdateSetting; + } + + public void setCanCreateOrUpdateSetting(Boolean canCreateOrUpdateSetting) { + this.canCreateOrUpdateSetting = canCreateOrUpdateSetting; + } + + + public UpdatePermissionGroupRequest canTagSetting(Boolean canTagSetting) { + this.canTagSetting = canTagSetting; + return this; + } + + /** + * Group members can attach/detach Tags to Feature Flags and Settings. + * @return canTagSetting + */ + @javax.annotation.Nullable + public Boolean getCanTagSetting() { + return canTagSetting; + } + + public void setCanTagSetting(Boolean canTagSetting) { + this.canTagSetting = canTagSetting; + } + + + public UpdatePermissionGroupRequest canDeleteSetting(Boolean canDeleteSetting) { + this.canDeleteSetting = canDeleteSetting; + return this; + } + + /** + * Group members can delete Feature Flags and Settings. + * @return canDeleteSetting + */ + @javax.annotation.Nullable + public Boolean getCanDeleteSetting() { + return canDeleteSetting; + } + + public void setCanDeleteSetting(Boolean canDeleteSetting) { + this.canDeleteSetting = canDeleteSetting; + } + + + public UpdatePermissionGroupRequest canCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { + this.canCreateOrUpdateTag = canCreateOrUpdateTag; + return this; + } + + /** + * Group members can create/update Tags. + * @return canCreateOrUpdateTag + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateTag() { + return canCreateOrUpdateTag; + } + + public void setCanCreateOrUpdateTag(Boolean canCreateOrUpdateTag) { + this.canCreateOrUpdateTag = canCreateOrUpdateTag; + } + + + public UpdatePermissionGroupRequest canDeleteTag(Boolean canDeleteTag) { + this.canDeleteTag = canDeleteTag; + return this; + } + + /** + * Group members can delete Tags. + * @return canDeleteTag + */ + @javax.annotation.Nullable + public Boolean getCanDeleteTag() { + return canDeleteTag; + } + + public void setCanDeleteTag(Boolean canDeleteTag) { + this.canDeleteTag = canDeleteTag; + } + + + public UpdatePermissionGroupRequest canManageWebhook(Boolean canManageWebhook) { + this.canManageWebhook = canManageWebhook; + return this; + } + + /** + * Group members can create/update/delete Webhooks. + * @return canManageWebhook + */ + @javax.annotation.Nullable + public Boolean getCanManageWebhook() { + return canManageWebhook; + } + + public void setCanManageWebhook(Boolean canManageWebhook) { + this.canManageWebhook = canManageWebhook; + } + + + public UpdatePermissionGroupRequest canUseExportImport(Boolean canUseExportImport) { + this.canUseExportImport = canUseExportImport; + return this; + } + + /** + * Group members can use the export/import feature. + * @return canUseExportImport + */ + @javax.annotation.Nullable + public Boolean getCanUseExportImport() { + return canUseExportImport; + } + + public void setCanUseExportImport(Boolean canUseExportImport) { + this.canUseExportImport = canUseExportImport; + } + + + public UpdatePermissionGroupRequest canManageProductPreferences(Boolean canManageProductPreferences) { + this.canManageProductPreferences = canManageProductPreferences; + return this; + } + + /** + * Group members can update Product preferences. + * @return canManageProductPreferences + */ + @javax.annotation.Nullable + public Boolean getCanManageProductPreferences() { + return canManageProductPreferences; + } + + public void setCanManageProductPreferences(Boolean canManageProductPreferences) { + this.canManageProductPreferences = canManageProductPreferences; + } + + + public UpdatePermissionGroupRequest canManageIntegrations(Boolean canManageIntegrations) { + this.canManageIntegrations = canManageIntegrations; + return this; + } + + /** + * Group members can add and configure integrations. + * @return canManageIntegrations + */ + @javax.annotation.Nullable + public Boolean getCanManageIntegrations() { + return canManageIntegrations; + } + + public void setCanManageIntegrations(Boolean canManageIntegrations) { + this.canManageIntegrations = canManageIntegrations; + } + + + public UpdatePermissionGroupRequest canViewSdkKey(Boolean canViewSdkKey) { + this.canViewSdkKey = canViewSdkKey; + return this; + } + + /** + * Group members has access to SDK keys. + * @return canViewSdkKey + */ + @javax.annotation.Nullable + public Boolean getCanViewSdkKey() { + return canViewSdkKey; + } + + public void setCanViewSdkKey(Boolean canViewSdkKey) { + this.canViewSdkKey = canViewSdkKey; + } + + + public UpdatePermissionGroupRequest canRotateSdkKey(Boolean canRotateSdkKey) { + this.canRotateSdkKey = canRotateSdkKey; + return this; + } + + /** + * Group members can rotate SDK keys. + * @return canRotateSdkKey + */ + @javax.annotation.Nullable + public Boolean getCanRotateSdkKey() { + return canRotateSdkKey; + } + + public void setCanRotateSdkKey(Boolean canRotateSdkKey) { + this.canRotateSdkKey = canRotateSdkKey; + } + + + public UpdatePermissionGroupRequest canCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { + this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; + return this; + } + + /** + * Group members can create/update Segments. + * @return canCreateOrUpdateSegments + */ + @javax.annotation.Nullable + public Boolean getCanCreateOrUpdateSegments() { + return canCreateOrUpdateSegments; + } + + public void setCanCreateOrUpdateSegments(Boolean canCreateOrUpdateSegments) { + this.canCreateOrUpdateSegments = canCreateOrUpdateSegments; + } + + + public UpdatePermissionGroupRequest canDeleteSegments(Boolean canDeleteSegments) { + this.canDeleteSegments = canDeleteSegments; + return this; + } + + /** + * Group members can delete Segments. + * @return canDeleteSegments + */ + @javax.annotation.Nullable + public Boolean getCanDeleteSegments() { + return canDeleteSegments; + } + + public void setCanDeleteSegments(Boolean canDeleteSegments) { + this.canDeleteSegments = canDeleteSegments; + } + + + public UpdatePermissionGroupRequest canViewProductAuditLog(Boolean canViewProductAuditLog) { + this.canViewProductAuditLog = canViewProductAuditLog; + return this; + } + + /** + * Group members has access to audit logs. + * @return canViewProductAuditLog + */ + @javax.annotation.Nullable + public Boolean getCanViewProductAuditLog() { + return canViewProductAuditLog; + } + + public void setCanViewProductAuditLog(Boolean canViewProductAuditLog) { + this.canViewProductAuditLog = canViewProductAuditLog; + } + + + public UpdatePermissionGroupRequest canViewProductStatistics(Boolean canViewProductStatistics) { + this.canViewProductStatistics = canViewProductStatistics; + return this; + } + + /** + * Group members has access to product statistics. + * @return canViewProductStatistics + */ + @javax.annotation.Nullable + public Boolean getCanViewProductStatistics() { + return canViewProductStatistics; + } + + public void setCanViewProductStatistics(Boolean canViewProductStatistics) { + this.canViewProductStatistics = canViewProductStatistics; + } + + + public UpdatePermissionGroupRequest canDisable2FA(Boolean canDisable2FA) { + this.canDisable2FA = canDisable2FA; + return this; + } + + /** + * Group members can disable two-factor authentication for other members. + * @return canDisable2FA + */ + @javax.annotation.Nullable + public Boolean getCanDisable2FA() { + return canDisable2FA; + } + + public void setCanDisable2FA(Boolean canDisable2FA) { + this.canDisable2FA = canDisable2FA; + } + + + public UpdatePermissionGroupRequest accessType(AccessType accessType) { + this.accessType = accessType; + return this; + } + + /** + * Get accessType + * @return accessType + */ + @javax.annotation.Nullable + public AccessType getAccessType() { + return accessType; + } + + public void setAccessType(AccessType accessType) { + this.accessType = accessType; + } + + + public UpdatePermissionGroupRequest newEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { + this.newEnvironmentAccessType = newEnvironmentAccessType; + return this; + } + + /** + * Get newEnvironmentAccessType + * @return newEnvironmentAccessType + */ + @javax.annotation.Nullable + public EnvironmentAccessType getNewEnvironmentAccessType() { + return newEnvironmentAccessType; + } + + public void setNewEnvironmentAccessType(EnvironmentAccessType newEnvironmentAccessType) { + this.newEnvironmentAccessType = newEnvironmentAccessType; + } + + + public UpdatePermissionGroupRequest environmentAccesses(List environmentAccesses) { + this.environmentAccesses = environmentAccesses; + return this; + } + + public UpdatePermissionGroupRequest addEnvironmentAccessesItem(CreateOrUpdateEnvironmentAccessModel environmentAccessesItem) { + if (this.environmentAccesses == null) { + this.environmentAccesses = new ArrayList<>(); + } + this.environmentAccesses.add(environmentAccessesItem); + return this; + } + + /** + * List of environment specific permissions. + * @return environmentAccesses + */ + @javax.annotation.Nullable + public List getEnvironmentAccesses() { + return environmentAccesses; + } + + public void setEnvironmentAccesses(List environmentAccesses) { + this.environmentAccesses = environmentAccesses; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdatePermissionGroupRequest instance itself + */ + public UpdatePermissionGroupRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdatePermissionGroupRequest updatePermissionGroupRequest = (UpdatePermissionGroupRequest) o; + return Objects.equals(this.name, updatePermissionGroupRequest.name) && + Objects.equals(this.canManageMembers, updatePermissionGroupRequest.canManageMembers) && + Objects.equals(this.canCreateOrUpdateConfig, updatePermissionGroupRequest.canCreateOrUpdateConfig) && + Objects.equals(this.canDeleteConfig, updatePermissionGroupRequest.canDeleteConfig) && + Objects.equals(this.canCreateOrUpdateEnvironment, updatePermissionGroupRequest.canCreateOrUpdateEnvironment) && + Objects.equals(this.canDeleteEnvironment, updatePermissionGroupRequest.canDeleteEnvironment) && + Objects.equals(this.canCreateOrUpdateSetting, updatePermissionGroupRequest.canCreateOrUpdateSetting) && + Objects.equals(this.canTagSetting, updatePermissionGroupRequest.canTagSetting) && + Objects.equals(this.canDeleteSetting, updatePermissionGroupRequest.canDeleteSetting) && + Objects.equals(this.canCreateOrUpdateTag, updatePermissionGroupRequest.canCreateOrUpdateTag) && + Objects.equals(this.canDeleteTag, updatePermissionGroupRequest.canDeleteTag) && + Objects.equals(this.canManageWebhook, updatePermissionGroupRequest.canManageWebhook) && + Objects.equals(this.canUseExportImport, updatePermissionGroupRequest.canUseExportImport) && + Objects.equals(this.canManageProductPreferences, updatePermissionGroupRequest.canManageProductPreferences) && + Objects.equals(this.canManageIntegrations, updatePermissionGroupRequest.canManageIntegrations) && + Objects.equals(this.canViewSdkKey, updatePermissionGroupRequest.canViewSdkKey) && + Objects.equals(this.canRotateSdkKey, updatePermissionGroupRequest.canRotateSdkKey) && + Objects.equals(this.canCreateOrUpdateSegments, updatePermissionGroupRequest.canCreateOrUpdateSegments) && + Objects.equals(this.canDeleteSegments, updatePermissionGroupRequest.canDeleteSegments) && + Objects.equals(this.canViewProductAuditLog, updatePermissionGroupRequest.canViewProductAuditLog) && + Objects.equals(this.canViewProductStatistics, updatePermissionGroupRequest.canViewProductStatistics) && + Objects.equals(this.canDisable2FA, updatePermissionGroupRequest.canDisable2FA) && + Objects.equals(this.accessType, updatePermissionGroupRequest.accessType) && + Objects.equals(this.newEnvironmentAccessType, updatePermissionGroupRequest.newEnvironmentAccessType) && + Objects.equals(this.environmentAccesses, updatePermissionGroupRequest.environmentAccesses)&& + Objects.equals(this.additionalProperties, updatePermissionGroupRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, canManageMembers, canCreateOrUpdateConfig, canDeleteConfig, canCreateOrUpdateEnvironment, canDeleteEnvironment, canCreateOrUpdateSetting, canTagSetting, canDeleteSetting, canCreateOrUpdateTag, canDeleteTag, canManageWebhook, canUseExportImport, canManageProductPreferences, canManageIntegrations, canViewSdkKey, canRotateSdkKey, canCreateOrUpdateSegments, canDeleteSegments, canViewProductAuditLog, canViewProductStatistics, canDisable2FA, accessType, newEnvironmentAccessType, environmentAccesses, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdatePermissionGroupRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" canManageMembers: ").append(toIndentedString(canManageMembers)).append("\n"); + sb.append(" canCreateOrUpdateConfig: ").append(toIndentedString(canCreateOrUpdateConfig)).append("\n"); + sb.append(" canDeleteConfig: ").append(toIndentedString(canDeleteConfig)).append("\n"); + sb.append(" canCreateOrUpdateEnvironment: ").append(toIndentedString(canCreateOrUpdateEnvironment)).append("\n"); + sb.append(" canDeleteEnvironment: ").append(toIndentedString(canDeleteEnvironment)).append("\n"); + sb.append(" canCreateOrUpdateSetting: ").append(toIndentedString(canCreateOrUpdateSetting)).append("\n"); + sb.append(" canTagSetting: ").append(toIndentedString(canTagSetting)).append("\n"); + sb.append(" canDeleteSetting: ").append(toIndentedString(canDeleteSetting)).append("\n"); + sb.append(" canCreateOrUpdateTag: ").append(toIndentedString(canCreateOrUpdateTag)).append("\n"); + sb.append(" canDeleteTag: ").append(toIndentedString(canDeleteTag)).append("\n"); + sb.append(" canManageWebhook: ").append(toIndentedString(canManageWebhook)).append("\n"); + sb.append(" canUseExportImport: ").append(toIndentedString(canUseExportImport)).append("\n"); + sb.append(" canManageProductPreferences: ").append(toIndentedString(canManageProductPreferences)).append("\n"); + sb.append(" canManageIntegrations: ").append(toIndentedString(canManageIntegrations)).append("\n"); + sb.append(" canViewSdkKey: ").append(toIndentedString(canViewSdkKey)).append("\n"); + sb.append(" canRotateSdkKey: ").append(toIndentedString(canRotateSdkKey)).append("\n"); + sb.append(" canCreateOrUpdateSegments: ").append(toIndentedString(canCreateOrUpdateSegments)).append("\n"); + sb.append(" canDeleteSegments: ").append(toIndentedString(canDeleteSegments)).append("\n"); + sb.append(" canViewProductAuditLog: ").append(toIndentedString(canViewProductAuditLog)).append("\n"); + sb.append(" canViewProductStatistics: ").append(toIndentedString(canViewProductStatistics)).append("\n"); + sb.append(" canDisable2FA: ").append(toIndentedString(canDisable2FA)).append("\n"); + sb.append(" accessType: ").append(toIndentedString(accessType)).append("\n"); + sb.append(" newEnvironmentAccessType: ").append(toIndentedString(newEnvironmentAccessType)).append("\n"); + sb.append(" environmentAccesses: ").append(toIndentedString(environmentAccesses)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("canManageMembers"); + openapiFields.add("canCreateOrUpdateConfig"); + openapiFields.add("canDeleteConfig"); + openapiFields.add("canCreateOrUpdateEnvironment"); + openapiFields.add("canDeleteEnvironment"); + openapiFields.add("canCreateOrUpdateSetting"); + openapiFields.add("canTagSetting"); + openapiFields.add("canDeleteSetting"); + openapiFields.add("canCreateOrUpdateTag"); + openapiFields.add("canDeleteTag"); + openapiFields.add("canManageWebhook"); + openapiFields.add("canUseExportImport"); + openapiFields.add("canManageProductPreferences"); + openapiFields.add("canManageIntegrations"); + openapiFields.add("canViewSdkKey"); + openapiFields.add("canRotateSdkKey"); + openapiFields.add("canCreateOrUpdateSegments"); + openapiFields.add("canDeleteSegments"); + openapiFields.add("canViewProductAuditLog"); + openapiFields.add("canViewProductStatistics"); + openapiFields.add("canDisable2FA"); + openapiFields.add("accessType"); + openapiFields.add("newEnvironmentAccessType"); + openapiFields.add("environmentAccesses"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePermissionGroupRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePermissionGroupRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdatePermissionGroupRequest is not found in the empty JSON string", UpdatePermissionGroupRequest.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - // validate the optional field `accessType` - if (jsonObj.get("accessType") != null && !jsonObj.get("accessType").isJsonNull()) { - AccessType.validateJsonElement(jsonObj.get("accessType")); - } - // validate the optional field `newEnvironmentAccessType` - if (jsonObj.get("newEnvironmentAccessType") != null - && !jsonObj.get("newEnvironmentAccessType").isJsonNull()) { - EnvironmentAccessType.validateJsonElement(jsonObj.get("newEnvironmentAccessType")); - } - if (jsonObj.get("environmentAccesses") != null - && !jsonObj.get("environmentAccesses").isJsonNull()) { - JsonArray jsonArrayenvironmentAccesses = jsonObj.getAsJsonArray("environmentAccesses"); - if (jsonArrayenvironmentAccesses != null) { - // ensure the json data is an array - if (!jsonObj.get("environmentAccesses").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentAccesses` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("environmentAccesses").toString())); - } - - // validate the optional field `environmentAccesses` (array) - for (int i = 0; i < jsonArrayenvironmentAccesses.size(); i++) { - CreateOrUpdateEnvironmentAccessModel.validateJsonElement( - jsonArrayenvironmentAccesses.get(i)); - } - ; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdatePermissionGroupRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdatePermissionGroupRequest' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(UpdatePermissionGroupRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdatePermissionGroupRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdatePermissionGroupRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + // validate the optional field `accessType` + if (jsonObj.get("accessType") != null && !jsonObj.get("accessType").isJsonNull()) { + AccessType.validateJsonElement(jsonObj.get("accessType")); + } + // validate the optional field `newEnvironmentAccessType` + if (jsonObj.get("newEnvironmentAccessType") != null && !jsonObj.get("newEnvironmentAccessType").isJsonNull()) { + EnvironmentAccessType.validateJsonElement(jsonObj.get("newEnvironmentAccessType")); + } + if (jsonObj.get("environmentAccesses") != null && !jsonObj.get("environmentAccesses").isJsonNull()) { + JsonArray jsonArrayenvironmentAccesses = jsonObj.getAsJsonArray("environmentAccesses"); + if (jsonArrayenvironmentAccesses != null) { + // ensure the json data is an array + if (!jsonObj.get("environmentAccesses").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentAccesses` to be an array in the JSON string but got `%s`", jsonObj.get("environmentAccesses").toString())); + } + + // validate the optional field `environmentAccesses` (array) + for (int i = 0; i < jsonArrayenvironmentAccesses.size(); i++) { + CreateOrUpdateEnvironmentAccessModel.validateJsonElement(jsonArrayenvironmentAccesses.get(i)); + }; } - } - - /** - * Create an instance of UpdatePermissionGroupRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdatePermissionGroupRequest - * @throws IOException if the JSON string is invalid with respect to - * UpdatePermissionGroupRequest - */ - public static UpdatePermissionGroupRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdatePermissionGroupRequest.class); - } + } + } - /** - * Convert an instance of UpdatePermissionGroupRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePermissionGroupRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePermissionGroupRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdatePermissionGroupRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePermissionGroupRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdatePermissionGroupRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdatePermissionGroupRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdatePermissionGroupRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePermissionGroupRequest + * @throws IOException if the JSON string is invalid with respect to UpdatePermissionGroupRequest + */ + public static UpdatePermissionGroupRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePermissionGroupRequest.class); + } + + /** + * Convert an instance of UpdatePermissionGroupRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdatePreferencesRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdatePreferencesRequest.java index 7b2b3ee..1a1c2f4 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdatePreferencesRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdatePreferencesRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,369 +10,421 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.KeyGenerationMode; +import com.configcat.publicapi.java.client.model.UpdateReasonRequiredEnvironmentModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdatePreferencesRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdatePreferencesRequest { - public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; - - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) - private Boolean reasonRequired; - - public static final String SERIALIZED_NAME_KEY_GENERATION_MODE = "keyGenerationMode"; - - @SerializedName(SERIALIZED_NAME_KEY_GENERATION_MODE) - private KeyGenerationMode keyGenerationMode; - - public static final String SERIALIZED_NAME_SHOW_VARIATION_ID = "showVariationId"; - - @SerializedName(SERIALIZED_NAME_SHOW_VARIATION_ID) - private Boolean showVariationId; - - public static final String SERIALIZED_NAME_MANDATORY_SETTING_HINT = "mandatorySettingHint"; - - @SerializedName(SERIALIZED_NAME_MANDATORY_SETTING_HINT) - private Boolean mandatorySettingHint; - - public static final String SERIALIZED_NAME_REASON_REQUIRED_ENVIRONMENTS = - "reasonRequiredEnvironments"; - - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED_ENVIRONMENTS) - private List reasonRequiredEnvironments; - - public UpdatePreferencesRequest() {} - - public UpdatePreferencesRequest reasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - return this; - } - - /** - * Indicates that a mandatory note is required for saving and publishing. - * - * @return reasonRequired - */ - @javax.annotation.Nullable - public Boolean getReasonRequired() { - return reasonRequired; - } - - public void setReasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - } - - public UpdatePreferencesRequest keyGenerationMode(KeyGenerationMode keyGenerationMode) { - this.keyGenerationMode = keyGenerationMode; - return this; - } - - /** - * Get keyGenerationMode - * - * @return keyGenerationMode - */ - @javax.annotation.Nullable - public KeyGenerationMode getKeyGenerationMode() { - return keyGenerationMode; - } - - public void setKeyGenerationMode(KeyGenerationMode keyGenerationMode) { - this.keyGenerationMode = keyGenerationMode; - } - - public UpdatePreferencesRequest showVariationId(Boolean showVariationId) { - this.showVariationId = showVariationId; - return this; - } - /** - * Indicates whether a variation ID's must be shown on the ConfigCat Dashboard. - * - * @return showVariationId - */ - @javax.annotation.Nullable - public Boolean getShowVariationId() { - return showVariationId; - } - - public void setShowVariationId(Boolean showVariationId) { - this.showVariationId = showVariationId; - } - - public UpdatePreferencesRequest mandatorySettingHint(Boolean mandatorySettingHint) { - this.mandatorySettingHint = mandatorySettingHint; - return this; - } - - /** - * Indicates whether Feature flags and Settings must have a hint. - * - * @return mandatorySettingHint - */ - @javax.annotation.Nullable - public Boolean getMandatorySettingHint() { - return mandatorySettingHint; - } - - public void setMandatorySettingHint(Boolean mandatorySettingHint) { - this.mandatorySettingHint = mandatorySettingHint; - } - - public UpdatePreferencesRequest reasonRequiredEnvironments( - List reasonRequiredEnvironments) { - this.reasonRequiredEnvironments = reasonRequiredEnvironments; - return this; - } - - public UpdatePreferencesRequest addReasonRequiredEnvironmentsItem( - UpdateReasonRequiredEnvironmentModel reasonRequiredEnvironmentsItem) { - if (this.reasonRequiredEnvironments == null) { - this.reasonRequiredEnvironments = new ArrayList<>(); - } - this.reasonRequiredEnvironments.add(reasonRequiredEnvironmentsItem); - return this; - } - - /** - * List of Environments where mandatory note must be set before saving and publishing. - * - * @return reasonRequiredEnvironments - */ - @javax.annotation.Nullable - public List getReasonRequiredEnvironments() { - return reasonRequiredEnvironments; - } +import com.configcat.publicapi.java.client.JSON; - public void setReasonRequiredEnvironments( - List reasonRequiredEnvironments) { - this.reasonRequiredEnvironments = reasonRequiredEnvironments; +/** + * UpdatePreferencesRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdatePreferencesRequest { + public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) + private Boolean reasonRequired; + + public static final String SERIALIZED_NAME_KEY_GENERATION_MODE = "keyGenerationMode"; + @SerializedName(SERIALIZED_NAME_KEY_GENERATION_MODE) + private KeyGenerationMode keyGenerationMode; + + public static final String SERIALIZED_NAME_SHOW_VARIATION_ID = "showVariationId"; + @SerializedName(SERIALIZED_NAME_SHOW_VARIATION_ID) + private Boolean showVariationId; + + public static final String SERIALIZED_NAME_MANDATORY_SETTING_HINT = "mandatorySettingHint"; + @SerializedName(SERIALIZED_NAME_MANDATORY_SETTING_HINT) + private Boolean mandatorySettingHint; + + public static final String SERIALIZED_NAME_REASON_REQUIRED_ENVIRONMENTS = "reasonRequiredEnvironments"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED_ENVIRONMENTS) + private List reasonRequiredEnvironments; + + public UpdatePreferencesRequest() { + } + + public UpdatePreferencesRequest reasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + return this; + } + + /** + * Indicates that a mandatory note is required for saving and publishing. + * @return reasonRequired + */ + @javax.annotation.Nullable + public Boolean getReasonRequired() { + return reasonRequired; + } + + public void setReasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + } + + + public UpdatePreferencesRequest keyGenerationMode(KeyGenerationMode keyGenerationMode) { + this.keyGenerationMode = keyGenerationMode; + return this; + } + + /** + * Get keyGenerationMode + * @return keyGenerationMode + */ + @javax.annotation.Nullable + public KeyGenerationMode getKeyGenerationMode() { + return keyGenerationMode; + } + + public void setKeyGenerationMode(KeyGenerationMode keyGenerationMode) { + this.keyGenerationMode = keyGenerationMode; + } + + + public UpdatePreferencesRequest showVariationId(Boolean showVariationId) { + this.showVariationId = showVariationId; + return this; + } + + /** + * Indicates whether a variation ID's must be shown on the ConfigCat Dashboard. + * @return showVariationId + */ + @javax.annotation.Nullable + public Boolean getShowVariationId() { + return showVariationId; + } + + public void setShowVariationId(Boolean showVariationId) { + this.showVariationId = showVariationId; + } + + + public UpdatePreferencesRequest mandatorySettingHint(Boolean mandatorySettingHint) { + this.mandatorySettingHint = mandatorySettingHint; + return this; + } + + /** + * Indicates whether Feature flags and Settings must have a hint. + * @return mandatorySettingHint + */ + @javax.annotation.Nullable + public Boolean getMandatorySettingHint() { + return mandatorySettingHint; + } + + public void setMandatorySettingHint(Boolean mandatorySettingHint) { + this.mandatorySettingHint = mandatorySettingHint; + } + + + public UpdatePreferencesRequest reasonRequiredEnvironments(List reasonRequiredEnvironments) { + this.reasonRequiredEnvironments = reasonRequiredEnvironments; + return this; + } + + public UpdatePreferencesRequest addReasonRequiredEnvironmentsItem(UpdateReasonRequiredEnvironmentModel reasonRequiredEnvironmentsItem) { + if (this.reasonRequiredEnvironments == null) { + this.reasonRequiredEnvironments = new ArrayList<>(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdatePreferencesRequest updatePreferencesRequest = (UpdatePreferencesRequest) o; - return Objects.equals(this.reasonRequired, updatePreferencesRequest.reasonRequired) - && Objects.equals( - this.keyGenerationMode, updatePreferencesRequest.keyGenerationMode) - && Objects.equals(this.showVariationId, updatePreferencesRequest.showVariationId) - && Objects.equals( - this.mandatorySettingHint, updatePreferencesRequest.mandatorySettingHint) - && Objects.equals( - this.reasonRequiredEnvironments, - updatePreferencesRequest.reasonRequiredEnvironments); + this.reasonRequiredEnvironments.add(reasonRequiredEnvironmentsItem); + return this; + } + + /** + * List of Environments where mandatory note must be set before saving and publishing. + * @return reasonRequiredEnvironments + */ + @javax.annotation.Nullable + public List getReasonRequiredEnvironments() { + return reasonRequiredEnvironments; + } + + public void setReasonRequiredEnvironments(List reasonRequiredEnvironments) { + this.reasonRequiredEnvironments = reasonRequiredEnvironments; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdatePreferencesRequest instance itself + */ + public UpdatePreferencesRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash( - reasonRequired, - keyGenerationMode, - showVariationId, - mandatorySettingHint, - reasonRequiredEnvironments); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdatePreferencesRequest {\n"); - sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); - sb.append(" keyGenerationMode: ") - .append(toIndentedString(keyGenerationMode)) - .append("\n"); - sb.append(" showVariationId: ").append(toIndentedString(showVariationId)).append("\n"); - sb.append(" mandatorySettingHint: ") - .append(toIndentedString(mandatorySettingHint)) - .append("\n"); - sb.append(" reasonRequiredEnvironments: ") - .append(toIndentedString(reasonRequiredEnvironments)) - .append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + UpdatePreferencesRequest updatePreferencesRequest = (UpdatePreferencesRequest) o; + return Objects.equals(this.reasonRequired, updatePreferencesRequest.reasonRequired) && + Objects.equals(this.keyGenerationMode, updatePreferencesRequest.keyGenerationMode) && + Objects.equals(this.showVariationId, updatePreferencesRequest.showVariationId) && + Objects.equals(this.mandatorySettingHint, updatePreferencesRequest.mandatorySettingHint) && + Objects.equals(this.reasonRequiredEnvironments, updatePreferencesRequest.reasonRequiredEnvironments)&& + Objects.equals(this.additionalProperties, updatePreferencesRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(reasonRequired, keyGenerationMode, showVariationId, mandatorySettingHint, reasonRequiredEnvironments, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("reasonRequired"); - openapiFields.add("keyGenerationMode"); - openapiFields.add("showVariationId"); - openapiFields.add("mandatorySettingHint"); - openapiFields.add("reasonRequiredEnvironments"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdatePreferencesRequest {\n"); + sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); + sb.append(" keyGenerationMode: ").append(toIndentedString(keyGenerationMode)).append("\n"); + sb.append(" showVariationId: ").append(toIndentedString(showVariationId)).append("\n"); + sb.append(" mandatorySettingHint: ").append(toIndentedString(mandatorySettingHint)).append("\n"); + sb.append(" reasonRequiredEnvironments: ").append(toIndentedString(reasonRequiredEnvironments)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdatePreferencesRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdatePreferencesRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdatePreferencesRequest is not found" - + " in the empty JSON string", - UpdatePreferencesRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdatePreferencesRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdatePreferencesRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("reasonRequired"); + openapiFields.add("keyGenerationMode"); + openapiFields.add("showVariationId"); + openapiFields.add("mandatorySettingHint"); + openapiFields.add("reasonRequiredEnvironments"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdatePreferencesRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdatePreferencesRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdatePreferencesRequest is not found in the empty JSON string", UpdatePreferencesRequest.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - // validate the optional field `keyGenerationMode` - if (jsonObj.get("keyGenerationMode") != null - && !jsonObj.get("keyGenerationMode").isJsonNull()) { - KeyGenerationMode.validateJsonElement(jsonObj.get("keyGenerationMode")); - } - if (jsonObj.get("reasonRequiredEnvironments") != null - && !jsonObj.get("reasonRequiredEnvironments").isJsonNull()) { - JsonArray jsonArrayreasonRequiredEnvironments = - jsonObj.getAsJsonArray("reasonRequiredEnvironments"); - if (jsonArrayreasonRequiredEnvironments != null) { - // ensure the json data is an array - if (!jsonObj.get("reasonRequiredEnvironments").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `reasonRequiredEnvironments` to be an" - + " array in the JSON string but got `%s`", - jsonObj.get("reasonRequiredEnvironments").toString())); - } - - // validate the optional field `reasonRequiredEnvironments` (array) - for (int i = 0; i < jsonArrayreasonRequiredEnvironments.size(); i++) { - UpdateReasonRequiredEnvironmentModel.validateJsonElement( - jsonArrayreasonRequiredEnvironments.get(i)); - } - ; - } + // validate the optional field `keyGenerationMode` + if (jsonObj.get("keyGenerationMode") != null && !jsonObj.get("keyGenerationMode").isJsonNull()) { + KeyGenerationMode.validateJsonElement(jsonObj.get("keyGenerationMode")); + } + if (jsonObj.get("reasonRequiredEnvironments") != null && !jsonObj.get("reasonRequiredEnvironments").isJsonNull()) { + JsonArray jsonArrayreasonRequiredEnvironments = jsonObj.getAsJsonArray("reasonRequiredEnvironments"); + if (jsonArrayreasonRequiredEnvironments != null) { + // ensure the json data is an array + if (!jsonObj.get("reasonRequiredEnvironments").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `reasonRequiredEnvironments` to be an array in the JSON string but got `%s`", jsonObj.get("reasonRequiredEnvironments").toString())); + } + + // validate the optional field `reasonRequiredEnvironments` (array) + for (int i = 0; i < jsonArrayreasonRequiredEnvironments.size(); i++) { + UpdateReasonRequiredEnvironmentModel.validateJsonElement(jsonArrayreasonRequiredEnvironments.get(i)); + }; } - } + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdatePreferencesRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdatePreferencesRequest' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdatePreferencesRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdatePreferencesRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdatePreferencesRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdatePreferencesRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdatePreferencesRequest - * @throws IOException if the JSON string is invalid with respect to UpdatePreferencesRequest - */ - public static UpdatePreferencesRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdatePreferencesRequest.class); - } - - /** - * Convert an instance of UpdatePreferencesRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdatePreferencesRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdatePreferencesRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdatePreferencesRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdatePreferencesRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdatePreferencesRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdatePreferencesRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdatePreferencesRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdatePreferencesRequest + * @throws IOException if the JSON string is invalid with respect to UpdatePreferencesRequest + */ + public static UpdatePreferencesRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdatePreferencesRequest.class); + } + + /** + * Convert an instance of UpdatePreferencesRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateProductRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateProductRequest.java index 5e08784..424e70f 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateProductRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateProductRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,274 +10,345 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdateProductRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateProductRequest { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_ORDER = "order"; - - @SerializedName(SERIALIZED_NAME_ORDER) - private Integer order; - - public UpdateProductRequest() {} - - public UpdateProductRequest name(String name) { - this.name = name; - return this; - } - - /** - * The name of the Product. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public UpdateProductRequest description(String description) { - this.description = description; - return this; - } - - /** - * The description of the Product. - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - public UpdateProductRequest order(Integer order) { - this.order = order; - return this; - } - - /** - * The order of the Product represented on the ConfigCat Dashboard. Determined from an ascending - * sequence of integers. - * - * @return order - */ - @javax.annotation.Nullable - public Integer getOrder() { - return order; - } - - public void setOrder(Integer order) { - this.order = order; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateProductRequest updateProductRequest = (UpdateProductRequest) o; - return Objects.equals(this.name, updateProductRequest.name) - && Objects.equals(this.description, updateProductRequest.description) - && Objects.equals(this.order, updateProductRequest.order); +/** + * UpdateProductRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateProductRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private Integer order; + + public UpdateProductRequest() { + } + + public UpdateProductRequest name(String name) { + this.name = name; + return this; + } + + /** + * The name of the Product. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public UpdateProductRequest description(String description) { + this.description = description; + return this; + } + + /** + * The description of the Product. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public UpdateProductRequest order(Integer order) { + this.order = order; + return this; + } + + /** + * The order of the Product represented on the ConfigCat Dashboard. Determined from an ascending sequence of integers. + * @return order + */ + @javax.annotation.Nullable + public Integer getOrder() { + return order; + } + + public void setOrder(Integer order) { + this.order = order; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateProductRequest instance itself + */ + public UpdateProductRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(name, description, order); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateProductRequest {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" order: ").append(toIndentedString(order)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + UpdateProductRequest updateProductRequest = (UpdateProductRequest) o; + return Objects.equals(this.name, updateProductRequest.name) && + Objects.equals(this.description, updateProductRequest.description) && + Objects.equals(this.order, updateProductRequest.order)&& + Objects.equals(this.additionalProperties, updateProductRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, order, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("order"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateProductRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdateProductRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateProductRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateProductRequest is not found in" - + " the empty JSON string", - UpdateProductRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateProductRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateProductRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("order"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateProductRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateProductRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateProductRequest is not found in the empty JSON string", UpdateProductRequest.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateProductRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateProductRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateProductRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateProductRequest value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateProductRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateProductRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateProductRequest - * @throws IOException if the JSON string is invalid with respect to UpdateProductRequest - */ - public static UpdateProductRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateProductRequest.class); - } - - /** - * Convert an instance of UpdateProductRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateProductRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateProductRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateProductRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateProductRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateProductRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateProductRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateProductRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateProductRequest + * @throws IOException if the JSON string is invalid with respect to UpdateProductRequest + */ + public static UpdateProductRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateProductRequest.class); + } + + /** + * Convert an instance of UpdateProductRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateReasonRequiredEnvironmentModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateReasonRequiredEnvironmentModel.java index 128963c..1a5a906 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateReasonRequiredEnvironmentModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateReasonRequiredEnvironmentModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,233 +10,305 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -/** UpdateReasonRequiredEnvironmentModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * UpdateReasonRequiredEnvironmentModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class UpdateReasonRequiredEnvironmentModel { - public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) + private UUID environmentId; - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) - private UUID environmentId; + public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; + @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) + private Boolean reasonRequired; - public static final String SERIALIZED_NAME_REASON_REQUIRED = "reasonRequired"; + public UpdateReasonRequiredEnvironmentModel() { + } - @SerializedName(SERIALIZED_NAME_REASON_REQUIRED) - private Boolean reasonRequired; + public UpdateReasonRequiredEnvironmentModel environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } - public UpdateReasonRequiredEnvironmentModel() {} + /** + * Identifier of the Environment. + * @return environmentId + */ + @javax.annotation.Nullable + public UUID getEnvironmentId() { + return environmentId; + } - public UpdateReasonRequiredEnvironmentModel environmentId(UUID environmentId) { - this.environmentId = environmentId; - return this; - } + public void setEnvironmentId(UUID environmentId) { + this.environmentId = environmentId; + } - /** - * Identifier of the Environment. - * - * @return environmentId - */ - @javax.annotation.Nullable - public UUID getEnvironmentId() { - return environmentId; - } - public void setEnvironmentId(UUID environmentId) { - this.environmentId = environmentId; - } + public UpdateReasonRequiredEnvironmentModel reasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + return this; + } - public UpdateReasonRequiredEnvironmentModel reasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - return this; - } + /** + * Indicates that a mandatory note is required in this Environment for saving and publishing. + * @return reasonRequired + */ + @javax.annotation.Nullable + public Boolean getReasonRequired() { + return reasonRequired; + } - /** - * Indicates that a mandatory note is required in this Environment for saving and publishing. - * - * @return reasonRequired - */ - @javax.annotation.Nullable - public Boolean getReasonRequired() { - return reasonRequired; - } + public void setReasonRequired(Boolean reasonRequired) { + this.reasonRequired = reasonRequired; + } - public void setReasonRequired(Boolean reasonRequired) { - this.reasonRequired = reasonRequired; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateReasonRequiredEnvironmentModel updateReasonRequiredEnvironmentModel = - (UpdateReasonRequiredEnvironmentModel) o; - return Objects.equals( - this.environmentId, updateReasonRequiredEnvironmentModel.environmentId) - && Objects.equals( - this.reasonRequired, updateReasonRequiredEnvironmentModel.reasonRequired); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateReasonRequiredEnvironmentModel instance itself + */ + public UpdateReasonRequiredEnvironmentModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - @Override - public int hashCode() { - return Objects.hash(environmentId, reasonRequired); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateReasonRequiredEnvironmentModel {\n"); - sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); - sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); - sb.append("}"); - return sb.toString(); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + UpdateReasonRequiredEnvironmentModel updateReasonRequiredEnvironmentModel = (UpdateReasonRequiredEnvironmentModel) o; + return Objects.equals(this.environmentId, updateReasonRequiredEnvironmentModel.environmentId) && + Objects.equals(this.reasonRequired, updateReasonRequiredEnvironmentModel.reasonRequired)&& + Objects.equals(this.additionalProperties, updateReasonRequiredEnvironmentModel.additionalProperties); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; + @Override + public int hashCode() { + return Objects.hash(environmentId, reasonRequired, additionalProperties); + } - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("environmentId"); - openapiFields.add("reasonRequired"); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateReasonRequiredEnvironmentModel {\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" reasonRequired: ").append(toIndentedString(reasonRequired)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateReasonRequiredEnvironmentModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateReasonRequiredEnvironmentModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateReasonRequiredEnvironmentModel" - + " is not found in the empty JSON string", - UpdateReasonRequiredEnvironmentModel.openapiRequiredFields - .toString())); - } - } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateReasonRequiredEnvironmentModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateReasonRequiredEnvironmentModel` properties. JSON:" - + " %s", - entry.getKey(), jsonElement.toString())); - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("environmentId"); + openapiFields.add("reasonRequired"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateReasonRequiredEnvironmentModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateReasonRequiredEnvironmentModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateReasonRequiredEnvironmentModel is not found in the empty JSON string", UpdateReasonRequiredEnvironmentModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) - && !jsonObj.get("environmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("environmentId").toString())); - } - } + if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) && !jsonObj.get("environmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environmentId").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateReasonRequiredEnvironmentModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateReasonRequiredEnvironmentModel' - // and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(UpdateReasonRequiredEnvironmentModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write( - JsonWriter out, UpdateReasonRequiredEnvironmentModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateReasonRequiredEnvironmentModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateReasonRequiredEnvironmentModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateReasonRequiredEnvironmentModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateReasonRequiredEnvironmentModel.class)); - /** - * Create an instance of UpdateReasonRequiredEnvironmentModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateReasonRequiredEnvironmentModel - * @throws IOException if the JSON string is invalid with respect to - * UpdateReasonRequiredEnvironmentModel - */ - public static UpdateReasonRequiredEnvironmentModel fromJson(String jsonString) - throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateReasonRequiredEnvironmentModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateReasonRequiredEnvironmentModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateReasonRequiredEnvironmentModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateReasonRequiredEnvironmentModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of UpdateReasonRequiredEnvironmentModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of UpdateReasonRequiredEnvironmentModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateReasonRequiredEnvironmentModel + * @throws IOException if the JSON string is invalid with respect to UpdateReasonRequiredEnvironmentModel + */ + public static UpdateReasonRequiredEnvironmentModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateReasonRequiredEnvironmentModel.class); + } + + /** + * Convert an instance of UpdateReasonRequiredEnvironmentModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateSegmentModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateSegmentModel.java index e198718..af597ba 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateSegmentModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateSegmentModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,350 +10,408 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.RolloutRuleComparator; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdateSegmentModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateSegmentModel { - public static final String SERIALIZED_NAME_NAME = "name"; - - @SerializedName(SERIALIZED_NAME_NAME) - private String name; - - public static final String SERIALIZED_NAME_DESCRIPTION = "description"; - - @SerializedName(SERIALIZED_NAME_DESCRIPTION) - private String description; - - public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) - private String comparisonAttribute; - - public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; - - @SerializedName(SERIALIZED_NAME_COMPARATOR) - private RolloutRuleComparator comparator; - - public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) - private String comparisonValue; - - public UpdateSegmentModel() {} - - public UpdateSegmentModel name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public UpdateSegmentModel description(String description) { - this.description = description; - return this; - } - - /** - * Get description - * - * @return description - */ - @javax.annotation.Nullable - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public UpdateSegmentModel comparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - return this; - } - - /** - * Get comparisonAttribute - * - * @return comparisonAttribute - */ - @javax.annotation.Nullable - public String getComparisonAttribute() { - return comparisonAttribute; - } - - public void setComparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - } - - public UpdateSegmentModel comparator(RolloutRuleComparator comparator) { - this.comparator = comparator; - return this; - } - - /** - * Get comparator - * - * @return comparator - */ - @javax.annotation.Nullable - public RolloutRuleComparator getComparator() { - return comparator; - } - - public void setComparator(RolloutRuleComparator comparator) { - this.comparator = comparator; - } - - public UpdateSegmentModel comparisonValue(String comparisonValue) { - this.comparisonValue = comparisonValue; - return this; - } - /** - * Get comparisonValue - * - * @return comparisonValue - */ - @javax.annotation.Nullable - public String getComparisonValue() { - return comparisonValue; - } - - public void setComparisonValue(String comparisonValue) { - this.comparisonValue = comparisonValue; - } +import com.configcat.publicapi.java.client.JSON; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateSegmentModel updateSegmentModel = (UpdateSegmentModel) o; - return Objects.equals(this.name, updateSegmentModel.name) - && Objects.equals(this.description, updateSegmentModel.description) - && Objects.equals(this.comparisonAttribute, updateSegmentModel.comparisonAttribute) - && Objects.equals(this.comparator, updateSegmentModel.comparator) - && Objects.equals(this.comparisonValue, updateSegmentModel.comparisonValue); +/** + * UpdateSegmentModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateSegmentModel { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + + public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; + @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) + private String comparisonAttribute; + + public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; + @SerializedName(SERIALIZED_NAME_COMPARATOR) + private RolloutRuleComparator comparator; + + public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; + @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) + private String comparisonValue; + + public UpdateSegmentModel() { + } + + public UpdateSegmentModel name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + public UpdateSegmentModel description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + public UpdateSegmentModel comparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + return this; + } + + /** + * Get comparisonAttribute + * @return comparisonAttribute + */ + @javax.annotation.Nullable + public String getComparisonAttribute() { + return comparisonAttribute; + } + + public void setComparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + } + + + public UpdateSegmentModel comparator(RolloutRuleComparator comparator) { + this.comparator = comparator; + return this; + } + + /** + * Get comparator + * @return comparator + */ + @javax.annotation.Nullable + public RolloutRuleComparator getComparator() { + return comparator; + } + + public void setComparator(RolloutRuleComparator comparator) { + this.comparator = comparator; + } + + + public UpdateSegmentModel comparisonValue(String comparisonValue) { + this.comparisonValue = comparisonValue; + return this; + } + + /** + * Get comparisonValue + * @return comparisonValue + */ + @javax.annotation.Nullable + public String getComparisonValue() { + return comparisonValue; + } + + public void setComparisonValue(String comparisonValue) { + this.comparisonValue = comparisonValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSegmentModel instance itself + */ + public UpdateSegmentModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(name, description, comparisonAttribute, comparator, comparisonValue); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSegmentModel {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" comparisonAttribute: ") - .append(toIndentedString(comparisonAttribute)) - .append("\n"); - sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); - sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + UpdateSegmentModel updateSegmentModel = (UpdateSegmentModel) o; + return Objects.equals(this.name, updateSegmentModel.name) && + Objects.equals(this.description, updateSegmentModel.description) && + Objects.equals(this.comparisonAttribute, updateSegmentModel.comparisonAttribute) && + Objects.equals(this.comparator, updateSegmentModel.comparator) && + Objects.equals(this.comparisonValue, updateSegmentModel.comparisonValue)&& + Objects.equals(this.additionalProperties, updateSegmentModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, description, comparisonAttribute, comparator, comparisonValue, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("description"); - openapiFields.add("comparisonAttribute"); - openapiFields.add("comparator"); - openapiFields.add("comparisonValue"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSegmentModel {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" comparisonAttribute: ").append(toIndentedString(comparisonAttribute)).append("\n"); + sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); + sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdateSegmentModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateSegmentModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateSegmentModel is not found in" - + " the empty JSON string", - UpdateSegmentModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSegmentModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateSegmentModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("description"); + openapiFields.add("comparisonAttribute"); + openapiFields.add("comparator"); + openapiFields.add("comparisonValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSegmentModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSegmentModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSegmentModel is not found in the empty JSON string", UpdateSegmentModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) - && !jsonObj.get("description").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `description` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("description").toString())); - } - if ((jsonObj.get("comparisonAttribute") != null - && !jsonObj.get("comparisonAttribute").isJsonNull()) - && !jsonObj.get("comparisonAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonAttribute` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("comparisonAttribute").toString())); - } - // validate the optional field `comparator` - if (jsonObj.get("comparator") != null && !jsonObj.get("comparator").isJsonNull()) { - RolloutRuleComparator.validateJsonElement(jsonObj.get("comparator")); - } - if ((jsonObj.get("comparisonValue") != null && !jsonObj.get("comparisonValue").isJsonNull()) - && !jsonObj.get("comparisonValue").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonValue` to be a primitive type in the" - + " JSON string but got `%s`", - jsonObj.get("comparisonValue").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSegmentModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSegmentModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateSegmentModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSegmentModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSegmentModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UpdateSegmentModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSegmentModel - * @throws IOException if the JSON string is invalid with respect to UpdateSegmentModel - */ - public static UpdateSegmentModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSegmentModel.class); - } - - /** - * Convert an instance of UpdateSegmentModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("comparisonAttribute") != null && !jsonObj.get("comparisonAttribute").isJsonNull()) && !jsonObj.get("comparisonAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonAttribute").toString())); + } + // validate the optional field `comparator` + if (jsonObj.get("comparator") != null && !jsonObj.get("comparator").isJsonNull()) { + RolloutRuleComparator.validateJsonElement(jsonObj.get("comparator")); + } + if ((jsonObj.get("comparisonValue") != null && !jsonObj.get("comparisonValue").isJsonNull()) && !jsonObj.get("comparisonValue").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonValue` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonValue").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSegmentModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSegmentModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSegmentModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSegmentModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateSegmentModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSegmentModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateSegmentModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSegmentModel + * @throws IOException if the JSON string is invalid with respect to UpdateSegmentModel + */ + public static UpdateSegmentModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSegmentModel.class); + } + + /** + * Convert an instance of UpdateSegmentModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValueModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValueModel.java index 097ca81..4164fb8 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValueModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValueModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,323 +10,387 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.RolloutPercentageItemModel; +import com.configcat.publicapi.java.client.model.RolloutRuleModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UpdateSettingValueModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateSettingValueModel { - public static final String SERIALIZED_NAME_ROLLOUT_RULES = "rolloutRules"; - - @SerializedName(SERIALIZED_NAME_ROLLOUT_RULES) - private List rolloutRules; - - public static final String SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS = "rolloutPercentageItems"; - - @SerializedName(SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS) - private List rolloutPercentageItems; - - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) - private Object value = null; - public UpdateSettingValueModel() {} - - public UpdateSettingValueModel rolloutRules(List rolloutRules) { - this.rolloutRules = rolloutRules; - return this; - } - - public UpdateSettingValueModel addRolloutRulesItem(RolloutRuleModel rolloutRulesItem) { - if (this.rolloutRules == null) { - this.rolloutRules = new ArrayList<>(); - } - this.rolloutRules.add(rolloutRulesItem); - return this; - } - - /** - * The targeting rule collection. - * - * @return rolloutRules - */ - @javax.annotation.Nullable - public List getRolloutRules() { - return rolloutRules; - } - - public void setRolloutRules(List rolloutRules) { - this.rolloutRules = rolloutRules; - } +import com.configcat.publicapi.java.client.JSON; - public UpdateSettingValueModel rolloutPercentageItems( - List rolloutPercentageItems) { - this.rolloutPercentageItems = rolloutPercentageItems; - return this; - } +/** + * UpdateSettingValueModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateSettingValueModel { + public static final String SERIALIZED_NAME_ROLLOUT_RULES = "rolloutRules"; + @SerializedName(SERIALIZED_NAME_ROLLOUT_RULES) + private List rolloutRules; - public UpdateSettingValueModel addRolloutPercentageItemsItem( - RolloutPercentageItemModel rolloutPercentageItemsItem) { - if (this.rolloutPercentageItems == null) { - this.rolloutPercentageItems = new ArrayList<>(); - } - this.rolloutPercentageItems.add(rolloutPercentageItemsItem); - return this; - } + public static final String SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS = "rolloutPercentageItems"; + @SerializedName(SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS) + private List rolloutPercentageItems; - /** - * The percentage rule collection. - * - * @return rolloutPercentageItems - */ - @javax.annotation.Nullable - public List getRolloutPercentageItems() { - return rolloutPercentageItems; - } + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; - public void setRolloutPercentageItems(List rolloutPercentageItems) { - this.rolloutPercentageItems = rolloutPercentageItems; - } + public UpdateSettingValueModel() { + } - public UpdateSettingValueModel value(Object value) { - this.value = value; - return this; - } + public UpdateSettingValueModel rolloutRules(List rolloutRules) { + this.rolloutRules = rolloutRules; + return this; + } - /** - * The value to serve. It must respect the setting type. - * - * @return value - */ - @javax.annotation.Nullable - public Object getValue() { - return value; + public UpdateSettingValueModel addRolloutRulesItem(RolloutRuleModel rolloutRulesItem) { + if (this.rolloutRules == null) { + this.rolloutRules = new ArrayList<>(); } - - public void setValue(Object value) { - this.value = value; + this.rolloutRules.add(rolloutRulesItem); + return this; + } + + /** + * The targeting rule collection. + * @return rolloutRules + */ + @javax.annotation.Nullable + public List getRolloutRules() { + return rolloutRules; + } + + public void setRolloutRules(List rolloutRules) { + this.rolloutRules = rolloutRules; + } + + + public UpdateSettingValueModel rolloutPercentageItems(List rolloutPercentageItems) { + this.rolloutPercentageItems = rolloutPercentageItems; + return this; + } + + public UpdateSettingValueModel addRolloutPercentageItemsItem(RolloutPercentageItemModel rolloutPercentageItemsItem) { + if (this.rolloutPercentageItems == null) { + this.rolloutPercentageItems = new ArrayList<>(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateSettingValueModel updateSettingValueModel = (UpdateSettingValueModel) o; - return Objects.equals(this.rolloutRules, updateSettingValueModel.rolloutRules) - && Objects.equals( - this.rolloutPercentageItems, updateSettingValueModel.rolloutPercentageItems) - && Objects.equals(this.value, updateSettingValueModel.value); + this.rolloutPercentageItems.add(rolloutPercentageItemsItem); + return this; + } + + /** + * The percentage rule collection. + * @return rolloutPercentageItems + */ + @javax.annotation.Nullable + public List getRolloutPercentageItems() { + return rolloutPercentageItems; + } + + public void setRolloutPercentageItems(List rolloutPercentageItems) { + this.rolloutPercentageItems = rolloutPercentageItems; + } + + + public UpdateSettingValueModel value(Object value) { + this.value = value; + return this; + } + + /** + * The value to serve. It must respect the setting type. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSettingValueModel instance itself + */ + public UpdateSettingValueModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(rolloutRules, rolloutPercentageItems, value); - } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSettingValueModel {\n"); - sb.append(" rolloutRules: ").append(toIndentedString(rolloutRules)).append("\n"); - sb.append(" rolloutPercentageItems: ") - .append(toIndentedString(rolloutPercentageItems)) - .append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); + if (o == null || getClass() != o.getClass()) { + return false; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + UpdateSettingValueModel updateSettingValueModel = (UpdateSettingValueModel) o; + return Objects.equals(this.rolloutRules, updateSettingValueModel.rolloutRules) && + Objects.equals(this.rolloutPercentageItems, updateSettingValueModel.rolloutPercentageItems) && + Objects.equals(this.value, updateSettingValueModel.value)&& + Objects.equals(this.additionalProperties, updateSettingValueModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(rolloutRules, rolloutPercentageItems, value, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("rolloutRules"); - openapiFields.add("rolloutPercentageItems"); - openapiFields.add("value"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSettingValueModel {\n"); + sb.append(" rolloutRules: ").append(toIndentedString(rolloutRules)).append("\n"); + sb.append(" rolloutPercentageItems: ").append(toIndentedString(rolloutPercentageItems)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdateSettingValueModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateSettingValueModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateSettingValueModel is not found" - + " in the empty JSON string", - UpdateSettingValueModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSettingValueModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateSettingValueModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rolloutRules"); + openapiFields.add("rolloutPercentageItems"); + openapiFields.add("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSettingValueModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSettingValueModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSettingValueModel is not found in the empty JSON string", UpdateSettingValueModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("rolloutRules") != null && !jsonObj.get("rolloutRules").isJsonNull()) { - JsonArray jsonArrayrolloutRules = jsonObj.getAsJsonArray("rolloutRules"); - if (jsonArrayrolloutRules != null) { - // ensure the json data is an array - if (!jsonObj.get("rolloutRules").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `rolloutRules` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("rolloutRules").toString())); - } - - // validate the optional field `rolloutRules` (array) - for (int i = 0; i < jsonArrayrolloutRules.size(); i++) { - RolloutRuleModel.validateJsonElement(jsonArrayrolloutRules.get(i)); - } - ; - } + if (jsonObj.get("rolloutRules") != null && !jsonObj.get("rolloutRules").isJsonNull()) { + JsonArray jsonArrayrolloutRules = jsonObj.getAsJsonArray("rolloutRules"); + if (jsonArrayrolloutRules != null) { + // ensure the json data is an array + if (!jsonObj.get("rolloutRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rolloutRules` to be an array in the JSON string but got `%s`", jsonObj.get("rolloutRules").toString())); + } + + // validate the optional field `rolloutRules` (array) + for (int i = 0; i < jsonArrayrolloutRules.size(); i++) { + RolloutRuleModel.validateJsonElement(jsonArrayrolloutRules.get(i)); + }; } - if (jsonObj.get("rolloutPercentageItems") != null - && !jsonObj.get("rolloutPercentageItems").isJsonNull()) { - JsonArray jsonArrayrolloutPercentageItems = - jsonObj.getAsJsonArray("rolloutPercentageItems"); - if (jsonArrayrolloutPercentageItems != null) { - // ensure the json data is an array - if (!jsonObj.get("rolloutPercentageItems").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `rolloutPercentageItems` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("rolloutPercentageItems").toString())); - } - - // validate the optional field `rolloutPercentageItems` (array) - for (int i = 0; i < jsonArrayrolloutPercentageItems.size(); i++) { - RolloutPercentageItemModel.validateJsonElement( - jsonArrayrolloutPercentageItems.get(i)); - } - ; - } + } + if (jsonObj.get("rolloutPercentageItems") != null && !jsonObj.get("rolloutPercentageItems").isJsonNull()) { + JsonArray jsonArrayrolloutPercentageItems = jsonObj.getAsJsonArray("rolloutPercentageItems"); + if (jsonArrayrolloutPercentageItems != null) { + // ensure the json data is an array + if (!jsonObj.get("rolloutPercentageItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rolloutPercentageItems` to be an array in the JSON string but got `%s`", jsonObj.get("rolloutPercentageItems").toString())); + } + + // validate the optional field `rolloutPercentageItems` (array) + for (int i = 0; i < jsonArrayrolloutPercentageItems.size(); i++) { + RolloutPercentageItemModel.validateJsonElement(jsonArrayrolloutPercentageItems.get(i)); + }; } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSettingValueModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSettingValueModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateSettingValueModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSettingValueModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSettingValueModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + } + } - /** - * Create an instance of UpdateSettingValueModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSettingValueModel - * @throws IOException if the JSON string is invalid with respect to UpdateSettingValueModel - */ - public static UpdateSettingValueModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSettingValueModel.class); - } - - /** - * Convert an instance of UpdateSettingValueModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSettingValueModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSettingValueModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSettingValueModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSettingValueModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateSettingValueModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSettingValueModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateSettingValueModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSettingValueModel + * @throws IOException if the JSON string is invalid with respect to UpdateSettingValueModel + */ + public static UpdateSettingValueModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSettingValueModel.class); + } + + /** + * Convert an instance of UpdateSettingValueModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValueWithSettingIdModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValueWithSettingIdModel.java index 0012c40..6a256f9 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValueWithSettingIdModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValueWithSettingIdModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,361 +10,413 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.RolloutPercentageItemModel; +import com.configcat.publicapi.java.client.model.RolloutRuleModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** UpdateSettingValueWithSettingIdModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UpdateSettingValueWithSettingIdModel { - public static final String SERIALIZED_NAME_ROLLOUT_RULES = "rolloutRules"; - - @SerializedName(SERIALIZED_NAME_ROLLOUT_RULES) - private List rolloutRules; - - public static final String SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS = "rolloutPercentageItems"; - - @SerializedName(SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS) - private List rolloutPercentageItems; - - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) - private Object value = null; - - public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; - - @SerializedName(SERIALIZED_NAME_SETTING_ID) - private Integer settingId; - - public UpdateSettingValueWithSettingIdModel() {} - - public UpdateSettingValueWithSettingIdModel rolloutRules(List rolloutRules) { - this.rolloutRules = rolloutRules; - return this; - } - - public UpdateSettingValueWithSettingIdModel addRolloutRulesItem( - RolloutRuleModel rolloutRulesItem) { - if (this.rolloutRules == null) { - this.rolloutRules = new ArrayList<>(); - } - this.rolloutRules.add(rolloutRulesItem); - return this; - } - - /** - * The targeting rule collection. - * - * @return rolloutRules - */ - @javax.annotation.Nullable - public List getRolloutRules() { - return rolloutRules; - } - - public void setRolloutRules(List rolloutRules) { - this.rolloutRules = rolloutRules; - } - - public UpdateSettingValueWithSettingIdModel rolloutPercentageItems( - List rolloutPercentageItems) { - this.rolloutPercentageItems = rolloutPercentageItems; - return this; - } +import com.configcat.publicapi.java.client.JSON; - public UpdateSettingValueWithSettingIdModel addRolloutPercentageItemsItem( - RolloutPercentageItemModel rolloutPercentageItemsItem) { - if (this.rolloutPercentageItems == null) { - this.rolloutPercentageItems = new ArrayList<>(); - } - this.rolloutPercentageItems.add(rolloutPercentageItemsItem); - return this; - } +/** + * UpdateSettingValueWithSettingIdModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UpdateSettingValueWithSettingIdModel { + public static final String SERIALIZED_NAME_ROLLOUT_RULES = "rolloutRules"; + @SerializedName(SERIALIZED_NAME_ROLLOUT_RULES) + private List rolloutRules; - /** - * The percentage rule collection. - * - * @return rolloutPercentageItems - */ - @javax.annotation.Nullable - public List getRolloutPercentageItems() { - return rolloutPercentageItems; - } + public static final String SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS = "rolloutPercentageItems"; + @SerializedName(SERIALIZED_NAME_ROLLOUT_PERCENTAGE_ITEMS) + private List rolloutPercentageItems; - public void setRolloutPercentageItems(List rolloutPercentageItems) { - this.rolloutPercentageItems = rolloutPercentageItems; - } + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; - public UpdateSettingValueWithSettingIdModel value(Object value) { - this.value = value; - return this; - } + public static final String SERIALIZED_NAME_SETTING_ID = "settingId"; + @SerializedName(SERIALIZED_NAME_SETTING_ID) + private Integer settingId; - /** - * The value to serve. It must respect the setting type. - * - * @return value - */ - @javax.annotation.Nullable - public Object getValue() { - return value; - } + public UpdateSettingValueWithSettingIdModel() { + } - public void setValue(Object value) { - this.value = value; - } + public UpdateSettingValueWithSettingIdModel rolloutRules(List rolloutRules) { + this.rolloutRules = rolloutRules; + return this; + } - public UpdateSettingValueWithSettingIdModel settingId(Integer settingId) { - this.settingId = settingId; - return this; + public UpdateSettingValueWithSettingIdModel addRolloutRulesItem(RolloutRuleModel rolloutRulesItem) { + if (this.rolloutRules == null) { + this.rolloutRules = new ArrayList<>(); } - - /** - * The id of the Setting. - * - * @return settingId - */ - @javax.annotation.Nullable - public Integer getSettingId() { - return settingId; + this.rolloutRules.add(rolloutRulesItem); + return this; + } + + /** + * The targeting rule collection. + * @return rolloutRules + */ + @javax.annotation.Nullable + public List getRolloutRules() { + return rolloutRules; + } + + public void setRolloutRules(List rolloutRules) { + this.rolloutRules = rolloutRules; + } + + + public UpdateSettingValueWithSettingIdModel rolloutPercentageItems(List rolloutPercentageItems) { + this.rolloutPercentageItems = rolloutPercentageItems; + return this; + } + + public UpdateSettingValueWithSettingIdModel addRolloutPercentageItemsItem(RolloutPercentageItemModel rolloutPercentageItemsItem) { + if (this.rolloutPercentageItems == null) { + this.rolloutPercentageItems = new ArrayList<>(); } - - public void setSettingId(Integer settingId) { - this.settingId = settingId; + this.rolloutPercentageItems.add(rolloutPercentageItemsItem); + return this; + } + + /** + * The percentage rule collection. + * @return rolloutPercentageItems + */ + @javax.annotation.Nullable + public List getRolloutPercentageItems() { + return rolloutPercentageItems; + } + + public void setRolloutPercentageItems(List rolloutPercentageItems) { + this.rolloutPercentageItems = rolloutPercentageItems; + } + + + public UpdateSettingValueWithSettingIdModel value(Object value) { + this.value = value; + return this; + } + + /** + * The value to serve. It must respect the setting type. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + + public UpdateSettingValueWithSettingIdModel settingId(Integer settingId) { + this.settingId = settingId; + return this; + } + + /** + * The id of the Setting. + * @return settingId + */ + @javax.annotation.Nullable + public Integer getSettingId() { + return settingId; + } + + public void setSettingId(Integer settingId) { + this.settingId = settingId; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSettingValueWithSettingIdModel instance itself + */ + public UpdateSettingValueWithSettingIdModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateSettingValueWithSettingIdModel updateSettingValueWithSettingIdModel = - (UpdateSettingValueWithSettingIdModel) o; - return Objects.equals(this.rolloutRules, updateSettingValueWithSettingIdModel.rolloutRules) - && Objects.equals( - this.rolloutPercentageItems, - updateSettingValueWithSettingIdModel.rolloutPercentageItems) - && Objects.equals(this.value, updateSettingValueWithSettingIdModel.value) - && Objects.equals(this.settingId, updateSettingValueWithSettingIdModel.settingId); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - @Override - public int hashCode() { - return Objects.hash(rolloutRules, rolloutPercentageItems, value, settingId); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSettingValueWithSettingIdModel {\n"); - sb.append(" rolloutRules: ").append(toIndentedString(rolloutRules)).append("\n"); - sb.append(" rolloutPercentageItems: ") - .append(toIndentedString(rolloutPercentageItems)) - .append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + UpdateSettingValueWithSettingIdModel updateSettingValueWithSettingIdModel = (UpdateSettingValueWithSettingIdModel) o; + return Objects.equals(this.rolloutRules, updateSettingValueWithSettingIdModel.rolloutRules) && + Objects.equals(this.rolloutPercentageItems, updateSettingValueWithSettingIdModel.rolloutPercentageItems) && + Objects.equals(this.value, updateSettingValueWithSettingIdModel.value) && + Objects.equals(this.settingId, updateSettingValueWithSettingIdModel.settingId)&& + Objects.equals(this.additionalProperties, updateSettingValueWithSettingIdModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(rolloutRules, rolloutPercentageItems, value, settingId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("rolloutRules"); - openapiFields.add("rolloutPercentageItems"); - openapiFields.add("value"); - openapiFields.add("settingId"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSettingValueWithSettingIdModel {\n"); + sb.append(" rolloutRules: ").append(toIndentedString(rolloutRules)).append("\n"); + sb.append(" rolloutPercentageItems: ").append(toIndentedString(rolloutPercentageItems)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" settingId: ").append(toIndentedString(settingId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateSettingValueWithSettingIdModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateSettingValueWithSettingIdModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateSettingValueWithSettingIdModel" - + " is not found in the empty JSON string", - UpdateSettingValueWithSettingIdModel.openapiRequiredFields - .toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSettingValueWithSettingIdModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateSettingValueWithSettingIdModel` properties. JSON:" - + " %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("rolloutRules"); + openapiFields.add("rolloutPercentageItems"); + openapiFields.add("value"); + openapiFields.add("settingId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSettingValueWithSettingIdModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSettingValueWithSettingIdModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSettingValueWithSettingIdModel is not found in the empty JSON string", UpdateSettingValueWithSettingIdModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("rolloutRules") != null && !jsonObj.get("rolloutRules").isJsonNull()) { - JsonArray jsonArrayrolloutRules = jsonObj.getAsJsonArray("rolloutRules"); - if (jsonArrayrolloutRules != null) { - // ensure the json data is an array - if (!jsonObj.get("rolloutRules").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `rolloutRules` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("rolloutRules").toString())); - } - - // validate the optional field `rolloutRules` (array) - for (int i = 0; i < jsonArrayrolloutRules.size(); i++) { - RolloutRuleModel.validateJsonElement(jsonArrayrolloutRules.get(i)); - } - ; - } + if (jsonObj.get("rolloutRules") != null && !jsonObj.get("rolloutRules").isJsonNull()) { + JsonArray jsonArrayrolloutRules = jsonObj.getAsJsonArray("rolloutRules"); + if (jsonArrayrolloutRules != null) { + // ensure the json data is an array + if (!jsonObj.get("rolloutRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rolloutRules` to be an array in the JSON string but got `%s`", jsonObj.get("rolloutRules").toString())); + } + + // validate the optional field `rolloutRules` (array) + for (int i = 0; i < jsonArrayrolloutRules.size(); i++) { + RolloutRuleModel.validateJsonElement(jsonArrayrolloutRules.get(i)); + }; } - if (jsonObj.get("rolloutPercentageItems") != null - && !jsonObj.get("rolloutPercentageItems").isJsonNull()) { - JsonArray jsonArrayrolloutPercentageItems = - jsonObj.getAsJsonArray("rolloutPercentageItems"); - if (jsonArrayrolloutPercentageItems != null) { - // ensure the json data is an array - if (!jsonObj.get("rolloutPercentageItems").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `rolloutPercentageItems` to be an array in" - + " the JSON string but got `%s`", - jsonObj.get("rolloutPercentageItems").toString())); - } - - // validate the optional field `rolloutPercentageItems` (array) - for (int i = 0; i < jsonArrayrolloutPercentageItems.size(); i++) { - RolloutPercentageItemModel.validateJsonElement( - jsonArrayrolloutPercentageItems.get(i)); - } - ; - } + } + if (jsonObj.get("rolloutPercentageItems") != null && !jsonObj.get("rolloutPercentageItems").isJsonNull()) { + JsonArray jsonArrayrolloutPercentageItems = jsonObj.getAsJsonArray("rolloutPercentageItems"); + if (jsonArrayrolloutPercentageItems != null) { + // ensure the json data is an array + if (!jsonObj.get("rolloutPercentageItems").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rolloutPercentageItems` to be an array in the JSON string but got `%s`", jsonObj.get("rolloutPercentageItems").toString())); + } + + // validate the optional field `rolloutPercentageItems` (array) + for (int i = 0; i < jsonArrayrolloutPercentageItems.size(); i++) { + RolloutPercentageItemModel.validateJsonElement(jsonArrayrolloutPercentageItems.get(i)); + }; } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSettingValueWithSettingIdModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSettingValueWithSettingIdModel' - // and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(UpdateSettingValueWithSettingIdModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write( - JsonWriter out, UpdateSettingValueWithSettingIdModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSettingValueWithSettingIdModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + } + } - /** - * Create an instance of UpdateSettingValueWithSettingIdModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSettingValueWithSettingIdModel - * @throws IOException if the JSON string is invalid with respect to - * UpdateSettingValueWithSettingIdModel - */ - public static UpdateSettingValueWithSettingIdModel fromJson(String jsonString) - throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSettingValueWithSettingIdModel.class); - } - - /** - * Convert an instance of UpdateSettingValueWithSettingIdModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSettingValueWithSettingIdModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSettingValueWithSettingIdModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSettingValueWithSettingIdModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSettingValueWithSettingIdModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateSettingValueWithSettingIdModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSettingValueWithSettingIdModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateSettingValueWithSettingIdModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSettingValueWithSettingIdModel + * @throws IOException if the JSON string is invalid with respect to UpdateSettingValueWithSettingIdModel + */ + public static UpdateSettingValueWithSettingIdModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSettingValueWithSettingIdModel.class); + } + + /** + * Convert an instance of UpdateSettingValueWithSettingIdModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValuesWithIdModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValuesWithIdModel.java index 6befdc7..5ae1294 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValuesWithIdModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateSettingValuesWithIdModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,242 +10,312 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.UpdateSettingValueWithSettingIdModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** UpdateSettingValuesWithIdModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * UpdateSettingValuesWithIdModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class UpdateSettingValuesWithIdModel { - public static final String SERIALIZED_NAME_SETTING_VALUES = "settingValues"; + public static final String SERIALIZED_NAME_SETTING_VALUES = "settingValues"; + @SerializedName(SERIALIZED_NAME_SETTING_VALUES) + private List settingValues; - @SerializedName(SERIALIZED_NAME_SETTING_VALUES) - private List settingValues; + public UpdateSettingValuesWithIdModel() { + } - public UpdateSettingValuesWithIdModel() {} + public UpdateSettingValuesWithIdModel settingValues(List settingValues) { + this.settingValues = settingValues; + return this; + } - public UpdateSettingValuesWithIdModel settingValues( - List settingValues) { - this.settingValues = settingValues; - return this; + public UpdateSettingValuesWithIdModel addSettingValuesItem(UpdateSettingValueWithSettingIdModel settingValuesItem) { + if (this.settingValues == null) { + this.settingValues = new ArrayList<>(); } + this.settingValues.add(settingValuesItem); + return this; + } - public UpdateSettingValuesWithIdModel addSettingValuesItem( - UpdateSettingValueWithSettingIdModel settingValuesItem) { - if (this.settingValues == null) { - this.settingValues = new ArrayList<>(); - } - this.settingValues.add(settingValuesItem); - return this; - } + /** + * The values to update. + * @return settingValues + */ + @javax.annotation.Nullable + public List getSettingValues() { + return settingValues; + } - /** - * The values to update. - * - * @return settingValues - */ - @javax.annotation.Nullable - public List getSettingValues() { - return settingValues; - } + public void setSettingValues(List settingValues) { + this.settingValues = settingValues; + } - public void setSettingValues(List settingValues) { - this.settingValues = settingValues; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel = - (UpdateSettingValuesWithIdModel) o; - return Objects.equals(this.settingValues, updateSettingValuesWithIdModel.settingValues); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateSettingValuesWithIdModel instance itself + */ + public UpdateSettingValuesWithIdModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(settingValues); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + UpdateSettingValuesWithIdModel updateSettingValuesWithIdModel = (UpdateSettingValuesWithIdModel) o; + return Objects.equals(this.settingValues, updateSettingValuesWithIdModel.settingValues)&& + Objects.equals(this.additionalProperties, updateSettingValuesWithIdModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateSettingValuesWithIdModel {\n"); - sb.append(" settingValues: ").append(toIndentedString(settingValues)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(settingValues, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSettingValuesWithIdModel {\n"); + sb.append(" settingValues: ").append(toIndentedString(settingValues)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("settingValues"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("settingValues"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to - * UpdateSettingValuesWithIdModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateSettingValuesWithIdModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateSettingValuesWithIdModel is not" - + " found in the empty JSON string", - UpdateSettingValuesWithIdModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateSettingValuesWithIdModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateSettingValuesWithIdModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateSettingValuesWithIdModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSettingValuesWithIdModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSettingValuesWithIdModel is not found in the empty JSON string", UpdateSettingValuesWithIdModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (jsonObj.get("settingValues") != null && !jsonObj.get("settingValues").isJsonNull()) { - JsonArray jsonArraysettingValues = jsonObj.getAsJsonArray("settingValues"); - if (jsonArraysettingValues != null) { - // ensure the json data is an array - if (!jsonObj.get("settingValues").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `settingValues` to be an array in the JSON" - + " string but got `%s`", - jsonObj.get("settingValues").toString())); - } - - // validate the optional field `settingValues` (array) - for (int i = 0; i < jsonArraysettingValues.size(); i++) { - UpdateSettingValueWithSettingIdModel.validateJsonElement( - jsonArraysettingValues.get(i)); - } - ; - } - } - } + if (jsonObj.get("settingValues") != null && !jsonObj.get("settingValues").isJsonNull()) { + JsonArray jsonArraysettingValues = jsonObj.getAsJsonArray("settingValues"); + if (jsonArraysettingValues != null) { + // ensure the json data is an array + if (!jsonObj.get("settingValues").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `settingValues` to be an array in the JSON string but got `%s`", jsonObj.get("settingValues").toString())); + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateSettingValuesWithIdModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateSettingValuesWithIdModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter( - this, TypeToken.get(UpdateSettingValuesWithIdModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateSettingValuesWithIdModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateSettingValuesWithIdModel read(JsonReader in) - throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); + // validate the optional field `settingValues` (array) + for (int i = 0; i < jsonArraysettingValues.size(); i++) { + UpdateSettingValueWithSettingIdModel.validateJsonElement(jsonArraysettingValues.get(i)); + }; } - } + } + } - /** - * Create an instance of UpdateSettingValuesWithIdModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateSettingValuesWithIdModel - * @throws IOException if the JSON string is invalid with respect to - * UpdateSettingValuesWithIdModel - */ - public static UpdateSettingValuesWithIdModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateSettingValuesWithIdModel.class); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSettingValuesWithIdModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSettingValuesWithIdModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSettingValuesWithIdModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSettingValuesWithIdModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateSettingValuesWithIdModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateSettingValuesWithIdModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of UpdateSettingValuesWithIdModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of UpdateSettingValuesWithIdModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSettingValuesWithIdModel + * @throws IOException if the JSON string is invalid with respect to UpdateSettingValuesWithIdModel + */ + public static UpdateSettingValuesWithIdModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSettingValuesWithIdModel.class); + } + + /** + * Convert an instance of UpdateSettingValuesWithIdModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UpdateTagModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UpdateTagModel.java index 1eddeda..45d5895 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UpdateTagModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UpdateTagModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,245 +10,319 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** UpdateTagModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * UpdateTagModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class UpdateTagModel { - public static final String SERIALIZED_NAME_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; - public static final String SERIALIZED_NAME_COLOR = "color"; + public UpdateTagModel() { + } - @SerializedName(SERIALIZED_NAME_COLOR) - private String color; + public UpdateTagModel name(String name) { + this.name = name; + return this; + } - public UpdateTagModel() {} + /** + * Name of the Tag. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public UpdateTagModel name(String name) { - this.name = name; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * Name of the Tag. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } + public UpdateTagModel color(String color) { + this.color = color; + return this; + } - public UpdateTagModel color(String color) { - this.color = color; - return this; - } + /** + * Color of the Tag. Possible values: `panther`, `whale`, `salmon`, `lizard`, `canary`, `koala`, or any HTML color code. + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } - /** - * Color of the Tag. - * - * @return color - */ - @javax.annotation.Nullable - public String getColor() { - return color; - } + public void setColor(String color) { + this.color = color; + } - public void setColor(String color) { - this.color = color; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UpdateTagModel updateTagModel = (UpdateTagModel) o; - return Objects.equals(this.name, updateTagModel.name) - && Objects.equals(this.color, updateTagModel.color); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpdateTagModel instance itself + */ + public UpdateTagModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(name, color); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTagModel updateTagModel = (UpdateTagModel) o; + return Objects.equals(this.name, updateTagModel.name) && + Objects.equals(this.color, updateTagModel.color)&& + Objects.equals(this.additionalProperties, updateTagModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UpdateTagModel {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" color: ").append(toIndentedString(color)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, color, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTagModel {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("color"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("color"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UpdateTagModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UpdateTagModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UpdateTagModel is not found in the" - + " empty JSON string", - UpdateTagModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UpdateTagModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UpdateTagModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateTagModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTagModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTagModel is not found in the empty JSON string", UpdateTagModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) - && !jsonObj.get("color").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `color` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("color").toString())); - } - } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UpdateTagModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UpdateTagModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UpdateTagModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UpdateTagModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UpdateTagModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateTagModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTagModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateTagModel.class)); - /** - * Create an instance of UpdateTagModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UpdateTagModel - * @throws IOException if the JSON string is invalid with respect to UpdateTagModel - */ - public static UpdateTagModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UpdateTagModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTagModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpdateTagModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpdateTagModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of UpdateTagModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of UpdateTagModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTagModel + * @throws IOException if the JSON string is invalid with respect to UpdateTagModel + */ + public static UpdateTagModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTagModel.class); + } + + /** + * Convert an instance of UpdateTagModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UserComparator.java b/src/main/java/com/configcat/publicapi/java/client/model/UserComparator.java index 30a7f4a..c8a4362 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UserComparator.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UserComparator.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,134 +10,137 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; /** - * The comparison operator which defines the relation between the comparison attribute and the - * comparison value. + * The comparison operator which defines the relation between the comparison attribute and the comparison value. */ @JsonAdapter(UserComparator.Adapter.class) public enum UserComparator { - IS_ONE_OF("isOneOf"), - - IS_NOT_ONE_OF("isNotOneOf"), - - CONTAINS_ANY_OF("containsAnyOf"), - - DOES_NOT_CONTAIN_ANY_OF("doesNotContainAnyOf"), - - SEM_VER_IS_ONE_OF("semVerIsOneOf"), - - SEM_VER_IS_NOT_ONE_OF("semVerIsNotOneOf"), - - SEM_VER_LESS("semVerLess"), - - SEM_VER_LESS_OR_EQUALS("semVerLessOrEquals"), - - SEM_VER_GREATER("semVerGreater"), - - SEM_VER_GREATER_OR_EQUALS("semVerGreaterOrEquals"), - - NUMBER_EQUALS("numberEquals"), - - NUMBER_DOES_NOT_EQUAL("numberDoesNotEqual"), - - NUMBER_LESS("numberLess"), - - NUMBER_LESS_OR_EQUALS("numberLessOrEquals"), - - NUMBER_GREATER("numberGreater"), - - NUMBER_GREATER_OR_EQUALS("numberGreaterOrEquals"), - - SENSITIVE_IS_ONE_OF("sensitiveIsOneOf"), - - SENSITIVE_IS_NOT_ONE_OF("sensitiveIsNotOneOf"), - - DATE_TIME_BEFORE("dateTimeBefore"), - - DATE_TIME_AFTER("dateTimeAfter"), - - SENSITIVE_TEXT_EQUALS("sensitiveTextEquals"), - - SENSITIVE_TEXT_DOES_NOT_EQUAL("sensitiveTextDoesNotEqual"), - - SENSITIVE_TEXT_STARTS_WITH_ANY_OF("sensitiveTextStartsWithAnyOf"), - - SENSITIVE_TEXT_NOT_STARTS_WITH_ANY_OF("sensitiveTextNotStartsWithAnyOf"), - - SENSITIVE_TEXT_ENDS_WITH_ANY_OF("sensitiveTextEndsWithAnyOf"), - - SENSITIVE_TEXT_NOT_ENDS_WITH_ANY_OF("sensitiveTextNotEndsWithAnyOf"), - - SENSITIVE_ARRAY_CONTAINS_ANY_OF("sensitiveArrayContainsAnyOf"), - - SENSITIVE_ARRAY_DOES_NOT_CONTAIN_ANY_OF("sensitiveArrayDoesNotContainAnyOf"), - - TEXT_EQUALS("textEquals"), - - TEXT_DOES_NOT_EQUAL("textDoesNotEqual"), - - TEXT_STARTS_WITH_ANY_OF("textStartsWithAnyOf"), - - TEXT_NOT_STARTS_WITH_ANY_OF("textNotStartsWithAnyOf"), - - TEXT_ENDS_WITH_ANY_OF("textEndsWithAnyOf"), - - TEXT_NOT_ENDS_WITH_ANY_OF("textNotEndsWithAnyOf"), - - ARRAY_CONTAINS_ANY_OF("arrayContainsAnyOf"), - - ARRAY_DOES_NOT_CONTAIN_ANY_OF("arrayDoesNotContainAnyOf"); - - private String value; - - UserComparator(String value) { - this.value = value; - } - - public String getValue() { - return value; + + IS_ONE_OF("isOneOf"), + + IS_NOT_ONE_OF("isNotOneOf"), + + CONTAINS_ANY_OF("containsAnyOf"), + + DOES_NOT_CONTAIN_ANY_OF("doesNotContainAnyOf"), + + SEM_VER_IS_ONE_OF("semVerIsOneOf"), + + SEM_VER_IS_NOT_ONE_OF("semVerIsNotOneOf"), + + SEM_VER_LESS("semVerLess"), + + SEM_VER_LESS_OR_EQUALS("semVerLessOrEquals"), + + SEM_VER_GREATER("semVerGreater"), + + SEM_VER_GREATER_OR_EQUALS("semVerGreaterOrEquals"), + + NUMBER_EQUALS("numberEquals"), + + NUMBER_DOES_NOT_EQUAL("numberDoesNotEqual"), + + NUMBER_LESS("numberLess"), + + NUMBER_LESS_OR_EQUALS("numberLessOrEquals"), + + NUMBER_GREATER("numberGreater"), + + NUMBER_GREATER_OR_EQUALS("numberGreaterOrEquals"), + + SENSITIVE_IS_ONE_OF("sensitiveIsOneOf"), + + SENSITIVE_IS_NOT_ONE_OF("sensitiveIsNotOneOf"), + + DATE_TIME_BEFORE("dateTimeBefore"), + + DATE_TIME_AFTER("dateTimeAfter"), + + SENSITIVE_TEXT_EQUALS("sensitiveTextEquals"), + + SENSITIVE_TEXT_DOES_NOT_EQUAL("sensitiveTextDoesNotEqual"), + + SENSITIVE_TEXT_STARTS_WITH_ANY_OF("sensitiveTextStartsWithAnyOf"), + + SENSITIVE_TEXT_NOT_STARTS_WITH_ANY_OF("sensitiveTextNotStartsWithAnyOf"), + + SENSITIVE_TEXT_ENDS_WITH_ANY_OF("sensitiveTextEndsWithAnyOf"), + + SENSITIVE_TEXT_NOT_ENDS_WITH_ANY_OF("sensitiveTextNotEndsWithAnyOf"), + + SENSITIVE_ARRAY_CONTAINS_ANY_OF("sensitiveArrayContainsAnyOf"), + + SENSITIVE_ARRAY_DOES_NOT_CONTAIN_ANY_OF("sensitiveArrayDoesNotContainAnyOf"), + + TEXT_EQUALS("textEquals"), + + TEXT_DOES_NOT_EQUAL("textDoesNotEqual"), + + TEXT_STARTS_WITH_ANY_OF("textStartsWithAnyOf"), + + TEXT_NOT_STARTS_WITH_ANY_OF("textNotStartsWithAnyOf"), + + TEXT_ENDS_WITH_ANY_OF("textEndsWithAnyOf"), + + TEXT_NOT_ENDS_WITH_ANY_OF("textNotEndsWithAnyOf"), + + ARRAY_CONTAINS_ANY_OF("arrayContainsAnyOf"), + + ARRAY_DOES_NOT_CONTAIN_ANY_OF("arrayDoesNotContainAnyOf"); + + private String value; + + UserComparator(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static UserComparator fromValue(String value) { + for (UserComparator b : UserComparator.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return String.valueOf(value); + public void write(final JsonWriter jsonWriter, final UserComparator enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static UserComparator fromValue(String value) { - for (UserComparator b : UserComparator.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); - } - - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final UserComparator enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public UserComparator read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return UserComparator.fromValue(value); - } + @Override + public UserComparator read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return UserComparator.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - UserComparator.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + UserComparator.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UserConditionModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UserConditionModel.java index 256e583..0ec0140 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UserConditionModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UserConditionModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,266 +10,346 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.ComparisonValueModel; +import com.configcat.publicapi.java.client.model.UserComparator; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** Describes a condition that is based on user attributes. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UserConditionModel { - public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) - private String comparisonAttribute; - - public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; - - @SerializedName(SERIALIZED_NAME_COMPARATOR) - private UserComparator comparator; - - public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; - - @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) - private ComparisonValueModel comparisonValue; - - public UserConditionModel() {} - - public UserConditionModel comparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - return this; - } - - /** - * The User Object attribute that the condition is based on. Can be \"User ID\", - * \"Email\", \"Country\" or any custom attribute. - * - * @return comparisonAttribute - */ - @javax.annotation.Nonnull - public String getComparisonAttribute() { - return comparisonAttribute; - } - - public void setComparisonAttribute(String comparisonAttribute) { - this.comparisonAttribute = comparisonAttribute; - } - - public UserConditionModel comparator(UserComparator comparator) { - this.comparator = comparator; - return this; - } - - /** - * Get comparator - * - * @return comparator - */ - @javax.annotation.Nonnull - public UserComparator getComparator() { - return comparator; - } - - public void setComparator(UserComparator comparator) { - this.comparator = comparator; - } +import com.configcat.publicapi.java.client.JSON; - public UserConditionModel comparisonValue(ComparisonValueModel comparisonValue) { - this.comparisonValue = comparisonValue; - return this; +/** + * Describes a condition that is based on user attributes. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UserConditionModel { + public static final String SERIALIZED_NAME_COMPARISON_ATTRIBUTE = "comparisonAttribute"; + @SerializedName(SERIALIZED_NAME_COMPARISON_ATTRIBUTE) + private String comparisonAttribute; + + public static final String SERIALIZED_NAME_COMPARATOR = "comparator"; + @SerializedName(SERIALIZED_NAME_COMPARATOR) + private UserComparator comparator; + + public static final String SERIALIZED_NAME_COMPARISON_VALUE = "comparisonValue"; + @SerializedName(SERIALIZED_NAME_COMPARISON_VALUE) + private ComparisonValueModel comparisonValue; + + public UserConditionModel() { + } + + public UserConditionModel comparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + return this; + } + + /** + * The User Object attribute that the condition is based on. Can be \"User ID\", \"Email\", \"Country\" or any custom attribute. + * @return comparisonAttribute + */ + @javax.annotation.Nonnull + public String getComparisonAttribute() { + return comparisonAttribute; + } + + public void setComparisonAttribute(String comparisonAttribute) { + this.comparisonAttribute = comparisonAttribute; + } + + + public UserConditionModel comparator(UserComparator comparator) { + this.comparator = comparator; + return this; + } + + /** + * Get comparator + * @return comparator + */ + @javax.annotation.Nonnull + public UserComparator getComparator() { + return comparator; + } + + public void setComparator(UserComparator comparator) { + this.comparator = comparator; + } + + + public UserConditionModel comparisonValue(ComparisonValueModel comparisonValue) { + this.comparisonValue = comparisonValue; + return this; + } + + /** + * Get comparisonValue + * @return comparisonValue + */ + @javax.annotation.Nonnull + public ComparisonValueModel getComparisonValue() { + return comparisonValue; + } + + public void setComparisonValue(ComparisonValueModel comparisonValue) { + this.comparisonValue = comparisonValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserConditionModel instance itself + */ + public UserConditionModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - /** - * Get comparisonValue - * - * @return comparisonValue - */ - @javax.annotation.Nonnull - public ComparisonValueModel getComparisonValue() { - return comparisonValue; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - public void setComparisonValue(ComparisonValueModel comparisonValue) { - this.comparisonValue = comparisonValue; - } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UserConditionModel userConditionModel = (UserConditionModel) o; - return Objects.equals(this.comparisonAttribute, userConditionModel.comparisonAttribute) - && Objects.equals(this.comparator, userConditionModel.comparator) - && Objects.equals(this.comparisonValue, userConditionModel.comparisonValue); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash(comparisonAttribute, comparator, comparisonValue); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserConditionModel {\n"); - sb.append(" comparisonAttribute: ") - .append(toIndentedString(comparisonAttribute)) - .append("\n"); - sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); - sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); - sb.append("}"); - return sb.toString(); + UserConditionModel userConditionModel = (UserConditionModel) o; + return Objects.equals(this.comparisonAttribute, userConditionModel.comparisonAttribute) && + Objects.equals(this.comparator, userConditionModel.comparator) && + Objects.equals(this.comparisonValue, userConditionModel.comparisonValue)&& + Objects.equals(this.additionalProperties, userConditionModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(comparisonAttribute, comparator, comparisonValue, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserConditionModel {\n"); + sb.append(" comparisonAttribute: ").append(toIndentedString(comparisonAttribute)).append("\n"); + sb.append(" comparator: ").append(toIndentedString(comparator)).append("\n"); + sb.append(" comparisonValue: ").append(toIndentedString(comparisonValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("comparisonAttribute"); + openapiFields.add("comparator"); + openapiFields.add("comparisonValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("comparisonAttribute"); + openapiRequiredFields.add("comparator"); + openapiRequiredFields.add("comparisonValue"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserConditionModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserConditionModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserConditionModel is not found in the empty JSON string", UserConditionModel.openapiRequiredFields.toString())); } - return o.toString().replace("\n", "\n "); - } + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("comparisonAttribute"); - openapiFields.add("comparator"); - openapiFields.add("comparisonValue"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("comparisonAttribute"); - openapiRequiredFields.add("comparator"); - openapiRequiredFields.add("comparisonValue"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UserConditionModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UserConditionModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UserConditionModel is not found in" - + " the empty JSON string", - UserConditionModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UserConditionModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UserConditionModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : UserConditionModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserConditionModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("comparisonAttribute").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `comparisonAttribute` to be a primitive type in" - + " the JSON string but got `%s`", - jsonObj.get("comparisonAttribute").toString())); - } - // validate the required field `comparator` - UserComparator.validateJsonElement(jsonObj.get("comparator")); - // validate the required field `comparisonValue` - ComparisonValueModel.validateJsonElement(jsonObj.get("comparisonValue")); - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UserConditionModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UserConditionModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UserConditionModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UserConditionModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UserConditionModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UserConditionModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UserConditionModel - * @throws IOException if the JSON string is invalid with respect to UserConditionModel - */ - public static UserConditionModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UserConditionModel.class); - } - - /** - * Convert an instance of UserConditionModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("comparisonAttribute").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `comparisonAttribute` to be a primitive type in the JSON string but got `%s`", jsonObj.get("comparisonAttribute").toString())); + } + // validate the required field `comparator` + UserComparator.validateJsonElement(jsonObj.get("comparator")); + // validate the required field `comparisonValue` + ComparisonValueModel.validateJsonElement(jsonObj.get("comparisonValue")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserConditionModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserConditionModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserConditionModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserConditionModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UserConditionModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UserConditionModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UserConditionModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserConditionModel + * @throws IOException if the JSON string is invalid with respect to UserConditionModel + */ + public static UserConditionModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserConditionModel.class); + } + + /** + * Convert an instance of UserConditionModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/UserModel.java b/src/main/java/com/configcat/publicapi/java/client/model/UserModel.java index 7c5f5d5..3e7f32d 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/UserModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/UserModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,307 +10,374 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** UserModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class UserModel { - public static final String SERIALIZED_NAME_USER_ID = "userId"; - - @SerializedName(SERIALIZED_NAME_USER_ID) - private String userId; - - public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; - - @SerializedName(SERIALIZED_NAME_FULL_NAME) - private String fullName; - - public static final String SERIALIZED_NAME_EMAIL = "email"; - - @SerializedName(SERIALIZED_NAME_EMAIL) - private String email; - - public static final String SERIALIZED_NAME_TWO_FACTOR_ENABLED = "twoFactorEnabled"; - - @SerializedName(SERIALIZED_NAME_TWO_FACTOR_ENABLED) - private Boolean twoFactorEnabled; - - public UserModel() {} - - public UserModel userId(String userId) { - this.userId = userId; - return this; - } - - /** - * Identifier of the Member. - * - * @return userId - */ - @javax.annotation.Nullable - public String getUserId() { - return userId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public UserModel fullName(String fullName) { - this.fullName = fullName; - return this; - } - - /** - * Name of the Member. - * - * @return fullName - */ - @javax.annotation.Nullable - public String getFullName() { - return fullName; - } - - public void setFullName(String fullName) { - this.fullName = fullName; - } - - public UserModel email(String email) { - this.email = email; - return this; - } - /** - * Email of the Member. - * - * @return email - */ - @javax.annotation.Nullable - public String getEmail() { - return email; - } +import com.configcat.publicapi.java.client.JSON; - public void setEmail(String email) { - this.email = email; +/** + * UserModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class UserModel { + public static final String SERIALIZED_NAME_USER_ID = "userId"; + @SerializedName(SERIALIZED_NAME_USER_ID) + private String userId; + + public static final String SERIALIZED_NAME_FULL_NAME = "fullName"; + @SerializedName(SERIALIZED_NAME_FULL_NAME) + private String fullName; + + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + + public static final String SERIALIZED_NAME_TWO_FACTOR_ENABLED = "twoFactorEnabled"; + @SerializedName(SERIALIZED_NAME_TWO_FACTOR_ENABLED) + private Boolean twoFactorEnabled; + + public UserModel() { + } + + public UserModel userId(String userId) { + this.userId = userId; + return this; + } + + /** + * Identifier of the Member. + * @return userId + */ + @javax.annotation.Nullable + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + + public UserModel fullName(String fullName) { + this.fullName = fullName; + return this; + } + + /** + * Name of the Member. + * @return fullName + */ + @javax.annotation.Nullable + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + + public UserModel email(String email) { + this.email = email; + return this; + } + + /** + * Email of the Member. + * @return email + */ + @javax.annotation.Nullable + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + public UserModel twoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + return this; + } + + /** + * Determines whether 2FA is enabled for the Member. + * @return twoFactorEnabled + */ + @javax.annotation.Nullable + public Boolean getTwoFactorEnabled() { + return twoFactorEnabled; + } + + public void setTwoFactorEnabled(Boolean twoFactorEnabled) { + this.twoFactorEnabled = twoFactorEnabled; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UserModel instance itself + */ + public UserModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public UserModel twoFactorEnabled(Boolean twoFactorEnabled) { - this.twoFactorEnabled = twoFactorEnabled; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * Determines whether 2FA is enabled for the Member. - * - * @return twoFactorEnabled - */ - @javax.annotation.Nullable - public Boolean getTwoFactorEnabled() { - return twoFactorEnabled; - } - public void setTwoFactorEnabled(Boolean twoFactorEnabled) { - this.twoFactorEnabled = twoFactorEnabled; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - UserModel userModel = (UserModel) o; - return Objects.equals(this.userId, userModel.userId) - && Objects.equals(this.fullName, userModel.fullName) - && Objects.equals(this.email, userModel.email) - && Objects.equals(this.twoFactorEnabled, userModel.twoFactorEnabled); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + UserModel userModel = (UserModel) o; + return Objects.equals(this.userId, userModel.userId) && + Objects.equals(this.fullName, userModel.fullName) && + Objects.equals(this.email, userModel.email) && + Objects.equals(this.twoFactorEnabled, userModel.twoFactorEnabled)&& + Objects.equals(this.additionalProperties, userModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(userId, fullName, email, twoFactorEnabled, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(userId, fullName, email, twoFactorEnabled); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserModel {\n"); + sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); + sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" twoFactorEnabled: ").append(toIndentedString(twoFactorEnabled)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class UserModel {\n"); - sb.append(" userId: ").append(toIndentedString(userId)).append("\n"); - sb.append(" fullName: ").append(toIndentedString(fullName)).append("\n"); - sb.append(" email: ").append(toIndentedString(email)).append("\n"); - sb.append(" twoFactorEnabled: ").append(toIndentedString(twoFactorEnabled)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("userId"); - openapiFields.add("fullName"); - openapiFields.add("email"); - openapiFields.add("twoFactorEnabled"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to UserModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!UserModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in UserModel is not found in the empty" - + " JSON string", - UserModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!UserModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `UserModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("userId"); + openapiFields.add("fullName"); + openapiFields.add("email"); + openapiFields.add("twoFactorEnabled"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserModel is not found in the empty JSON string", UserModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) - && !jsonObj.get("userId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `userId` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("userId").toString())); - } - if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) - && !jsonObj.get("fullName").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `fullName` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("fullName").toString())); - } - if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) - && !jsonObj.get("email").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `email` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("email").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!UserModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'UserModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(UserModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, UserModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public UserModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of UserModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of UserModel - * @throws IOException if the JSON string is invalid with respect to UserModel - */ - public static UserModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, UserModel.class); - } - - /** - * Convert an instance of UserModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if ((jsonObj.get("userId") != null && !jsonObj.get("userId").isJsonNull()) && !jsonObj.get("userId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userId").toString())); + } + if ((jsonObj.get("fullName") != null && !jsonObj.get("fullName").isJsonNull()) && !jsonObj.get("fullName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fullName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fullName").toString())); + } + if ((jsonObj.get("email") != null && !jsonObj.get("email").isJsonNull()) && !jsonObj.get("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UserModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UserModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of UserModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserModel + * @throws IOException if the JSON string is invalid with respect to UserModel + */ + public static UserModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserModel.class); + } + + /** + * Convert an instance of UserModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/ValueModel.java b/src/main/java/com/configcat/publicapi/java/client/model/ValueModel.java index 223024c..d56e917 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/ValueModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/ValueModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,291 +10,368 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** Represents the value of a Feature Flag or Setting. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class ValueModel { - public static final String SERIALIZED_NAME_BOOL_VALUE = "boolValue"; - - @SerializedName(SERIALIZED_NAME_BOOL_VALUE) - private Boolean boolValue; - public static final String SERIALIZED_NAME_STRING_VALUE = "stringValue"; - - @SerializedName(SERIALIZED_NAME_STRING_VALUE) - private String stringValue; - - public static final String SERIALIZED_NAME_INT_VALUE = "intValue"; - - @SerializedName(SERIALIZED_NAME_INT_VALUE) - private Integer intValue; - - public static final String SERIALIZED_NAME_DOUBLE_VALUE = "doubleValue"; - - @SerializedName(SERIALIZED_NAME_DOUBLE_VALUE) - private Double doubleValue; - - public ValueModel() {} - - public ValueModel boolValue(Boolean boolValue) { - this.boolValue = boolValue; - return this; - } - - /** - * The served value in case of a boolean Feature Flag. - * - * @return boolValue - */ - @javax.annotation.Nullable - public Boolean getBoolValue() { - return boolValue; - } - - public void setBoolValue(Boolean boolValue) { - this.boolValue = boolValue; - } - - public ValueModel stringValue(String stringValue) { - this.stringValue = stringValue; - return this; - } - - /** - * The served value in case of a text Setting. - * - * @return stringValue - */ - @javax.annotation.Nullable - public String getStringValue() { - return stringValue; - } - - public void setStringValue(String stringValue) { - this.stringValue = stringValue; - } - - public ValueModel intValue(Integer intValue) { - this.intValue = intValue; - return this; - } - - /** - * The served value in case of a whole number Setting. - * - * @return intValue - */ - @javax.annotation.Nullable - public Integer getIntValue() { - return intValue; - } +import com.configcat.publicapi.java.client.JSON; - public void setIntValue(Integer intValue) { - this.intValue = intValue; +/** + * Represents the value of a Feature Flag or Setting. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class ValueModel { + public static final String SERIALIZED_NAME_BOOL_VALUE = "boolValue"; + @SerializedName(SERIALIZED_NAME_BOOL_VALUE) + private Boolean boolValue; + + public static final String SERIALIZED_NAME_STRING_VALUE = "stringValue"; + @SerializedName(SERIALIZED_NAME_STRING_VALUE) + private String stringValue; + + public static final String SERIALIZED_NAME_INT_VALUE = "intValue"; + @SerializedName(SERIALIZED_NAME_INT_VALUE) + private Integer intValue; + + public static final String SERIALIZED_NAME_DOUBLE_VALUE = "doubleValue"; + @SerializedName(SERIALIZED_NAME_DOUBLE_VALUE) + private Double doubleValue; + + public ValueModel() { + } + + public ValueModel boolValue(Boolean boolValue) { + this.boolValue = boolValue; + return this; + } + + /** + * The served value in case of a boolean Feature Flag. + * @return boolValue + */ + @javax.annotation.Nullable + public Boolean getBoolValue() { + return boolValue; + } + + public void setBoolValue(Boolean boolValue) { + this.boolValue = boolValue; + } + + + public ValueModel stringValue(String stringValue) { + this.stringValue = stringValue; + return this; + } + + /** + * The served value in case of a text Setting. + * @return stringValue + */ + @javax.annotation.Nullable + public String getStringValue() { + return stringValue; + } + + public void setStringValue(String stringValue) { + this.stringValue = stringValue; + } + + + public ValueModel intValue(Integer intValue) { + this.intValue = intValue; + return this; + } + + /** + * The served value in case of a whole number Setting. + * @return intValue + */ + @javax.annotation.Nullable + public Integer getIntValue() { + return intValue; + } + + public void setIntValue(Integer intValue) { + this.intValue = intValue; + } + + + public ValueModel doubleValue(Double doubleValue) { + this.doubleValue = doubleValue; + return this; + } + + /** + * The served value in case of a decimal number Setting. + * @return doubleValue + */ + @javax.annotation.Nullable + public Double getDoubleValue() { + return doubleValue; + } + + public void setDoubleValue(Double doubleValue) { + this.doubleValue = doubleValue; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ValueModel instance itself + */ + public ValueModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public ValueModel doubleValue(Double doubleValue) { - this.doubleValue = doubleValue; - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * The served value in case of a decimal number Setting. - * - * @return doubleValue - */ - @javax.annotation.Nullable - public Double getDoubleValue() { - return doubleValue; - } - public void setDoubleValue(Double doubleValue) { - this.doubleValue = doubleValue; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ValueModel valueModel = (ValueModel) o; - return Objects.equals(this.boolValue, valueModel.boolValue) - && Objects.equals(this.stringValue, valueModel.stringValue) - && Objects.equals(this.intValue, valueModel.intValue) - && Objects.equals(this.doubleValue, valueModel.doubleValue); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + ValueModel valueModel = (ValueModel) o; + return Objects.equals(this.boolValue, valueModel.boolValue) && + Objects.equals(this.stringValue, valueModel.stringValue) && + Objects.equals(this.intValue, valueModel.intValue) && + Objects.equals(this.doubleValue, valueModel.doubleValue)&& + Objects.equals(this.additionalProperties, valueModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(boolValue, stringValue, intValue, doubleValue, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(boolValue, stringValue, intValue, doubleValue); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValueModel {\n"); + sb.append(" boolValue: ").append(toIndentedString(boolValue)).append("\n"); + sb.append(" stringValue: ").append(toIndentedString(stringValue)).append("\n"); + sb.append(" intValue: ").append(toIndentedString(intValue)).append("\n"); + sb.append(" doubleValue: ").append(toIndentedString(doubleValue)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ValueModel {\n"); - sb.append(" boolValue: ").append(toIndentedString(boolValue)).append("\n"); - sb.append(" stringValue: ").append(toIndentedString(stringValue)).append("\n"); - sb.append(" intValue: ").append(toIndentedString(intValue)).append("\n"); - sb.append(" doubleValue: ").append(toIndentedString(doubleValue)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("boolValue"); - openapiFields.add("stringValue"); - openapiFields.add("intValue"); - openapiFields.add("doubleValue"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to ValueModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!ValueModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in ValueModel is not found in the empty" - + " JSON string", - ValueModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!ValueModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `ValueModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("boolValue"); + openapiFields.add("stringValue"); + openapiFields.add("intValue"); + openapiFields.add("doubleValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ValueModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ValueModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ValueModel is not found in the empty JSON string", ValueModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("stringValue") != null && !jsonObj.get("stringValue").isJsonNull()) - && !jsonObj.get("stringValue").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `stringValue` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("stringValue").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!ValueModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'ValueModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(ValueModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, ValueModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public ValueModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + if ((jsonObj.get("stringValue") != null && !jsonObj.get("stringValue").isJsonNull()) && !jsonObj.get("stringValue").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `stringValue` to be a primitive type in the JSON string but got `%s`", jsonObj.get("stringValue").toString())); + } + } - /** - * Create an instance of ValueModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of ValueModel - * @throws IOException if the JSON string is invalid with respect to ValueModel - */ - public static ValueModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, ValueModel.class); - } - - /** - * Convert an instance of ValueModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ValueModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ValueModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ValueModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ValueModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ValueModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ValueModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of ValueModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of ValueModel + * @throws IOException if the JSON string is invalid with respect to ValueModel + */ + public static ValueModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ValueModel.class); + } + + /** + * Convert an instance of ValueModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/WebHookHttpMethod.java b/src/main/java/com/configcat/publicapi/java/client/model/WebHookHttpMethod.java index a2498f0..01b30f7 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/WebHookHttpMethod.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/WebHookHttpMethod.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,63 +10,69 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -import com.google.gson.JsonElement; +import java.io.IOException; import com.google.gson.TypeAdapter; +import com.google.gson.JsonElement; import com.google.gson.annotations.JsonAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; -/** Gets or Sets WebHookHttpMethod */ +/** + * Gets or Sets WebHookHttpMethod + */ @JsonAdapter(WebHookHttpMethod.Adapter.class) public enum WebHookHttpMethod { - GET("get"), + + GET("get"), + + POST("post"); - POST("post"); + private String value; - private String value; + WebHookHttpMethod(String value) { + this.value = value; + } - WebHookHttpMethod(String value) { - this.value = value; - } + public String getValue() { + return value; + } - public String getValue() { - return value; - } + @Override + public String toString() { + return String.valueOf(value); + } - @Override - public String toString() { - return String.valueOf(value); + public static WebHookHttpMethod fromValue(String value) { + for (WebHookHttpMethod b : WebHookHttpMethod.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - public static WebHookHttpMethod fromValue(String value) { - for (WebHookHttpMethod b : WebHookHttpMethod.values()) { - if (b.value.equals(value)) { - return b; - } - } - throw new IllegalArgumentException("Unexpected value '" + value + "'"); + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final WebHookHttpMethod enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final WebHookHttpMethod enumeration) - throws IOException { - jsonWriter.value(enumeration.getValue()); - } - - @Override - public WebHookHttpMethod read(final JsonReader jsonReader) throws IOException { - String value = jsonReader.nextString(); - return WebHookHttpMethod.fromValue(value); - } + @Override + public WebHookHttpMethod read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return WebHookHttpMethod.fromValue(value); } + } - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - String value = jsonElement.getAsString(); - WebHookHttpMethod.fromValue(value); - } + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + WebHookHttpMethod.fromValue(value); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/WebHookRequest.java b/src/main/java/com/configcat/publicapi/java/client/model/WebHookRequest.java index 3faad40..e5686e0 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/WebHookRequest.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/WebHookRequest.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,343 +10,409 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.WebHookHttpMethod; +import com.configcat.publicapi.java.client.model.WebhookHeaderModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** WebHookRequest */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class WebHookRequest { - public static final String SERIALIZED_NAME_URL = "url"; - - @SerializedName(SERIALIZED_NAME_URL) - private String url; - - public static final String SERIALIZED_NAME_CONTENT = "content"; - - @SerializedName(SERIALIZED_NAME_CONTENT) - private String content; - - public static final String SERIALIZED_NAME_HTTP_METHOD = "httpMethod"; - - @SerializedName(SERIALIZED_NAME_HTTP_METHOD) - private WebHookHttpMethod httpMethod; - - public static final String SERIALIZED_NAME_WEB_HOOK_HEADERS = "webHookHeaders"; - - @SerializedName(SERIALIZED_NAME_WEB_HOOK_HEADERS) - private List webHookHeaders; - - public WebHookRequest() {} - - public WebHookRequest url(String url) { - this.url = url; - return this; - } - - /** - * The URL of the Webhook. - * - * @return url - */ - @javax.annotation.Nonnull - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public WebHookRequest content(String content) { - this.content = content; - return this; - } - - /** - * The HTTP body content. - * - * @return content - */ - @javax.annotation.Nullable - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public WebHookRequest httpMethod(WebHookHttpMethod httpMethod) { - this.httpMethod = httpMethod; - return this; - } - /** - * Get httpMethod - * - * @return httpMethod - */ - @javax.annotation.Nullable - public WebHookHttpMethod getHttpMethod() { - return httpMethod; - } +import com.configcat.publicapi.java.client.JSON; - public void setHttpMethod(WebHookHttpMethod httpMethod) { - this.httpMethod = httpMethod; +/** + * WebHookRequest + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class WebHookRequest { + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + private String content; + + public static final String SERIALIZED_NAME_HTTP_METHOD = "httpMethod"; + @SerializedName(SERIALIZED_NAME_HTTP_METHOD) + private WebHookHttpMethod httpMethod; + + public static final String SERIALIZED_NAME_WEB_HOOK_HEADERS = "webHookHeaders"; + @SerializedName(SERIALIZED_NAME_WEB_HOOK_HEADERS) + private List webHookHeaders; + + public WebHookRequest() { + } + + public WebHookRequest url(String url) { + this.url = url; + return this; + } + + /** + * The URL of the Webhook. + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + + public WebHookRequest content(String content) { + this.content = content; + return this; + } + + /** + * The HTTP body content. + * @return content + */ + @javax.annotation.Nullable + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + + public WebHookRequest httpMethod(WebHookHttpMethod httpMethod) { + this.httpMethod = httpMethod; + return this; + } + + /** + * Get httpMethod + * @return httpMethod + */ + @javax.annotation.Nullable + public WebHookHttpMethod getHttpMethod() { + return httpMethod; + } + + public void setHttpMethod(WebHookHttpMethod httpMethod) { + this.httpMethod = httpMethod; + } + + + public WebHookRequest webHookHeaders(List webHookHeaders) { + this.webHookHeaders = webHookHeaders; + return this; + } + + public WebHookRequest addWebHookHeadersItem(WebhookHeaderModel webHookHeadersItem) { + if (this.webHookHeaders == null) { + this.webHookHeaders = new ArrayList<>(); } - - public WebHookRequest webHookHeaders(List webHookHeaders) { - this.webHookHeaders = webHookHeaders; - return this; + this.webHookHeaders.add(webHookHeadersItem); + return this; + } + + /** + * List of HTTP headers. + * @return webHookHeaders + */ + @javax.annotation.Nullable + public List getWebHookHeaders() { + return webHookHeaders; + } + + public void setWebHookHeaders(List webHookHeaders) { + this.webHookHeaders = webHookHeaders; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebHookRequest instance itself + */ + public WebHookRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - public WebHookRequest addWebHookHeadersItem(WebhookHeaderModel webHookHeadersItem) { - if (this.webHookHeaders == null) { - this.webHookHeaders = new ArrayList<>(); - } - this.webHookHeaders.add(webHookHeadersItem); - return this; + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - /** - * List of HTTP headers. - * - * @return webHookHeaders - */ - @javax.annotation.Nullable - public List getWebHookHeaders() { - return webHookHeaders; - } - public void setWebHookHeaders(List webHookHeaders) { - this.webHookHeaders = webHookHeaders; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebHookRequest webHookRequest = (WebHookRequest) o; - return Objects.equals(this.url, webHookRequest.url) - && Objects.equals(this.content, webHookRequest.content) - && Objects.equals(this.httpMethod, webHookRequest.httpMethod) - && Objects.equals(this.webHookHeaders, webHookRequest.webHookHeaders); + if (o == null || getClass() != o.getClass()) { + return false; } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); + WebHookRequest webHookRequest = (WebHookRequest) o; + return Objects.equals(this.url, webHookRequest.url) && + Objects.equals(this.content, webHookRequest.content) && + Objects.equals(this.httpMethod, webHookRequest.httpMethod) && + Objects.equals(this.webHookHeaders, webHookRequest.webHookHeaders)&& + Objects.equals(this.additionalProperties, webHookRequest.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(url, content, httpMethod, webHookHeaders, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(url, content, httpMethod, webHookHeaders); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebHookRequest {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" httpMethod: ").append(toIndentedString(httpMethod)).append("\n"); + sb.append(" webHookHeaders: ").append(toIndentedString(webHookHeaders)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("url"); + openapiFields.add("content"); + openapiFields.add("httpMethod"); + openapiFields.add("webHookHeaders"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebHookRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebHookRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebHookRequest is not found in the empty JSON string", WebHookRequest.openapiRequiredFields.toString())); } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WebHookRequest {\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - sb.append(" httpMethod: ").append(toIndentedString(httpMethod)).append("\n"); - sb.append(" webHookHeaders: ").append(toIndentedString(webHookHeaders)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("url"); - openapiFields.add("content"); - openapiFields.add("httpMethod"); - openapiFields.add("webHookHeaders"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("url"); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to WebHookRequest - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!WebHookRequest.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in WebHookRequest is not found in the" - + " empty JSON string", - WebHookRequest.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!WebHookRequest.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `WebHookRequest` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } - } - - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WebHookRequest.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebHookRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("url").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `url` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("url").toString())); - } - if ((jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) - && !jsonObj.get("content").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `content` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("content").toString())); + if (!jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + if ((jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) && !jsonObj.get("content").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `content` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content").toString())); + } + // validate the optional field `httpMethod` + if (jsonObj.get("httpMethod") != null && !jsonObj.get("httpMethod").isJsonNull()) { + WebHookHttpMethod.validateJsonElement(jsonObj.get("httpMethod")); + } + if (jsonObj.get("webHookHeaders") != null && !jsonObj.get("webHookHeaders").isJsonNull()) { + JsonArray jsonArraywebHookHeaders = jsonObj.getAsJsonArray("webHookHeaders"); + if (jsonArraywebHookHeaders != null) { + // ensure the json data is an array + if (!jsonObj.get("webHookHeaders").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `webHookHeaders` to be an array in the JSON string but got `%s`", jsonObj.get("webHookHeaders").toString())); + } + + // validate the optional field `webHookHeaders` (array) + for (int i = 0; i < jsonArraywebHookHeaders.size(); i++) { + WebhookHeaderModel.validateJsonElement(jsonArraywebHookHeaders.get(i)); + }; } - // validate the optional field `httpMethod` - if (jsonObj.get("httpMethod") != null && !jsonObj.get("httpMethod").isJsonNull()) { - WebHookHttpMethod.validateJsonElement(jsonObj.get("httpMethod")); - } - if (jsonObj.get("webHookHeaders") != null && !jsonObj.get("webHookHeaders").isJsonNull()) { - JsonArray jsonArraywebHookHeaders = jsonObj.getAsJsonArray("webHookHeaders"); - if (jsonArraywebHookHeaders != null) { - // ensure the json data is an array - if (!jsonObj.get("webHookHeaders").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `webHookHeaders` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("webHookHeaders").toString())); - } - - // validate the optional field `webHookHeaders` (array) - for (int i = 0; i < jsonArraywebHookHeaders.size(); i++) { - WebhookHeaderModel.validateJsonElement(jsonArraywebHookHeaders.get(i)); - } - ; - } - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WebHookRequest.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WebHookRequest' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(WebHookRequest.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, WebHookRequest value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WebHookRequest read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of WebHookRequest given an JSON string - * - * @param jsonString JSON string - * @return An instance of WebHookRequest - * @throws IOException if the JSON string is invalid with respect to WebHookRequest - */ - public static WebHookRequest fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WebHookRequest.class); - } + } + } - /** - * Convert an instance of WebHookRequest to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebHookRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebHookRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebHookRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebHookRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebHookRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebHookRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of WebHookRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebHookRequest + * @throws IOException if the JSON string is invalid with respect to WebHookRequest + */ + public static WebHookRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebHookRequest.class); + } + + /** + * Convert an instance of WebHookRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/WebhookConfig.java b/src/main/java/com/configcat/publicapi/java/client/model/WebhookConfig.java index 58f1dcb..ee3eb06 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/WebhookConfig.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/WebhookConfig.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,246 +10,320 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; -/** The Config where the applied changes will invoke the Webhook. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * The Config where the applied changes will invoke the Webhook. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class WebhookConfig { - public static final String SERIALIZED_NAME_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; + @SerializedName(SERIALIZED_NAME_CONFIG_ID) + private UUID configId; - public static final String SERIALIZED_NAME_CONFIG_ID = "configId"; + public WebhookConfig() { + } - @SerializedName(SERIALIZED_NAME_CONFIG_ID) - private UUID configId; + public WebhookConfig name(String name) { + this.name = name; + return this; + } - public WebhookConfig() {} + /** + * The Config's name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public WebhookConfig name(String name) { - this.name = name; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * The Config's name. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } + public WebhookConfig configId(UUID configId) { + this.configId = configId; + return this; + } - public WebhookConfig configId(UUID configId) { - this.configId = configId; - return this; - } + /** + * The Config's identifier. + * @return configId + */ + @javax.annotation.Nullable + public UUID getConfigId() { + return configId; + } - /** - * The Config's identifier. - * - * @return configId - */ - @javax.annotation.Nullable - public UUID getConfigId() { - return configId; - } + public void setConfigId(UUID configId) { + this.configId = configId; + } - public void setConfigId(UUID configId) { - this.configId = configId; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebhookConfig webhookConfig = (WebhookConfig) o; - return Objects.equals(this.name, webhookConfig.name) - && Objects.equals(this.configId, webhookConfig.configId); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookConfig instance itself + */ + public WebhookConfig putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(name, configId); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + WebhookConfig webhookConfig = (WebhookConfig) o; + return Objects.equals(this.name, webhookConfig.name) && + Objects.equals(this.configId, webhookConfig.configId)&& + Objects.equals(this.additionalProperties, webhookConfig.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WebhookConfig {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, configId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookConfig {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" configId: ").append(toIndentedString(configId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("configId"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("configId"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to WebhookConfig - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!WebhookConfig.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in WebhookConfig is not found in the" - + " empty JSON string", - WebhookConfig.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!WebhookConfig.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `WebhookConfig` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookConfig + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookConfig.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookConfig is not found in the empty JSON string", WebhookConfig.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("configId") != null && !jsonObj.get("configId").isJsonNull()) - && !jsonObj.get("configId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `configId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("configId").toString())); - } - } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("configId") != null && !jsonObj.get("configId").isJsonNull()) && !jsonObj.get("configId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `configId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("configId").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WebhookConfig.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WebhookConfig' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(WebhookConfig.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, WebhookConfig value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WebhookConfig read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookConfig.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookConfig' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookConfig.class)); - /** - * Create an instance of WebhookConfig given an JSON string - * - * @param jsonString JSON string - * @return An instance of WebhookConfig - * @throws IOException if the JSON string is invalid with respect to WebhookConfig - */ - public static WebhookConfig fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WebhookConfig.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookConfig value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookConfig read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookConfig instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of WebhookConfig to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of WebhookConfig given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookConfig + * @throws IOException if the JSON string is invalid with respect to WebhookConfig + */ + public static WebhookConfig fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookConfig.class); + } + + /** + * Convert an instance of WebhookConfig to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/WebhookEnvironment.java b/src/main/java/com/configcat/publicapi/java/client/model/WebhookEnvironment.java index 2c759b0..5cc1abc 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/WebhookEnvironment.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/WebhookEnvironment.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,247 +10,320 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import java.util.UUID; -import org.openapitools.jackson.nullable.JsonNullable; -/** The Environment where the applied changes will invoke the Webhook. */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * The Environment where the applied changes will invoke the Webhook. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class WebhookEnvironment { - public static final String SERIALIZED_NAME_NAME = "name"; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; - @SerializedName(SERIALIZED_NAME_NAME) - private String name; + public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) + private UUID environmentId; - public static final String SERIALIZED_NAME_ENVIRONMENT_ID = "environmentId"; + public WebhookEnvironment() { + } - @SerializedName(SERIALIZED_NAME_ENVIRONMENT_ID) - private UUID environmentId; + public WebhookEnvironment name(String name) { + this.name = name; + return this; + } - public WebhookEnvironment() {} + /** + * The Environment's name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } - public WebhookEnvironment name(String name) { - this.name = name; - return this; - } + public void setName(String name) { + this.name = name; + } - /** - * The Environment's name. - * - * @return name - */ - @javax.annotation.Nullable - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } + public WebhookEnvironment environmentId(UUID environmentId) { + this.environmentId = environmentId; + return this; + } - public WebhookEnvironment environmentId(UUID environmentId) { - this.environmentId = environmentId; - return this; - } + /** + * The Environment's identifier. + * @return environmentId + */ + @javax.annotation.Nullable + public UUID getEnvironmentId() { + return environmentId; + } - /** - * The Environment's identifier. - * - * @return environmentId - */ - @javax.annotation.Nullable - public UUID getEnvironmentId() { - return environmentId; - } + public void setEnvironmentId(UUID environmentId) { + this.environmentId = environmentId; + } - public void setEnvironmentId(UUID environmentId) { - this.environmentId = environmentId; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebhookEnvironment webhookEnvironment = (WebhookEnvironment) o; - return Objects.equals(this.name, webhookEnvironment.name) - && Objects.equals(this.environmentId, webhookEnvironment.environmentId); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookEnvironment instance itself + */ + public WebhookEnvironment putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(name, environmentId); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + WebhookEnvironment webhookEnvironment = (WebhookEnvironment) o; + return Objects.equals(this.name, webhookEnvironment.name) && + Objects.equals(this.environmentId, webhookEnvironment.environmentId)&& + Objects.equals(this.additionalProperties, webhookEnvironment.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WebhookEnvironment {\n"); - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(name, environmentId, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookEnvironment {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("name"); - openapiFields.add("environmentId"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("environmentId"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to WebhookEnvironment - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!WebhookEnvironment.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in WebhookEnvironment is not found in" - + " the empty JSON string", - WebhookEnvironment.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!WebhookEnvironment.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `WebhookEnvironment` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookEnvironment + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookEnvironment.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookEnvironment is not found in the empty JSON string", WebhookEnvironment.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) - && !jsonObj.get("name").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `name` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("name").toString())); - } - if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) - && !jsonObj.get("environmentId").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `environmentId` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("environmentId").toString())); - } - } + if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if ((jsonObj.get("environmentId") != null && !jsonObj.get("environmentId").isJsonNull()) && !jsonObj.get("environmentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `environmentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("environmentId").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WebhookEnvironment.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WebhookEnvironment' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(WebhookEnvironment.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, WebhookEnvironment value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WebhookEnvironment read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookEnvironment.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookEnvironment' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookEnvironment.class)); - /** - * Create an instance of WebhookEnvironment given an JSON string - * - * @param jsonString JSON string - * @return An instance of WebhookEnvironment - * @throws IOException if the JSON string is invalid with respect to WebhookEnvironment - */ - public static WebhookEnvironment fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WebhookEnvironment.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookEnvironment value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookEnvironment read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookEnvironment instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of WebhookEnvironment to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of WebhookEnvironment given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookEnvironment + * @throws IOException if the JSON string is invalid with respect to WebhookEnvironment + */ + public static WebhookEnvironment fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookEnvironment.class); + } + + /** + * Convert an instance of WebhookEnvironment to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/WebhookHeaderModel.java b/src/main/java/com/configcat/publicapi/java/client/model/WebhookHeaderModel.java index 1769ec2..37236cb 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/WebhookHeaderModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/WebhookHeaderModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,265 +10,342 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -/** WebhookHeaderModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class WebhookHeaderModel { - public static final String SERIALIZED_NAME_KEY = "key"; - - @SerializedName(SERIALIZED_NAME_KEY) - private String key; - - public static final String SERIALIZED_NAME_VALUE = "value"; - - @SerializedName(SERIALIZED_NAME_VALUE) - private String value; - - public static final String SERIALIZED_NAME_IS_SECURE = "isSecure"; - - @SerializedName(SERIALIZED_NAME_IS_SECURE) - private Boolean isSecure; - - public WebhookHeaderModel() {} - - public WebhookHeaderModel key(String key) { - this.key = key; - return this; - } - - /** - * The HTTP header key. - * - * @return key - */ - @javax.annotation.Nonnull - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public WebhookHeaderModel value(String value) { - this.value = value; - return this; - } - - /** - * The HTTP header value. - * - * @return value - */ - @javax.annotation.Nonnull - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public WebhookHeaderModel isSecure(Boolean isSecure) { - this.isSecure = isSecure; - return this; - } - - /** - * Indicates whether the header value is sensitive. - * - * @return isSecure - */ - @javax.annotation.Nullable - public Boolean getIsSecure() { - return isSecure; - } +import com.configcat.publicapi.java.client.JSON; - public void setIsSecure(Boolean isSecure) { - this.isSecure = isSecure; +/** + * WebhookHeaderModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class WebhookHeaderModel { + public static final String SERIALIZED_NAME_KEY = "key"; + @SerializedName(SERIALIZED_NAME_KEY) + private String key; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + + public static final String SERIALIZED_NAME_IS_SECURE = "isSecure"; + @SerializedName(SERIALIZED_NAME_IS_SECURE) + private Boolean isSecure; + + public WebhookHeaderModel() { + } + + public WebhookHeaderModel key(String key) { + this.key = key; + return this; + } + + /** + * The HTTP header key. + * @return key + */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + + public WebhookHeaderModel value(String value) { + this.value = value; + return this; + } + + /** + * The HTTP header value. + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + + public WebhookHeaderModel isSecure(Boolean isSecure) { + this.isSecure = isSecure; + return this; + } + + /** + * Indicates whether the header value is sensitive. + * @return isSecure + */ + @javax.annotation.Nullable + public Boolean getIsSecure() { + return isSecure; + } + + public void setIsSecure(Boolean isSecure) { + this.isSecure = isSecure; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookHeaderModel instance itself + */ + public WebhookHeaderModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebhookHeaderModel webhookHeaderModel = (WebhookHeaderModel) o; - return Objects.equals(this.key, webhookHeaderModel.key) - && Objects.equals(this.value, webhookHeaderModel.value) - && Objects.equals(this.isSecure, webhookHeaderModel.isSecure); + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - @Override - public int hashCode() { - return Objects.hash(key, value, isSecure); - } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WebhookHeaderModel {\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append(" isSecure: ").append(toIndentedString(isSecure)).append("\n"); - sb.append("}"); - return sb.toString(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("key"); - openapiFields.add("value"); - openapiFields.add("isSecure"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - openapiRequiredFields.add("key"); - openapiRequiredFields.add("value"); + WebhookHeaderModel webhookHeaderModel = (WebhookHeaderModel) o; + return Objects.equals(this.key, webhookHeaderModel.key) && + Objects.equals(this.value, webhookHeaderModel.value) && + Objects.equals(this.isSecure, webhookHeaderModel.isSecure)&& + Objects.equals(this.additionalProperties, webhookHeaderModel.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, isSecure, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookHeaderModel {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" isSecure: ").append(toIndentedString(isSecure)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to WebhookHeaderModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!WebhookHeaderModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in WebhookHeaderModel is not found in" - + " the empty JSON string", - WebhookHeaderModel.openapiRequiredFields.toString())); - } - } - - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!WebhookHeaderModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `WebhookHeaderModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key"); + openapiFields.add("value"); + openapiFields.add("isSecure"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("key"); + openapiRequiredFields.add("value"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookHeaderModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookHeaderModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookHeaderModel is not found in the empty JSON string", WebhookHeaderModel.openapiRequiredFields.toString())); } + } - // check to make sure all required properties/fields are present in the JSON string - for (String requiredField : WebhookHeaderModel.openapiRequiredFields) { - if (jsonElement.getAsJsonObject().get(requiredField) == null) { - throw new IllegalArgumentException( - String.format( - "The required field `%s` is not found in the JSON string: %s", - requiredField, jsonElement.toString())); - } + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookHeaderModel.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if (!jsonObj.get("key").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `key` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("key").toString())); - } - if (!jsonObj.get("value").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `value` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("value").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WebhookHeaderModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WebhookHeaderModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(WebhookHeaderModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, WebhookHeaderModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WebhookHeaderModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of WebhookHeaderModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of WebhookHeaderModel - * @throws IOException if the JSON string is invalid with respect to WebhookHeaderModel - */ - public static WebhookHeaderModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WebhookHeaderModel.class); - } - - /** - * Convert an instance of WebhookHeaderModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + if (!jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + if (!jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookHeaderModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookHeaderModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookHeaderModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookHeaderModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookHeaderModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookHeaderModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); } + } + + /** + * Create an instance of WebhookHeaderModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookHeaderModel + * @throws IOException if the JSON string is invalid with respect to WebhookHeaderModel + */ + public static WebhookHeaderModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookHeaderModel.class); + } + + /** + * Convert an instance of WebhookHeaderModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/WebhookModel.java b/src/main/java/com/configcat/publicapi/java/client/model/WebhookModel.java index 2466b81..148c655 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/WebhookModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/WebhookModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,423 +10,489 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.configcat.publicapi.java.client.model.WebHookHttpMethod; +import com.configcat.publicapi.java.client.model.WebhookConfig; +import com.configcat.publicapi.java.client.model.WebhookEnvironment; +import com.configcat.publicapi.java.client.model.WebhookHeaderModel; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; - -/** WebhookModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") -public class WebhookModel { - public static final String SERIALIZED_NAME_WEBHOOK_ID = "webhookId"; - - @SerializedName(SERIALIZED_NAME_WEBHOOK_ID) - private Integer webhookId; - - public static final String SERIALIZED_NAME_URL = "url"; - - @SerializedName(SERIALIZED_NAME_URL) - private String url; - - public static final String SERIALIZED_NAME_HTTP_METHOD = "httpMethod"; - - @SerializedName(SERIALIZED_NAME_HTTP_METHOD) - private WebHookHttpMethod httpMethod; - - public static final String SERIALIZED_NAME_CONTENT = "content"; - - @SerializedName(SERIALIZED_NAME_CONTENT) - private String content; - - public static final String SERIALIZED_NAME_WEB_HOOK_HEADERS = "webHookHeaders"; - - @SerializedName(SERIALIZED_NAME_WEB_HOOK_HEADERS) - private List webHookHeaders; - public static final String SERIALIZED_NAME_CONFIG = "config"; - - @SerializedName(SERIALIZED_NAME_CONFIG) - private WebhookConfig config; - - public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; - - @SerializedName(SERIALIZED_NAME_ENVIRONMENT) - private WebhookEnvironment environment; - - public WebhookModel() {} - - public WebhookModel webhookId(Integer webhookId) { - this.webhookId = webhookId; - return this; - } - - /** - * The identifier of the Webhook. - * - * @return webhookId - */ - @javax.annotation.Nullable - public Integer getWebhookId() { - return webhookId; - } - - public void setWebhookId(Integer webhookId) { - this.webhookId = webhookId; - } - - public WebhookModel url(String url) { - this.url = url; - return this; - } - - /** - * The URL of the Webhook. - * - * @return url - */ - @javax.annotation.Nullable - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public WebhookModel httpMethod(WebHookHttpMethod httpMethod) { - this.httpMethod = httpMethod; - return this; - } - - /** - * Get httpMethod - * - * @return httpMethod - */ - @javax.annotation.Nullable - public WebHookHttpMethod getHttpMethod() { - return httpMethod; - } - - public void setHttpMethod(WebHookHttpMethod httpMethod) { - this.httpMethod = httpMethod; - } - - public WebhookModel content(String content) { - this.content = content; - return this; - } - - /** - * The HTTP body content. - * - * @return content - */ - @javax.annotation.Nullable - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public WebhookModel webHookHeaders(List webHookHeaders) { - this.webHookHeaders = webHookHeaders; - return this; - } - - public WebhookModel addWebHookHeadersItem(WebhookHeaderModel webHookHeadersItem) { - if (this.webHookHeaders == null) { - this.webHookHeaders = new ArrayList<>(); - } - this.webHookHeaders.add(webHookHeadersItem); - return this; - } - - /** - * List of HTTP headers that the Webhook must send. - * - * @return webHookHeaders - */ - @javax.annotation.Nullable - public List getWebHookHeaders() { - return webHookHeaders; - } - - public void setWebHookHeaders(List webHookHeaders) { - this.webHookHeaders = webHookHeaders; - } - - public WebhookModel config(WebhookConfig config) { - this.config = config; - return this; - } - - /** - * Get config - * - * @return config - */ - @javax.annotation.Nullable - public WebhookConfig getConfig() { - return config; - } - - public void setConfig(WebhookConfig config) { - this.config = config; - } - - public WebhookModel environment(WebhookEnvironment environment) { - this.environment = environment; - return this; - } - - /** - * Get environment - * - * @return environment - */ - @javax.annotation.Nullable - public WebhookEnvironment getEnvironment() { - return environment; - } - - public void setEnvironment(WebhookEnvironment environment) { - this.environment = environment; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebhookModel webhookModel = (WebhookModel) o; - return Objects.equals(this.webhookId, webhookModel.webhookId) - && Objects.equals(this.url, webhookModel.url) - && Objects.equals(this.httpMethod, webhookModel.httpMethod) - && Objects.equals(this.content, webhookModel.content) - && Objects.equals(this.webHookHeaders, webhookModel.webHookHeaders) - && Objects.equals(this.config, webhookModel.config) - && Objects.equals(this.environment, webhookModel.environment); - } - - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } - - @Override - public int hashCode() { - return Objects.hash( - webhookId, url, httpMethod, content, webHookHeaders, config, environment); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WebhookModel {\n"); - sb.append(" webhookId: ").append(toIndentedString(webhookId)).append("\n"); - sb.append(" url: ").append(toIndentedString(url)).append("\n"); - sb.append(" httpMethod: ").append(toIndentedString(httpMethod)).append("\n"); - sb.append(" content: ").append(toIndentedString(content)).append("\n"); - sb.append(" webHookHeaders: ").append(toIndentedString(webHookHeaders)).append("\n"); - sb.append(" config: ").append(toIndentedString(config)).append("\n"); - sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("webhookId"); - openapiFields.add("url"); - openapiFields.add("httpMethod"); - openapiFields.add("content"); - openapiFields.add("webHookHeaders"); - openapiFields.add("config"); - openapiFields.add("environment"); - - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } - - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to WebhookModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!WebhookModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in WebhookModel is not found in the" - + " empty JSON string", - WebhookModel.openapiRequiredFields.toString())); - } - } +import com.configcat.publicapi.java.client.JSON; - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!WebhookModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `WebhookModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } +/** + * WebhookModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") +public class WebhookModel { + public static final String SERIALIZED_NAME_WEBHOOK_ID = "webhookId"; + @SerializedName(SERIALIZED_NAME_WEBHOOK_ID) + private Integer webhookId; + + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + + public static final String SERIALIZED_NAME_HTTP_METHOD = "httpMethod"; + @SerializedName(SERIALIZED_NAME_HTTP_METHOD) + private WebHookHttpMethod httpMethod; + + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + private String content; + + public static final String SERIALIZED_NAME_WEB_HOOK_HEADERS = "webHookHeaders"; + @SerializedName(SERIALIZED_NAME_WEB_HOOK_HEADERS) + private List webHookHeaders; + + public static final String SERIALIZED_NAME_CONFIG = "config"; + @SerializedName(SERIALIZED_NAME_CONFIG) + private WebhookConfig config; + + public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; + @SerializedName(SERIALIZED_NAME_ENVIRONMENT) + private WebhookEnvironment environment; + + public WebhookModel() { + } + + public WebhookModel webhookId(Integer webhookId) { + this.webhookId = webhookId; + return this; + } + + /** + * The identifier of the Webhook. + * @return webhookId + */ + @javax.annotation.Nullable + public Integer getWebhookId() { + return webhookId; + } + + public void setWebhookId(Integer webhookId) { + this.webhookId = webhookId; + } + + + public WebhookModel url(String url) { + this.url = url; + return this; + } + + /** + * The URL of the Webhook. + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + + public WebhookModel httpMethod(WebHookHttpMethod httpMethod) { + this.httpMethod = httpMethod; + return this; + } + + /** + * Get httpMethod + * @return httpMethod + */ + @javax.annotation.Nullable + public WebHookHttpMethod getHttpMethod() { + return httpMethod; + } + + public void setHttpMethod(WebHookHttpMethod httpMethod) { + this.httpMethod = httpMethod; + } + + + public WebhookModel content(String content) { + this.content = content; + return this; + } + + /** + * The HTTP body content. + * @return content + */ + @javax.annotation.Nullable + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + + public WebhookModel webHookHeaders(List webHookHeaders) { + this.webHookHeaders = webHookHeaders; + return this; + } + + public WebhookModel addWebHookHeadersItem(WebhookHeaderModel webHookHeadersItem) { + if (this.webHookHeaders == null) { + this.webHookHeaders = new ArrayList<>(); + } + this.webHookHeaders.add(webHookHeadersItem); + return this; + } + + /** + * List of HTTP headers that the Webhook must send. + * @return webHookHeaders + */ + @javax.annotation.Nullable + public List getWebHookHeaders() { + return webHookHeaders; + } + + public void setWebHookHeaders(List webHookHeaders) { + this.webHookHeaders = webHookHeaders; + } + + + public WebhookModel config(WebhookConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * @return config + */ + @javax.annotation.Nullable + public WebhookConfig getConfig() { + return config; + } + + public void setConfig(WebhookConfig config) { + this.config = config; + } + + + public WebhookModel environment(WebhookEnvironment environment) { + this.environment = environment; + return this; + } + + /** + * Get environment + * @return environment + */ + @javax.annotation.Nullable + public WebhookEnvironment getEnvironment() { + return environment; + } + + public void setEnvironment(WebhookEnvironment environment) { + this.environment = environment; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookModel instance itself + */ + public WebhookModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookModel webhookModel = (WebhookModel) o; + return Objects.equals(this.webhookId, webhookModel.webhookId) && + Objects.equals(this.url, webhookModel.url) && + Objects.equals(this.httpMethod, webhookModel.httpMethod) && + Objects.equals(this.content, webhookModel.content) && + Objects.equals(this.webHookHeaders, webhookModel.webHookHeaders) && + Objects.equals(this.config, webhookModel.config) && + Objects.equals(this.environment, webhookModel.environment)&& + Objects.equals(this.additionalProperties, webhookModel.additionalProperties); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(webhookId, url, httpMethod, content, webHookHeaders, config, environment, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookModel {\n"); + sb.append(" webhookId: ").append(toIndentedString(webhookId)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" httpMethod: ").append(toIndentedString(httpMethod)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" webHookHeaders: ").append(toIndentedString(webHookHeaders)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + sb.append(" environment: ").append(toIndentedString(environment)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("webhookId"); + openapiFields.add("url"); + openapiFields.add("httpMethod"); + openapiFields.add("content"); + openapiFields.add("webHookHeaders"); + openapiFields.add("config"); + openapiFields.add("environment"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookModel is not found in the empty JSON string", WebhookModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) - && !jsonObj.get("url").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `url` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("url").toString())); + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + // validate the optional field `httpMethod` + if (jsonObj.get("httpMethod") != null && !jsonObj.get("httpMethod").isJsonNull()) { + WebHookHttpMethod.validateJsonElement(jsonObj.get("httpMethod")); + } + if ((jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) && !jsonObj.get("content").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `content` to be a primitive type in the JSON string but got `%s`", jsonObj.get("content").toString())); + } + if (jsonObj.get("webHookHeaders") != null && !jsonObj.get("webHookHeaders").isJsonNull()) { + JsonArray jsonArraywebHookHeaders = jsonObj.getAsJsonArray("webHookHeaders"); + if (jsonArraywebHookHeaders != null) { + // ensure the json data is an array + if (!jsonObj.get("webHookHeaders").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `webHookHeaders` to be an array in the JSON string but got `%s`", jsonObj.get("webHookHeaders").toString())); + } + + // validate the optional field `webHookHeaders` (array) + for (int i = 0; i < jsonArraywebHookHeaders.size(); i++) { + WebhookHeaderModel.validateJsonElement(jsonArraywebHookHeaders.get(i)); + }; } - // validate the optional field `httpMethod` - if (jsonObj.get("httpMethod") != null && !jsonObj.get("httpMethod").isJsonNull()) { - WebHookHttpMethod.validateJsonElement(jsonObj.get("httpMethod")); - } - if ((jsonObj.get("content") != null && !jsonObj.get("content").isJsonNull()) - && !jsonObj.get("content").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `content` to be a primitive type in the JSON" - + " string but got `%s`", - jsonObj.get("content").toString())); - } - if (jsonObj.get("webHookHeaders") != null && !jsonObj.get("webHookHeaders").isJsonNull()) { - JsonArray jsonArraywebHookHeaders = jsonObj.getAsJsonArray("webHookHeaders"); - if (jsonArraywebHookHeaders != null) { - // ensure the json data is an array - if (!jsonObj.get("webHookHeaders").isJsonArray()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `webHookHeaders` to be an array in the" - + " JSON string but got `%s`", - jsonObj.get("webHookHeaders").toString())); - } - - // validate the optional field `webHookHeaders` (array) - for (int i = 0; i < jsonArraywebHookHeaders.size(); i++) { - WebhookHeaderModel.validateJsonElement(jsonArraywebHookHeaders.get(i)); - } - ; - } - } - // validate the optional field `config` - if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { - WebhookConfig.validateJsonElement(jsonObj.get("config")); - } - // validate the optional field `environment` - if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { - WebhookEnvironment.validateJsonElement(jsonObj.get("environment")); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WebhookModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WebhookModel' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(WebhookModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, WebhookModel value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WebhookModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } - - /** - * Create an instance of WebhookModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of WebhookModel - * @throws IOException if the JSON string is invalid with respect to WebhookModel - */ - public static WebhookModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WebhookModel.class); - } - - /** - * Convert an instance of WebhookModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); - } + } + // validate the optional field `config` + if (jsonObj.get("config") != null && !jsonObj.get("config").isJsonNull()) { + WebhookConfig.validateJsonElement(jsonObj.get("config")); + } + // validate the optional field `environment` + if (jsonObj.get("environment") != null && !jsonObj.get("environment").isJsonNull()) { + WebhookEnvironment.validateJsonElement(jsonObj.get("environment")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookModel.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of WebhookModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookModel + * @throws IOException if the JSON string is invalid with respect to WebhookModel + */ + public static WebhookModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookModel.class); + } + + /** + * Convert an instance of WebhookModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + diff --git a/src/main/java/com/configcat/publicapi/java/client/model/WebhookSigningKeysModel.java b/src/main/java/com/configcat/publicapi/java/client/model/WebhookSigningKeysModel.java index d8c21c0..191d09c 100644 --- a/src/main/java/com/configcat/publicapi/java/client/model/WebhookSigningKeysModel.java +++ b/src/main/java/com/configcat/publicapi/java/client/model/WebhookSigningKeysModel.java @@ -1,6 +1,6 @@ /* * ConfigCat Public Management API - * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. + * The purpose of this API is to access the ConfigCat platform programmatically. You can **Create**, **Read**, **Update** and **Delete** any entities like **Feature Flags, Configs, Environments** or **Products** within ConfigCat. **Base API URL**: https://api.configcat.com If you prefer the swagger documentation, you can find it here: [Swagger UI](https://api.configcat.com/swagger). The API is based on HTTP REST, uses resource-oriented URLs, status codes and supports JSON format. **Important:** Do not use this API for accessing and evaluating feature flag values. Use the [SDKs](https://configcat.com/docs/sdk-reference/overview) or the [ConfigCat Proxy](https://configcat.com/docs/advanced/proxy/proxy-overview/) instead. # OpenAPI Specification The complete specification is publicly available in the following formats: - [OpenAPI v3](https://api.configcat.com/docs/v1/swagger.json) - [Swagger v2](https://api.configcat.com/docs/v1/swagger.v2.json) You can use it to generate client libraries in various languages with [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator) or [Swagger Codegen](https://swagger.io/tools/swagger-codegen/) to interact with this API. # Authentication This API uses the [Basic HTTP Authentication Scheme](https://en.wikipedia.org/wiki/Basic_access_authentication). # Throttling and rate limits All the rate limited API calls are returning information about the current rate limit period in the following HTTP headers: | Header | Description | | :- | :- | | X-Rate-Limit-Remaining | The maximum number of requests remaining in the current rate limit period. | | X-Rate-Limit-Reset | The time when the current rate limit period resets. | When the rate limit is exceeded by a request, the API returns with a `HTTP 429 - Too many requests` status along with a `Retry-After` HTTP header. * * The version of the OpenAPI document: v1 * Contact: support@configcat.com @@ -10,247 +10,319 @@ * Do not edit the class manually. */ + package com.configcat.publicapi.java.client.model; +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -import com.configcat.publicapi.java.client.JSON; import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonParseException; import com.google.gson.TypeAdapterFactory; -import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.util.Arrays; + +import java.lang.reflect.Type; +import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; -import org.openapitools.jackson.nullable.JsonNullable; -/** WebhookSigningKeysModel */ -@javax.annotation.Generated( - value = "org.openapitools.codegen.languages.JavaClientCodegen", - date = "2024-10-09T12:38:06.739118192Z[Etc/UTC]", - comments = "Generator version: 7.7.0") +import com.configcat.publicapi.java.client.JSON; + +/** + * WebhookSigningKeysModel + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-02-20T16:55:24.304297906Z[Etc/UTC]", comments = "Generator version: 7.7.0") public class WebhookSigningKeysModel { - public static final String SERIALIZED_NAME_KEY1 = "key1"; + public static final String SERIALIZED_NAME_KEY1 = "key1"; + @SerializedName(SERIALIZED_NAME_KEY1) + private String key1; - @SerializedName(SERIALIZED_NAME_KEY1) - private String key1; + public static final String SERIALIZED_NAME_KEY2 = "key2"; + @SerializedName(SERIALIZED_NAME_KEY2) + private String key2; - public static final String SERIALIZED_NAME_KEY2 = "key2"; + public WebhookSigningKeysModel() { + } - @SerializedName(SERIALIZED_NAME_KEY2) - private String key2; + public WebhookSigningKeysModel key1(String key1) { + this.key1 = key1; + return this; + } - public WebhookSigningKeysModel() {} + /** + * The first signing key. + * @return key1 + */ + @javax.annotation.Nullable + public String getKey1() { + return key1; + } - public WebhookSigningKeysModel key1(String key1) { - this.key1 = key1; - return this; - } + public void setKey1(String key1) { + this.key1 = key1; + } - /** - * The first signing key. - * - * @return key1 - */ - @javax.annotation.Nullable - public String getKey1() { - return key1; - } - public void setKey1(String key1) { - this.key1 = key1; - } + public WebhookSigningKeysModel key2(String key2) { + this.key2 = key2; + return this; + } - public WebhookSigningKeysModel key2(String key2) { - this.key2 = key2; - return this; - } + /** + * The second signing key. + * @return key2 + */ + @javax.annotation.Nullable + public String getKey2() { + return key2; + } - /** - * The second signing key. - * - * @return key2 - */ - @javax.annotation.Nullable - public String getKey2() { - return key2; - } + public void setKey2(String key2) { + this.key2 = key2; + } - public void setKey2(String key2) { - this.key2 = key2; - } + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - WebhookSigningKeysModel webhookSigningKeysModel = (WebhookSigningKeysModel) o; - return Objects.equals(this.key1, webhookSigningKeysModel.key1) - && Objects.equals(this.key2, webhookSigningKeysModel.key2); + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the WebhookSigningKeysModel instance itself + */ + public WebhookSigningKeysModel putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); } + this.additionalProperties.put(key, value); + return this; + } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b - || (a != null - && b != null - && a.isPresent() - && b.isPresent() - && Objects.deepEquals(a.get(), b.get())); - } + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } - @Override - public int hashCode() { - return Objects.hash(key1, key2); + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; } + return this.additionalProperties.get(key); + } - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[] {a.get()}) : 31; + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + WebhookSigningKeysModel webhookSigningKeysModel = (WebhookSigningKeysModel) o; + return Objects.equals(this.key1, webhookSigningKeysModel.key1) && + Objects.equals(this.key2, webhookSigningKeysModel.key2)&& + Objects.equals(this.additionalProperties, webhookSigningKeysModel.additionalProperties); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class WebhookSigningKeysModel {\n"); - sb.append(" key1: ").append(toIndentedString(key1)).append("\n"); - sb.append(" key2: ").append(toIndentedString(key2)).append("\n"); - sb.append("}"); - return sb.toString(); + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(key1, key2, additionalProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - /** - * Convert the given object to string with each line indented by 4 spaces (except the first - * line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookSigningKeysModel {\n"); + sb.append(" key1: ").append(toIndentedString(key1)).append("\n"); + sb.append(" key2: ").append(toIndentedString(key2)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; } + return o.toString().replace("\n", "\n "); + } - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("key1"); - openapiFields.add("key2"); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("key1"); + openapiFields.add("key2"); - /** - * Validates the JSON Element and throws an exception if issues found - * - * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to WebhookSigningKeysModel - */ - public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!WebhookSigningKeysModel.openapiRequiredFields - .isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException( - String.format( - "The required field(s) %s in WebhookSigningKeysModel is not found" - + " in the empty JSON string", - WebhookSigningKeysModel.openapiRequiredFields.toString())); - } - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - Set> entries = jsonElement.getAsJsonObject().entrySet(); - // check to see if the JSON string contains additional fields - for (Map.Entry entry : entries) { - if (!WebhookSigningKeysModel.openapiFields.contains(entry.getKey())) { - throw new IllegalArgumentException( - String.format( - "The field `%s` in the JSON string is not defined in the" - + " `WebhookSigningKeysModel` properties. JSON: %s", - entry.getKey(), jsonElement.toString())); - } + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookSigningKeysModel + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookSigningKeysModel.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookSigningKeysModel is not found in the empty JSON string", WebhookSigningKeysModel.openapiRequiredFields.toString())); } + } JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("key1") != null && !jsonObj.get("key1").isJsonNull()) - && !jsonObj.get("key1").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `key1` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("key1").toString())); - } - if ((jsonObj.get("key2") != null && !jsonObj.get("key2").isJsonNull()) - && !jsonObj.get("key2").isJsonPrimitive()) { - throw new IllegalArgumentException( - String.format( - "Expected the field `key2` to be a primitive type in the JSON string" - + " but got `%s`", - jsonObj.get("key2").toString())); - } - } + if ((jsonObj.get("key1") != null && !jsonObj.get("key1").isJsonNull()) && !jsonObj.get("key1").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key1` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key1").toString())); + } + if ((jsonObj.get("key2") != null && !jsonObj.get("key2").isJsonNull()) && !jsonObj.get("key2").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key2` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key2").toString())); + } + } - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!WebhookSigningKeysModel.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'WebhookSigningKeysModel' and its - // subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter = - gson.getDelegateAdapter(this, TypeToken.get(WebhookSigningKeysModel.class)); - - return (TypeAdapter) - new TypeAdapter() { - @Override - public void write(JsonWriter out, WebhookSigningKeysModel value) - throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - elementAdapter.write(out, obj); - } - - @Override - public WebhookSigningKeysModel read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - return thisAdapter.fromJsonTree(jsonElement); - } - }.nullSafe(); - } - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookSigningKeysModel.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookSigningKeysModel' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookSigningKeysModel.class)); - /** - * Create an instance of WebhookSigningKeysModel given an JSON string - * - * @param jsonString JSON string - * @return An instance of WebhookSigningKeysModel - * @throws IOException if the JSON string is invalid with respect to WebhookSigningKeysModel - */ - public static WebhookSigningKeysModel fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, WebhookSigningKeysModel.class); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookSigningKeysModel value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public WebhookSigningKeysModel read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + WebhookSigningKeysModel instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } - /** - * Convert an instance of WebhookSigningKeysModel to an JSON string - * - * @return JSON string - */ - public String toJson() { - return JSON.getGson().toJson(this); + }.nullSafe(); } + } + + /** + * Create an instance of WebhookSigningKeysModel given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookSigningKeysModel + * @throws IOException if the JSON string is invalid with respect to WebhookSigningKeysModel + */ + public static WebhookSigningKeysModel fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookSigningKeysModel.class); + } + + /** + * Convert an instance of WebhookSigningKeysModel to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } + From 766f56f77f500e8b353389ec5daab3dc6729e600 Mon Sep 17 00:00:00 2001 From: novalisdenahi Date: Thu, 20 Feb 2025 18:06:16 +0100 Subject: [PATCH 3/3] Update version to 1.1.0 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0b40df4..d0a3bc2 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ apply plugin: 'signing' apply plugin: 'maven-publish' group = 'com.configcat' -version = '1.0.1' +version = '1.1.0' buildscript { repositories {