From 7c2c82dcaf0fe094d1517fd619ac7d2394574669 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Fri, 14 Aug 2026 16:02:03 +0300 Subject: [PATCH] chore: update API clients to latest specification --- changelog.md | 4 + pom.xml | 2 +- qase-api-client/docs/Author.md | 3 +- qase-api-client/docs/AuthorsApi.md | 4 +- qase-api-client/docs/Review.md | 40 + qase-api-client/docs/ReviewBulk.md | 13 + qase-api-client/docs/ReviewBulkResponse.md | 14 + .../docs/ReviewBulkResponseAllOfResult.md | 13 + .../ReviewBulkResponseAllOfResultItems.md | 15 + qase-api-client/docs/ReviewCaseData.md | 44 + qase-api-client/docs/ReviewCreate.md | 15 + qase-api-client/docs/ReviewDetailed.md | 41 + qase-api-client/docs/ReviewListResponse.md | 14 + .../docs/ReviewListResponseAllOfResult.md | 16 + qase-api-client/docs/ReviewProposedCase.md | 44 + qase-api-client/docs/ReviewProposedStep.md | 19 + qase-api-client/docs/ReviewResponse.md | 14 + qase-api-client/docs/ReviewReviewersInner.md | 24 + qase-api-client/docs/ReviewStepData.md | 20 + qase-api-client/docs/ReviewUpdate.md | 14 + qase-api-client/docs/ReviewsApi.md | 496 ++++++++ qase-api-client/docs/TestStepCreate.md | 1 + qase-api-client/pom.xml | 2 +- .../src/main/java/io/qase/client/v1/JSON.java | 16 + .../io/qase/client/v1/api/AuthorsApi.java | 18 +- .../io/qase/client/v1/api/ReviewsApi.java | 1128 +++++++++++++++++ .../java/io/qase/client/v1/models/Author.java | 41 +- .../java/io/qase/client/v1/models/Review.java | 656 ++++++++++ .../io/qase/client/v1/models/ReviewBulk.java | 311 +++++ .../client/v1/models/ReviewBulkResponse.java | 314 +++++ .../models/ReviewBulkResponseAllOfResult.java | 308 +++++ .../ReviewBulkResponseAllOfResultItems.java | 350 +++++ .../qase/client/v1/models/ReviewCaseData.java | 994 +++++++++++++++ .../qase/client/v1/models/ReviewCreate.java | 372 ++++++ .../qase/client/v1/models/ReviewDetailed.java | 682 ++++++++++ .../client/v1/models/ReviewListResponse.java | 314 +++++ .../models/ReviewListResponseAllOfResult.java | 386 ++++++ .../client/v1/models/ReviewProposedCase.java | 1007 +++++++++++++++ .../client/v1/models/ReviewProposedStep.java | 480 +++++++ .../qase/client/v1/models/ReviewResponse.java | 314 +++++ .../v1/models/ReviewReviewersInner.java | 386 ++++++ .../qase/client/v1/models/ReviewStepData.java | 480 +++++++ .../qase/client/v1/models/ReviewUpdate.java | 329 +++++ .../qase/client/v1/models/TestStepCreate.java | 2 +- qase-api-v2-client/pom.xml | 2 +- qase-cucumber-v3-reporter/pom.xml | 2 +- qase-cucumber-v4-reporter/pom.xml | 2 +- qase-cucumber-v5-reporter/pom.xml | 2 +- qase-cucumber-v6-reporter/pom.xml | 2 +- qase-cucumber-v7-reporter/pom.xml | 2 +- qase-java-commons/pom.xml | 2 +- qase-junit4-reporter/pom.xml | 2 +- qase-junit5-reporter/pom.xml | 2 +- qase-testng-reporter/pom.xml | 2 +- 54 files changed, 9752 insertions(+), 28 deletions(-) create mode 100644 qase-api-client/docs/Review.md create mode 100644 qase-api-client/docs/ReviewBulk.md create mode 100644 qase-api-client/docs/ReviewBulkResponse.md create mode 100644 qase-api-client/docs/ReviewBulkResponseAllOfResult.md create mode 100644 qase-api-client/docs/ReviewBulkResponseAllOfResultItems.md create mode 100644 qase-api-client/docs/ReviewCaseData.md create mode 100644 qase-api-client/docs/ReviewCreate.md create mode 100644 qase-api-client/docs/ReviewDetailed.md create mode 100644 qase-api-client/docs/ReviewListResponse.md create mode 100644 qase-api-client/docs/ReviewListResponseAllOfResult.md create mode 100644 qase-api-client/docs/ReviewProposedCase.md create mode 100644 qase-api-client/docs/ReviewProposedStep.md create mode 100644 qase-api-client/docs/ReviewResponse.md create mode 100644 qase-api-client/docs/ReviewReviewersInner.md create mode 100644 qase-api-client/docs/ReviewStepData.md create mode 100644 qase-api-client/docs/ReviewUpdate.md create mode 100644 qase-api-client/docs/ReviewsApi.md create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/api/ReviewsApi.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/Review.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulk.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponse.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponseAllOfResult.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponseAllOfResultItems.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewCaseData.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewCreate.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewDetailed.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewListResponse.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewListResponseAllOfResult.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewProposedCase.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewProposedStep.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewResponse.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewReviewersInner.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewStepData.java create mode 100644 qase-api-client/src/main/java/io/qase/client/v1/models/ReviewUpdate.java diff --git a/changelog.md b/changelog.md index f4b4cc10..2ff53ae2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +# qase-java 4.1.59 + +- Updated API clients to the latest specification + # qase-java 4.1.58 - Updated API clients to the latest specification diff --git a/pom.xml b/pom.xml index 92ff4d80..9d147be1 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ io.qase qase-java pom - 4.1.58 + 4.1.59 qase-java-commons qase-api-client diff --git a/qase-api-client/docs/Author.md b/qase-api-client/docs/Author.md index 4e4cc159..f988ee63 100644 --- a/qase-api-client/docs/Author.md +++ b/qase-api-client/docs/Author.md @@ -8,7 +8,8 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**id** | **Long** | | [optional] | -|**authorId** | **Long** | | [optional] | +|**uuid** | **UUID** | Author UUID. Use it to reference the author in other API methods. | [optional] | +|**authorId** | **Long** | Deprecated, use `uuid` instead. | [optional] | |**entityType** | **String** | | [optional] | |**entityId** | **Long** | | [optional] | |**email** | **String** | | [optional] | diff --git a/qase-api-client/docs/AuthorsApi.md b/qase-api-client/docs/AuthorsApi.md index 7fd9ab9b..804863fd 100644 --- a/qase-api-client/docs/AuthorsApi.md +++ b/qase-api-client/docs/AuthorsApi.md @@ -38,7 +38,7 @@ public class Example { //TokenAuth.setApiKeyPrefix("Token"); AuthorsApi apiInstance = new AuthorsApi(defaultClient); - Integer id = 56; // Integer | Identifier. + String id = "id_example"; // String | Author UUID, or the deprecated integer author ID. try { AuthorResponse result = apiInstance.getAuthor(id); System.out.println(result); @@ -57,7 +57,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **id** | **Integer**| Identifier. | | +| **id** | **String**| Author UUID, or the deprecated integer author ID. | | ### Return type diff --git a/qase-api-client/docs/Review.md b/qase-api-client/docs/Review.md new file mode 100644 index 00000000..e2546b0c --- /dev/null +++ b/qase-api-client/docs/Review.md @@ -0,0 +1,40 @@ + + +# Review + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Review ID, unique within the project. | [optional] | +|**title** | **String** | | [optional] | +|**type** | [**TypeEnum**](#TypeEnum) | `create` — the review proposes a new test case; `edit` — the review proposes changes to an existing test case. | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | | [optional] | +|**caseId** | **Long** | ID of the reviewed test case. Null for new-case draft reviews. | [optional] | +|**authorUuid** | **UUID** | Author UUID of the review creator (see `GET /author`). | [optional] | +|**reviewers** | [**List<ReviewReviewersInner>**](ReviewReviewersInner.md) | | [optional] | +|**createdAt** | **OffsetDateTime** | | [optional] | +|**updatedAt** | **OffsetDateTime** | | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| CREATE | "create" | +| EDIT | "edit" | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| OPEN | "open" | +| MERGED | "merged" | +| DECLINED | "declined" | + + + diff --git a/qase-api-client/docs/ReviewBulk.md b/qase-api-client/docs/ReviewBulk.md new file mode 100644 index 00000000..9b461bad --- /dev/null +++ b/qase-api-client/docs/ReviewBulk.md @@ -0,0 +1,13 @@ + + +# ReviewBulk + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**reviews** | [**List<ReviewCreate>**](ReviewCreate.md) | Validated as a whole: if any item is invalid nothing is created. Otherwise each item is processed on its own and reported in the response. | | + + + diff --git a/qase-api-client/docs/ReviewBulkResponse.md b/qase-api-client/docs/ReviewBulkResponse.md new file mode 100644 index 00000000..a54bdc03 --- /dev/null +++ b/qase-api-client/docs/ReviewBulkResponse.md @@ -0,0 +1,14 @@ + + +# ReviewBulkResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | | [optional] | +|**result** | [**ReviewBulkResponseAllOfResult**](ReviewBulkResponseAllOfResult.md) | | [optional] | + + + diff --git a/qase-api-client/docs/ReviewBulkResponseAllOfResult.md b/qase-api-client/docs/ReviewBulkResponseAllOfResult.md new file mode 100644 index 00000000..ba530c46 --- /dev/null +++ b/qase-api-client/docs/ReviewBulkResponseAllOfResult.md @@ -0,0 +1,13 @@ + + +# ReviewBulkResponseAllOfResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**items** | [**List<ReviewBulkResponseAllOfResultItems>**](ReviewBulkResponseAllOfResultItems.md) | Per-item outcomes, in request order. | [optional] | + + + diff --git a/qase-api-client/docs/ReviewBulkResponseAllOfResultItems.md b/qase-api-client/docs/ReviewBulkResponseAllOfResultItems.md new file mode 100644 index 00000000..9f55110e --- /dev/null +++ b/qase-api-client/docs/ReviewBulkResponseAllOfResultItems.md @@ -0,0 +1,15 @@ + + +# ReviewBulkResponseAllOfResultItems + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**reviewId** | **Long** | ID of the created review. Null when the item failed. | [optional] | +|**caseId** | **Long** | The `case_id` submitted with the item, echoed back for correlation. Null for new-case draft reviews. | [optional] | +|**error** | **String** | Failure reason. Null when the item was created. | [optional] | + + + diff --git a/qase-api-client/docs/ReviewCaseData.md b/qase-api-client/docs/ReviewCaseData.md new file mode 100644 index 00000000..aa6b9b8a --- /dev/null +++ b/qase-api-client/docs/ReviewCaseData.md @@ -0,0 +1,44 @@ + + +# ReviewCaseData + +The test case fields proposed by the review. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**title** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**preconditions** | **String** | | [optional] | +|**postconditions** | **String** | | [optional] | +|**severity** | **Integer** | | [optional] | +|**priority** | **Integer** | | [optional] | +|**behavior** | **Integer** | | [optional] | +|**type** | **Integer** | | [optional] | +|**layer** | **Integer** | | [optional] | +|**isFlaky** | **Integer** | | [optional] | +|**isMuted** | **Boolean** | Mute state of the proposed test case. | [optional] | +|**suiteId** | **Long** | | [optional] | +|**milestoneId** | **Long** | | [optional] | +|**isManual** | **Boolean** | `true` if the case is manual, `false` if it is automated. | [optional] | +|**isToBeAutomated** | **Boolean** | `true` if a manual case is planned to be automated. | [optional] | +|**status** | **Integer** | | [optional] | +|**stepsType** | [**StepsTypeEnum**](#StepsTypeEnum) | Format of the steps field. Omit to keep the current one, `classic` for a new-case draft; changing it requires sending `steps` in the same request. | [optional] | +|**attachments** | **List<String>** | A list of Attachment hashes. | [optional] | +|**steps** | [**List<ReviewStepData>**](ReviewStepData.md) | For gherkin steps send the scenario in `value`. | [optional] | +|**tags** | **List<String>** | | [optional] | +|**parameters** | [**List<TestCaseParameterCreate>**](TestCaseParameterCreate.md) | | [optional] | +|**customField** | **Map<String, String>** | Map of custom field ID to value. A `create` review must carry every required custom field. An `edit` review is validated against the current test case, so send only the fields the proposal changes. | [optional] | + + + +## Enum: StepsTypeEnum + +| Name | Value | +|---- | -----| +| CLASSIC | "classic" | +| GHERKIN | "gherkin" | + + + diff --git a/qase-api-client/docs/ReviewCreate.md b/qase-api-client/docs/ReviewCreate.md new file mode 100644 index 00000000..d0cff523 --- /dev/null +++ b/qase-api-client/docs/ReviewCreate.md @@ -0,0 +1,15 @@ + + +# ReviewCreate + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**caseId** | **Long** | ID of the reviewed test case. When present an `edit` review is created, otherwise a `create` review with a new-case draft. | [optional] | +|**reviewers** | **List<UUID>** | Author UUIDs of team members to assign as reviewers (see `GET /author`). | [optional] | +|**proposedCase** | [**ReviewCaseData**](ReviewCaseData.md) | For `create` reviews `title` and all required project fields are required. For `edit` reviews send only the fields the proposal changes. | | + + + diff --git a/qase-api-client/docs/ReviewDetailed.md b/qase-api-client/docs/ReviewDetailed.md new file mode 100644 index 00000000..d496db94 --- /dev/null +++ b/qase-api-client/docs/ReviewDetailed.md @@ -0,0 +1,41 @@ + + +# ReviewDetailed + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**id** | **Long** | Review ID, unique within the project. | [optional] | +|**title** | **String** | | [optional] | +|**type** | [**TypeEnum**](#TypeEnum) | `create` — the review proposes a new test case; `edit` — the review proposes changes to an existing test case. | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | | [optional] | +|**caseId** | **Long** | ID of the reviewed test case. Null for new-case draft reviews. | [optional] | +|**authorUuid** | **UUID** | Author UUID of the review creator (see `GET /author`). | [optional] | +|**reviewers** | [**List<ReviewReviewersInner>**](ReviewReviewersInner.md) | | [optional] | +|**createdAt** | **OffsetDateTime** | | [optional] | +|**updatedAt** | **OffsetDateTime** | | [optional] | +|**proposedCase** | **Object** | The proposed test case state. Merging the review applies it to the test case. | [optional] | + + + +## Enum: TypeEnum + +| Name | Value | +|---- | -----| +| CREATE | "create" | +| EDIT | "edit" | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| OPEN | "open" | +| MERGED | "merged" | +| DECLINED | "declined" | + + + diff --git a/qase-api-client/docs/ReviewListResponse.md b/qase-api-client/docs/ReviewListResponse.md new file mode 100644 index 00000000..8ba36c4e --- /dev/null +++ b/qase-api-client/docs/ReviewListResponse.md @@ -0,0 +1,14 @@ + + +# ReviewListResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | | [optional] | +|**result** | [**ReviewListResponseAllOfResult**](ReviewListResponseAllOfResult.md) | | [optional] | + + + diff --git a/qase-api-client/docs/ReviewListResponseAllOfResult.md b/qase-api-client/docs/ReviewListResponseAllOfResult.md new file mode 100644 index 00000000..5f624208 --- /dev/null +++ b/qase-api-client/docs/ReviewListResponseAllOfResult.md @@ -0,0 +1,16 @@ + + +# ReviewListResponseAllOfResult + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**total** | **Integer** | | [optional] | +|**filtered** | **Integer** | | [optional] | +|**count** | **Integer** | | [optional] | +|**entities** | [**List<Review>**](Review.md) | | [optional] | + + + diff --git a/qase-api-client/docs/ReviewProposedCase.md b/qase-api-client/docs/ReviewProposedCase.md new file mode 100644 index 00000000..735365be --- /dev/null +++ b/qase-api-client/docs/ReviewProposedCase.md @@ -0,0 +1,44 @@ + + +# ReviewProposedCase + +The test case state proposed by the review. Only the fields the proposal carries are present. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**title** | **String** | | [optional] | +|**description** | **String** | | [optional] | +|**preconditions** | **String** | | [optional] | +|**postconditions** | **String** | | [optional] | +|**severity** | **Integer** | | [optional] | +|**priority** | **Integer** | | [optional] | +|**behavior** | **Integer** | | [optional] | +|**type** | **Integer** | | [optional] | +|**layer** | **Integer** | | [optional] | +|**isFlaky** | **Integer** | | [optional] | +|**isMuted** | **Boolean** | | [optional] | +|**suiteId** | **Long** | | [optional] | +|**milestoneId** | **Long** | | [optional] | +|**isManual** | **Boolean** | `true` if the case is manual, `false` if it is automated. | [optional] | +|**isToBeAutomated** | **Boolean** | `true` if a manual case is planned to be automated. | [optional] | +|**status** | **Integer** | | [optional] | +|**stepsType** | [**StepsTypeEnum**](#StepsTypeEnum) | | [optional] | +|**attachments** | **List<String>** | Attachment hashes. | [optional] | +|**steps** | [**List<ReviewProposedStep>**](ReviewProposedStep.md) | | [optional] | +|**tags** | **List<String>** | | [optional] | +|**parameters** | [**List<TestCaseParameter>**](TestCaseParameter.md) | | [optional] | +|**customFields** | [**List<CustomFieldValue>**](CustomFieldValue.md) | | [optional] | + + + +## Enum: StepsTypeEnum + +| Name | Value | +|---- | -----| +| CLASSIC | "classic" | +| GHERKIN | "gherkin" | + + + diff --git a/qase-api-client/docs/ReviewProposedStep.md b/qase-api-client/docs/ReviewProposedStep.md new file mode 100644 index 00000000..3e9b9f50 --- /dev/null +++ b/qase-api-client/docs/ReviewProposedStep.md @@ -0,0 +1,19 @@ + + +# ReviewProposedStep + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**action** | **String** | Step action text. Used for classic steps. For gherkin steps, use the \"value\" property instead. | [optional] | +|**expectedResult** | **String** | | [optional] | +|**data** | **String** | | [optional] | +|**value** | **String** | Gherkin scenario text. Used when steps_type is \"gherkin\". | [optional] | +|**shared** | **String** | Hash of the referenced shared step. | [optional] | +|**attachments** | **List<String>** | A list of Attachment hashes. | [optional] | +|**steps** | **List<Object>** | Nested steps use the same structure. | [optional] | + + + diff --git a/qase-api-client/docs/ReviewResponse.md b/qase-api-client/docs/ReviewResponse.md new file mode 100644 index 00000000..4f8763b6 --- /dev/null +++ b/qase-api-client/docs/ReviewResponse.md @@ -0,0 +1,14 @@ + + +# ReviewResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**status** | **Boolean** | | [optional] | +|**result** | [**ReviewDetailed**](ReviewDetailed.md) | | [optional] | + + + diff --git a/qase-api-client/docs/ReviewReviewersInner.md b/qase-api-client/docs/ReviewReviewersInner.md new file mode 100644 index 00000000..b25065e6 --- /dev/null +++ b/qase-api-client/docs/ReviewReviewersInner.md @@ -0,0 +1,24 @@ + + +# ReviewReviewersInner + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**authorUuid** | **UUID** | Author UUID of the reviewer (see `GET /author`). | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | | [optional] | + + + +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| UNAPPROVED | "unapproved" | +| APPROVED | "approved" | +| CHANGES_REQUESTED | "changes_requested" | + + + diff --git a/qase-api-client/docs/ReviewStepData.md b/qase-api-client/docs/ReviewStepData.md new file mode 100644 index 00000000..ed7ffc35 --- /dev/null +++ b/qase-api-client/docs/ReviewStepData.md @@ -0,0 +1,20 @@ + + +# ReviewStepData + +A step of the proposed test case. When `steps_type` is `gherkin` the step carries the scenario in `value` and nothing else: a non-empty `action`, `expected_result`, `data`, `attachments`, `shared` or nested `steps` is rejected. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**action** | **String** | Step action text. Classic steps only. | [optional] | +|**shared** | **String** | Hash of an existing shared step to insert at this position. | [optional] | +|**expectedResult** | **String** | | [optional] | +|**data** | **String** | | [optional] | +|**value** | **String** | Gherkin scenario text. Used when steps_type is \"gherkin\". Example: \"Given a user exists\\nWhen they log in\\nThen they see the dashboard\" | [optional] | +|**attachments** | **List<String>** | A list of Attachment hashes. | [optional] | +|**steps** | **List<Object>** | Nested steps may be passed here. Use same structure for them. | [optional] | + + + diff --git a/qase-api-client/docs/ReviewUpdate.md b/qase-api-client/docs/ReviewUpdate.md new file mode 100644 index 00000000..5cbfee6e --- /dev/null +++ b/qase-api-client/docs/ReviewUpdate.md @@ -0,0 +1,14 @@ + + +# ReviewUpdate + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**reviewers** | **List<UUID>** | Author UUIDs of team members assigned as reviewers (see `GET /author`). When provided, replaces the current reviewer list; an empty array removes all reviewers. Omit to leave reviewers unchanged. | [optional] | +|**proposedCase** | [**ReviewCaseData**](ReviewCaseData.md) | Sent fields are merged into the stored proposal. Changing the proposal resets all existing approvals; updating only the reviewers keeps them. | [optional] | + + + diff --git a/qase-api-client/docs/ReviewsApi.md b/qase-api-client/docs/ReviewsApi.md new file mode 100644 index 00000000..c265ce1b --- /dev/null +++ b/qase-api-client/docs/ReviewsApi.md @@ -0,0 +1,496 @@ +# ReviewsApi + +All URIs are relative to *https://api.qase.io/v1* + +| Method | HTTP request | Description | +|------------- | ------------- | -------------| +| [**bulkCreateReviews**](ReviewsApi.md#bulkCreateReviews) | **POST** /review/{code}/bulk | Create reviews in bulk | +| [**createReview**](ReviewsApi.md#createReview) | **POST** /review/{code} | Create a new review | +| [**deleteReview**](ReviewsApi.md#deleteReview) | **DELETE** /review/{code}/{id} | Delete review | +| [**getReview**](ReviewsApi.md#getReview) | **GET** /review/{code}/{id} | Get a specific review | +| [**getReviews**](ReviewsApi.md#getReviews) | **GET** /review/{code} | Get all reviews | +| [**updateReview**](ReviewsApi.md#updateReview) | **PATCH** /review/{code}/{id} | Update review | + + + +# **bulkCreateReviews** +> ReviewBulkResponse bulkCreateReviews(code, reviewBulk) + +Create reviews in bulk + +This method allows to submit multiple test cases for review in one request. Returns an error if test case review is disabled in the project settings. + +### Example +```java +// Import classes: +import io.qase.client.v1.ApiClient; +import io.qase.client.v1.ApiException; +import io.qase.client.v1.Configuration; +import io.qase.client.v1.auth.*; +import io.qase.client.v1.models.*; +import io.qase.client.v1.api.ReviewsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.qase.io/v1"); + + // Configure API key authorization: TokenAuth + ApiKeyAuth TokenAuth = (ApiKeyAuth) defaultClient.getAuthentication("TokenAuth"); + TokenAuth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //TokenAuth.setApiKeyPrefix("Token"); + + ReviewsApi apiInstance = new ReviewsApi(defaultClient); + String code = "code_example"; // String | Code of project, where to search entities. + ReviewBulk reviewBulk = new ReviewBulk(); // ReviewBulk | + try { + ReviewBulkResponse result = apiInstance.bulkCreateReviews(code, reviewBulk); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReviewsApi#bulkCreateReviews"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **code** | **String**| Code of project, where to search entities. | | +| **reviewBulk** | [**ReviewBulk**](ReviewBulk.md)| | | + +### Return type + +[**ReviewBulkResponse**](ReviewBulkResponse.md) + +### Authorization + +[TokenAuth](../README.md#TokenAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Per-item outcomes for the submitted reviews. | - | +| **400** | Bad Request. | - | +| **401** | Unauthorized. | - | +| **402** | Payment Required. | - | +| **403** | Forbidden. | - | +| **404** | Not Found. | - | +| **422** | Unprocessable Entity. | - | +| **429** | Too Many Requests. | - | + + +# **createReview** +> IdResponse createReview(code, reviewCreate) + +Create a new review + +This method allows to submit a test case for review in selected project. Returns an error if test case review is disabled in the project settings. + +### Example +```java +// Import classes: +import io.qase.client.v1.ApiClient; +import io.qase.client.v1.ApiException; +import io.qase.client.v1.Configuration; +import io.qase.client.v1.auth.*; +import io.qase.client.v1.models.*; +import io.qase.client.v1.api.ReviewsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.qase.io/v1"); + + // Configure API key authorization: TokenAuth + ApiKeyAuth TokenAuth = (ApiKeyAuth) defaultClient.getAuthentication("TokenAuth"); + TokenAuth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //TokenAuth.setApiKeyPrefix("Token"); + + ReviewsApi apiInstance = new ReviewsApi(defaultClient); + String code = "code_example"; // String | Code of project, where to search entities. + ReviewCreate reviewCreate = new ReviewCreate(); // ReviewCreate | + try { + IdResponse result = apiInstance.createReview(code, reviewCreate); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReviewsApi#createReview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **code** | **String**| Code of project, where to search entities. | | +| **reviewCreate** | [**ReviewCreate**](ReviewCreate.md)| | | + +### Return type + +[**IdResponse**](IdResponse.md) + +### Authorization + +[TokenAuth](../README.md#TokenAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A result. | - | +| **400** | Bad Request. | - | +| **401** | Unauthorized. | - | +| **402** | Payment Required. | - | +| **403** | Forbidden. | - | +| **404** | Not Found. | - | +| **422** | Unprocessable Entity. | - | +| **429** | Too Many Requests. | - | + + +# **deleteReview** +> IdResponse deleteReview(code, id) + +Delete review + +This method allows to delete a review. Merged reviews cannot be deleted. Returns an error if test case review is disabled in the project settings. + +### Example +```java +// Import classes: +import io.qase.client.v1.ApiClient; +import io.qase.client.v1.ApiException; +import io.qase.client.v1.Configuration; +import io.qase.client.v1.auth.*; +import io.qase.client.v1.models.*; +import io.qase.client.v1.api.ReviewsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.qase.io/v1"); + + // Configure API key authorization: TokenAuth + ApiKeyAuth TokenAuth = (ApiKeyAuth) defaultClient.getAuthentication("TokenAuth"); + TokenAuth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //TokenAuth.setApiKeyPrefix("Token"); + + ReviewsApi apiInstance = new ReviewsApi(defaultClient); + String code = "code_example"; // String | Code of project, where to search entities. + Integer id = 56; // Integer | Identifier. + try { + IdResponse result = apiInstance.deleteReview(code, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReviewsApi#deleteReview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **code** | **String**| Code of project, where to search entities. | | +| **id** | **Integer**| Identifier. | | + +### Return type + +[**IdResponse**](IdResponse.md) + +### Authorization + +[TokenAuth](../README.md#TokenAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A result. | - | +| **400** | Bad Request. | - | +| **401** | Unauthorized. | - | +| **402** | Payment Required. | - | +| **403** | Forbidden. | - | +| **404** | Not Found. | - | +| **422** | Unprocessable Entity. | - | +| **429** | Too Many Requests. | - | + + +# **getReview** +> ReviewResponse getReview(code, id) + +Get a specific review + +This method allows to retrieve a specific review, including its current approval status per reviewer. + +### Example +```java +// Import classes: +import io.qase.client.v1.ApiClient; +import io.qase.client.v1.ApiException; +import io.qase.client.v1.Configuration; +import io.qase.client.v1.auth.*; +import io.qase.client.v1.models.*; +import io.qase.client.v1.api.ReviewsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.qase.io/v1"); + + // Configure API key authorization: TokenAuth + ApiKeyAuth TokenAuth = (ApiKeyAuth) defaultClient.getAuthentication("TokenAuth"); + TokenAuth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //TokenAuth.setApiKeyPrefix("Token"); + + ReviewsApi apiInstance = new ReviewsApi(defaultClient); + String code = "code_example"; // String | Code of project, where to search entities. + Integer id = 56; // Integer | Identifier. + try { + ReviewResponse result = apiInstance.getReview(code, id); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReviewsApi#getReview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **code** | **String**| Code of project, where to search entities. | | +| **id** | **Integer**| Identifier. | | + +### Return type + +[**ReviewResponse**](ReviewResponse.md) + +### Authorization + +[TokenAuth](../README.md#TokenAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A Review. | - | +| **400** | Bad Request. | - | +| **401** | Unauthorized. | - | +| **402** | Payment Required. | - | +| **403** | Forbidden. | - | +| **404** | Not Found. | - | +| **429** | Too Many Requests. | - | + + +# **getReviews** +> ReviewListResponse getReviews(code, status, type, caseId, authorUuid, reviewerUuid, search, limit, offset) + +Get all reviews + +This method allows to retrieve all test case reviews stored in selected project. + +### Example +```java +// Import classes: +import io.qase.client.v1.ApiClient; +import io.qase.client.v1.ApiException; +import io.qase.client.v1.Configuration; +import io.qase.client.v1.auth.*; +import io.qase.client.v1.models.*; +import io.qase.client.v1.api.ReviewsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.qase.io/v1"); + + // Configure API key authorization: TokenAuth + ApiKeyAuth TokenAuth = (ApiKeyAuth) defaultClient.getAuthentication("TokenAuth"); + TokenAuth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //TokenAuth.setApiKeyPrefix("Token"); + + ReviewsApi apiInstance = new ReviewsApi(defaultClient); + String code = "code_example"; // String | Code of project, where to search entities. + String status = "open"; // String | + String type = "create"; // String | + Long caseId = 56L; // Long | Filter reviews by the reviewed test case ID. + UUID authorUuid = UUID.randomUUID(); // UUID | Filter reviews by the author who created them (author UUID). + UUID reviewerUuid = UUID.randomUUID(); // UUID | Filter reviews by an assigned reviewer (author UUID). + String search = "search_example"; // String | Provide a string that will be used to search by review title. + Integer limit = 10; // Integer | A number of entities in result set. + Integer offset = 0; // Integer | How many entities should be skipped. + try { + ReviewListResponse result = apiInstance.getReviews(code, status, type, caseId, authorUuid, reviewerUuid, search, limit, offset); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReviewsApi#getReviews"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **code** | **String**| Code of project, where to search entities. | | +| **status** | **String**| | [optional] [enum: open, merged, declined] | +| **type** | **String**| | [optional] [enum: create, edit] | +| **caseId** | **Long**| Filter reviews by the reviewed test case ID. | [optional] | +| **authorUuid** | **UUID**| Filter reviews by the author who created them (author UUID). | [optional] | +| **reviewerUuid** | **UUID**| Filter reviews by an assigned reviewer (author UUID). | [optional] | +| **search** | **String**| Provide a string that will be used to search by review title. | [optional] | +| **limit** | **Integer**| A number of entities in result set. | [optional] [default to 10] | +| **offset** | **Integer**| How many entities should be skipped. | [optional] [default to 0] | + +### Return type + +[**ReviewListResponse**](ReviewListResponse.md) + +### Authorization + +[TokenAuth](../README.md#TokenAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A list of all reviews. | - | +| **400** | Bad Request. | - | +| **401** | Unauthorized. | - | +| **402** | Payment Required. | - | +| **403** | Forbidden. | - | +| **404** | Not Found. | - | +| **429** | Too Many Requests. | - | + + +# **updateReview** +> IdResponse updateReview(code, id, reviewUpdate) + +Update review + +This method allows to update the assigned reviewers and/or the proposed test case payload of an open review. The reviewed test case cannot be changed. Returns an error if test case review is disabled in the project settings, or if the review is not open. + +### Example +```java +// Import classes: +import io.qase.client.v1.ApiClient; +import io.qase.client.v1.ApiException; +import io.qase.client.v1.Configuration; +import io.qase.client.v1.auth.*; +import io.qase.client.v1.models.*; +import io.qase.client.v1.api.ReviewsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.qase.io/v1"); + + // Configure API key authorization: TokenAuth + ApiKeyAuth TokenAuth = (ApiKeyAuth) defaultClient.getAuthentication("TokenAuth"); + TokenAuth.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //TokenAuth.setApiKeyPrefix("Token"); + + ReviewsApi apiInstance = new ReviewsApi(defaultClient); + String code = "code_example"; // String | Code of project, where to search entities. + Integer id = 56; // Integer | Identifier. + ReviewUpdate reviewUpdate = new ReviewUpdate(); // ReviewUpdate | + try { + IdResponse result = apiInstance.updateReview(code, id, reviewUpdate); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReviewsApi#updateReview"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **code** | **String**| Code of project, where to search entities. | | +| **id** | **Integer**| Identifier. | | +| **reviewUpdate** | [**ReviewUpdate**](ReviewUpdate.md)| | | + +### Return type + +[**IdResponse**](IdResponse.md) + +### Authorization + +[TokenAuth](../README.md#TokenAuth) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | A result. | - | +| **400** | Bad Request. | - | +| **401** | Unauthorized. | - | +| **402** | Payment Required. | - | +| **403** | Forbidden. | - | +| **404** | Not Found. | - | +| **422** | Unprocessable Entity. | - | +| **429** | Too Many Requests. | - | + diff --git a/qase-api-client/docs/TestStepCreate.md b/qase-api-client/docs/TestStepCreate.md index 719a50f6..109a4d4e 100644 --- a/qase-api-client/docs/TestStepCreate.md +++ b/qase-api-client/docs/TestStepCreate.md @@ -2,6 +2,7 @@ # TestStepCreate +When `steps_type` is `gherkin` only the scenario text is read from a step. A non-empty `expected_result`, `data`, `attachments`, `shared` or nested `steps` is rejected, and so is sending the scenario in `value` and `action` at once. ## Properties diff --git a/qase-api-client/pom.xml b/qase-api-client/pom.xml index e6974afc..b7035c8c 100644 --- a/qase-api-client/pom.xml +++ b/qase-api-client/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0 diff --git a/qase-api-client/src/main/java/io/qase/client/v1/JSON.java b/qase-api-client/src/main/java/io/qase/client/v1/JSON.java index b6c74a4e..f7a3cd27 100644 --- a/qase-api-client/src/main/java/io/qase/client/v1/JSON.java +++ b/qase-api-client/src/main/java/io/qase/client/v1/JSON.java @@ -193,6 +193,22 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ResultQuery.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ResultResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ResultUpdate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.Review.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewBulk.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewBulkResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewBulkResponseAllOfResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewBulkResponseAllOfResultItems.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewCaseData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewCreate.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewDetailed.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewListResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewListResponseAllOfResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewProposedCase.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewProposedStep.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewReviewersInner.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewStepData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.ReviewUpdate.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.Run.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.RunCreate.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new io.qase.client.v1.models.RunCreateCloudRunConfig.CustomTypeAdapterFactory()); diff --git a/qase-api-client/src/main/java/io/qase/client/v1/api/AuthorsApi.java b/qase-api-client/src/main/java/io/qase/client/v1/api/AuthorsApi.java index e1283be7..fba4bf4c 100644 --- a/qase-api-client/src/main/java/io/qase/client/v1/api/AuthorsApi.java +++ b/qase-api-client/src/main/java/io/qase/client/v1/api/AuthorsApi.java @@ -75,7 +75,7 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for getAuthor - * @param id Identifier. (required) + * @param id Author UUID, or the deprecated integer author ID. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -91,7 +91,7 @@ public void setCustomBaseUrl(String customBaseUrl) { 429 Too Many Requests. - */ - public okhttp3.Call getAuthorCall(@javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getAuthorCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; @@ -137,7 +137,7 @@ public okhttp3.Call getAuthorCall(@javax.annotation.Nonnull Integer id, final Ap } @SuppressWarnings("rawtypes") - private okhttp3.Call getAuthorValidateBeforeCall(@javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + private okhttp3.Call getAuthorValidateBeforeCall(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling getAuthor(Async)"); @@ -150,7 +150,7 @@ private okhttp3.Call getAuthorValidateBeforeCall(@javax.annotation.Nonnull Integ /** * Get a specific author * This method allows to retrieve a specific author. - * @param id Identifier. (required) + * @param id Author UUID, or the deprecated integer author ID. (required) * @return AuthorResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -165,7 +165,7 @@ private okhttp3.Call getAuthorValidateBeforeCall(@javax.annotation.Nonnull Integ 429 Too Many Requests. - */ - public AuthorResponse getAuthor(@javax.annotation.Nonnull Integer id) throws ApiException { + public AuthorResponse getAuthor(@javax.annotation.Nonnull String id) throws ApiException { ApiResponse localVarResp = getAuthorWithHttpInfo(id); return localVarResp.getData(); } @@ -173,7 +173,7 @@ public AuthorResponse getAuthor(@javax.annotation.Nonnull Integer id) throws Api /** * Get a specific author * This method allows to retrieve a specific author. - * @param id Identifier. (required) + * @param id Author UUID, or the deprecated integer author ID. (required) * @return ApiResponse<AuthorResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -188,7 +188,7 @@ public AuthorResponse getAuthor(@javax.annotation.Nonnull Integer id) throws Api 429 Too Many Requests. - */ - public ApiResponse getAuthorWithHttpInfo(@javax.annotation.Nonnull Integer id) throws ApiException { + public ApiResponse getAuthorWithHttpInfo(@javax.annotation.Nonnull String id) throws ApiException { okhttp3.Call localVarCall = getAuthorValidateBeforeCall(id, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -197,7 +197,7 @@ public ApiResponse getAuthorWithHttpInfo(@javax.annotation.Nonnu /** * Get a specific author (asynchronously) * This method allows to retrieve a specific author. - * @param id Identifier. (required) + * @param id Author UUID, or the deprecated integer author ID. (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 @@ -213,7 +213,7 @@ public ApiResponse getAuthorWithHttpInfo(@javax.annotation.Nonnu 429 Too Many Requests. - */ - public okhttp3.Call getAuthorAsync(@javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getAuthorAsync(@javax.annotation.Nonnull String id, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getAuthorValidateBeforeCall(id, _callback); Type localVarReturnType = new TypeToken(){}.getType(); diff --git a/qase-api-client/src/main/java/io/qase/client/v1/api/ReviewsApi.java b/qase-api-client/src/main/java/io/qase/client/v1/api/ReviewsApi.java new file mode 100644 index 00000000..5603991f --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/api/ReviewsApi.java @@ -0,0 +1,1128 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.api; + +import io.qase.client.v1.ApiCallback; +import io.qase.client.v1.ApiClient; +import io.qase.client.v1.ApiException; +import io.qase.client.v1.ApiResponse; +import io.qase.client.v1.Configuration; +import io.qase.client.v1.Pair; +import io.qase.client.v1.ProgressRequestBody; +import io.qase.client.v1.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import io.qase.client.v1.models.IdResponse; +import io.qase.client.v1.models.ReviewBulk; +import io.qase.client.v1.models.ReviewBulkResponse; +import io.qase.client.v1.models.ReviewCreate; +import io.qase.client.v1.models.ReviewListResponse; +import io.qase.client.v1.models.ReviewResponse; +import io.qase.client.v1.models.ReviewUpdate; +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; + +public class ReviewsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ReviewsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ReviewsApi(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public ApiClient getApiClient() { + return localVarApiClient; + } + + public void setApiClient(ApiClient apiClient) { + this.localVarApiClient = apiClient; + } + + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + + /** + * Build call for bulkCreateReviews + * @param code Code of project, where to search entities. (required) + * @param reviewBulk (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 + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Per-item outcomes for the submitted reviews. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public okhttp3.Call bulkCreateReviewsCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewBulk reviewBulk, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = reviewBulk; + + // create path and map variables + String localVarPath = "/review/{code}/bulk" + .replace("{" + "code" + "}", localVarApiClient.escapeString(code.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call bulkCreateReviewsValidateBeforeCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewBulk reviewBulk, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'code' is set + if (code == null) { + throw new ApiException("Missing the required parameter 'code' when calling bulkCreateReviews(Async)"); + } + + // verify the required parameter 'reviewBulk' is set + if (reviewBulk == null) { + throw new ApiException("Missing the required parameter 'reviewBulk' when calling bulkCreateReviews(Async)"); + } + + return bulkCreateReviewsCall(code, reviewBulk, _callback); + + } + + /** + * Create reviews in bulk + * This method allows to submit multiple test cases for review in one request. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param reviewBulk (required) + * @return ReviewBulkResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Per-item outcomes for the submitted reviews. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public ReviewBulkResponse bulkCreateReviews(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewBulk reviewBulk) throws ApiException { + ApiResponse localVarResp = bulkCreateReviewsWithHttpInfo(code, reviewBulk); + return localVarResp.getData(); + } + + /** + * Create reviews in bulk + * This method allows to submit multiple test cases for review in one request. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param reviewBulk (required) + * @return ApiResponse<ReviewBulkResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Per-item outcomes for the submitted reviews. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public ApiResponse bulkCreateReviewsWithHttpInfo(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewBulk reviewBulk) throws ApiException { + okhttp3.Call localVarCall = bulkCreateReviewsValidateBeforeCall(code, reviewBulk, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create reviews in bulk (asynchronously) + * This method allows to submit multiple test cases for review in one request. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param reviewBulk (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 + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 Per-item outcomes for the submitted reviews. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public okhttp3.Call bulkCreateReviewsAsync(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewBulk reviewBulk, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = bulkCreateReviewsValidateBeforeCall(code, reviewBulk, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for createReview + * @param code Code of project, where to search entities. (required) + * @param reviewCreate (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 + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public okhttp3.Call createReviewCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewCreate reviewCreate, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = reviewCreate; + + // create path and map variables + String localVarPath = "/review/{code}" + .replace("{" + "code" + "}", localVarApiClient.escapeString(code.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createReviewValidateBeforeCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewCreate reviewCreate, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'code' is set + if (code == null) { + throw new ApiException("Missing the required parameter 'code' when calling createReview(Async)"); + } + + // verify the required parameter 'reviewCreate' is set + if (reviewCreate == null) { + throw new ApiException("Missing the required parameter 'reviewCreate' when calling createReview(Async)"); + } + + return createReviewCall(code, reviewCreate, _callback); + + } + + /** + * Create a new review + * This method allows to submit a test case for review in selected project. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param reviewCreate (required) + * @return IdResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public IdResponse createReview(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewCreate reviewCreate) throws ApiException { + ApiResponse localVarResp = createReviewWithHttpInfo(code, reviewCreate); + return localVarResp.getData(); + } + + /** + * Create a new review + * This method allows to submit a test case for review in selected project. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param reviewCreate (required) + * @return ApiResponse<IdResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public ApiResponse createReviewWithHttpInfo(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewCreate reviewCreate) throws ApiException { + okhttp3.Call localVarCall = createReviewValidateBeforeCall(code, reviewCreate, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create a new review (asynchronously) + * This method allows to submit a test case for review in selected project. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param reviewCreate (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 + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public okhttp3.Call createReviewAsync(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull ReviewCreate reviewCreate, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createReviewValidateBeforeCall(code, reviewCreate, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for deleteReview + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (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 + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public okhttp3.Call deleteReviewCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/review/{code}/{id}" + .replace("{" + "code" + "}", localVarApiClient.escapeString(code.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + 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); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteReviewValidateBeforeCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'code' is set + if (code == null) { + throw new ApiException("Missing the required parameter 'code' when calling deleteReview(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling deleteReview(Async)"); + } + + return deleteReviewCall(code, id, _callback); + + } + + /** + * Delete review + * This method allows to delete a review. Merged reviews cannot be deleted. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (required) + * @return IdResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public IdResponse deleteReview(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id) throws ApiException { + ApiResponse localVarResp = deleteReviewWithHttpInfo(code, id); + return localVarResp.getData(); + } + + /** + * Delete review + * This method allows to delete a review. Merged reviews cannot be deleted. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (required) + * @return ApiResponse<IdResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public ApiResponse deleteReviewWithHttpInfo(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id) throws ApiException { + okhttp3.Call localVarCall = deleteReviewValidateBeforeCall(code, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Delete review (asynchronously) + * This method allows to delete a review. Merged reviews cannot be deleted. Returns an error if test case review is disabled in the project settings. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (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 + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public okhttp3.Call deleteReviewAsync(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteReviewValidateBeforeCall(code, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getReview + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (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 + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A Review. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
429 Too Many Requests. -
+ */ + public okhttp3.Call getReviewCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/review/{code}/{id}" + .replace("{" + "code" + "}", localVarApiClient.escapeString(code.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + 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); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getReviewValidateBeforeCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'code' is set + if (code == null) { + throw new ApiException("Missing the required parameter 'code' when calling getReview(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling getReview(Async)"); + } + + return getReviewCall(code, id, _callback); + + } + + /** + * Get a specific review + * This method allows to retrieve a specific review, including its current approval status per reviewer. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (required) + * @return ReviewResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A Review. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
429 Too Many Requests. -
+ */ + public ReviewResponse getReview(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id) throws ApiException { + ApiResponse localVarResp = getReviewWithHttpInfo(code, id); + return localVarResp.getData(); + } + + /** + * Get a specific review + * This method allows to retrieve a specific review, including its current approval status per reviewer. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (required) + * @return ApiResponse<ReviewResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A Review. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
429 Too Many Requests. -
+ */ + public ApiResponse getReviewWithHttpInfo(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id) throws ApiException { + okhttp3.Call localVarCall = getReviewValidateBeforeCall(code, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get a specific review (asynchronously) + * This method allows to retrieve a specific review, including its current approval status per reviewer. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A Review. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
429 Too Many Requests. -
+ */ + public okhttp3.Call getReviewAsync(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getReviewValidateBeforeCall(code, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for getReviews + * @param code Code of project, where to search entities. (required) + * @param status (optional) + * @param type (optional) + * @param caseId Filter reviews by the reviewed test case ID. (optional) + * @param authorUuid Filter reviews by the author who created them (author UUID). (optional) + * @param reviewerUuid Filter reviews by an assigned reviewer (author UUID). (optional) + * @param search Provide a string that will be used to search by review title. (optional) + * @param limit A number of entities in result set. (optional, default to 10) + * @param offset How many entities should be skipped. (optional, default to 0) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A list of all reviews. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
429 Too Many Requests. -
+ */ + public okhttp3.Call getReviewsCall(@javax.annotation.Nonnull String code, @javax.annotation.Nullable String status, @javax.annotation.Nullable String type, @javax.annotation.Nullable Long caseId, @javax.annotation.Nullable UUID authorUuid, @javax.annotation.Nullable UUID reviewerUuid, @javax.annotation.Nullable String search, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = null; + + // create path and map variables + String localVarPath = "/review/{code}" + .replace("{" + "code" + "}", localVarApiClient.escapeString(code.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); + } + + if (type != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("type", type)); + } + + if (caseId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("case_id", caseId)); + } + + if (authorUuid != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("author_uuid", authorUuid)); + } + + if (reviewerUuid != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("reviewer_uuid", reviewerUuid)); + } + + if (search != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("search", search)); + } + + if (limit != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("limit", limit)); + } + + if (offset != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); + } + + 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); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getReviewsValidateBeforeCall(@javax.annotation.Nonnull String code, @javax.annotation.Nullable String status, @javax.annotation.Nullable String type, @javax.annotation.Nullable Long caseId, @javax.annotation.Nullable UUID authorUuid, @javax.annotation.Nullable UUID reviewerUuid, @javax.annotation.Nullable String search, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'code' is set + if (code == null) { + throw new ApiException("Missing the required parameter 'code' when calling getReviews(Async)"); + } + + return getReviewsCall(code, status, type, caseId, authorUuid, reviewerUuid, search, limit, offset, _callback); + + } + + /** + * Get all reviews + * This method allows to retrieve all test case reviews stored in selected project. + * @param code Code of project, where to search entities. (required) + * @param status (optional) + * @param type (optional) + * @param caseId Filter reviews by the reviewed test case ID. (optional) + * @param authorUuid Filter reviews by the author who created them (author UUID). (optional) + * @param reviewerUuid Filter reviews by an assigned reviewer (author UUID). (optional) + * @param search Provide a string that will be used to search by review title. (optional) + * @param limit A number of entities in result set. (optional, default to 10) + * @param offset How many entities should be skipped. (optional, default to 0) + * @return ReviewListResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A list of all reviews. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
429 Too Many Requests. -
+ */ + public ReviewListResponse getReviews(@javax.annotation.Nonnull String code, @javax.annotation.Nullable String status, @javax.annotation.Nullable String type, @javax.annotation.Nullable Long caseId, @javax.annotation.Nullable UUID authorUuid, @javax.annotation.Nullable UUID reviewerUuid, @javax.annotation.Nullable String search, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + ApiResponse localVarResp = getReviewsWithHttpInfo(code, status, type, caseId, authorUuid, reviewerUuid, search, limit, offset); + return localVarResp.getData(); + } + + /** + * Get all reviews + * This method allows to retrieve all test case reviews stored in selected project. + * @param code Code of project, where to search entities. (required) + * @param status (optional) + * @param type (optional) + * @param caseId Filter reviews by the reviewed test case ID. (optional) + * @param authorUuid Filter reviews by the author who created them (author UUID). (optional) + * @param reviewerUuid Filter reviews by an assigned reviewer (author UUID). (optional) + * @param search Provide a string that will be used to search by review title. (optional) + * @param limit A number of entities in result set. (optional, default to 10) + * @param offset How many entities should be skipped. (optional, default to 0) + * @return ApiResponse<ReviewListResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A list of all reviews. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
429 Too Many Requests. -
+ */ + public ApiResponse getReviewsWithHttpInfo(@javax.annotation.Nonnull String code, @javax.annotation.Nullable String status, @javax.annotation.Nullable String type, @javax.annotation.Nullable Long caseId, @javax.annotation.Nullable UUID authorUuid, @javax.annotation.Nullable UUID reviewerUuid, @javax.annotation.Nullable String search, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset) throws ApiException { + okhttp3.Call localVarCall = getReviewsValidateBeforeCall(code, status, type, caseId, authorUuid, reviewerUuid, search, limit, offset, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Get all reviews (asynchronously) + * This method allows to retrieve all test case reviews stored in selected project. + * @param code Code of project, where to search entities. (required) + * @param status (optional) + * @param type (optional) + * @param caseId Filter reviews by the reviewed test case ID. (optional) + * @param authorUuid Filter reviews by the author who created them (author UUID). (optional) + * @param reviewerUuid Filter reviews by an assigned reviewer (author UUID). (optional) + * @param search Provide a string that will be used to search by review title. (optional) + * @param limit A number of entities in result set. (optional, default to 10) + * @param offset How many entities should be skipped. (optional, default to 0) + * @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 + * @http.response.details + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A list of all reviews. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
429 Too Many Requests. -
+ */ + public okhttp3.Call getReviewsAsync(@javax.annotation.Nonnull String code, @javax.annotation.Nullable String status, @javax.annotation.Nullable String type, @javax.annotation.Nullable Long caseId, @javax.annotation.Nullable UUID authorUuid, @javax.annotation.Nullable UUID reviewerUuid, @javax.annotation.Nullable String search, @javax.annotation.Nullable Integer limit, @javax.annotation.Nullable Integer offset, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getReviewsValidateBeforeCall(code, status, type, caseId, authorUuid, reviewerUuid, search, limit, offset, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + /** + * Build call for updateReview + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (required) + * @param reviewUpdate (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 + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public okhttp3.Call updateReviewCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, @javax.annotation.Nonnull ReviewUpdate reviewUpdate, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = reviewUpdate; + + // create path and map variables + String localVarPath = "/review/{code}/{id}" + .replace("{" + "code" + "}", localVarApiClient.escapeString(code.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "TokenAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call updateReviewValidateBeforeCall(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, @javax.annotation.Nonnull ReviewUpdate reviewUpdate, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'code' is set + if (code == null) { + throw new ApiException("Missing the required parameter 'code' when calling updateReview(Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling updateReview(Async)"); + } + + // verify the required parameter 'reviewUpdate' is set + if (reviewUpdate == null) { + throw new ApiException("Missing the required parameter 'reviewUpdate' when calling updateReview(Async)"); + } + + return updateReviewCall(code, id, reviewUpdate, _callback); + + } + + /** + * Update review + * This method allows to update the assigned reviewers and/or the proposed test case payload of an open review. The reviewed test case cannot be changed. Returns an error if test case review is disabled in the project settings, or if the review is not open. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (required) + * @param reviewUpdate (required) + * @return IdResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public IdResponse updateReview(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, @javax.annotation.Nonnull ReviewUpdate reviewUpdate) throws ApiException { + ApiResponse localVarResp = updateReviewWithHttpInfo(code, id, reviewUpdate); + return localVarResp.getData(); + } + + /** + * Update review + * This method allows to update the assigned reviewers and/or the proposed test case payload of an open review. The reviewed test case cannot be changed. Returns an error if test case review is disabled in the project settings, or if the review is not open. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (required) + * @param reviewUpdate (required) + * @return ApiResponse<IdResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public ApiResponse updateReviewWithHttpInfo(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, @javax.annotation.Nonnull ReviewUpdate reviewUpdate) throws ApiException { + okhttp3.Call localVarCall = updateReviewValidateBeforeCall(code, id, reviewUpdate, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Update review (asynchronously) + * This method allows to update the assigned reviewers and/or the proposed test case payload of an open review. The reviewed test case cannot be changed. Returns an error if test case review is disabled in the project settings, or if the review is not open. + * @param code Code of project, where to search entities. (required) + * @param id Identifier. (required) + * @param reviewUpdate (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 + * @http.response.details + + + + + + + + + + + +
Response Details
Status Code Description Response Headers
200 A result. -
400 Bad Request. -
401 Unauthorized. -
402 Payment Required. -
403 Forbidden. -
404 Not Found. -
422 Unprocessable Entity. -
429 Too Many Requests. -
+ */ + public okhttp3.Call updateReviewAsync(@javax.annotation.Nonnull String code, @javax.annotation.Nonnull Integer id, @javax.annotation.Nonnull ReviewUpdate reviewUpdate, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = updateReviewValidateBeforeCall(code, id, reviewUpdate, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } +} diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/Author.java b/qase-api-client/src/main/java/io/qase/client/v1/models/Author.java index b27cc33a..e16dda7b 100644 --- a/qase-api-client/src/main/java/io/qase/client/v1/models/Author.java +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/Author.java @@ -21,6 +21,7 @@ import com.google.gson.stream.JsonWriter; import java.io.IOException; import java.util.Arrays; +import java.util.UUID; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -55,7 +56,13 @@ public class Author { @javax.annotation.Nullable private Long id; + public static final String SERIALIZED_NAME_UUID = "uuid"; + @SerializedName(SERIALIZED_NAME_UUID) + @javax.annotation.Nullable + private UUID uuid; + public static final String SERIALIZED_NAME_AUTHOR_ID = "author_id"; + @Deprecated @SerializedName(SERIALIZED_NAME_AUTHOR_ID) @javax.annotation.Nullable private Long authorId; @@ -107,20 +114,43 @@ public void setId(@javax.annotation.Nullable Long id) { } + public Author uuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Author UUID. Use it to reference the author in other API methods. + * @return uuid + */ + @javax.annotation.Nullable + public UUID getUuid() { + return uuid; + } + + public void setUuid(@javax.annotation.Nullable UUID uuid) { + this.uuid = uuid; + } + + + @Deprecated public Author authorId(@javax.annotation.Nullable Long authorId) { this.authorId = authorId; return this; } /** - * Get authorId + * Deprecated, use `uuid` instead. * @return authorId + * @deprecated */ + @Deprecated @javax.annotation.Nullable public Long getAuthorId() { return authorId; } + @Deprecated public void setAuthorId(@javax.annotation.Nullable Long authorId) { this.authorId = authorId; } @@ -276,6 +306,7 @@ public boolean equals(Object o) { } Author author = (Author) o; return Objects.equals(this.id, author.id) && + Objects.equals(this.uuid, author.uuid) && Objects.equals(this.authorId, author.authorId) && Objects.equals(this.entityType, author.entityType) && Objects.equals(this.entityId, author.entityId) && @@ -287,7 +318,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(id, authorId, entityType, entityId, email, name, isActive, additionalProperties); + return Objects.hash(id, uuid, authorId, entityType, entityId, email, name, isActive, additionalProperties); } @Override @@ -295,6 +326,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Author {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); sb.append(" authorId: ").append(toIndentedString(authorId)).append("\n"); sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n"); sb.append(" entityId: ").append(toIndentedString(entityId)).append("\n"); @@ -323,7 +355,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("id", "author_id", "entity_type", "entity_id", "email", "name", "is_active")); + openapiFields = new HashSet(Arrays.asList("id", "uuid", "author_id", "entity_type", "entity_id", "email", "name", "is_active")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); @@ -342,6 +374,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("uuid") != null && !jsonObj.get("uuid").isJsonNull()) && !jsonObj.get("uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uuid").toString())); + } if ((jsonObj.get("entity_type") != null && !jsonObj.get("entity_type").isJsonNull()) && !jsonObj.get("entity_type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `entity_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("entity_type").toString())); } diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/Review.java b/qase-api-client/src/main/java/io/qase/client/v1/models/Review.java new file mode 100644 index 00000000..a06d4bfd --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/Review.java @@ -0,0 +1,656 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewReviewersInner; +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.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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * Review + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class Review { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nullable + private String title; + + /** + * `create` — the review proposes a new test case; `edit` — the review proposes changes to an existing test case. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CREATE("create"), + + EDIT("edit"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.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 TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + OPEN("open"), + + MERGED("merged"), + + DECLINED("declined"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.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 StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_CASE_ID = "case_id"; + @SerializedName(SERIALIZED_NAME_CASE_ID) + @javax.annotation.Nullable + private Long caseId; + + public static final String SERIALIZED_NAME_AUTHOR_UUID = "author_uuid"; + @SerializedName(SERIALIZED_NAME_AUTHOR_UUID) + @javax.annotation.Nullable + private UUID authorUuid; + + public static final String SERIALIZED_NAME_REVIEWERS = "reviewers"; + @SerializedName(SERIALIZED_NAME_REVIEWERS) + @javax.annotation.Nullable + private List reviewers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updated_at"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public Review() { + } + + public Review id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Review ID, unique within the project. + * @return id + */ + @javax.annotation.Nullable + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public Review title(@javax.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@javax.annotation.Nullable String title) { + this.title = title; + } + + + public Review type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * `create` — the review proposes a new test case; `edit` — the review proposes changes to an existing test case. + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public Review status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public Review caseId(@javax.annotation.Nullable Long caseId) { + this.caseId = caseId; + return this; + } + + /** + * ID of the reviewed test case. Null for new-case draft reviews. + * @return caseId + */ + @javax.annotation.Nullable + public Long getCaseId() { + return caseId; + } + + public void setCaseId(@javax.annotation.Nullable Long caseId) { + this.caseId = caseId; + } + + + public Review authorUuid(@javax.annotation.Nullable UUID authorUuid) { + this.authorUuid = authorUuid; + return this; + } + + /** + * Author UUID of the review creator (see `GET /author`). + * @return authorUuid + */ + @javax.annotation.Nullable + public UUID getAuthorUuid() { + return authorUuid; + } + + public void setAuthorUuid(@javax.annotation.Nullable UUID authorUuid) { + this.authorUuid = authorUuid; + } + + + public Review reviewers(@javax.annotation.Nullable List reviewers) { + this.reviewers = reviewers; + return this; + } + + public Review addReviewersItem(ReviewReviewersInner reviewersItem) { + if (this.reviewers == null) { + this.reviewers = new ArrayList<>(); + } + this.reviewers.add(reviewersItem); + return this; + } + + /** + * Get reviewers + * @return reviewers + */ + @javax.annotation.Nullable + public List getReviewers() { + return reviewers; + } + + public void setReviewers(@javax.annotation.Nullable List reviewers) { + this.reviewers = reviewers; + } + + + public Review createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public Review updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * 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 Review instance itself + */ + public Review 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; + } + Review review = (Review) o; + return Objects.equals(this.id, review.id) && + Objects.equals(this.title, review.title) && + Objects.equals(this.type, review.type) && + Objects.equals(this.status, review.status) && + Objects.equals(this.caseId, review.caseId) && + Objects.equals(this.authorUuid, review.authorUuid) && + Objects.equals(this.reviewers, review.reviewers) && + Objects.equals(this.createdAt, review.createdAt) && + Objects.equals(this.updatedAt, review.updatedAt)&& + Objects.equals(this.additionalProperties, review.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(id, title, type, status, caseId, authorUuid, reviewers, createdAt, updatedAt, 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 Review {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" caseId: ").append(toIndentedString(caseId)).append("\n"); + sb.append(" authorUuid: ").append(toIndentedString(authorUuid)).append("\n"); + sb.append(" reviewers: ").append(toIndentedString(reviewers)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).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(Arrays.asList("id", "title", "type", "status", "case_id", "author_uuid", "reviewers", "created_at", "updated_at")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 Review + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Review.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in Review is not found in the empty JSON string", Review.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("author_uuid") != null && !jsonObj.get("author_uuid").isJsonNull()) && !jsonObj.get("author_uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `author_uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("author_uuid").toString())); + } + if (jsonObj.get("reviewers") != null && !jsonObj.get("reviewers").isJsonNull()) { + JsonArray jsonArrayreviewers = jsonObj.getAsJsonArray("reviewers"); + if (jsonArrayreviewers != null) { + // ensure the json data is an array + if (!jsonObj.get("reviewers").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reviewers` to be an array in the JSON string but got `%s`", jsonObj.get("reviewers").toString())); + } + + // validate the optional field `reviewers` (array) + for (int i = 0; i < jsonArrayreviewers.size(); i++) { + ReviewReviewersInner.validateJsonElement(jsonArrayreviewers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Review.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Review' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Review.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Review 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 Review read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Review 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(java.util.Locale.ROOT, "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 Review given an JSON string + * + * @param jsonString JSON string + * @return An instance of Review + * @throws IOException if the JSON string is invalid with respect to Review + */ + public static Review fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Review.class); + } + + /** + * Convert an instance of Review to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulk.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulk.java new file mode 100644 index 00000000..7482b341 --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulk.java @@ -0,0 +1,311 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewCreate; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewBulk + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewBulk { + public static final String SERIALIZED_NAME_REVIEWS = "reviews"; + @SerializedName(SERIALIZED_NAME_REVIEWS) + @javax.annotation.Nonnull + private List reviews = new ArrayList<>(); + + public ReviewBulk() { + } + + public ReviewBulk reviews(@javax.annotation.Nonnull List reviews) { + this.reviews = reviews; + return this; + } + + public ReviewBulk addReviewsItem(ReviewCreate reviewsItem) { + if (this.reviews == null) { + this.reviews = new ArrayList<>(); + } + this.reviews.add(reviewsItem); + return this; + } + + /** + * Validated as a whole: if any item is invalid nothing is created. Otherwise each item is processed on its own and reported in the response. + * @return reviews + */ + @javax.annotation.Nonnull + public List getReviews() { + return reviews; + } + + public void setReviews(@javax.annotation.Nonnull List reviews) { + this.reviews = reviews; + } + + /** + * 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 ReviewBulk instance itself + */ + public ReviewBulk 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; + } + ReviewBulk reviewBulk = (ReviewBulk) o; + return Objects.equals(this.reviews, reviewBulk.reviews)&& + Objects.equals(this.additionalProperties, reviewBulk.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(reviews, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewBulk {\n"); + sb.append(" reviews: ").append(toIndentedString(reviews)).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(Arrays.asList("reviews")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("reviews")); + } + + /** + * 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 ReviewBulk + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewBulk.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewBulk is not found in the empty JSON string", ReviewBulk.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReviewBulk.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("reviews") != null) { + if (!jsonObj.get("reviews").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reviews` to be an array in the JSON string but got `%s`", jsonObj.get("reviews").toString())); + } + JsonArray jsonArrayreviews = jsonObj.getAsJsonArray("reviews"); + // validate the required field `reviews` (array) + for (int i = 0; i < jsonArrayreviews.size(); i++) { + ReviewCreate.validateJsonElement(jsonArrayreviews.get(i)); + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewBulk.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewBulk' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewBulk.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewBulk 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 ReviewBulk read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewBulk 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(java.util.Locale.ROOT, "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 ReviewBulk given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewBulk + * @throws IOException if the JSON string is invalid with respect to ReviewBulk + */ + public static ReviewBulk fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewBulk.class); + } + + /** + * Convert an instance of ReviewBulk to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponse.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponse.java new file mode 100644 index 00000000..7870ed3d --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponse.java @@ -0,0 +1,314 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewBulkResponseAllOfResult; +import java.io.IOException; +import java.util.Arrays; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewBulkResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewBulkResponse { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private Boolean status; + + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + @javax.annotation.Nullable + private ReviewBulkResponseAllOfResult result; + + public ReviewBulkResponse() { + } + + public ReviewBulkResponse status(@javax.annotation.Nullable Boolean status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public Boolean getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable Boolean status) { + this.status = status; + } + + + public ReviewBulkResponse result(@javax.annotation.Nullable ReviewBulkResponseAllOfResult result) { + this.result = result; + return this; + } + + /** + * Get result + * @return result + */ + @javax.annotation.Nullable + public ReviewBulkResponseAllOfResult getResult() { + return result; + } + + public void setResult(@javax.annotation.Nullable ReviewBulkResponseAllOfResult result) { + this.result = result; + } + + /** + * 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 ReviewBulkResponse instance itself + */ + public ReviewBulkResponse 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; + } + ReviewBulkResponse reviewBulkResponse = (ReviewBulkResponse) o; + return Objects.equals(this.status, reviewBulkResponse.status) && + Objects.equals(this.result, reviewBulkResponse.result)&& + Objects.equals(this.additionalProperties, reviewBulkResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(status, result, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewBulkResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).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(Arrays.asList("status", "result")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewBulkResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewBulkResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewBulkResponse is not found in the empty JSON string", ReviewBulkResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `result` + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + ReviewBulkResponseAllOfResult.validateJsonElement(jsonObj.get("result")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewBulkResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewBulkResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewBulkResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewBulkResponse 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 ReviewBulkResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewBulkResponse 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(java.util.Locale.ROOT, "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 ReviewBulkResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewBulkResponse + * @throws IOException if the JSON string is invalid with respect to ReviewBulkResponse + */ + public static ReviewBulkResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewBulkResponse.class); + } + + /** + * Convert an instance of ReviewBulkResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponseAllOfResult.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponseAllOfResult.java new file mode 100644 index 00000000..2438fbca --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponseAllOfResult.java @@ -0,0 +1,308 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewBulkResponseAllOfResultItems; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewBulkResponseAllOfResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewBulkResponseAllOfResult { + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + @javax.annotation.Nullable + private List items = new ArrayList<>(); + + public ReviewBulkResponseAllOfResult() { + } + + public ReviewBulkResponseAllOfResult items(@javax.annotation.Nullable List items) { + this.items = items; + return this; + } + + public ReviewBulkResponseAllOfResult addItemsItem(ReviewBulkResponseAllOfResultItems itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * Per-item outcomes, in request order. + * @return items + */ + @javax.annotation.Nullable + public List getItems() { + return items; + } + + public void setItems(@javax.annotation.Nullable List items) { + this.items = items; + } + + /** + * 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 ReviewBulkResponseAllOfResult instance itself + */ + public ReviewBulkResponseAllOfResult 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; + } + ReviewBulkResponseAllOfResult reviewBulkResponseAllOfResult = (ReviewBulkResponseAllOfResult) o; + return Objects.equals(this.items, reviewBulkResponseAllOfResult.items)&& + Objects.equals(this.additionalProperties, reviewBulkResponseAllOfResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(items, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewBulkResponseAllOfResult {\n"); + sb.append(" items: ").append(toIndentedString(items)).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(Arrays.asList("items")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewBulkResponseAllOfResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewBulkResponseAllOfResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewBulkResponseAllOfResult is not found in the empty JSON string", ReviewBulkResponseAllOfResult.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("items") != null && !jsonObj.get("items").isJsonNull()) { + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + if (jsonArrayitems != null) { + // ensure the json data is an array + if (!jsonObj.get("items").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + // validate the optional field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ReviewBulkResponseAllOfResultItems.validateJsonElement(jsonArrayitems.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewBulkResponseAllOfResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewBulkResponseAllOfResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewBulkResponseAllOfResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewBulkResponseAllOfResult 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 ReviewBulkResponseAllOfResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewBulkResponseAllOfResult 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(java.util.Locale.ROOT, "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 ReviewBulkResponseAllOfResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewBulkResponseAllOfResult + * @throws IOException if the JSON string is invalid with respect to ReviewBulkResponseAllOfResult + */ + public static ReviewBulkResponseAllOfResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewBulkResponseAllOfResult.class); + } + + /** + * Convert an instance of ReviewBulkResponseAllOfResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponseAllOfResultItems.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponseAllOfResultItems.java new file mode 100644 index 00000000..dce3d56e --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewBulkResponseAllOfResultItems.java @@ -0,0 +1,350 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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.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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewBulkResponseAllOfResultItems + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewBulkResponseAllOfResultItems { + public static final String SERIALIZED_NAME_REVIEW_ID = "review_id"; + @SerializedName(SERIALIZED_NAME_REVIEW_ID) + @javax.annotation.Nullable + private Long reviewId; + + public static final String SERIALIZED_NAME_CASE_ID = "case_id"; + @SerializedName(SERIALIZED_NAME_CASE_ID) + @javax.annotation.Nullable + private Long caseId; + + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + @javax.annotation.Nullable + private String error; + + public ReviewBulkResponseAllOfResultItems() { + } + + public ReviewBulkResponseAllOfResultItems reviewId(@javax.annotation.Nullable Long reviewId) { + this.reviewId = reviewId; + return this; + } + + /** + * ID of the created review. Null when the item failed. + * @return reviewId + */ + @javax.annotation.Nullable + public Long getReviewId() { + return reviewId; + } + + public void setReviewId(@javax.annotation.Nullable Long reviewId) { + this.reviewId = reviewId; + } + + + public ReviewBulkResponseAllOfResultItems caseId(@javax.annotation.Nullable Long caseId) { + this.caseId = caseId; + return this; + } + + /** + * The `case_id` submitted with the item, echoed back for correlation. Null for new-case draft reviews. + * @return caseId + */ + @javax.annotation.Nullable + public Long getCaseId() { + return caseId; + } + + public void setCaseId(@javax.annotation.Nullable Long caseId) { + this.caseId = caseId; + } + + + public ReviewBulkResponseAllOfResultItems error(@javax.annotation.Nullable String error) { + this.error = error; + return this; + } + + /** + * Failure reason. Null when the item was created. + * @return error + */ + @javax.annotation.Nullable + public String getError() { + return error; + } + + public void setError(@javax.annotation.Nullable String error) { + this.error = error; + } + + /** + * 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 ReviewBulkResponseAllOfResultItems instance itself + */ + public ReviewBulkResponseAllOfResultItems 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; + } + ReviewBulkResponseAllOfResultItems reviewBulkResponseAllOfResultItems = (ReviewBulkResponseAllOfResultItems) o; + return Objects.equals(this.reviewId, reviewBulkResponseAllOfResultItems.reviewId) && + Objects.equals(this.caseId, reviewBulkResponseAllOfResultItems.caseId) && + Objects.equals(this.error, reviewBulkResponseAllOfResultItems.error)&& + Objects.equals(this.additionalProperties, reviewBulkResponseAllOfResultItems.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(reviewId, caseId, error, 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 ReviewBulkResponseAllOfResultItems {\n"); + sb.append(" reviewId: ").append(toIndentedString(reviewId)).append("\n"); + sb.append(" caseId: ").append(toIndentedString(caseId)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).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(Arrays.asList("review_id", "case_id", "error")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewBulkResponseAllOfResultItems + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewBulkResponseAllOfResultItems.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewBulkResponseAllOfResultItems is not found in the empty JSON string", ReviewBulkResponseAllOfResultItems.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) && !jsonObj.get("error").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `error` to be a primitive type in the JSON string but got `%s`", jsonObj.get("error").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewBulkResponseAllOfResultItems.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewBulkResponseAllOfResultItems' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewBulkResponseAllOfResultItems.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewBulkResponseAllOfResultItems 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 ReviewBulkResponseAllOfResultItems read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewBulkResponseAllOfResultItems 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(java.util.Locale.ROOT, "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 ReviewBulkResponseAllOfResultItems given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewBulkResponseAllOfResultItems + * @throws IOException if the JSON string is invalid with respect to ReviewBulkResponseAllOfResultItems + */ + public static ReviewBulkResponseAllOfResultItems fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewBulkResponseAllOfResultItems.class); + } + + /** + * Convert an instance of ReviewBulkResponseAllOfResultItems to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewCaseData.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewCaseData.java new file mode 100644 index 00000000..a343478f --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewCaseData.java @@ -0,0 +1,994 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewStepData; +import io.qase.client.v1.models.TestCaseParameterCreate; +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 org.openapitools.jackson.nullable.JsonNullable; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * The test case fields proposed by the review. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewCaseData { + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_PRECONDITIONS = "preconditions"; + @SerializedName(SERIALIZED_NAME_PRECONDITIONS) + @javax.annotation.Nullable + private String preconditions; + + public static final String SERIALIZED_NAME_POSTCONDITIONS = "postconditions"; + @SerializedName(SERIALIZED_NAME_POSTCONDITIONS) + @javax.annotation.Nullable + private String postconditions; + + public static final String SERIALIZED_NAME_SEVERITY = "severity"; + @SerializedName(SERIALIZED_NAME_SEVERITY) + @javax.annotation.Nullable + private Integer severity; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + @javax.annotation.Nullable + private Integer priority; + + public static final String SERIALIZED_NAME_BEHAVIOR = "behavior"; + @SerializedName(SERIALIZED_NAME_BEHAVIOR) + @javax.annotation.Nullable + private Integer behavior; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private Integer type; + + public static final String SERIALIZED_NAME_LAYER = "layer"; + @SerializedName(SERIALIZED_NAME_LAYER) + @javax.annotation.Nullable + private Integer layer; + + public static final String SERIALIZED_NAME_IS_FLAKY = "is_flaky"; + @SerializedName(SERIALIZED_NAME_IS_FLAKY) + @javax.annotation.Nullable + private Integer isFlaky; + + public static final String SERIALIZED_NAME_IS_MUTED = "is_muted"; + @SerializedName(SERIALIZED_NAME_IS_MUTED) + @javax.annotation.Nullable + private Boolean isMuted; + + public static final String SERIALIZED_NAME_SUITE_ID = "suite_id"; + @SerializedName(SERIALIZED_NAME_SUITE_ID) + @javax.annotation.Nullable + private Long suiteId; + + public static final String SERIALIZED_NAME_MILESTONE_ID = "milestone_id"; + @SerializedName(SERIALIZED_NAME_MILESTONE_ID) + @javax.annotation.Nullable + private Long milestoneId; + + public static final String SERIALIZED_NAME_IS_MANUAL = "is_manual"; + @SerializedName(SERIALIZED_NAME_IS_MANUAL) + @javax.annotation.Nullable + private Boolean isManual; + + public static final String SERIALIZED_NAME_IS_TO_BE_AUTOMATED = "is_to_be_automated"; + @SerializedName(SERIALIZED_NAME_IS_TO_BE_AUTOMATED) + @javax.annotation.Nullable + private Boolean isToBeAutomated; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private Integer status; + + /** + * Format of the steps field. Omit to keep the current one, `classic` for a new-case draft; changing it requires sending `steps` in the same request. + */ + @JsonAdapter(StepsTypeEnum.Adapter.class) + public enum StepsTypeEnum { + CLASSIC("classic"), + + GHERKIN("gherkin"); + + private String value; + + StepsTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StepsTypeEnum fromValue(String value) { + for (StepsTypeEnum b : StepsTypeEnum.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 StepsTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StepsTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StepsTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StepsTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STEPS_TYPE = "steps_type"; + @SerializedName(SERIALIZED_NAME_STEPS_TYPE) + @javax.annotation.Nullable + private StepsTypeEnum stepsType; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STEPS = "steps"; + @SerializedName(SERIALIZED_NAME_STEPS) + @javax.annotation.Nullable + private List steps = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters; + + public static final String SERIALIZED_NAME_CUSTOM_FIELD = "custom_field"; + @SerializedName(SERIALIZED_NAME_CUSTOM_FIELD) + @javax.annotation.Nullable + private Map customField; + + public ReviewCaseData() { + } + + public ReviewCaseData title(@javax.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@javax.annotation.Nullable String title) { + this.title = title; + } + + + public ReviewCaseData description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public ReviewCaseData preconditions(@javax.annotation.Nullable String preconditions) { + this.preconditions = preconditions; + return this; + } + + /** + * Get preconditions + * @return preconditions + */ + @javax.annotation.Nullable + public String getPreconditions() { + return preconditions; + } + + public void setPreconditions(@javax.annotation.Nullable String preconditions) { + this.preconditions = preconditions; + } + + + public ReviewCaseData postconditions(@javax.annotation.Nullable String postconditions) { + this.postconditions = postconditions; + return this; + } + + /** + * Get postconditions + * @return postconditions + */ + @javax.annotation.Nullable + public String getPostconditions() { + return postconditions; + } + + public void setPostconditions(@javax.annotation.Nullable String postconditions) { + this.postconditions = postconditions; + } + + + public ReviewCaseData severity(@javax.annotation.Nullable Integer severity) { + this.severity = severity; + return this; + } + + /** + * Get severity + * @return severity + */ + @javax.annotation.Nullable + public Integer getSeverity() { + return severity; + } + + public void setSeverity(@javax.annotation.Nullable Integer severity) { + this.severity = severity; + } + + + public ReviewCaseData priority(@javax.annotation.Nullable Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + */ + @javax.annotation.Nullable + public Integer getPriority() { + return priority; + } + + public void setPriority(@javax.annotation.Nullable Integer priority) { + this.priority = priority; + } + + + public ReviewCaseData behavior(@javax.annotation.Nullable Integer behavior) { + this.behavior = behavior; + return this; + } + + /** + * Get behavior + * @return behavior + */ + @javax.annotation.Nullable + public Integer getBehavior() { + return behavior; + } + + public void setBehavior(@javax.annotation.Nullable Integer behavior) { + this.behavior = behavior; + } + + + public ReviewCaseData type(@javax.annotation.Nullable Integer type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public Integer getType() { + return type; + } + + public void setType(@javax.annotation.Nullable Integer type) { + this.type = type; + } + + + public ReviewCaseData layer(@javax.annotation.Nullable Integer layer) { + this.layer = layer; + return this; + } + + /** + * Get layer + * @return layer + */ + @javax.annotation.Nullable + public Integer getLayer() { + return layer; + } + + public void setLayer(@javax.annotation.Nullable Integer layer) { + this.layer = layer; + } + + + public ReviewCaseData isFlaky(@javax.annotation.Nullable Integer isFlaky) { + this.isFlaky = isFlaky; + return this; + } + + /** + * Get isFlaky + * @return isFlaky + */ + @javax.annotation.Nullable + public Integer getIsFlaky() { + return isFlaky; + } + + public void setIsFlaky(@javax.annotation.Nullable Integer isFlaky) { + this.isFlaky = isFlaky; + } + + + public ReviewCaseData isMuted(@javax.annotation.Nullable Boolean isMuted) { + this.isMuted = isMuted; + return this; + } + + /** + * Mute state of the proposed test case. + * @return isMuted + */ + @javax.annotation.Nullable + public Boolean getIsMuted() { + return isMuted; + } + + public void setIsMuted(@javax.annotation.Nullable Boolean isMuted) { + this.isMuted = isMuted; + } + + + public ReviewCaseData suiteId(@javax.annotation.Nullable Long suiteId) { + this.suiteId = suiteId; + return this; + } + + /** + * Get suiteId + * @return suiteId + */ + @javax.annotation.Nullable + public Long getSuiteId() { + return suiteId; + } + + public void setSuiteId(@javax.annotation.Nullable Long suiteId) { + this.suiteId = suiteId; + } + + + public ReviewCaseData milestoneId(@javax.annotation.Nullable Long milestoneId) { + this.milestoneId = milestoneId; + return this; + } + + /** + * Get milestoneId + * @return milestoneId + */ + @javax.annotation.Nullable + public Long getMilestoneId() { + return milestoneId; + } + + public void setMilestoneId(@javax.annotation.Nullable Long milestoneId) { + this.milestoneId = milestoneId; + } + + + public ReviewCaseData isManual(@javax.annotation.Nullable Boolean isManual) { + this.isManual = isManual; + return this; + } + + /** + * `true` if the case is manual, `false` if it is automated. + * @return isManual + */ + @javax.annotation.Nullable + public Boolean getIsManual() { + return isManual; + } + + public void setIsManual(@javax.annotation.Nullable Boolean isManual) { + this.isManual = isManual; + } + + + public ReviewCaseData isToBeAutomated(@javax.annotation.Nullable Boolean isToBeAutomated) { + this.isToBeAutomated = isToBeAutomated; + return this; + } + + /** + * `true` if a manual case is planned to be automated. + * @return isToBeAutomated + */ + @javax.annotation.Nullable + public Boolean getIsToBeAutomated() { + return isToBeAutomated; + } + + public void setIsToBeAutomated(@javax.annotation.Nullable Boolean isToBeAutomated) { + this.isToBeAutomated = isToBeAutomated; + } + + + public ReviewCaseData status(@javax.annotation.Nullable Integer status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public Integer getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable Integer status) { + this.status = status; + } + + + public ReviewCaseData stepsType(@javax.annotation.Nullable StepsTypeEnum stepsType) { + this.stepsType = stepsType; + return this; + } + + /** + * Format of the steps field. Omit to keep the current one, `classic` for a new-case draft; changing it requires sending `steps` in the same request. + * @return stepsType + */ + @javax.annotation.Nullable + public StepsTypeEnum getStepsType() { + return stepsType; + } + + public void setStepsType(@javax.annotation.Nullable StepsTypeEnum stepsType) { + this.stepsType = stepsType; + } + + + public ReviewCaseData attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public ReviewCaseData addAttachmentsItem(String attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * A list of Attachment hashes. + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + public ReviewCaseData steps(@javax.annotation.Nullable List steps) { + this.steps = steps; + return this; + } + + public ReviewCaseData addStepsItem(ReviewStepData stepsItem) { + if (this.steps == null) { + this.steps = new ArrayList<>(); + } + this.steps.add(stepsItem); + return this; + } + + /** + * For gherkin steps send the scenario in `value`. + * @return steps + */ + @javax.annotation.Nullable + public List getSteps() { + return steps; + } + + public void setSteps(@javax.annotation.Nullable List steps) { + this.steps = steps; + } + + + public ReviewCaseData tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public ReviewCaseData addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public ReviewCaseData parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public ReviewCaseData addParametersItem(TestCaseParameterCreate parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public ReviewCaseData customField(@javax.annotation.Nullable Map customField) { + this.customField = customField; + return this; + } + + public ReviewCaseData putCustomFieldItem(String key, String customFieldItem) { + if (this.customField == null) { + this.customField = new HashMap<>(); + } + this.customField.put(key, customFieldItem); + return this; + } + + /** + * Map of custom field ID to value. A `create` review must carry every required custom field. An `edit` review is validated against the current test case, so send only the fields the proposal changes. + * @return customField + */ + @javax.annotation.Nullable + public Map getCustomField() { + return customField; + } + + public void setCustomField(@javax.annotation.Nullable Map customField) { + this.customField = customField; + } + + /** + * 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 ReviewCaseData instance itself + */ + public ReviewCaseData 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; + } + ReviewCaseData reviewCaseData = (ReviewCaseData) o; + return Objects.equals(this.title, reviewCaseData.title) && + Objects.equals(this.description, reviewCaseData.description) && + Objects.equals(this.preconditions, reviewCaseData.preconditions) && + Objects.equals(this.postconditions, reviewCaseData.postconditions) && + Objects.equals(this.severity, reviewCaseData.severity) && + Objects.equals(this.priority, reviewCaseData.priority) && + Objects.equals(this.behavior, reviewCaseData.behavior) && + Objects.equals(this.type, reviewCaseData.type) && + Objects.equals(this.layer, reviewCaseData.layer) && + Objects.equals(this.isFlaky, reviewCaseData.isFlaky) && + Objects.equals(this.isMuted, reviewCaseData.isMuted) && + Objects.equals(this.suiteId, reviewCaseData.suiteId) && + Objects.equals(this.milestoneId, reviewCaseData.milestoneId) && + Objects.equals(this.isManual, reviewCaseData.isManual) && + Objects.equals(this.isToBeAutomated, reviewCaseData.isToBeAutomated) && + Objects.equals(this.status, reviewCaseData.status) && + Objects.equals(this.stepsType, reviewCaseData.stepsType) && + Objects.equals(this.attachments, reviewCaseData.attachments) && + Objects.equals(this.steps, reviewCaseData.steps) && + Objects.equals(this.tags, reviewCaseData.tags) && + Objects.equals(this.parameters, reviewCaseData.parameters) && + Objects.equals(this.customField, reviewCaseData.customField)&& + Objects.equals(this.additionalProperties, reviewCaseData.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(title, description, preconditions, postconditions, severity, priority, behavior, type, layer, isFlaky, isMuted, suiteId, milestoneId, isManual, isToBeAutomated, status, stepsType, attachments, steps, tags, parameters, customField, 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 ReviewCaseData {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" preconditions: ").append(toIndentedString(preconditions)).append("\n"); + sb.append(" postconditions: ").append(toIndentedString(postconditions)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" behavior: ").append(toIndentedString(behavior)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" layer: ").append(toIndentedString(layer)).append("\n"); + sb.append(" isFlaky: ").append(toIndentedString(isFlaky)).append("\n"); + sb.append(" isMuted: ").append(toIndentedString(isMuted)).append("\n"); + sb.append(" suiteId: ").append(toIndentedString(suiteId)).append("\n"); + sb.append(" milestoneId: ").append(toIndentedString(milestoneId)).append("\n"); + sb.append(" isManual: ").append(toIndentedString(isManual)).append("\n"); + sb.append(" isToBeAutomated: ").append(toIndentedString(isToBeAutomated)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" stepsType: ").append(toIndentedString(stepsType)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" customField: ").append(toIndentedString(customField)).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(Arrays.asList("title", "description", "preconditions", "postconditions", "severity", "priority", "behavior", "type", "layer", "is_flaky", "is_muted", "suite_id", "milestone_id", "is_manual", "is_to_be_automated", "status", "steps_type", "attachments", "steps", "tags", "parameters", "custom_field")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewCaseData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewCaseData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewCaseData is not found in the empty JSON string", ReviewCaseData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("preconditions") != null && !jsonObj.get("preconditions").isJsonNull()) && !jsonObj.get("preconditions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `preconditions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("preconditions").toString())); + } + if ((jsonObj.get("postconditions") != null && !jsonObj.get("postconditions").isJsonNull()) && !jsonObj.get("postconditions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `postconditions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postconditions").toString())); + } + if ((jsonObj.get("steps_type") != null && !jsonObj.get("steps_type").isJsonNull()) && !jsonObj.get("steps_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `steps_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("steps_type").toString())); + } + // validate the optional field `steps_type` + if (jsonObj.get("steps_type") != null && !jsonObj.get("steps_type").isJsonNull()) { + StepsTypeEnum.validateJsonElement(jsonObj.get("steps_type")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull() && !jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + if (jsonObj.get("steps") != null && !jsonObj.get("steps").isJsonNull()) { + JsonArray jsonArraysteps = jsonObj.getAsJsonArray("steps"); + if (jsonArraysteps != null) { + // ensure the json data is an array + if (!jsonObj.get("steps").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `steps` to be an array in the JSON string but got `%s`", jsonObj.get("steps").toString())); + } + + // validate the optional field `steps` (array) + for (int i = 0; i < jsonArraysteps.size(); i++) { + ReviewStepData.validateJsonElement(jsonArraysteps.get(i)); + }; + } + } + // 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(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + TestCaseParameterCreate.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewCaseData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewCaseData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewCaseData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewCaseData 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 ReviewCaseData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewCaseData 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(java.util.Locale.ROOT, "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 ReviewCaseData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewCaseData + * @throws IOException if the JSON string is invalid with respect to ReviewCaseData + */ + public static ReviewCaseData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewCaseData.class); + } + + /** + * Convert an instance of ReviewCaseData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewCreate.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewCreate.java new file mode 100644 index 00000000..d567439b --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewCreate.java @@ -0,0 +1,372 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewCaseData; +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.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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewCreate + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewCreate { + public static final String SERIALIZED_NAME_CASE_ID = "case_id"; + @SerializedName(SERIALIZED_NAME_CASE_ID) + @javax.annotation.Nullable + private Long caseId; + + public static final String SERIALIZED_NAME_REVIEWERS = "reviewers"; + @SerializedName(SERIALIZED_NAME_REVIEWERS) + @javax.annotation.Nullable + private List reviewers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PROPOSED_CASE = "proposed_case"; + @SerializedName(SERIALIZED_NAME_PROPOSED_CASE) + @javax.annotation.Nonnull + private ReviewCaseData proposedCase; + + public ReviewCreate() { + } + + public ReviewCreate caseId(@javax.annotation.Nullable Long caseId) { + this.caseId = caseId; + return this; + } + + /** + * ID of the reviewed test case. When present an `edit` review is created, otherwise a `create` review with a new-case draft. + * @return caseId + */ + @javax.annotation.Nullable + public Long getCaseId() { + return caseId; + } + + public void setCaseId(@javax.annotation.Nullable Long caseId) { + this.caseId = caseId; + } + + + public ReviewCreate reviewers(@javax.annotation.Nullable List reviewers) { + this.reviewers = reviewers; + return this; + } + + public ReviewCreate addReviewersItem(UUID reviewersItem) { + if (this.reviewers == null) { + this.reviewers = new ArrayList<>(); + } + this.reviewers.add(reviewersItem); + return this; + } + + /** + * Author UUIDs of team members to assign as reviewers (see `GET /author`). + * @return reviewers + */ + @javax.annotation.Nullable + public List getReviewers() { + return reviewers; + } + + public void setReviewers(@javax.annotation.Nullable List reviewers) { + this.reviewers = reviewers; + } + + + public ReviewCreate proposedCase(@javax.annotation.Nonnull ReviewCaseData proposedCase) { + this.proposedCase = proposedCase; + return this; + } + + /** + * For `create` reviews `title` and all required project fields are required. For `edit` reviews send only the fields the proposal changes. + * @return proposedCase + */ + @javax.annotation.Nonnull + public ReviewCaseData getProposedCase() { + return proposedCase; + } + + public void setProposedCase(@javax.annotation.Nonnull ReviewCaseData proposedCase) { + this.proposedCase = proposedCase; + } + + /** + * 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 ReviewCreate instance itself + */ + public ReviewCreate 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; + } + ReviewCreate reviewCreate = (ReviewCreate) o; + return Objects.equals(this.caseId, reviewCreate.caseId) && + Objects.equals(this.reviewers, reviewCreate.reviewers) && + Objects.equals(this.proposedCase, reviewCreate.proposedCase)&& + Objects.equals(this.additionalProperties, reviewCreate.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(caseId, reviewers, proposedCase, 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 ReviewCreate {\n"); + sb.append(" caseId: ").append(toIndentedString(caseId)).append("\n"); + sb.append(" reviewers: ").append(toIndentedString(reviewers)).append("\n"); + sb.append(" proposedCase: ").append(toIndentedString(proposedCase)).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(Arrays.asList("case_id", "reviewers", "proposed_case")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("proposed_case")); + } + + /** + * 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 ReviewCreate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewCreate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewCreate is not found in the empty JSON string", ReviewCreate.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReviewCreate.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("reviewers") != null && !jsonObj.get("reviewers").isJsonNull() && !jsonObj.get("reviewers").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reviewers` to be an array in the JSON string but got `%s`", jsonObj.get("reviewers").toString())); + } + // validate the required field `proposed_case` + ReviewCaseData.validateJsonElement(jsonObj.get("proposed_case")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewCreate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewCreate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewCreate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewCreate 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 ReviewCreate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewCreate 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(java.util.Locale.ROOT, "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 ReviewCreate given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewCreate + * @throws IOException if the JSON string is invalid with respect to ReviewCreate + */ + public static ReviewCreate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewCreate.class); + } + + /** + * Convert an instance of ReviewCreate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewDetailed.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewDetailed.java new file mode 100644 index 00000000..e24338f8 --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewDetailed.java @@ -0,0 +1,682 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewReviewersInner; +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.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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewDetailed + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewDetailed { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable + private Long id; + + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nullable + private String title; + + /** + * `create` — the review proposes a new test case; `edit` — the review proposes changes to an existing test case. + */ + @JsonAdapter(TypeEnum.Adapter.class) + public enum TypeEnum { + CREATE("create"), + + EDIT("edit"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.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 TypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private TypeEnum type; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + OPEN("open"), + + MERGED("merged"), + + DECLINED("declined"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.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 StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public static final String SERIALIZED_NAME_CASE_ID = "case_id"; + @SerializedName(SERIALIZED_NAME_CASE_ID) + @javax.annotation.Nullable + private Long caseId; + + public static final String SERIALIZED_NAME_AUTHOR_UUID = "author_uuid"; + @SerializedName(SERIALIZED_NAME_AUTHOR_UUID) + @javax.annotation.Nullable + private UUID authorUuid; + + public static final String SERIALIZED_NAME_REVIEWERS = "reviewers"; + @SerializedName(SERIALIZED_NAME_REVIEWERS) + @javax.annotation.Nullable + private List reviewers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CREATED_AT = "created_at"; + @SerializedName(SERIALIZED_NAME_CREATED_AT) + @javax.annotation.Nullable + private OffsetDateTime createdAt; + + public static final String SERIALIZED_NAME_UPDATED_AT = "updated_at"; + @SerializedName(SERIALIZED_NAME_UPDATED_AT) + @javax.annotation.Nullable + private OffsetDateTime updatedAt; + + public static final String SERIALIZED_NAME_PROPOSED_CASE = "proposed_case"; + @SerializedName(SERIALIZED_NAME_PROPOSED_CASE) + @javax.annotation.Nullable + private Object proposedCase; + + public ReviewDetailed() { + } + + public ReviewDetailed id(@javax.annotation.Nullable Long id) { + this.id = id; + return this; + } + + /** + * Review ID, unique within the project. + * @return id + */ + @javax.annotation.Nullable + public Long getId() { + return id; + } + + public void setId(@javax.annotation.Nullable Long id) { + this.id = id; + } + + + public ReviewDetailed title(@javax.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@javax.annotation.Nullable String title) { + this.title = title; + } + + + public ReviewDetailed type(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + return this; + } + + /** + * `create` — the review proposes a new test case; `edit` — the review proposes changes to an existing test case. + * @return type + */ + @javax.annotation.Nullable + public TypeEnum getType() { + return type; + } + + public void setType(@javax.annotation.Nullable TypeEnum type) { + this.type = type; + } + + + public ReviewDetailed status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + } + + + public ReviewDetailed caseId(@javax.annotation.Nullable Long caseId) { + this.caseId = caseId; + return this; + } + + /** + * ID of the reviewed test case. Null for new-case draft reviews. + * @return caseId + */ + @javax.annotation.Nullable + public Long getCaseId() { + return caseId; + } + + public void setCaseId(@javax.annotation.Nullable Long caseId) { + this.caseId = caseId; + } + + + public ReviewDetailed authorUuid(@javax.annotation.Nullable UUID authorUuid) { + this.authorUuid = authorUuid; + return this; + } + + /** + * Author UUID of the review creator (see `GET /author`). + * @return authorUuid + */ + @javax.annotation.Nullable + public UUID getAuthorUuid() { + return authorUuid; + } + + public void setAuthorUuid(@javax.annotation.Nullable UUID authorUuid) { + this.authorUuid = authorUuid; + } + + + public ReviewDetailed reviewers(@javax.annotation.Nullable List reviewers) { + this.reviewers = reviewers; + return this; + } + + public ReviewDetailed addReviewersItem(ReviewReviewersInner reviewersItem) { + if (this.reviewers == null) { + this.reviewers = new ArrayList<>(); + } + this.reviewers.add(reviewersItem); + return this; + } + + /** + * Get reviewers + * @return reviewers + */ + @javax.annotation.Nullable + public List getReviewers() { + return reviewers; + } + + public void setReviewers(@javax.annotation.Nullable List reviewers) { + this.reviewers = reviewers; + } + + + public ReviewDetailed createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get createdAt + * @return createdAt + */ + @javax.annotation.Nullable + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + + public ReviewDetailed updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Get updatedAt + * @return updatedAt + */ + @javax.annotation.Nullable + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + + public ReviewDetailed proposedCase(@javax.annotation.Nullable Object proposedCase) { + this.proposedCase = proposedCase; + return this; + } + + /** + * The proposed test case state. Merging the review applies it to the test case. + * @return proposedCase + */ + @javax.annotation.Nullable + public Object getProposedCase() { + return proposedCase; + } + + public void setProposedCase(@javax.annotation.Nullable Object proposedCase) { + this.proposedCase = proposedCase; + } + + /** + * 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 ReviewDetailed instance itself + */ + public ReviewDetailed 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; + } + ReviewDetailed reviewDetailed = (ReviewDetailed) o; + return Objects.equals(this.id, reviewDetailed.id) && + Objects.equals(this.title, reviewDetailed.title) && + Objects.equals(this.type, reviewDetailed.type) && + Objects.equals(this.status, reviewDetailed.status) && + Objects.equals(this.caseId, reviewDetailed.caseId) && + Objects.equals(this.authorUuid, reviewDetailed.authorUuid) && + Objects.equals(this.reviewers, reviewDetailed.reviewers) && + Objects.equals(this.createdAt, reviewDetailed.createdAt) && + Objects.equals(this.updatedAt, reviewDetailed.updatedAt) && + Objects.equals(this.proposedCase, reviewDetailed.proposedCase)&& + Objects.equals(this.additionalProperties, reviewDetailed.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(id, title, type, status, caseId, authorUuid, reviewers, createdAt, updatedAt, proposedCase, 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 ReviewDetailed {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" caseId: ").append(toIndentedString(caseId)).append("\n"); + sb.append(" authorUuid: ").append(toIndentedString(authorUuid)).append("\n"); + sb.append(" reviewers: ").append(toIndentedString(reviewers)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" proposedCase: ").append(toIndentedString(proposedCase)).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(Arrays.asList("id", "title", "type", "status", "case_id", "author_uuid", "reviewers", "created_at", "updated_at", "proposed_case")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewDetailed + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewDetailed.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewDetailed is not found in the empty JSON string", ReviewDetailed.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + TypeEnum.validateJsonElement(jsonObj.get("type")); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + if ((jsonObj.get("author_uuid") != null && !jsonObj.get("author_uuid").isJsonNull()) && !jsonObj.get("author_uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `author_uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("author_uuid").toString())); + } + if (jsonObj.get("reviewers") != null && !jsonObj.get("reviewers").isJsonNull()) { + JsonArray jsonArrayreviewers = jsonObj.getAsJsonArray("reviewers"); + if (jsonArrayreviewers != null) { + // ensure the json data is an array + if (!jsonObj.get("reviewers").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reviewers` to be an array in the JSON string but got `%s`", jsonObj.get("reviewers").toString())); + } + + // validate the optional field `reviewers` (array) + for (int i = 0; i < jsonArrayreviewers.size(); i++) { + ReviewReviewersInner.validateJsonElement(jsonArrayreviewers.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewDetailed.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewDetailed' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewDetailed.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewDetailed 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 ReviewDetailed read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewDetailed 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(java.util.Locale.ROOT, "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 ReviewDetailed given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewDetailed + * @throws IOException if the JSON string is invalid with respect to ReviewDetailed + */ + public static ReviewDetailed fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewDetailed.class); + } + + /** + * Convert an instance of ReviewDetailed to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewListResponse.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewListResponse.java new file mode 100644 index 00000000..f958020c --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewListResponse.java @@ -0,0 +1,314 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewListResponseAllOfResult; +import java.io.IOException; +import java.util.Arrays; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewListResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewListResponse { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private Boolean status; + + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + @javax.annotation.Nullable + private ReviewListResponseAllOfResult result; + + public ReviewListResponse() { + } + + public ReviewListResponse status(@javax.annotation.Nullable Boolean status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public Boolean getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable Boolean status) { + this.status = status; + } + + + public ReviewListResponse result(@javax.annotation.Nullable ReviewListResponseAllOfResult result) { + this.result = result; + return this; + } + + /** + * Get result + * @return result + */ + @javax.annotation.Nullable + public ReviewListResponseAllOfResult getResult() { + return result; + } + + public void setResult(@javax.annotation.Nullable ReviewListResponseAllOfResult result) { + this.result = result; + } + + /** + * 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 ReviewListResponse instance itself + */ + public ReviewListResponse 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; + } + ReviewListResponse reviewListResponse = (ReviewListResponse) o; + return Objects.equals(this.status, reviewListResponse.status) && + Objects.equals(this.result, reviewListResponse.result)&& + Objects.equals(this.additionalProperties, reviewListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(status, result, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewListResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).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(Arrays.asList("status", "result")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewListResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewListResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewListResponse is not found in the empty JSON string", ReviewListResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `result` + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + ReviewListResponseAllOfResult.validateJsonElement(jsonObj.get("result")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewListResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewListResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewListResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewListResponse 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 ReviewListResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewListResponse 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(java.util.Locale.ROOT, "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 ReviewListResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewListResponse + * @throws IOException if the JSON string is invalid with respect to ReviewListResponse + */ + public static ReviewListResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewListResponse.class); + } + + /** + * Convert an instance of ReviewListResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewListResponseAllOfResult.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewListResponseAllOfResult.java new file mode 100644 index 00000000..969d5f81 --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewListResponseAllOfResult.java @@ -0,0 +1,386 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.Review; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewListResponseAllOfResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewListResponseAllOfResult { + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + @javax.annotation.Nullable + private Integer total; + + public static final String SERIALIZED_NAME_FILTERED = "filtered"; + @SerializedName(SERIALIZED_NAME_FILTERED) + @javax.annotation.Nullable + private Integer filtered; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable + private Integer count; + + public static final String SERIALIZED_NAME_ENTITIES = "entities"; + @SerializedName(SERIALIZED_NAME_ENTITIES) + @javax.annotation.Nullable + private List entities = new ArrayList<>(); + + public ReviewListResponseAllOfResult() { + } + + public ReviewListResponseAllOfResult total(@javax.annotation.Nullable Integer total) { + this.total = total; + return this; + } + + /** + * Get total + * @return total + */ + @javax.annotation.Nullable + public Integer getTotal() { + return total; + } + + public void setTotal(@javax.annotation.Nullable Integer total) { + this.total = total; + } + + + public ReviewListResponseAllOfResult filtered(@javax.annotation.Nullable Integer filtered) { + this.filtered = filtered; + return this; + } + + /** + * Get filtered + * @return filtered + */ + @javax.annotation.Nullable + public Integer getFiltered() { + return filtered; + } + + public void setFiltered(@javax.annotation.Nullable Integer filtered) { + this.filtered = filtered; + } + + + public ReviewListResponseAllOfResult count(@javax.annotation.Nullable Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * @return count + */ + @javax.annotation.Nullable + public Integer getCount() { + return count; + } + + public void setCount(@javax.annotation.Nullable Integer count) { + this.count = count; + } + + + public ReviewListResponseAllOfResult entities(@javax.annotation.Nullable List entities) { + this.entities = entities; + return this; + } + + public ReviewListResponseAllOfResult addEntitiesItem(Review entitiesItem) { + if (this.entities == null) { + this.entities = new ArrayList<>(); + } + this.entities.add(entitiesItem); + return this; + } + + /** + * Get entities + * @return entities + */ + @javax.annotation.Nullable + public List getEntities() { + return entities; + } + + public void setEntities(@javax.annotation.Nullable List entities) { + this.entities = entities; + } + + /** + * 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 ReviewListResponseAllOfResult instance itself + */ + public ReviewListResponseAllOfResult 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; + } + ReviewListResponseAllOfResult reviewListResponseAllOfResult = (ReviewListResponseAllOfResult) o; + return Objects.equals(this.total, reviewListResponseAllOfResult.total) && + Objects.equals(this.filtered, reviewListResponseAllOfResult.filtered) && + Objects.equals(this.count, reviewListResponseAllOfResult.count) && + Objects.equals(this.entities, reviewListResponseAllOfResult.entities)&& + Objects.equals(this.additionalProperties, reviewListResponseAllOfResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(total, filtered, count, entities, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewListResponseAllOfResult {\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" filtered: ").append(toIndentedString(filtered)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" entities: ").append(toIndentedString(entities)).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(Arrays.asList("total", "filtered", "count", "entities")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewListResponseAllOfResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewListResponseAllOfResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewListResponseAllOfResult is not found in the empty JSON string", ReviewListResponseAllOfResult.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("entities") != null && !jsonObj.get("entities").isJsonNull()) { + JsonArray jsonArrayentities = jsonObj.getAsJsonArray("entities"); + if (jsonArrayentities != null) { + // ensure the json data is an array + if (!jsonObj.get("entities").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `entities` to be an array in the JSON string but got `%s`", jsonObj.get("entities").toString())); + } + + // validate the optional field `entities` (array) + for (int i = 0; i < jsonArrayentities.size(); i++) { + Review.validateJsonElement(jsonArrayentities.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewListResponseAllOfResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewListResponseAllOfResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewListResponseAllOfResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewListResponseAllOfResult 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 ReviewListResponseAllOfResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewListResponseAllOfResult 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(java.util.Locale.ROOT, "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 ReviewListResponseAllOfResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewListResponseAllOfResult + * @throws IOException if the JSON string is invalid with respect to ReviewListResponseAllOfResult + */ + public static ReviewListResponseAllOfResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewListResponseAllOfResult.class); + } + + /** + * Convert an instance of ReviewListResponseAllOfResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewProposedCase.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewProposedCase.java new file mode 100644 index 00000000..db6e158a --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewProposedCase.java @@ -0,0 +1,1007 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.CustomFieldValue; +import io.qase.client.v1.models.ReviewProposedStep; +import io.qase.client.v1.models.TestCaseParameter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * The test case state proposed by the review. Only the fields the proposal carries are present. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewProposedCase { + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + @javax.annotation.Nullable + private String title; + + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + @javax.annotation.Nullable + private String description; + + public static final String SERIALIZED_NAME_PRECONDITIONS = "preconditions"; + @SerializedName(SERIALIZED_NAME_PRECONDITIONS) + @javax.annotation.Nullable + private String preconditions; + + public static final String SERIALIZED_NAME_POSTCONDITIONS = "postconditions"; + @SerializedName(SERIALIZED_NAME_POSTCONDITIONS) + @javax.annotation.Nullable + private String postconditions; + + public static final String SERIALIZED_NAME_SEVERITY = "severity"; + @SerializedName(SERIALIZED_NAME_SEVERITY) + @javax.annotation.Nullable + private Integer severity; + + public static final String SERIALIZED_NAME_PRIORITY = "priority"; + @SerializedName(SERIALIZED_NAME_PRIORITY) + @javax.annotation.Nullable + private Integer priority; + + public static final String SERIALIZED_NAME_BEHAVIOR = "behavior"; + @SerializedName(SERIALIZED_NAME_BEHAVIOR) + @javax.annotation.Nullable + private Integer behavior; + + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable + private Integer type; + + public static final String SERIALIZED_NAME_LAYER = "layer"; + @SerializedName(SERIALIZED_NAME_LAYER) + @javax.annotation.Nullable + private Integer layer; + + public static final String SERIALIZED_NAME_IS_FLAKY = "is_flaky"; + @SerializedName(SERIALIZED_NAME_IS_FLAKY) + @javax.annotation.Nullable + private Integer isFlaky; + + public static final String SERIALIZED_NAME_IS_MUTED = "is_muted"; + @SerializedName(SERIALIZED_NAME_IS_MUTED) + @javax.annotation.Nullable + private Boolean isMuted; + + public static final String SERIALIZED_NAME_SUITE_ID = "suite_id"; + @SerializedName(SERIALIZED_NAME_SUITE_ID) + @javax.annotation.Nullable + private Long suiteId; + + public static final String SERIALIZED_NAME_MILESTONE_ID = "milestone_id"; + @SerializedName(SERIALIZED_NAME_MILESTONE_ID) + @javax.annotation.Nullable + private Long milestoneId; + + public static final String SERIALIZED_NAME_IS_MANUAL = "is_manual"; + @SerializedName(SERIALIZED_NAME_IS_MANUAL) + @javax.annotation.Nullable + private Boolean isManual; + + public static final String SERIALIZED_NAME_IS_TO_BE_AUTOMATED = "is_to_be_automated"; + @SerializedName(SERIALIZED_NAME_IS_TO_BE_AUTOMATED) + @javax.annotation.Nullable + private Boolean isToBeAutomated; + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private Integer status; + + /** + * Gets or Sets stepsType + */ + @JsonAdapter(StepsTypeEnum.Adapter.class) + public enum StepsTypeEnum { + CLASSIC("classic"), + + GHERKIN("gherkin"); + + private String value; + + StepsTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StepsTypeEnum fromValue(String value) { + for (StepsTypeEnum b : StepsTypeEnum.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 StepsTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StepsTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StepsTypeEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StepsTypeEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STEPS_TYPE = "steps_type"; + @SerializedName(SERIALIZED_NAME_STEPS_TYPE) + @javax.annotation.Nullable + private StepsTypeEnum stepsType; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments; + + public static final String SERIALIZED_NAME_STEPS = "steps"; + @SerializedName(SERIALIZED_NAME_STEPS) + @javax.annotation.Nullable + private List steps = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + @javax.annotation.Nullable + private List tags; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + @javax.annotation.Nullable + private List parameters = new ArrayList<>(); + + public static final String SERIALIZED_NAME_CUSTOM_FIELDS = "custom_fields"; + @SerializedName(SERIALIZED_NAME_CUSTOM_FIELDS) + @javax.annotation.Nullable + private List customFields = new ArrayList<>(); + + public ReviewProposedCase() { + } + + public ReviewProposedCase title(@javax.annotation.Nullable String title) { + this.title = title; + return this; + } + + /** + * Get title + * @return title + */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(@javax.annotation.Nullable String title) { + this.title = title; + } + + + public ReviewProposedCase description(@javax.annotation.Nullable String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(@javax.annotation.Nullable String description) { + this.description = description; + } + + + public ReviewProposedCase preconditions(@javax.annotation.Nullable String preconditions) { + this.preconditions = preconditions; + return this; + } + + /** + * Get preconditions + * @return preconditions + */ + @javax.annotation.Nullable + public String getPreconditions() { + return preconditions; + } + + public void setPreconditions(@javax.annotation.Nullable String preconditions) { + this.preconditions = preconditions; + } + + + public ReviewProposedCase postconditions(@javax.annotation.Nullable String postconditions) { + this.postconditions = postconditions; + return this; + } + + /** + * Get postconditions + * @return postconditions + */ + @javax.annotation.Nullable + public String getPostconditions() { + return postconditions; + } + + public void setPostconditions(@javax.annotation.Nullable String postconditions) { + this.postconditions = postconditions; + } + + + public ReviewProposedCase severity(@javax.annotation.Nullable Integer severity) { + this.severity = severity; + return this; + } + + /** + * Get severity + * @return severity + */ + @javax.annotation.Nullable + public Integer getSeverity() { + return severity; + } + + public void setSeverity(@javax.annotation.Nullable Integer severity) { + this.severity = severity; + } + + + public ReviewProposedCase priority(@javax.annotation.Nullable Integer priority) { + this.priority = priority; + return this; + } + + /** + * Get priority + * @return priority + */ + @javax.annotation.Nullable + public Integer getPriority() { + return priority; + } + + public void setPriority(@javax.annotation.Nullable Integer priority) { + this.priority = priority; + } + + + public ReviewProposedCase behavior(@javax.annotation.Nullable Integer behavior) { + this.behavior = behavior; + return this; + } + + /** + * Get behavior + * @return behavior + */ + @javax.annotation.Nullable + public Integer getBehavior() { + return behavior; + } + + public void setBehavior(@javax.annotation.Nullable Integer behavior) { + this.behavior = behavior; + } + + + public ReviewProposedCase type(@javax.annotation.Nullable Integer type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public Integer getType() { + return type; + } + + public void setType(@javax.annotation.Nullable Integer type) { + this.type = type; + } + + + public ReviewProposedCase layer(@javax.annotation.Nullable Integer layer) { + this.layer = layer; + return this; + } + + /** + * Get layer + * @return layer + */ + @javax.annotation.Nullable + public Integer getLayer() { + return layer; + } + + public void setLayer(@javax.annotation.Nullable Integer layer) { + this.layer = layer; + } + + + public ReviewProposedCase isFlaky(@javax.annotation.Nullable Integer isFlaky) { + this.isFlaky = isFlaky; + return this; + } + + /** + * Get isFlaky + * @return isFlaky + */ + @javax.annotation.Nullable + public Integer getIsFlaky() { + return isFlaky; + } + + public void setIsFlaky(@javax.annotation.Nullable Integer isFlaky) { + this.isFlaky = isFlaky; + } + + + public ReviewProposedCase isMuted(@javax.annotation.Nullable Boolean isMuted) { + this.isMuted = isMuted; + return this; + } + + /** + * Get isMuted + * @return isMuted + */ + @javax.annotation.Nullable + public Boolean getIsMuted() { + return isMuted; + } + + public void setIsMuted(@javax.annotation.Nullable Boolean isMuted) { + this.isMuted = isMuted; + } + + + public ReviewProposedCase suiteId(@javax.annotation.Nullable Long suiteId) { + this.suiteId = suiteId; + return this; + } + + /** + * Get suiteId + * @return suiteId + */ + @javax.annotation.Nullable + public Long getSuiteId() { + return suiteId; + } + + public void setSuiteId(@javax.annotation.Nullable Long suiteId) { + this.suiteId = suiteId; + } + + + public ReviewProposedCase milestoneId(@javax.annotation.Nullable Long milestoneId) { + this.milestoneId = milestoneId; + return this; + } + + /** + * Get milestoneId + * @return milestoneId + */ + @javax.annotation.Nullable + public Long getMilestoneId() { + return milestoneId; + } + + public void setMilestoneId(@javax.annotation.Nullable Long milestoneId) { + this.milestoneId = milestoneId; + } + + + public ReviewProposedCase isManual(@javax.annotation.Nullable Boolean isManual) { + this.isManual = isManual; + return this; + } + + /** + * `true` if the case is manual, `false` if it is automated. + * @return isManual + */ + @javax.annotation.Nullable + public Boolean getIsManual() { + return isManual; + } + + public void setIsManual(@javax.annotation.Nullable Boolean isManual) { + this.isManual = isManual; + } + + + public ReviewProposedCase isToBeAutomated(@javax.annotation.Nullable Boolean isToBeAutomated) { + this.isToBeAutomated = isToBeAutomated; + return this; + } + + /** + * `true` if a manual case is planned to be automated. + * @return isToBeAutomated + */ + @javax.annotation.Nullable + public Boolean getIsToBeAutomated() { + return isToBeAutomated; + } + + public void setIsToBeAutomated(@javax.annotation.Nullable Boolean isToBeAutomated) { + this.isToBeAutomated = isToBeAutomated; + } + + + public ReviewProposedCase status(@javax.annotation.Nullable Integer status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public Integer getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable Integer status) { + this.status = status; + } + + + public ReviewProposedCase stepsType(@javax.annotation.Nullable StepsTypeEnum stepsType) { + this.stepsType = stepsType; + return this; + } + + /** + * Get stepsType + * @return stepsType + */ + @javax.annotation.Nullable + public StepsTypeEnum getStepsType() { + return stepsType; + } + + public void setStepsType(@javax.annotation.Nullable StepsTypeEnum stepsType) { + this.stepsType = stepsType; + } + + + public ReviewProposedCase attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public ReviewProposedCase addAttachmentsItem(String attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * Attachment hashes. + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + public ReviewProposedCase steps(@javax.annotation.Nullable List steps) { + this.steps = steps; + return this; + } + + public ReviewProposedCase addStepsItem(ReviewProposedStep stepsItem) { + if (this.steps == null) { + this.steps = new ArrayList<>(); + } + this.steps.add(stepsItem); + return this; + } + + /** + * Get steps + * @return steps + */ + @javax.annotation.Nullable + public List getSteps() { + return steps; + } + + public void setSteps(@javax.annotation.Nullable List steps) { + this.steps = steps; + } + + + public ReviewProposedCase tags(@javax.annotation.Nullable List tags) { + this.tags = tags; + return this; + } + + public ReviewProposedCase addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(@javax.annotation.Nullable List tags) { + this.tags = tags; + } + + + public ReviewProposedCase parameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + return this; + } + + public ReviewProposedCase addParametersItem(TestCaseParameter parametersItem) { + if (this.parameters == null) { + this.parameters = new ArrayList<>(); + } + this.parameters.add(parametersItem); + return this; + } + + /** + * Get parameters + * @return parameters + */ + @javax.annotation.Nullable + public List getParameters() { + return parameters; + } + + public void setParameters(@javax.annotation.Nullable List parameters) { + this.parameters = parameters; + } + + + public ReviewProposedCase customFields(@javax.annotation.Nullable List customFields) { + this.customFields = customFields; + return this; + } + + public ReviewProposedCase addCustomFieldsItem(CustomFieldValue customFieldsItem) { + if (this.customFields == null) { + this.customFields = new ArrayList<>(); + } + this.customFields.add(customFieldsItem); + return this; + } + + /** + * Get customFields + * @return customFields + */ + @javax.annotation.Nullable + public List getCustomFields() { + return customFields; + } + + public void setCustomFields(@javax.annotation.Nullable List customFields) { + this.customFields = customFields; + } + + /** + * 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 ReviewProposedCase instance itself + */ + public ReviewProposedCase 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; + } + ReviewProposedCase reviewProposedCase = (ReviewProposedCase) o; + return Objects.equals(this.title, reviewProposedCase.title) && + Objects.equals(this.description, reviewProposedCase.description) && + Objects.equals(this.preconditions, reviewProposedCase.preconditions) && + Objects.equals(this.postconditions, reviewProposedCase.postconditions) && + Objects.equals(this.severity, reviewProposedCase.severity) && + Objects.equals(this.priority, reviewProposedCase.priority) && + Objects.equals(this.behavior, reviewProposedCase.behavior) && + Objects.equals(this.type, reviewProposedCase.type) && + Objects.equals(this.layer, reviewProposedCase.layer) && + Objects.equals(this.isFlaky, reviewProposedCase.isFlaky) && + Objects.equals(this.isMuted, reviewProposedCase.isMuted) && + Objects.equals(this.suiteId, reviewProposedCase.suiteId) && + Objects.equals(this.milestoneId, reviewProposedCase.milestoneId) && + Objects.equals(this.isManual, reviewProposedCase.isManual) && + Objects.equals(this.isToBeAutomated, reviewProposedCase.isToBeAutomated) && + Objects.equals(this.status, reviewProposedCase.status) && + Objects.equals(this.stepsType, reviewProposedCase.stepsType) && + Objects.equals(this.attachments, reviewProposedCase.attachments) && + Objects.equals(this.steps, reviewProposedCase.steps) && + Objects.equals(this.tags, reviewProposedCase.tags) && + Objects.equals(this.parameters, reviewProposedCase.parameters) && + Objects.equals(this.customFields, reviewProposedCase.customFields)&& + Objects.equals(this.additionalProperties, reviewProposedCase.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(title, description, preconditions, postconditions, severity, priority, behavior, type, layer, isFlaky, isMuted, suiteId, milestoneId, isManual, isToBeAutomated, status, stepsType, attachments, steps, tags, parameters, customFields, 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 ReviewProposedCase {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" preconditions: ").append(toIndentedString(preconditions)).append("\n"); + sb.append(" postconditions: ").append(toIndentedString(postconditions)).append("\n"); + sb.append(" severity: ").append(toIndentedString(severity)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + sb.append(" behavior: ").append(toIndentedString(behavior)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" layer: ").append(toIndentedString(layer)).append("\n"); + sb.append(" isFlaky: ").append(toIndentedString(isFlaky)).append("\n"); + sb.append(" isMuted: ").append(toIndentedString(isMuted)).append("\n"); + sb.append(" suiteId: ").append(toIndentedString(suiteId)).append("\n"); + sb.append(" milestoneId: ").append(toIndentedString(milestoneId)).append("\n"); + sb.append(" isManual: ").append(toIndentedString(isManual)).append("\n"); + sb.append(" isToBeAutomated: ").append(toIndentedString(isToBeAutomated)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" stepsType: ").append(toIndentedString(stepsType)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" customFields: ").append(toIndentedString(customFields)).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(Arrays.asList("title", "description", "preconditions", "postconditions", "severity", "priority", "behavior", "type", "layer", "is_flaky", "is_muted", "suite_id", "milestone_id", "is_manual", "is_to_be_automated", "status", "steps_type", "attachments", "steps", "tags", "parameters", "custom_fields")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewProposedCase + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewProposedCase.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewProposedCase is not found in the empty JSON string", ReviewProposedCase.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("preconditions") != null && !jsonObj.get("preconditions").isJsonNull()) && !jsonObj.get("preconditions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `preconditions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("preconditions").toString())); + } + if ((jsonObj.get("postconditions") != null && !jsonObj.get("postconditions").isJsonNull()) && !jsonObj.get("postconditions").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `postconditions` to be a primitive type in the JSON string but got `%s`", jsonObj.get("postconditions").toString())); + } + if ((jsonObj.get("steps_type") != null && !jsonObj.get("steps_type").isJsonNull()) && !jsonObj.get("steps_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `steps_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("steps_type").toString())); + } + // validate the optional field `steps_type` + if (jsonObj.get("steps_type") != null && !jsonObj.get("steps_type").isJsonNull()) { + StepsTypeEnum.validateJsonElement(jsonObj.get("steps_type")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull() && !jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + if (jsonObj.get("steps") != null && !jsonObj.get("steps").isJsonNull()) { + JsonArray jsonArraysteps = jsonObj.getAsJsonArray("steps"); + if (jsonArraysteps != null) { + // ensure the json data is an array + if (!jsonObj.get("steps").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `steps` to be an array in the JSON string but got `%s`", jsonObj.get("steps").toString())); + } + + // validate the optional field `steps` (array) + for (int i = 0; i < jsonArraysteps.size(); i++) { + ReviewProposedStep.validateJsonElement(jsonArraysteps.get(i)); + }; + } + } + // 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(java.util.Locale.ROOT, "Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { + JsonArray jsonArrayparameters = jsonObj.getAsJsonArray("parameters"); + if (jsonArrayparameters != null) { + // ensure the json data is an array + if (!jsonObj.get("parameters").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `parameters` to be an array in the JSON string but got `%s`", jsonObj.get("parameters").toString())); + } + + // validate the optional field `parameters` (array) + for (int i = 0; i < jsonArrayparameters.size(); i++) { + TestCaseParameter.validateJsonElement(jsonArrayparameters.get(i)); + }; + } + } + if (jsonObj.get("custom_fields") != null && !jsonObj.get("custom_fields").isJsonNull()) { + JsonArray jsonArraycustomFields = jsonObj.getAsJsonArray("custom_fields"); + if (jsonArraycustomFields != null) { + // ensure the json data is an array + if (!jsonObj.get("custom_fields").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `custom_fields` to be an array in the JSON string but got `%s`", jsonObj.get("custom_fields").toString())); + } + + // validate the optional field `custom_fields` (array) + for (int i = 0; i < jsonArraycustomFields.size(); i++) { + CustomFieldValue.validateJsonElement(jsonArraycustomFields.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewProposedCase.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewProposedCase' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewProposedCase.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewProposedCase 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 ReviewProposedCase read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewProposedCase 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(java.util.Locale.ROOT, "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 ReviewProposedCase given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewProposedCase + * @throws IOException if the JSON string is invalid with respect to ReviewProposedCase + */ + public static ReviewProposedCase fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewProposedCase.class); + } + + /** + * Convert an instance of ReviewProposedCase to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewProposedStep.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewProposedStep.java new file mode 100644 index 00000000..9369c859 --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewProposedStep.java @@ -0,0 +1,480 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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.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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewProposedStep + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewProposedStep { + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + @javax.annotation.Nullable + private String action; + + public static final String SERIALIZED_NAME_EXPECTED_RESULT = "expected_result"; + @SerializedName(SERIALIZED_NAME_EXPECTED_RESULT) + @javax.annotation.Nullable + private String expectedResult; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nullable + private String data; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_SHARED = "shared"; + @SerializedName(SERIALIZED_NAME_SHARED) + @javax.annotation.Nullable + private String shared; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STEPS = "steps"; + @SerializedName(SERIALIZED_NAME_STEPS) + @javax.annotation.Nullable + private List steps = new ArrayList<>(); + + public ReviewProposedStep() { + } + + public ReviewProposedStep action(@javax.annotation.Nullable String action) { + this.action = action; + return this; + } + + /** + * Step action text. Used for classic steps. For gherkin steps, use the \"value\" property instead. + * @return action + */ + @javax.annotation.Nullable + public String getAction() { + return action; + } + + public void setAction(@javax.annotation.Nullable String action) { + this.action = action; + } + + + public ReviewProposedStep expectedResult(@javax.annotation.Nullable String expectedResult) { + this.expectedResult = expectedResult; + return this; + } + + /** + * Get expectedResult + * @return expectedResult + */ + @javax.annotation.Nullable + public String getExpectedResult() { + return expectedResult; + } + + public void setExpectedResult(@javax.annotation.Nullable String expectedResult) { + this.expectedResult = expectedResult; + } + + + public ReviewProposedStep data(@javax.annotation.Nullable String data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public String getData() { + return data; + } + + public void setData(@javax.annotation.Nullable String data) { + this.data = data; + } + + + public ReviewProposedStep value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Gherkin scenario text. Used when steps_type is \"gherkin\". + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public ReviewProposedStep shared(@javax.annotation.Nullable String shared) { + this.shared = shared; + return this; + } + + /** + * Hash of the referenced shared step. + * @return shared + */ + @javax.annotation.Nullable + public String getShared() { + return shared; + } + + public void setShared(@javax.annotation.Nullable String shared) { + this.shared = shared; + } + + + public ReviewProposedStep attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public ReviewProposedStep addAttachmentsItem(String attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * A list of Attachment hashes. + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + public ReviewProposedStep steps(@javax.annotation.Nullable List steps) { + this.steps = steps; + return this; + } + + public ReviewProposedStep addStepsItem(Object stepsItem) { + if (this.steps == null) { + this.steps = new ArrayList<>(); + } + this.steps.add(stepsItem); + return this; + } + + /** + * Nested steps use the same structure. + * @return steps + */ + @javax.annotation.Nullable + public List getSteps() { + return steps; + } + + public void setSteps(@javax.annotation.Nullable List steps) { + this.steps = steps; + } + + /** + * 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 ReviewProposedStep instance itself + */ + public ReviewProposedStep 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; + } + ReviewProposedStep reviewProposedStep = (ReviewProposedStep) o; + return Objects.equals(this.action, reviewProposedStep.action) && + Objects.equals(this.expectedResult, reviewProposedStep.expectedResult) && + Objects.equals(this.data, reviewProposedStep.data) && + Objects.equals(this.value, reviewProposedStep.value) && + Objects.equals(this.shared, reviewProposedStep.shared) && + Objects.equals(this.attachments, reviewProposedStep.attachments) && + Objects.equals(this.steps, reviewProposedStep.steps)&& + Objects.equals(this.additionalProperties, reviewProposedStep.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(action, expectedResult, data, value, shared, attachments, steps, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewProposedStep {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" expectedResult: ").append(toIndentedString(expectedResult)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" shared: ").append(toIndentedString(shared)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).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(Arrays.asList("action", "expected_result", "data", "value", "shared", "attachments", "steps")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewProposedStep + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewProposedStep.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewProposedStep is not found in the empty JSON string", ReviewProposedStep.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) && !jsonObj.get("action").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("action").toString())); + } + if ((jsonObj.get("expected_result") != null && !jsonObj.get("expected_result").isJsonNull()) && !jsonObj.get("expected_result").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `expected_result` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expected_result").toString())); + } + if ((jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) && !jsonObj.get("data").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + if ((jsonObj.get("shared") != null && !jsonObj.get("shared").isJsonNull()) && !jsonObj.get("shared").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shared` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shared").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull() && !jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("steps") != null && !jsonObj.get("steps").isJsonNull() && !jsonObj.get("steps").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `steps` to be an array in the JSON string but got `%s`", jsonObj.get("steps").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewProposedStep.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewProposedStep' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewProposedStep.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewProposedStep 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 ReviewProposedStep read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewProposedStep 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(java.util.Locale.ROOT, "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 ReviewProposedStep given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewProposedStep + * @throws IOException if the JSON string is invalid with respect to ReviewProposedStep + */ + public static ReviewProposedStep fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewProposedStep.class); + } + + /** + * Convert an instance of ReviewProposedStep to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewResponse.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewResponse.java new file mode 100644 index 00000000..a4f2f203 --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewResponse.java @@ -0,0 +1,314 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewDetailed; +import java.io.IOException; +import java.util.Arrays; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewResponse { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private Boolean status; + + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + @javax.annotation.Nullable + private ReviewDetailed result; + + public ReviewResponse() { + } + + public ReviewResponse status(@javax.annotation.Nullable Boolean status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public Boolean getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable Boolean status) { + this.status = status; + } + + + public ReviewResponse result(@javax.annotation.Nullable ReviewDetailed result) { + this.result = result; + return this; + } + + /** + * Get result + * @return result + */ + @javax.annotation.Nullable + public ReviewDetailed getResult() { + return result; + } + + public void setResult(@javax.annotation.Nullable ReviewDetailed result) { + this.result = result; + } + + /** + * 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 ReviewResponse instance itself + */ + public ReviewResponse 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; + } + ReviewResponse reviewResponse = (ReviewResponse) o; + return Objects.equals(this.status, reviewResponse.status) && + Objects.equals(this.result, reviewResponse.result)&& + Objects.equals(this.additionalProperties, reviewResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(status, result, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).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(Arrays.asList("status", "result")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewResponse is not found in the empty JSON string", ReviewResponse.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `result` + if (jsonObj.get("result") != null && !jsonObj.get("result").isJsonNull()) { + ReviewDetailed.validateJsonElement(jsonObj.get("result")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewResponse 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 ReviewResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewResponse 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(java.util.Locale.ROOT, "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 ReviewResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewResponse + * @throws IOException if the JSON string is invalid with respect to ReviewResponse + */ + public static ReviewResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewResponse.class); + } + + /** + * Convert an instance of ReviewResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewReviewersInner.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewReviewersInner.java new file mode 100644 index 00000000..dbf877f4 --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewReviewersInner.java @@ -0,0 +1,386 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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.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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewReviewersInner + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewReviewersInner { + public static final String SERIALIZED_NAME_AUTHOR_UUID = "author_uuid"; + @SerializedName(SERIALIZED_NAME_AUTHOR_UUID) + @javax.annotation.Nullable + private UUID authorUuid; + + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + UNAPPROVED("unapproved"), + + APPROVED("approved"), + + CHANGES_REQUESTED("changes_requested"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.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 StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StatusEnum.fromValue(value); + } + } + + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + @javax.annotation.Nullable + private StatusEnum status; + + public ReviewReviewersInner() { + } + + public ReviewReviewersInner authorUuid(@javax.annotation.Nullable UUID authorUuid) { + this.authorUuid = authorUuid; + return this; + } + + /** + * Author UUID of the reviewer (see `GET /author`). + * @return authorUuid + */ + @javax.annotation.Nullable + public UUID getAuthorUuid() { + return authorUuid; + } + + public void setAuthorUuid(@javax.annotation.Nullable UUID authorUuid) { + this.authorUuid = authorUuid; + } + + + public ReviewReviewersInner status(@javax.annotation.Nullable StatusEnum status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nullable + public StatusEnum getStatus() { + return status; + } + + public void setStatus(@javax.annotation.Nullable StatusEnum 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 ReviewReviewersInner instance itself + */ + public ReviewReviewersInner 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; + } + ReviewReviewersInner reviewReviewersInner = (ReviewReviewersInner) o; + return Objects.equals(this.authorUuid, reviewReviewersInner.authorUuid) && + Objects.equals(this.status, reviewReviewersInner.status)&& + Objects.equals(this.additionalProperties, reviewReviewersInner.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(authorUuid, status, 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 ReviewReviewersInner {\n"); + sb.append(" authorUuid: ").append(toIndentedString(authorUuid)).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"; + } + 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(Arrays.asList("author_uuid", "status")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewReviewersInner + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewReviewersInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewReviewersInner is not found in the empty JSON string", ReviewReviewersInner.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("author_uuid") != null && !jsonObj.get("author_uuid").isJsonNull()) && !jsonObj.get("author_uuid").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `author_uuid` to be a primitive type in the JSON string but got `%s`", jsonObj.get("author_uuid").toString())); + } + if ((jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) && !jsonObj.get("status").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `status` to be a primitive type in the JSON string but got `%s`", jsonObj.get("status").toString())); + } + // validate the optional field `status` + if (jsonObj.get("status") != null && !jsonObj.get("status").isJsonNull()) { + StatusEnum.validateJsonElement(jsonObj.get("status")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewReviewersInner.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewReviewersInner' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewReviewersInner.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewReviewersInner 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 ReviewReviewersInner read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewReviewersInner 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(java.util.Locale.ROOT, "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 ReviewReviewersInner given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewReviewersInner + * @throws IOException if the JSON string is invalid with respect to ReviewReviewersInner + */ + public static ReviewReviewersInner fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewReviewersInner.class); + } + + /** + * Convert an instance of ReviewReviewersInner to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewStepData.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewStepData.java new file mode 100644 index 00000000..f9fcd5f1 --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewStepData.java @@ -0,0 +1,480 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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.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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * A step of the proposed test case. When `steps_type` is `gherkin` the step carries the scenario in `value` and nothing else: a non-empty `action`, `expected_result`, `data`, `attachments`, `shared` or nested `steps` is rejected. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewStepData { + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + @javax.annotation.Nullable + private String action; + + public static final String SERIALIZED_NAME_SHARED = "shared"; + @SerializedName(SERIALIZED_NAME_SHARED) + @javax.annotation.Nullable + private String shared; + + public static final String SERIALIZED_NAME_EXPECTED_RESULT = "expected_result"; + @SerializedName(SERIALIZED_NAME_EXPECTED_RESULT) + @javax.annotation.Nullable + private String expectedResult; + + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nullable + private String data; + + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + @javax.annotation.Nullable + private String value; + + public static final String SERIALIZED_NAME_ATTACHMENTS = "attachments"; + @SerializedName(SERIALIZED_NAME_ATTACHMENTS) + @javax.annotation.Nullable + private List attachments = new ArrayList<>(); + + public static final String SERIALIZED_NAME_STEPS = "steps"; + @SerializedName(SERIALIZED_NAME_STEPS) + @javax.annotation.Nullable + private List steps = new ArrayList<>(); + + public ReviewStepData() { + } + + public ReviewStepData action(@javax.annotation.Nullable String action) { + this.action = action; + return this; + } + + /** + * Step action text. Classic steps only. + * @return action + */ + @javax.annotation.Nullable + public String getAction() { + return action; + } + + public void setAction(@javax.annotation.Nullable String action) { + this.action = action; + } + + + public ReviewStepData shared(@javax.annotation.Nullable String shared) { + this.shared = shared; + return this; + } + + /** + * Hash of an existing shared step to insert at this position. + * @return shared + */ + @javax.annotation.Nullable + public String getShared() { + return shared; + } + + public void setShared(@javax.annotation.Nullable String shared) { + this.shared = shared; + } + + + public ReviewStepData expectedResult(@javax.annotation.Nullable String expectedResult) { + this.expectedResult = expectedResult; + return this; + } + + /** + * Get expectedResult + * @return expectedResult + */ + @javax.annotation.Nullable + public String getExpectedResult() { + return expectedResult; + } + + public void setExpectedResult(@javax.annotation.Nullable String expectedResult) { + this.expectedResult = expectedResult; + } + + + public ReviewStepData data(@javax.annotation.Nullable String data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public String getData() { + return data; + } + + public void setData(@javax.annotation.Nullable String data) { + this.data = data; + } + + + public ReviewStepData value(@javax.annotation.Nullable String value) { + this.value = value; + return this; + } + + /** + * Gherkin scenario text. Used when steps_type is \"gherkin\". Example: \"Given a user exists\\nWhen they log in\\nThen they see the dashboard\" + * @return value + */ + @javax.annotation.Nullable + public String getValue() { + return value; + } + + public void setValue(@javax.annotation.Nullable String value) { + this.value = value; + } + + + public ReviewStepData attachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + return this; + } + + public ReviewStepData addAttachmentsItem(String attachmentsItem) { + if (this.attachments == null) { + this.attachments = new ArrayList<>(); + } + this.attachments.add(attachmentsItem); + return this; + } + + /** + * A list of Attachment hashes. + * @return attachments + */ + @javax.annotation.Nullable + public List getAttachments() { + return attachments; + } + + public void setAttachments(@javax.annotation.Nullable List attachments) { + this.attachments = attachments; + } + + + public ReviewStepData steps(@javax.annotation.Nullable List steps) { + this.steps = steps; + return this; + } + + public ReviewStepData addStepsItem(Object stepsItem) { + if (this.steps == null) { + this.steps = new ArrayList<>(); + } + this.steps.add(stepsItem); + return this; + } + + /** + * Nested steps may be passed here. Use same structure for them. + * @return steps + */ + @javax.annotation.Nullable + public List getSteps() { + return steps; + } + + public void setSteps(@javax.annotation.Nullable List steps) { + this.steps = steps; + } + + /** + * 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 ReviewStepData instance itself + */ + public ReviewStepData 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; + } + ReviewStepData reviewStepData = (ReviewStepData) o; + return Objects.equals(this.action, reviewStepData.action) && + Objects.equals(this.shared, reviewStepData.shared) && + Objects.equals(this.expectedResult, reviewStepData.expectedResult) && + Objects.equals(this.data, reviewStepData.data) && + Objects.equals(this.value, reviewStepData.value) && + Objects.equals(this.attachments, reviewStepData.attachments) && + Objects.equals(this.steps, reviewStepData.steps)&& + Objects.equals(this.additionalProperties, reviewStepData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(action, shared, expectedResult, data, value, attachments, steps, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewStepData {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" shared: ").append(toIndentedString(shared)).append("\n"); + sb.append(" expectedResult: ").append(toIndentedString(expectedResult)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" attachments: ").append(toIndentedString(attachments)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).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(Arrays.asList("action", "shared", "expected_result", "data", "value", "attachments", "steps")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewStepData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewStepData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewStepData is not found in the empty JSON string", ReviewStepData.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) && !jsonObj.get("action").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `action` to be a primitive type in the JSON string but got `%s`", jsonObj.get("action").toString())); + } + if ((jsonObj.get("shared") != null && !jsonObj.get("shared").isJsonNull()) && !jsonObj.get("shared").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `shared` to be a primitive type in the JSON string but got `%s`", jsonObj.get("shared").toString())); + } + if ((jsonObj.get("expected_result") != null && !jsonObj.get("expected_result").isJsonNull()) && !jsonObj.get("expected_result").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `expected_result` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expected_result").toString())); + } + if ((jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) && !jsonObj.get("data").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `data` to be a primitive type in the JSON string but got `%s`", jsonObj.get("data").toString())); + } + if ((jsonObj.get("value") != null && !jsonObj.get("value").isJsonNull()) && !jsonObj.get("value").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `value` to be a primitive type in the JSON string but got `%s`", jsonObj.get("value").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("attachments") != null && !jsonObj.get("attachments").isJsonNull() && !jsonObj.get("attachments").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `attachments` to be an array in the JSON string but got `%s`", jsonObj.get("attachments").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("steps") != null && !jsonObj.get("steps").isJsonNull() && !jsonObj.get("steps").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `steps` to be an array in the JSON string but got `%s`", jsonObj.get("steps").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewStepData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewStepData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewStepData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewStepData 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 ReviewStepData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewStepData 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(java.util.Locale.ROOT, "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 ReviewStepData given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewStepData + * @throws IOException if the JSON string is invalid with respect to ReviewStepData + */ + public static ReviewStepData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewStepData.class); + } + + /** + * Convert an instance of ReviewStepData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewUpdate.java b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewUpdate.java new file mode 100644 index 00000000..6cf0aba1 --- /dev/null +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/ReviewUpdate.java @@ -0,0 +1,329 @@ +/* + * Qase.io TestOps API v1 + * Qase TestOps API v1 Specification. + * + * The version of the OpenAPI document: 1.0.0 + * Contact: support@qase.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package io.qase.client.v1.models; + +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 io.qase.client.v1.models.ReviewCaseData; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + +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; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import io.qase.client.v1.JSON; + +/** + * ReviewUpdate + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") +public class ReviewUpdate { + public static final String SERIALIZED_NAME_REVIEWERS = "reviewers"; + @SerializedName(SERIALIZED_NAME_REVIEWERS) + @javax.annotation.Nullable + private List reviewers = new ArrayList<>(); + + public static final String SERIALIZED_NAME_PROPOSED_CASE = "proposed_case"; + @SerializedName(SERIALIZED_NAME_PROPOSED_CASE) + @javax.annotation.Nullable + private ReviewCaseData proposedCase; + + public ReviewUpdate() { + } + + public ReviewUpdate reviewers(@javax.annotation.Nullable List reviewers) { + this.reviewers = reviewers; + return this; + } + + public ReviewUpdate addReviewersItem(UUID reviewersItem) { + if (this.reviewers == null) { + this.reviewers = new ArrayList<>(); + } + this.reviewers.add(reviewersItem); + return this; + } + + /** + * Author UUIDs of team members assigned as reviewers (see `GET /author`). When provided, replaces the current reviewer list; an empty array removes all reviewers. Omit to leave reviewers unchanged. + * @return reviewers + */ + @javax.annotation.Nullable + public List getReviewers() { + return reviewers; + } + + public void setReviewers(@javax.annotation.Nullable List reviewers) { + this.reviewers = reviewers; + } + + + public ReviewUpdate proposedCase(@javax.annotation.Nullable ReviewCaseData proposedCase) { + this.proposedCase = proposedCase; + return this; + } + + /** + * Sent fields are merged into the stored proposal. Changing the proposal resets all existing approvals; updating only the reviewers keeps them. + * @return proposedCase + */ + @javax.annotation.Nullable + public ReviewCaseData getProposedCase() { + return proposedCase; + } + + public void setProposedCase(@javax.annotation.Nullable ReviewCaseData proposedCase) { + this.proposedCase = proposedCase; + } + + /** + * 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 ReviewUpdate instance itself + */ + public ReviewUpdate 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; + } + ReviewUpdate reviewUpdate = (ReviewUpdate) o; + return Objects.equals(this.reviewers, reviewUpdate.reviewers) && + Objects.equals(this.proposedCase, reviewUpdate.proposedCase)&& + Objects.equals(this.additionalProperties, reviewUpdate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(reviewers, proposedCase, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReviewUpdate {\n"); + sb.append(" reviewers: ").append(toIndentedString(reviewers)).append("\n"); + sb.append(" proposedCase: ").append(toIndentedString(proposedCase)).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(Arrays.asList("reviewers", "proposed_case")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * 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 ReviewUpdate + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReviewUpdate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "The required field(s) %s in ReviewUpdate is not found in the empty JSON string", ReviewUpdate.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("reviewers") != null && !jsonObj.get("reviewers").isJsonNull() && !jsonObj.get("reviewers").isJsonArray()) { + throw new IllegalArgumentException(String.format(java.util.Locale.ROOT, "Expected the field `reviewers` to be an array in the JSON string but got `%s`", jsonObj.get("reviewers").toString())); + } + // validate the optional field `proposed_case` + if (jsonObj.get("proposed_case") != null && !jsonObj.get("proposed_case").isJsonNull()) { + ReviewCaseData.validateJsonElement(jsonObj.get("proposed_case")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReviewUpdate.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReviewUpdate' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReviewUpdate.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReviewUpdate 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 ReviewUpdate read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ReviewUpdate 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(java.util.Locale.ROOT, "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 ReviewUpdate given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReviewUpdate + * @throws IOException if the JSON string is invalid with respect to ReviewUpdate + */ + public static ReviewUpdate fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReviewUpdate.class); + } + + /** + * Convert an instance of ReviewUpdate to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/qase-api-client/src/main/java/io/qase/client/v1/models/TestStepCreate.java b/qase-api-client/src/main/java/io/qase/client/v1/models/TestStepCreate.java index 884f4325..9c75aa71 100644 --- a/qase-api-client/src/main/java/io/qase/client/v1/models/TestStepCreate.java +++ b/qase-api-client/src/main/java/io/qase/client/v1/models/TestStepCreate.java @@ -48,7 +48,7 @@ import io.qase.client.v1.JSON; /** - * TestStepCreate + * When `steps_type` is `gherkin` only the scenario text is read from a step. A non-empty `expected_result`, `data`, `attachments`, `shared` or nested `steps` is rejected, and so is sending the scenario in `value` and `action` at once. */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.20.0") public class TestStepCreate { diff --git a/qase-api-v2-client/pom.xml b/qase-api-v2-client/pom.xml index 3b332cf6..ac319b17 100644 --- a/qase-api-v2-client/pom.xml +++ b/qase-api-v2-client/pom.xml @@ -6,7 +6,7 @@ io.qase qase-java - 4.1.58 + 4.1.59 qase-api-v2-client diff --git a/qase-cucumber-v3-reporter/pom.xml b/qase-cucumber-v3-reporter/pom.xml index 22e16027..b3ecdbc3 100644 --- a/qase-cucumber-v3-reporter/pom.xml +++ b/qase-cucumber-v3-reporter/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0 diff --git a/qase-cucumber-v4-reporter/pom.xml b/qase-cucumber-v4-reporter/pom.xml index 504063ca..88a29336 100644 --- a/qase-cucumber-v4-reporter/pom.xml +++ b/qase-cucumber-v4-reporter/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0 diff --git a/qase-cucumber-v5-reporter/pom.xml b/qase-cucumber-v5-reporter/pom.xml index fddac1e3..85f03409 100644 --- a/qase-cucumber-v5-reporter/pom.xml +++ b/qase-cucumber-v5-reporter/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0 diff --git a/qase-cucumber-v6-reporter/pom.xml b/qase-cucumber-v6-reporter/pom.xml index 7fa69edb..14002538 100644 --- a/qase-cucumber-v6-reporter/pom.xml +++ b/qase-cucumber-v6-reporter/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0 diff --git a/qase-cucumber-v7-reporter/pom.xml b/qase-cucumber-v7-reporter/pom.xml index 24512d26..4442d45d 100644 --- a/qase-cucumber-v7-reporter/pom.xml +++ b/qase-cucumber-v7-reporter/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0 diff --git a/qase-java-commons/pom.xml b/qase-java-commons/pom.xml index 4adb2430..d86dfe17 100644 --- a/qase-java-commons/pom.xml +++ b/qase-java-commons/pom.xml @@ -6,7 +6,7 @@ io.qase qase-java - 4.1.58 + 4.1.59 qase-java-commons diff --git a/qase-junit4-reporter/pom.xml b/qase-junit4-reporter/pom.xml index 554746e1..42f70e03 100644 --- a/qase-junit4-reporter/pom.xml +++ b/qase-junit4-reporter/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0 diff --git a/qase-junit5-reporter/pom.xml b/qase-junit5-reporter/pom.xml index 878dc252..a2da6911 100644 --- a/qase-junit5-reporter/pom.xml +++ b/qase-junit5-reporter/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0 diff --git a/qase-testng-reporter/pom.xml b/qase-testng-reporter/pom.xml index ffced6b3..33b7d463 100644 --- a/qase-testng-reporter/pom.xml +++ b/qase-testng-reporter/pom.xml @@ -5,7 +5,7 @@ qase-java io.qase - 4.1.58 + 4.1.59 4.0.0