diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 5b3c8d4b..c74c1de7 100644 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 5bbaa3a9-baa0-471b-ba6a-13fd88e8c119 management: - docChecksum: 61316b2167c37c8d046202e604959b9e + docChecksum: e3771e00aea360bab79ef413c9e57e99 docVersion: 1.0.0 speakeasyVersion: 1.555.0 generationVersion: 2.618.0 - releaseVersion: 1.0.0-beta.5 - configChecksum: c7af573200b905609b461157e26de40f + releaseVersion: 1.0.0-beta.6 + configChecksum: ea7055c48ab992bf7a79e145ea4f9f5a repoURL: https://github.com/gr4vy/gr4vy-java.git published: true features: @@ -92,6 +92,8 @@ generatedFiles: - docs/models/components/CollectionPaymentServiceDefinition.md - docs/models/components/CollectionPayoutSummary.md - docs/models/components/CollectionRefund.md + - docs/models/components/CollectionReport.md + - docs/models/components/CollectionReportExecution.md - docs/models/components/CollectionTransactionEvent.md - docs/models/components/CollectionTransactionSummary.md - docs/models/components/ConnectionOptions.md @@ -103,6 +105,7 @@ generatedFiles: - docs/models/components/CryptogramCreate.md - docs/models/components/DefinitionField.md - docs/models/components/DefinitionFieldFormat.md + - docs/models/components/DetailedSettlementReportSpec.md - docs/models/components/DigitalWallet.md - docs/models/components/DigitalWalletCreate.md - docs/models/components/DigitalWalletDomain.md @@ -181,6 +184,19 @@ generatedFiles: - docs/models/components/Refund.md - docs/models/components/RefundStatus.md - docs/models/components/RefundTargetType.md + - docs/models/components/Report.md + - docs/models/components/ReportCreate.md + - docs/models/components/ReportCreatorType.md + - docs/models/components/ReportExecution.md + - docs/models/components/ReportExecutionContext.md + - docs/models/components/ReportExecutionStatus.md + - docs/models/components/ReportExecutionSummary.md + - docs/models/components/ReportExecutionUrl.md + - docs/models/components/ReportSchedule.md + - docs/models/components/ReportSpec.md + - docs/models/components/ReportSpecModel.md + - docs/models/components/ReportSummary.md + - docs/models/components/ReportUpdate.md - docs/models/components/RequiredCheckoutFields.md - docs/models/components/RequiredFields1.md - docs/models/components/RequiredFields2.md @@ -190,6 +206,7 @@ generatedFiles: - docs/models/components/ShippingDetails.md - docs/models/components/ShippingDetailsCreate.md - docs/models/components/ShippingDetailsUpdate.md + - docs/models/components/Spec.md - docs/models/components/StatementDescriptor.md - docs/models/components/TaxId.md - docs/models/components/TaxIdKind.md @@ -217,9 +234,11 @@ generatedFiles: - docs/models/components/TransactionPaymentSource.md - docs/models/components/TransactionRefundAllCreate.md - docs/models/components/TransactionRefundCreate.md + - docs/models/components/TransactionRetriesReportSpec.md - docs/models/components/TransactionStatus.md - docs/models/components/TransactionSummary.md - docs/models/components/TransactionThreeDSecureSummary.md + - docs/models/components/TransactionsReportSpec.md - docs/models/components/UserDevice.md - docs/models/components/UserStatus.md - docs/models/components/ValidationError.md @@ -242,6 +261,8 @@ generatedFiles: - docs/models/operations/AddBuyerResponse.md - docs/models/operations/AddBuyerShippingDetailsRequest.md - docs/models/operations/AddBuyerShippingDetailsResponse.md + - docs/models/operations/AddReportRequest.md + - docs/models/operations/AddReportResponse.md - docs/models/operations/Body.md - docs/models/operations/CaptureTransactionRequest.md - docs/models/operations/CaptureTransactionResponse.md @@ -277,6 +298,8 @@ generatedFiles: - docs/models/operations/CreatePaymentServiceSessionResponse.md - docs/models/operations/CreatePayoutRequest.md - docs/models/operations/CreatePayoutResponse.md + - docs/models/operations/CreateReportExecutionUrlRequest.md + - docs/models/operations/CreateReportExecutionUrlResponse.md - docs/models/operations/CreateTransactionRefundRequest.md - docs/models/operations/CreateTransactionRefundResponse.md - docs/models/operations/CreateTransactionRequest.md @@ -321,10 +344,16 @@ generatedFiles: - docs/models/operations/GetPayoutResponse.md - docs/models/operations/GetRefundRequest.md - docs/models/operations/GetRefundResponse.md + - docs/models/operations/GetReportExecutionRequest.md + - docs/models/operations/GetReportExecutionResponse.md + - docs/models/operations/GetReportRequest.md + - docs/models/operations/GetReportResponse.md - docs/models/operations/GetTransactionRefundRequest.md - docs/models/operations/GetTransactionRefundResponse.md - docs/models/operations/GetTransactionRequest.md - docs/models/operations/GetTransactionResponse.md + - docs/models/operations/ListAllReportExecutionsRequest.md + - docs/models/operations/ListAllReportExecutionsResponse.md - docs/models/operations/ListAuditLogsRequest.md - docs/models/operations/ListAuditLogsResponse.md - docs/models/operations/ListBuyerGiftCardsRequest.md @@ -359,6 +388,10 @@ generatedFiles: - docs/models/operations/ListPaymentServicesResponse.md - docs/models/operations/ListPayoutsRequest.md - docs/models/operations/ListPayoutsResponse.md + - docs/models/operations/ListReportExecutionsRequest.md + - docs/models/operations/ListReportExecutionsResponse.md + - docs/models/operations/ListReportsRequest.md + - docs/models/operations/ListReportsResponse.md - docs/models/operations/ListTransactionEventsRequest.md - docs/models/operations/ListTransactionEventsResponse.md - docs/models/operations/ListTransactionRefundsRequest.md @@ -388,6 +421,8 @@ generatedFiles: - docs/models/operations/UpdateMerchantAccountResponse.md - docs/models/operations/UpdatePaymentServiceRequest.md - docs/models/operations/UpdatePaymentServiceResponse.md + - docs/models/operations/UpdateReportRequest.md + - docs/models/operations/UpdateReportResponse.md - docs/models/operations/VerifyPaymentServiceCredentialsRequest.md - docs/models/operations/VerifyPaymentServiceCredentialsResponse.md - docs/models/operations/VoidTransactionRequest.md @@ -405,6 +440,7 @@ generatedFiles: - docs/sdks/digitalwallets/README.md - docs/sdks/domains/README.md - docs/sdks/events/README.md + - docs/sdks/executions/README.md - docs/sdks/giftcards/README.md - docs/sdks/gr4vy/README.md - docs/sdks/jobs/README.md @@ -417,6 +453,8 @@ generatedFiles: - docs/sdks/paymentservicetokens/README.md - docs/sdks/payouts/README.md - docs/sdks/refunds/README.md + - docs/sdks/reports/README.md + - docs/sdks/reportsexecutions/README.md - docs/sdks/sessions/README.md - docs/sdks/shippingdetails/README.md - docs/sdks/transactions/README.md @@ -440,6 +478,7 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/DigitalWallets.java - src/main/java/com/gr4vy/sdk/Domains.java - src/main/java/com/gr4vy/sdk/Events.java + - src/main/java/com/gr4vy/sdk/Executions.java - src/main/java/com/gr4vy/sdk/GiftCards.java - src/main/java/com/gr4vy/sdk/Gr4vy.java - src/main/java/com/gr4vy/sdk/Jobs.java @@ -452,6 +491,8 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/PaymentServices.java - src/main/java/com/gr4vy/sdk/Payouts.java - src/main/java/com/gr4vy/sdk/Refunds.java + - src/main/java/com/gr4vy/sdk/Reports.java + - src/main/java/com/gr4vy/sdk/ReportsExecutions.java - src/main/java/com/gr4vy/sdk/SDKConfiguration.java - src/main/java/com/gr4vy/sdk/SecuritySource.java - src/main/java/com/gr4vy/sdk/Sessions.java @@ -517,6 +558,8 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/components/CollectionPaymentServiceDefinition.java - src/main/java/com/gr4vy/sdk/models/components/CollectionPayoutSummary.java - src/main/java/com/gr4vy/sdk/models/components/CollectionRefund.java + - src/main/java/com/gr4vy/sdk/models/components/CollectionReport.java + - src/main/java/com/gr4vy/sdk/models/components/CollectionReportExecution.java - src/main/java/com/gr4vy/sdk/models/components/CollectionTransactionEvent.java - src/main/java/com/gr4vy/sdk/models/components/CollectionTransactionSummary.java - src/main/java/com/gr4vy/sdk/models/components/ConnectionOptions.java @@ -528,6 +571,7 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/components/CryptogramCreate.java - src/main/java/com/gr4vy/sdk/models/components/DefinitionField.java - src/main/java/com/gr4vy/sdk/models/components/DefinitionFieldFormat.java + - src/main/java/com/gr4vy/sdk/models/components/DetailedSettlementReportSpec.java - src/main/java/com/gr4vy/sdk/models/components/DigitalWallet.java - src/main/java/com/gr4vy/sdk/models/components/DigitalWalletCreate.java - src/main/java/com/gr4vy/sdk/models/components/DigitalWalletDomain.java @@ -606,6 +650,19 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/components/Refund.java - src/main/java/com/gr4vy/sdk/models/components/RefundStatus.java - src/main/java/com/gr4vy/sdk/models/components/RefundTargetType.java + - src/main/java/com/gr4vy/sdk/models/components/Report.java + - src/main/java/com/gr4vy/sdk/models/components/ReportCreate.java + - src/main/java/com/gr4vy/sdk/models/components/ReportCreatorType.java + - src/main/java/com/gr4vy/sdk/models/components/ReportExecution.java + - src/main/java/com/gr4vy/sdk/models/components/ReportExecutionContext.java + - src/main/java/com/gr4vy/sdk/models/components/ReportExecutionStatus.java + - src/main/java/com/gr4vy/sdk/models/components/ReportExecutionSummary.java + - src/main/java/com/gr4vy/sdk/models/components/ReportExecutionUrl.java + - src/main/java/com/gr4vy/sdk/models/components/ReportSchedule.java + - src/main/java/com/gr4vy/sdk/models/components/ReportSpec.java + - src/main/java/com/gr4vy/sdk/models/components/ReportSpecModel.java + - src/main/java/com/gr4vy/sdk/models/components/ReportSummary.java + - src/main/java/com/gr4vy/sdk/models/components/ReportUpdate.java - src/main/java/com/gr4vy/sdk/models/components/RequiredCheckoutFields.java - src/main/java/com/gr4vy/sdk/models/components/RequiredFields1.java - src/main/java/com/gr4vy/sdk/models/components/RequiredFields2.java @@ -615,6 +672,7 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/components/ShippingDetails.java - src/main/java/com/gr4vy/sdk/models/components/ShippingDetailsCreate.java - src/main/java/com/gr4vy/sdk/models/components/ShippingDetailsUpdate.java + - src/main/java/com/gr4vy/sdk/models/components/Spec.java - src/main/java/com/gr4vy/sdk/models/components/StatementDescriptor.java - src/main/java/com/gr4vy/sdk/models/components/TaxId.java - src/main/java/com/gr4vy/sdk/models/components/TaxIdKind.java @@ -642,9 +700,11 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/components/TransactionPaymentSource.java - src/main/java/com/gr4vy/sdk/models/components/TransactionRefundAllCreate.java - src/main/java/com/gr4vy/sdk/models/components/TransactionRefundCreate.java + - src/main/java/com/gr4vy/sdk/models/components/TransactionRetriesReportSpec.java - src/main/java/com/gr4vy/sdk/models/components/TransactionStatus.java - src/main/java/com/gr4vy/sdk/models/components/TransactionSummary.java - src/main/java/com/gr4vy/sdk/models/components/TransactionThreeDSecureSummary.java + - src/main/java/com/gr4vy/sdk/models/components/TransactionsReportSpec.java - src/main/java/com/gr4vy/sdk/models/components/UserDevice.java - src/main/java/com/gr4vy/sdk/models/components/UserStatus.java - src/main/java/com/gr4vy/sdk/models/components/ValidationError.java @@ -671,6 +731,9 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/AddBuyerShippingDetailsRequest.java - src/main/java/com/gr4vy/sdk/models/operations/AddBuyerShippingDetailsRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/AddBuyerShippingDetailsResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/AddReportRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/AddReportRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/AddReportResponse.java - src/main/java/com/gr4vy/sdk/models/operations/Body.java - src/main/java/com/gr4vy/sdk/models/operations/CaptureTransactionRequest.java - src/main/java/com/gr4vy/sdk/models/operations/CaptureTransactionRequestBuilder.java @@ -724,6 +787,9 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/CreatePayoutRequest.java - src/main/java/com/gr4vy/sdk/models/operations/CreatePayoutRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/CreatePayoutResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlResponse.java - src/main/java/com/gr4vy/sdk/models/operations/CreateTransactionRefundRequest.java - src/main/java/com/gr4vy/sdk/models/operations/CreateTransactionRefundRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/CreateTransactionRefundResponse.java @@ -790,12 +856,21 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/GetRefundRequest.java - src/main/java/com/gr4vy/sdk/models/operations/GetRefundRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/GetRefundResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/GetReportRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/GetReportRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/GetReportResponse.java - src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundRequest.java - src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRefundResponse.java - src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRequest.java - src/main/java/com/gr4vy/sdk/models/operations/GetTransactionRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/GetTransactionResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsResponse.java - src/main/java/com/gr4vy/sdk/models/operations/ListAuditLogsRequest.java - src/main/java/com/gr4vy/sdk/models/operations/ListAuditLogsRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/ListAuditLogsResponse.java @@ -847,6 +922,12 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/ListPayoutsRequest.java - src/main/java/com/gr4vy/sdk/models/operations/ListPayoutsRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/ListPayoutsResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/ListReportsRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/ListReportsRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/ListReportsResponse.java - src/main/java/com/gr4vy/sdk/models/operations/ListTransactionEventsRequest.java - src/main/java/com/gr4vy/sdk/models/operations/ListTransactionEventsRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/ListTransactionEventsResponse.java @@ -891,6 +972,9 @@ generatedFiles: - src/main/java/com/gr4vy/sdk/models/operations/UpdatePaymentServiceRequest.java - src/main/java/com/gr4vy/sdk/models/operations/UpdatePaymentServiceRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/UpdatePaymentServiceResponse.java + - src/main/java/com/gr4vy/sdk/models/operations/UpdateReportRequest.java + - src/main/java/com/gr4vy/sdk/models/operations/UpdateReportRequestBuilder.java + - src/main/java/com/gr4vy/sdk/models/operations/UpdateReportResponse.java - src/main/java/com/gr4vy/sdk/models/operations/VerifyPaymentServiceCredentialsRequest.java - src/main/java/com/gr4vy/sdk/models/operations/VerifyPaymentServiceCredentialsRequestBuilder.java - src/main/java/com/gr4vy/sdk/models/operations/VerifyPaymentServiceCredentialsResponse.java @@ -3854,5 +3938,265 @@ examples: application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} "504": application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + list_reports: + speakeasy-default-list-reports: + parameters: + query: + limit: 20 + responses: + "200": + application/json: {"items": [{"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "schedule": "weekly", "schedule_enabled": true, "schedule_timezone": "UTC", "spec": {"model": "detailed_settlement", "params": {"fields": ["id", "status"], "filters": {"status": ["succeeded"]}}}}, {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "schedule": "weekly", "schedule_enabled": true, "schedule_timezone": "UTC", "spec": {"model": "detailed_settlement", "params": {"fields": ["id", "status"], "filters": {"status": ["succeeded"]}}}}], "limit": 20} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + add_report: + speakeasy-default-add-report: + requestBody: + application/json: {"name": "Monthly Transaction Report", "schedule": "daily", "schedule_enabled": true, "schedule_timezone": "UTC", "spec": {"model": "detailed_settlement", "params": {"filters": {"ingested_at": {"end": "day_end", "start": "day_start"}}}}} + responses: + "201": + application/json: {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "schedule": "daily", "schedule_enabled": true, "schedule_timezone": "UTC", "spec": {"model": "detailed_settlement", "params": {"fields": ["id", "status"], "filters": {"status": ["succeeded"]}}}} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + get_report: + speakeasy-default-get-report: + parameters: + path: + report_id: "4d4c7123-b794-4fad-b1b9-5ab2606e6bbe" + responses: + "200": + application/json: {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "schedule": "daily", "schedule_enabled": true, "schedule_timezone": "UTC", "spec": {"model": "transaction_retries", "params": {"fields": ["id", "status"], "filters": {"status": ["succeeded"]}}}} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + update_report: + speakeasy-default-update-report: + parameters: + path: + report_id: "4d4c7123-b794-4fad-b1b9-5ab2606e6bbe" + requestBody: + application/json: {} + responses: + "200": + application/json: {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "schedule": "daily", "schedule_enabled": true, "schedule_timezone": "UTC", "spec": {"model": "detailed_settlement", "params": {"fields": ["id", "status"], "filters": {"status": ["succeeded"]}}}} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + list_report_executions: + speakeasy-default-list-report-executions: + parameters: + path: + report_id: "4d4c7123-b794-4fad-b1b9-5ab2606e6bbe" + query: + limit: 20 + responses: + "200": + application/json: {"items": [{"type": "report-execution", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "failed", "context": {"reference_timestamp": "2024-05-30T12:34:56.000Z", "reference_timezone": "UTC"}, "report": {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report"}}, {"type": "report-execution", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "failed", "context": {"reference_timestamp": "2024-05-30T12:34:56.000Z", "reference_timezone": "UTC"}, "report": {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report"}}, {"type": "report-execution", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "failed", "context": {"reference_timestamp": "2024-05-30T12:34:56.000Z", "reference_timezone": "UTC"}, "report": {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report"}}], "limit": 20} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + create_report_execution_url: + speakeasy-default-create-report-execution-url: + parameters: + path: + report_id: "4d4c7123-b794-4fad-b1b9-5ab2606e6bbe" + report_execution_id: "003bc416-f32a-420c-8eb2-062a386e1fb0" + responses: + "200": + application/json: {"url": "https://example.com/download/report.csv?signature=abc123", "expires_at": "2024-06-01T00:00:00.000Z"} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + list_all_report_executions: + speakeasy-default-list-all-report-executions: + parameters: + query: + limit: 20 + responses: + "200": + application/json: {"items": [{"type": "report-execution", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "failed", "context": {"reference_timestamp": "2024-05-30T12:34:56.000Z", "reference_timezone": "UTC"}, "report": {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report"}}, {"type": "report-execution", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "failed", "context": {"reference_timestamp": "2024-05-30T12:34:56.000Z", "reference_timezone": "UTC"}, "report": {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report"}}, {"type": "report-execution", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "failed", "context": {"reference_timestamp": "2024-05-30T12:34:56.000Z", "reference_timezone": "UTC"}, "report": {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report"}}], "limit": 20} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} + get_report_execution: + speakeasy-default-get-report-execution: + parameters: + path: + report_execution_id: "003bc416-f32a-420c-8eb2-062a386e1fb0" + responses: + "200": + application/json: {"type": "report-execution", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "created_at": "2024-05-30T12:34:56.000Z", "updated_at": "2024-05-30T13:00:00.000Z", "status": "dispatched", "context": {"reference_timestamp": "2024-05-30T12:34:56.000Z", "reference_timezone": "UTC"}, "report": {"type": "report", "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab", "merchant_account_id": "merchant-account-12345", "name": "Monthly Transaction Report"}} + "400": + application/json: {"type": "error", "code": "bad_request", "status": 400, "message": "Request failed validation"} + "401": + application/json: {"type": "error", "code": "unauthorized", "status": 401, "message": "No valid API authentication found"} + "403": + application/json: {"type": "error", "code": "forbidden", "status": 403, "message": "Request failed validation"} + "404": + application/json: {"type": "error", "code": "not_found", "status": 404, "message": "The resource could not be found"} + "405": + application/json: {"type": "error", "code": "method_not_allowed", "status": 405, "message": "Method Not Allowed"} + "409": + application/json: {"type": "error", "code": "duplicate_record", "status": 409, "message": "Request failed validation"} + "422": + application/json: {} + "425": + application/json: {"type": "error", "code": "too_early", "status": 425, "message": "Request failed validation"} + "429": + application/json: {"type": "error", "code": "too_many_requests", "status": 429, "message": "Request failed validation"} + "500": + application/json: {"type": "error", "code": "server_error", "status": 500, "message": "Request could not be processed"} + "502": + application/json: {"type": "error", "code": "bad_gateway", "status": 502, "message": "Request could not be processed"} + "504": + application/json: {"type": "error", "code": "gateway_timeout", "status": 504, "message": "Request could not be processed"} examplesVersion: 1.0.2 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 659486c4..a3212b58 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -18,7 +18,7 @@ generation: oAuth2PasswordEnabled: false sdkHooksConfigAccess: true java: - version: 1.0.0-beta.5 + version: 1.0.0-beta.6 additionalDependencies: - testImplementation:org.junit.jupiter:junit-jupiter:5.10.0 - implementation:com.auth0:java-jwt:4.5.0 diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index c2580692..dfc547fe 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -9,11 +9,11 @@ sources: - 1.0.0 openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:d508ddf668dbe8af6ca27728bc3cb3ae37b90adc29cd0ae4df1945d840a3b66c - sourceBlobDigest: sha256:2eb1d80aa5e27997c3663da76dddb7809d6cfaeb98451fd6ff56a686035769a8 + sourceRevisionDigest: sha256:6b3dc3631928863a66a1608e5a573d65f61faf3f1eea7bb466f895d31ae01077 + sourceBlobDigest: sha256:e292563575fcc151f2be97051458c6e5ad35e1ebe9acd96c3fb5dd862b2130c1 tags: - latest - - speakeasy-sdk-regen-1748951350 + - speakeasy-sdk-regen-1748954136 - 1.0.0 targets: gr-4-vy: @@ -26,10 +26,10 @@ targets: java: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:d508ddf668dbe8af6ca27728bc3cb3ae37b90adc29cd0ae4df1945d840a3b66c - sourceBlobDigest: sha256:2eb1d80aa5e27997c3663da76dddb7809d6cfaeb98451fd6ff56a686035769a8 + sourceRevisionDigest: sha256:6b3dc3631928863a66a1608e5a573d65f61faf3f1eea7bb466f895d31ae01077 + sourceBlobDigest: sha256:e292563575fcc151f2be97051458c6e5ad35e1ebe9acd96c3fb5dd862b2130c1 codeSamplesNamespace: openapi-java-code-samples - codeSamplesRevisionDigest: sha256:8bbc6a73fea2335ba4096176d2276a3a559855686522c0e233100d998282f09e + codeSamplesRevisionDigest: sha256:2725a21b3096f3bce2bc3144ed6844807d9d9a2bebd5e82d2e4bad599a76e7bc workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index af33ff79..ced343f5 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'com.gr4vy:sdk:1.0.0-beta.5' +implementation 'com.gr4vy:sdk:1.0.0-beta.6' ``` Maven: @@ -68,7 +68,7 @@ Maven: com.gr4vy sdk - 1.0.0-beta.5 + 1.0.0-beta.6 ``` @@ -386,6 +386,23 @@ try { * [get](docs/sdks/refunds/README.md#get) - Get refund +### [reports()](docs/sdks/reports/README.md) + +* [list](docs/sdks/reports/README.md#list) - List configured reports +* [create](docs/sdks/reports/README.md#create) - Add a report +* [get](docs/sdks/reports/README.md#get) - Get a report +* [put](docs/sdks/reports/README.md#put) - Update a report + +#### [reports().executions()](docs/sdks/executions/README.md) + +* [list](docs/sdks/executions/README.md#list) - List executions for report +* [url](docs/sdks/executions/README.md#url) - Create URL for executed report + +### [reportsExecutions()](docs/sdks/reportsexecutions/README.md) + +* [list](docs/sdks/reportsexecutions/README.md#list) - List executed reports +* [get](docs/sdks/reportsexecutions/README.md#get) - Get executed report + ### [transactions()](docs/sdks/transactions/README.md) * [list](docs/sdks/transactions/README.md#list) - List transactions diff --git a/RELEASES.md b/RELEASES.md index 31fee716..3e4c572b 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -38,4 +38,14 @@ Based on: ### Generated - [java v1.0.0-beta.5] . ### Releases -- [Maven Central v1.0.0-beta.5] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.5 - . \ No newline at end of file +- [Maven Central v1.0.0-beta.5] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.5 - . + +## 2025-06-03 12:35:18 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.555.0 (2.618.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v1.0.0-beta.6] . +### Releases +- [Maven Central v1.0.0-beta.6] https://central.sonatype.com/artifact/com.gr4vy/sdk/1.0.0-beta.6 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index 64d15c6b..acc3c7a6 100644 --- a/build.gradle +++ b/build.gradle @@ -103,7 +103,7 @@ publishing { // https://github.com/gradle/gradle/issues/18619 groupId = "com.gr4vy" artifactId = "sdk" - version = "1.0.0-beta.5" + version = "1.0.0-beta.6" from components.java diff --git a/docs/models/components/CollectionReport.md b/docs/models/components/CollectionReport.md new file mode 100644 index 00000000..c541bd13 --- /dev/null +++ b/docs/models/components/CollectionReport.md @@ -0,0 +1,11 @@ +# CollectionReport + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `items` | List\<[Report](../../models/components/Report.md)> | :heavy_check_mark: | A list of items returned for this request. | | +| `limit` | *Optional\* | :heavy_minus_sign: | The number of items for this page. | 20 | +| `nextCursor` | *JsonNullable\* | :heavy_minus_sign: | The cursor pointing at the next page of items. | ZXhhbXBsZTE | +| `previousCursor` | *JsonNullable\* | :heavy_minus_sign: | The cursor pointing at the previous page of items. | Xkjss7asS | \ No newline at end of file diff --git a/docs/models/components/CollectionReportExecution.md b/docs/models/components/CollectionReportExecution.md new file mode 100644 index 00000000..77f49e1d --- /dev/null +++ b/docs/models/components/CollectionReportExecution.md @@ -0,0 +1,11 @@ +# CollectionReportExecution + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------- | +| `items` | List\<[ReportExecution](../../models/components/ReportExecution.md)> | :heavy_check_mark: | A list of items returned for this request. | | +| `limit` | *Optional\* | :heavy_minus_sign: | The number of items for this page. | 20 | +| `nextCursor` | *JsonNullable\* | :heavy_minus_sign: | The cursor pointing at the next page of items. | ZXhhbXBsZTE | +| `previousCursor` | *JsonNullable\* | :heavy_minus_sign: | The cursor pointing at the previous page of items. | Xkjss7asS | \ No newline at end of file diff --git a/docs/models/components/DetailedSettlementReportSpec.md b/docs/models/components/DetailedSettlementReportSpec.md new file mode 100644 index 00000000..04cd74ce --- /dev/null +++ b/docs/models/components/DetailedSettlementReportSpec.md @@ -0,0 +1,9 @@ +# DetailedSettlementReportSpec + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `model` | *Optional\* | :heavy_minus_sign: | The report model type. | detailed_settlement | +| `params` | Map\ | :heavy_check_mark: | The parameters for the detailed settlement report model. | {
"filters": {
"ingested_at": {
"end": "day_end",
"start": "day_start"
}
}
} | \ No newline at end of file diff --git a/docs/models/components/Report.md b/docs/models/components/Report.md new file mode 100644 index 00000000..7c548e8c --- /dev/null +++ b/docs/models/components/Report.md @@ -0,0 +1,23 @@ +# Report + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `type` | *Optional\* | :heavy_minus_sign: | Always `report`. | report | +| `id` | *String* | :heavy_check_mark: | The unique ID for the report. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `merchantAccountId` | *String* | :heavy_check_mark: | The merchant account ID this report belongs to. | merchant-account-12345 | +| `name` | *String* | :heavy_check_mark: | The name of the report. | Monthly Transaction Report | +| `creatorId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the user who created the report. | d290f1ee-6c54-4b01-90e6-d701748f0851 | +| `creatorDisplayName` | *JsonNullable\* | :heavy_minus_sign: | The display name of the report creator. | Jane Doe | +| `creatorType` | [JsonNullable\](../../models/components/ReportCreatorType.md) | :heavy_minus_sign: | The type of the report creator. | user | +| `createdAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date this report was created at. | 2024-05-30T12:34:56.000Z | +| `updatedAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date this report was last updated. | 2024-05-30T13:00:00.000Z | +| `nextExecutionAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_minus_sign: | The next scheduled execution time for the report. | 2024-06-01T00:00:00.000Z | +| `description` | *JsonNullable\* | :heavy_minus_sign: | A description of the report. | Monthly transaction summary for May 2024. | +| `schedule` | [ReportSchedule](../../models/components/ReportSchedule.md) | :heavy_check_mark: | N/A | | +| `scheduleEnabled` | *boolean* | :heavy_check_mark: | Whether the report schedule is enabled. | true | +| `scheduleTimezone` | *String* | :heavy_check_mark: | The timezone for the report schedule. | UTC | +| `spec` | [ReportSpec](../../models/components/ReportSpec.md) | :heavy_check_mark: | N/A | | +| `latestExecution` | [JsonNullable\](../../models/components/ReportExecutionSummary.md) | :heavy_minus_sign: | The latest execution summary for the report. | | \ No newline at end of file diff --git a/docs/models/components/ReportCreate.md b/docs/models/components/ReportCreate.md new file mode 100644 index 00000000..f8a25154 --- /dev/null +++ b/docs/models/components/ReportCreate.md @@ -0,0 +1,13 @@ +# ReportCreate + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- | +| `name` | *String* | :heavy_check_mark: | The name of the report. | Monthly Transaction Report | +| `description` | *JsonNullable\* | :heavy_minus_sign: | A description of the report. | Monthly transaction summary for May 2024. | +| `schedule` | [ReportSchedule](../../models/components/ReportSchedule.md) | :heavy_check_mark: | N/A | | +| `scheduleEnabled` | *boolean* | :heavy_check_mark: | Whether the report schedule is enabled. | true | +| `scheduleTimezone` | *Optional\* | :heavy_minus_sign: | The timezone for the report schedule. | UTC | +| `spec` | [Spec](../../models/components/Spec.md) | :heavy_check_mark: | The report specification. | | \ No newline at end of file diff --git a/docs/models/components/ReportCreatorType.md b/docs/models/components/ReportCreatorType.md new file mode 100644 index 00000000..d9a402e7 --- /dev/null +++ b/docs/models/components/ReportCreatorType.md @@ -0,0 +1,9 @@ +# ReportCreatorType + + +## Values + +| Name | Value | +| ------------- | ------------- | +| `USER` | user | +| `PRIVATE_KEY` | private_key | \ No newline at end of file diff --git a/docs/models/components/ReportExecution.md b/docs/models/components/ReportExecution.md new file mode 100644 index 00000000..144742e2 --- /dev/null +++ b/docs/models/components/ReportExecution.md @@ -0,0 +1,14 @@ +# ReportExecution + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `type` | *Optional\* | :heavy_minus_sign: | Always `report-execution`. | report-execution | +| `id` | *String* | :heavy_check_mark: | The unique ID for the report execution. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `createdAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date this report execution was created at. | 2024-05-30T12:34:56.000Z | +| `updatedAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date this report execution was last updated. | 2024-05-30T13:00:00.000Z | +| `status` | [ReportExecutionStatus](../../models/components/ReportExecutionStatus.md) | :heavy_check_mark: | N/A | | +| `context` | [ReportExecutionContext](../../models/components/ReportExecutionContext.md) | :heavy_check_mark: | N/A | | +| `report` | [ReportSummary](../../models/components/ReportSummary.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/components/ReportExecutionContext.md b/docs/models/components/ReportExecutionContext.md new file mode 100644 index 00000000..94bec2ec --- /dev/null +++ b/docs/models/components/ReportExecutionContext.md @@ -0,0 +1,9 @@ +# ReportExecutionContext + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `referenceTimestamp` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The reference timestamp for the report execution context. | 2024-05-30T12:34:56.000Z | +| `referenceTimezone` | *String* | :heavy_check_mark: | The reference timezone for the report execution context. | UTC | \ No newline at end of file diff --git a/docs/models/components/ReportExecutionStatus.md b/docs/models/components/ReportExecutionStatus.md new file mode 100644 index 00000000..b179bac3 --- /dev/null +++ b/docs/models/components/ReportExecutionStatus.md @@ -0,0 +1,12 @@ +# ReportExecutionStatus + + +## Values + +| Name | Value | +| ------------ | ------------ | +| `DISPATCHED` | dispatched | +| `FAILED` | failed | +| `PENDING` | pending | +| `PROCESSING` | processing | +| `SUCCEEDED` | succeeded | \ No newline at end of file diff --git a/docs/models/components/ReportExecutionSummary.md b/docs/models/components/ReportExecutionSummary.md new file mode 100644 index 00000000..d2f6d364 --- /dev/null +++ b/docs/models/components/ReportExecutionSummary.md @@ -0,0 +1,13 @@ +# ReportExecutionSummary + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `type` | *Optional\* | :heavy_minus_sign: | Always `report-execution`. | report-execution | +| `id` | *String* | :heavy_check_mark: | The unique ID for the report execution. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `createdAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date this report execution was created at. | 2024-05-30T12:34:56.000Z | +| `updatedAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date this report execution was last updated. | 2024-05-30T13:00:00.000Z | +| `status` | [ReportExecutionStatus](../../models/components/ReportExecutionStatus.md) | :heavy_check_mark: | N/A | | +| `context` | [ReportExecutionContext](../../models/components/ReportExecutionContext.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/components/ReportExecutionUrl.md b/docs/models/components/ReportExecutionUrl.md new file mode 100644 index 00000000..3ab24ffc --- /dev/null +++ b/docs/models/components/ReportExecutionUrl.md @@ -0,0 +1,9 @@ +# ReportExecutionUrl + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `url` | *String* | :heavy_check_mark: | A signed URL to download the report execution file. | https://example.com/download/report.csv?signature=abc123 | +| `expiresAt` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_check_mark: | The date and time when the download URL expires. | 2024-06-01T00:00:00.000Z | \ No newline at end of file diff --git a/docs/models/components/ReportSchedule.md b/docs/models/components/ReportSchedule.md new file mode 100644 index 00000000..456e45fa --- /dev/null +++ b/docs/models/components/ReportSchedule.md @@ -0,0 +1,11 @@ +# ReportSchedule + + +## Values + +| Name | Value | +| --------- | --------- | +| `DAILY` | daily | +| `MONTHLY` | monthly | +| `ONCE` | once | +| `WEEKLY` | weekly | \ No newline at end of file diff --git a/docs/models/components/ReportSpec.md b/docs/models/components/ReportSpec.md new file mode 100644 index 00000000..5eeb15e1 --- /dev/null +++ b/docs/models/components/ReportSpec.md @@ -0,0 +1,9 @@ +# ReportSpec + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `model` | [ReportSpecModel](../../models/components/ReportSpecModel.md) | :heavy_check_mark: | N/A | | +| `params` | Map\ | :heavy_check_mark: | The parameters for the report model. | {
"fields": [
"id",
"status"
],
"filters": {
"status": [
"succeeded"
]
}
} | \ No newline at end of file diff --git a/docs/models/components/ReportSpecModel.md b/docs/models/components/ReportSpecModel.md new file mode 100644 index 00000000..92d3faad --- /dev/null +++ b/docs/models/components/ReportSpecModel.md @@ -0,0 +1,10 @@ +# ReportSpecModel + + +## Values + +| Name | Value | +| --------------------- | --------------------- | +| `TRANSACTIONS` | transactions | +| `TRANSACTION_RETRIES` | transaction_retries | +| `DETAILED_SETTLEMENT` | detailed_settlement | \ No newline at end of file diff --git a/docs/models/components/ReportSummary.md b/docs/models/components/ReportSummary.md new file mode 100644 index 00000000..f421936e --- /dev/null +++ b/docs/models/components/ReportSummary.md @@ -0,0 +1,14 @@ +# ReportSummary + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `type` | *Optional\* | :heavy_minus_sign: | Always `report`. | report | +| `id` | *String* | :heavy_check_mark: | The unique ID for the report. | a1b2c3d4-5678-90ab-cdef-1234567890ab | +| `merchantAccountId` | *String* | :heavy_check_mark: | The merchant account ID this report belongs to. | merchant-account-12345 | +| `name` | *String* | :heavy_check_mark: | The name of the report. | Monthly Transaction Report | +| `creatorId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the user who created the report. | d290f1ee-6c54-4b01-90e6-d701748f0851 | +| `creatorDisplayName` | *JsonNullable\* | :heavy_minus_sign: | The display name of the report creator. | Jane Doe | +| `creatorType` | [JsonNullable\](../../models/components/ReportCreatorType.md) | :heavy_minus_sign: | The type of the report creator. | user | \ No newline at end of file diff --git a/docs/models/components/ReportUpdate.md b/docs/models/components/ReportUpdate.md new file mode 100644 index 00000000..de58b5e5 --- /dev/null +++ b/docs/models/components/ReportUpdate.md @@ -0,0 +1,10 @@ +# ReportUpdate + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| `name` | *JsonNullable\* | :heavy_minus_sign: | The name of the report. | Monthly Transaction Report | +| `description` | *JsonNullable\* | :heavy_minus_sign: | A description of the report. | Monthly transaction summary for May 2024. | +| `scheduleEnabled` | *JsonNullable\* | :heavy_minus_sign: | Whether the report schedule is enabled. | true | \ No newline at end of file diff --git a/docs/models/components/Spec.md b/docs/models/components/Spec.md new file mode 100644 index 00000000..a445299f --- /dev/null +++ b/docs/models/components/Spec.md @@ -0,0 +1,4 @@ +# Spec + +The report specification. + diff --git a/docs/models/components/TransactionRetriesReportSpec.md b/docs/models/components/TransactionRetriesReportSpec.md new file mode 100644 index 00000000..674b7a1a --- /dev/null +++ b/docs/models/components/TransactionRetriesReportSpec.md @@ -0,0 +1,9 @@ +# TransactionRetriesReportSpec + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `model` | *Optional\* | :heavy_minus_sign: | The report model type. | transaction_retries | +| `params` | Map\ | :heavy_check_mark: | The parameters for the transaction retries report model. | {
"filters": {
"created_at": {
"end": "2024-05-31T23:59:59Z",
"start": "2024-05-01T00:00:00Z"
}
}
} | \ No newline at end of file diff --git a/docs/models/components/TransactionsReportSpec.md b/docs/models/components/TransactionsReportSpec.md new file mode 100644 index 00000000..1a7b0234 --- /dev/null +++ b/docs/models/components/TransactionsReportSpec.md @@ -0,0 +1,9 @@ +# TransactionsReportSpec + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `model` | *Optional\* | :heavy_minus_sign: | The report model type. | transactions | +| `params` | Map\ | :heavy_check_mark: | The parameters for the transactions report model. | {
"fields": [
"id",
"status"
],
"filters": {
"status": [
"succeeded"
]
}
} | \ No newline at end of file diff --git a/docs/models/operations/AddReportRequest.md b/docs/models/operations/AddReportRequest.md new file mode 100644 index 00000000..26d8f838 --- /dev/null +++ b/docs/models/operations/AddReportRequest.md @@ -0,0 +1,9 @@ +# AddReportRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | +| `reportCreate` | [ReportCreate](../../models/components/ReportCreate.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/AddReportResponse.md b/docs/models/operations/AddReportResponse.md new file mode 100644 index 00000000..0e2b0ce7 --- /dev/null +++ b/docs/models/operations/AddReportResponse.md @@ -0,0 +1,11 @@ +# AddReportResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `report` | [Optional\](../../models/components/Report.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/CreateReportExecutionUrlRequest.md b/docs/models/operations/CreateReportExecutionUrlRequest.md new file mode 100644 index 00000000..e4126433 --- /dev/null +++ b/docs/models/operations/CreateReportExecutionUrlRequest.md @@ -0,0 +1,10 @@ +# CreateReportExecutionUrlRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `reportId` | *String* | :heavy_check_mark: | The ID of the report to retrieve a URL for. | 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe | +| `reportExecutionId` | *String* | :heavy_check_mark: | The ID of the execution of a report to retrieve a URL for. | 003bc416-f32a-420c-8eb2-062a386e1fb0 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/CreateReportExecutionUrlResponse.md b/docs/models/operations/CreateReportExecutionUrlResponse.md new file mode 100644 index 00000000..0cf07912 --- /dev/null +++ b/docs/models/operations/CreateReportExecutionUrlResponse.md @@ -0,0 +1,11 @@ +# CreateReportExecutionUrlResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `reportExecutionUrl` | [Optional\](../../models/components/ReportExecutionUrl.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/GetReportExecutionRequest.md b/docs/models/operations/GetReportExecutionRequest.md new file mode 100644 index 00000000..56d598f0 --- /dev/null +++ b/docs/models/operations/GetReportExecutionRequest.md @@ -0,0 +1,9 @@ +# GetReportExecutionRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `reportExecutionId` | *String* | :heavy_check_mark: | The ID of the execution of a report to retrieve details for. | 003bc416-f32a-420c-8eb2-062a386e1fb0 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/GetReportExecutionResponse.md b/docs/models/operations/GetReportExecutionResponse.md new file mode 100644 index 00000000..68dc22ce --- /dev/null +++ b/docs/models/operations/GetReportExecutionResponse.md @@ -0,0 +1,11 @@ +# GetReportExecutionResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `reportExecution` | [Optional\](../../models/components/ReportExecution.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/GetReportRequest.md b/docs/models/operations/GetReportRequest.md new file mode 100644 index 00000000..13a805d9 --- /dev/null +++ b/docs/models/operations/GetReportRequest.md @@ -0,0 +1,9 @@ +# GetReportRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `reportId` | *String* | :heavy_check_mark: | The ID of the report to retrieve details for. | 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/GetReportResponse.md b/docs/models/operations/GetReportResponse.md new file mode 100644 index 00000000..28c26eaa --- /dev/null +++ b/docs/models/operations/GetReportResponse.md @@ -0,0 +1,11 @@ +# GetReportResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `report` | [Optional\](../../models/components/Report.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/ListAllReportExecutionsRequest.md b/docs/models/operations/ListAllReportExecutionsRequest.md new file mode 100644 index 00000000..8593a0c1 --- /dev/null +++ b/docs/models/operations/ListAllReportExecutionsRequest.md @@ -0,0 +1,15 @@ +# ListAllReportExecutionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `cursor` | *JsonNullable\* | :heavy_minus_sign: | A pointer to the page of results to return. | ZXhhbXBsZTE | +| `limit` | *Optional\* | :heavy_minus_sign: | The maximum number of items that are at returned. | 20 | +| `reportName` | *JsonNullable\* | :heavy_minus_sign: | Filters the reports by searching their name for (partial) matches. | My report | +| `createdAtLte` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_minus_sign: | Filters the results to only reports created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. | 2022-01-01T12:00:00+08:00 | +| `createdAtGte` | [OffsetDateTime](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) | :heavy_minus_sign: | Filters the results to only reports created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. | 2022-01-01T12:00:00+08:00 | +| `status` | List\<[ReportExecutionStatus](../../models/components/ReportExecutionStatus.md)> | :heavy_minus_sign: | Filters the results to only the reports that have a `status` that matches with any of the provided status values. | succeeded | +| `creatorId` | List\<*String*> | :heavy_minus_sign: | Filters the results to only the reports that were created by the users with these IDs. | 30362ed1-05cf-4a4c-8b4a-e76323df5f1e | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/ListAllReportExecutionsResponse.md b/docs/models/operations/ListAllReportExecutionsResponse.md new file mode 100644 index 00000000..db91099f --- /dev/null +++ b/docs/models/operations/ListAllReportExecutionsResponse.md @@ -0,0 +1,11 @@ +# ListAllReportExecutionsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `collectionReportExecution` | [Optional\](../../models/components/CollectionReportExecution.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/ListReportExecutionsRequest.md b/docs/models/operations/ListReportExecutionsRequest.md new file mode 100644 index 00000000..d40f1a20 --- /dev/null +++ b/docs/models/operations/ListReportExecutionsRequest.md @@ -0,0 +1,11 @@ +# ListReportExecutionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `reportId` | *String* | :heavy_check_mark: | The ID of the report to retrieve details for. | 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe | +| `cursor` | *JsonNullable\* | :heavy_minus_sign: | A pointer to the page of results to return. | ZXhhbXBsZTE | +| `limit` | *Optional\* | :heavy_minus_sign: | The maximum number of items that are at returned. | 20 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/ListReportExecutionsResponse.md b/docs/models/operations/ListReportExecutionsResponse.md new file mode 100644 index 00000000..4533559e --- /dev/null +++ b/docs/models/operations/ListReportExecutionsResponse.md @@ -0,0 +1,11 @@ +# ListReportExecutionsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `collectionReportExecution` | [Optional\](../../models/components/CollectionReportExecution.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/ListReportsRequest.md b/docs/models/operations/ListReportsRequest.md new file mode 100644 index 00000000..86cc8ab0 --- /dev/null +++ b/docs/models/operations/ListReportsRequest.md @@ -0,0 +1,13 @@ +# ListReportsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `cursor` | *JsonNullable\* | :heavy_minus_sign: | A pointer to the page of results to return. | ZXhhbXBsZTE | +| `limit` | *Optional\* | :heavy_minus_sign: | The maximum number of items that are at returned. | 20 | +| `schedule` | List\<[ReportSchedule](../../models/components/ReportSchedule.md)> | :heavy_minus_sign: | Filters the reports by the type of schedule at which they run. | [
"daily",
"monthly"
] | +| `scheduleEnabled` | *JsonNullable\* | :heavy_minus_sign: | Filters the reports by wether their schedule is enabled. | true | +| `name` | *JsonNullable\* | :heavy_minus_sign: | Filters the reports by searching their name for (partial) matches. | My report | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | \ No newline at end of file diff --git a/docs/models/operations/ListReportsResponse.md b/docs/models/operations/ListReportsResponse.md new file mode 100644 index 00000000..f9053e83 --- /dev/null +++ b/docs/models/operations/ListReportsResponse.md @@ -0,0 +1,11 @@ +# ListReportsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `collectionReport` | [Optional\](../../models/components/CollectionReport.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/models/operations/UpdateReportRequest.md b/docs/models/operations/UpdateReportRequest.md new file mode 100644 index 00000000..c4566fbe --- /dev/null +++ b/docs/models/operations/UpdateReportRequest.md @@ -0,0 +1,10 @@ +# UpdateReportRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `reportId` | *String* | :heavy_check_mark: | The ID of the report to edit. | 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | +| `reportUpdate` | [ReportUpdate](../../models/components/ReportUpdate.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/UpdateReportResponse.md b/docs/models/operations/UpdateReportResponse.md new file mode 100644 index 00000000..06e0c22e --- /dev/null +++ b/docs/models/operations/UpdateReportResponse.md @@ -0,0 +1,11 @@ +# UpdateReportResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `report` | [Optional\](../../models/components/Report.md) | :heavy_minus_sign: | Successful Response | \ No newline at end of file diff --git a/docs/sdks/executions/README.md b/docs/sdks/executions/README.md new file mode 100644 index 00000000..0fd6a092 --- /dev/null +++ b/docs/sdks/executions/README.md @@ -0,0 +1,136 @@ +# Executions +(*reports().executions()*) + +## Overview + +### Available Operations + +* [list](#list) - List executions for report +* [url](#url) - Create URL for executed report + +## list + +List all executed reports that have been generated. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .bearerAuth("") + .build(); + + sdk.reports().executions().list() + .reportId("4d4c7123-b794-4fad-b1b9-5ab2606e6bbe") + .callAsStream() + .forEach(item -> { + // handle item + }); + + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `reportId` | *String* | :heavy_check_mark: | The ID of the report to retrieve details for. | 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe | +| `cursor` | *JsonNullable\* | :heavy_minus_sign: | A pointer to the page of results to return. | ZXhhbXBsZTE | +| `limit` | *Optional\* | :heavy_minus_sign: | The maximum number of items that are at returned. | 20 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[ListReportExecutionsResponse](../../models/operations/ListReportExecutionsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## url + +Creates a download URL for a specific execution of a report. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.CreateReportExecutionUrlResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .bearerAuth("") + .build(); + + CreateReportExecutionUrlResponse res = sdk.reports().executions().url() + .reportId("4d4c7123-b794-4fad-b1b9-5ab2606e6bbe") + .reportExecutionId("003bc416-f32a-420c-8eb2-062a386e1fb0") + .call(); + + if (res.reportExecutionUrl().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `reportId` | *String* | :heavy_check_mark: | The ID of the report to retrieve a URL for. | 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe | +| `reportExecutionId` | *String* | :heavy_check_mark: | The ID of the execution of a report to retrieve a URL for. | 003bc416-f32a-420c-8eb2-062a386e1fb0 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[CreateReportExecutionUrlResponse](../../models/operations/CreateReportExecutionUrlResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/reports/README.md b/docs/sdks/reports/README.md new file mode 100644 index 00000000..ce08b3ca --- /dev/null +++ b/docs/sdks/reports/README.md @@ -0,0 +1,278 @@ +# Reports +(*reports()*) + +## Overview + +### Available Operations + +* [list](#list) - List configured reports +* [create](#create) - Add a report +* [get](#get) - Get a report +* [put](#put) - Update a report + +## list + +List all configured reports that can be generated. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.ListReportsRequest; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .bearerAuth("") + .build(); + + ListReportsRequest req = ListReportsRequest.builder() + .build(); + + sdk.reports().list() + .request(req) + .callAsStream() + .forEach(item -> { + // handle item + }); + + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `request` | [ListReportsRequest](../../models/operations/ListReportsRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[ListReportsResponse](../../models/operations/ListReportsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## create + +Create a new report. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.components.*; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.AddReportResponse; +import java.lang.Exception; +import java.util.Map; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .bearerAuth("") + .build(); + + AddReportResponse res = sdk.reports().create() + .reportCreate(ReportCreate.builder() + .name("Monthly Transaction Report") + .schedule(ReportSchedule.DAILY) + .scheduleEnabled(true) + .spec(DetailedSettlementReportSpec.builder() + .params(Map.ofEntries( + Map.entry("filters", Map.ofEntries( + Map.entry("ingested_at", Map.ofEntries( + Map.entry("end", "day_end"), + Map.entry("start", "day_start"))))))) + .build()) + .build()) + .call(); + + if (res.report().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | +| `reportCreate` | [ReportCreate](../../models/components/ReportCreate.md) | :heavy_check_mark: | N/A | + +### Response + +**[AddReportResponse](../../models/operations/AddReportResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## get + +Fetches a report by its ID. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.GetReportResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .bearerAuth("") + .build(); + + GetReportResponse res = sdk.reports().get() + .reportId("4d4c7123-b794-4fad-b1b9-5ab2606e6bbe") + .call(); + + if (res.report().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `reportId` | *String* | :heavy_check_mark: | The ID of the report to retrieve details for. | 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[GetReportResponse](../../models/operations/GetReportResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## put + +Updates the configuration of a report. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.components.ReportUpdate; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.UpdateReportResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .bearerAuth("") + .build(); + + UpdateReportResponse res = sdk.reports().put() + .reportId("4d4c7123-b794-4fad-b1b9-5ab2606e6bbe") + .reportUpdate(ReportUpdate.builder() + .build()) + .call(); + + if (res.report().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | +| `reportId` | *String* | :heavy_check_mark: | The ID of the report to edit. | 4d4c7123-b794-4fad-b1b9-5ab2606e6bbe | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | +| `reportUpdate` | [ReportUpdate](../../models/components/ReportUpdate.md) | :heavy_check_mark: | N/A | | + +### Response + +**[UpdateReportResponse](../../models/operations/UpdateReportResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/reportsexecutions/README.md b/docs/sdks/reportsexecutions/README.md new file mode 100644 index 00000000..d7f70130 --- /dev/null +++ b/docs/sdks/reportsexecutions/README.md @@ -0,0 +1,136 @@ +# ReportsExecutions +(*reportsExecutions()*) + +## Overview + +### Available Operations + +* [list](#list) - List executed reports +* [get](#get) - Get executed report + +## list + +List all executed reports that have been generated. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.ListAllReportExecutionsRequest; +import com.gr4vy.sdk.models.operations.ListAllReportExecutionsResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .bearerAuth("") + .build(); + + ListAllReportExecutionsRequest req = ListAllReportExecutionsRequest.builder() + .build(); + + ListAllReportExecutionsResponse res = sdk.reportsExecutions().list() + .request(req) + .call(); + + if (res.collectionReportExecution().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | +| `request` | [ListAllReportExecutionsRequest](../../models/operations/ListAllReportExecutionsRequest.md) | :heavy_check_mark: | The request object to use for the request. | + +### Response + +**[ListAllReportExecutionsResponse](../../models/operations/ListAllReportExecutionsResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | + +## get + +Fetch a specific executed report. + +### Example Usage + +```java +package hello.world; + +import com.gr4vy.sdk.Gr4vy; +import com.gr4vy.sdk.models.errors.*; +import com.gr4vy.sdk.models.operations.GetReportExecutionResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws Exception { + + Gr4vy sdk = Gr4vy.builder() + .bearerAuth("") + .build(); + + GetReportExecutionResponse res = sdk.reportsExecutions().get() + .reportExecutionId("003bc416-f32a-420c-8eb2-062a386e1fb0") + .call(); + + if (res.reportExecution().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `reportExecutionId` | *String* | :heavy_check_mark: | The ID of the execution of a report to retrieve details for. | 003bc416-f32a-420c-8eb2-062a386e1fb0 | +| `merchantAccountId` | *JsonNullable\* | :heavy_minus_sign: | The ID of the merchant account to use for this request. | | + +### Response + +**[GetReportExecutionResponse](../../models/operations/GetReportExecutionResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------------------------- | --------------------------------- | --------------------------------- | +| models/errors/Error400 | 400 | application/json | +| models/errors/Error401 | 401 | application/json | +| models/errors/Error403 | 403 | application/json | +| models/errors/Error404 | 404 | application/json | +| models/errors/Error405 | 405 | application/json | +| models/errors/Error409 | 409 | application/json | +| models/errors/HTTPValidationError | 422 | application/json | +| models/errors/Error425 | 425 | application/json | +| models/errors/Error429 | 429 | application/json | +| models/errors/Error500 | 500 | application/json | +| models/errors/Error502 | 502 | application/json | +| models/errors/Error504 | 504 | application/json | +| models/errors/APIException | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index fdb8b983..e418cf63 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ groupId=com.gr4vy artifactId=sdk -version=1.0.0-beta.5 \ No newline at end of file +version=1.0.0-beta.6 \ No newline at end of file diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f..6689b85b 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,92 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/src/main/java/com/gr4vy/sdk/Executions.java b/src/main/java/com/gr4vy/sdk/Executions.java new file mode 100644 index 00000000..fbc1436b --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/Executions.java @@ -0,0 +1,837 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.models.components.CollectionReportExecution; +import com.gr4vy.sdk.models.components.ReportExecutionUrl; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.models.errors.Error400; +import com.gr4vy.sdk.models.errors.Error401; +import com.gr4vy.sdk.models.errors.Error403; +import com.gr4vy.sdk.models.errors.Error404; +import com.gr4vy.sdk.models.errors.Error405; +import com.gr4vy.sdk.models.errors.Error409; +import com.gr4vy.sdk.models.errors.Error425; +import com.gr4vy.sdk.models.errors.Error429; +import com.gr4vy.sdk.models.errors.Error500; +import com.gr4vy.sdk.models.errors.Error502; +import com.gr4vy.sdk.models.errors.Error504; +import com.gr4vy.sdk.models.errors.HTTPValidationError; +import com.gr4vy.sdk.models.operations.CreateReportExecutionUrlRequest; +import com.gr4vy.sdk.models.operations.CreateReportExecutionUrlRequestBuilder; +import com.gr4vy.sdk.models.operations.CreateReportExecutionUrlResponse; +import com.gr4vy.sdk.models.operations.ListReportExecutionsRequest; +import com.gr4vy.sdk.models.operations.ListReportExecutionsRequestBuilder; +import com.gr4vy.sdk.models.operations.ListReportExecutionsResponse; +import com.gr4vy.sdk.models.operations.SDKMethodInterfaces.*; +import com.gr4vy.sdk.utils.BackoffStrategy; +import com.gr4vy.sdk.utils.HTTPClient; +import com.gr4vy.sdk.utils.HTTPRequest; +import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl; +import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl; +import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.Retries.NonRetryableException; +import com.gr4vy.sdk.utils.Retries; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Option; +import com.jayway.jsonpath.ReadContext; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.Long; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import org.openapitools.jackson.nullable.JsonNullable; + +public class Executions implements + MethodCallListReportExecutions, + MethodCallCreateReportExecutionUrl { + + private final SDKConfiguration sdkConfiguration; + + Executions(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + + /** + * List executions for report + * + *

List all executed reports that have been generated. + * + * @return The call builder + */ + public ListReportExecutionsRequestBuilder list() { + return new ListReportExecutionsRequestBuilder(this); + } + + /** + * List executions for report + * + *

List all executed reports that have been generated. + * + * @param reportId The ID of the report to retrieve details for. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ListReportExecutionsResponse list( + String reportId) throws Exception { + return list(reportId, JsonNullable.undefined(), Optional.empty(), JsonNullable.undefined(), Optional.empty()); + } + + /** + * List executions for report + * + *

List all executed reports that have been generated. + * + * @param reportId The ID of the report to retrieve details for. + * @param cursor A pointer to the page of results to return. + * @param limit The maximum number of items that are at returned. + * @param merchantAccountId + * @param options additional options + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ListReportExecutionsResponse list( + String reportId, + JsonNullable cursor, + Optional limit, + JsonNullable merchantAccountId, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + ListReportExecutionsRequest request = + ListReportExecutionsRequest + .builder() + .reportId(reportId) + .cursor(cursor) + .limit(limit) + .merchantAccountId(merchantAccountId) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + ListReportExecutionsRequest.class, + _baseUrl, + "/reports/{report_id}/executions", + request, this.sdkConfiguration.globals); + + HTTPRequest _req = new HTTPRequest(_url, "GET"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + + _req.addQueryParams(Utils.getQueryParams( + ListReportExecutionsRequest.class, + request, + this.sdkConfiguration.globals)); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HTTPRequest _finalReq = _req; + RetryConfig _retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + _retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig().isPresent()) { + _retryConfig = this.sdkConfiguration.retryConfig().get(); + } else { + _retryConfig = RetryConfig.builder() + .backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double)(1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + List _statusCodes = new ArrayList<>(); + _statusCodes.add("5XX"); + Retries _retries = Retries.builder() + .action(() -> { + HttpRequest _r = null; + try { + _r = sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_report_executions", + Optional.of(List.of()), + _hookSecuritySource), + _finalReq.build()); + } catch (Exception _e) { + throw new NonRetryableException(_e); + } + try { + return _client.send(_r); + } catch (Exception _e) { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_report_executions", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + }) + .retryConfig(_retryConfig) + .statusCodes(_statusCodes) + .build(); + HttpResponse _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_report_executions", + Optional.of(List.of()), + _hookSecuritySource), + _retries.run()); + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + byte[] _fullResponse = Utils.extractByteArrayFromBody(_httpRes); + + @SuppressWarnings("deprecation") + ListReportExecutionsResponse.Builder _resBuilder = + ListReportExecutionsResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes) + .next(() -> { + if (request == null) { + return Optional.empty(); + } + String _stringBody = new String(_fullResponse, StandardCharsets.UTF_8); + Configuration _config = Configuration.defaultConfiguration() + .addOptions(Option.SUPPRESS_EXCEPTIONS); + ReadContext _body = JsonPath.using(_config).parse(_stringBody); + String _nextCursor = _body.read("$.next_cursor", String.class); + if (_nextCursor == null) { + return Optional.empty(); + } + ListReportExecutionsRequestBuilder _nextRequest = list() + .reportId(reportId) + .cursor(_nextCursor) + .limit(limit) + .merchantAccountId(merchantAccountId); + return Optional.of(_nextRequest.call()); + }); + + ListReportExecutionsResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + CollectionReportExecution _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _res.withCollectionReportExecution(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + _fullResponse); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + _fullResponse); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + _fullResponse); + } + + + + /** + * Create URL for executed report + * + *

Creates a download URL for a specific execution of a report. + * + * @return The call builder + */ + public CreateReportExecutionUrlRequestBuilder url() { + return new CreateReportExecutionUrlRequestBuilder(this); + } + + /** + * Create URL for executed report + * + *

Creates a download URL for a specific execution of a report. + * + * @param reportId The ID of the report to retrieve a URL for. + * @param reportExecutionId The ID of the execution of a report to retrieve a URL for. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public CreateReportExecutionUrlResponse url( + String reportId, + String reportExecutionId) throws Exception { + return url(reportId, reportExecutionId, JsonNullable.undefined()); + } + + /** + * Create URL for executed report + * + *

Creates a download URL for a specific execution of a report. + * + * @param reportId The ID of the report to retrieve a URL for. + * @param reportExecutionId The ID of the execution of a report to retrieve a URL for. + * @param merchantAccountId + * @return The response from the API call + * @throws Exception if the API call fails + */ + public CreateReportExecutionUrlResponse url( + String reportId, + String reportExecutionId, + JsonNullable merchantAccountId) throws Exception { + CreateReportExecutionUrlRequest request = + CreateReportExecutionUrlRequest + .builder() + .reportId(reportId) + .reportExecutionId(reportExecutionId) + .merchantAccountId(merchantAccountId) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + CreateReportExecutionUrlRequest.class, + _baseUrl, + "/reports/{report_id}/executions/{report_execution_id}/url", + request, this.sdkConfiguration.globals); + + HTTPRequest _req = new HTTPRequest(_url, "POST"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HttpRequest _r = + sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "create_report_execution_url", + Optional.of(List.of()), + _hookSecuritySource), + _req.build()); + HttpResponse _httpRes; + try { + _httpRes = _client.send(_r); + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "403", "404", "405", "409", "422", "425", "429", "4XX", "500", "502", "504", "5XX")) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "create_report_execution_url", + Optional.of(List.of()), + _hookSecuritySource), + Optional.of(_httpRes), + Optional.empty()); + } else { + _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "create_report_execution_url", + Optional.of(List.of()), + _hookSecuritySource), + _httpRes); + } + } catch (Exception _e) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "create_report_execution_url", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + CreateReportExecutionUrlResponse.Builder _resBuilder = + CreateReportExecutionUrlResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + CreateReportExecutionUrlResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + ReportExecutionUrl _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _res.withReportExecutionUrl(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + +} diff --git a/src/main/java/com/gr4vy/sdk/Gr4vy.java b/src/main/java/com/gr4vy/sdk/Gr4vy.java index 4d882249..ee6dd546 100644 --- a/src/main/java/com/gr4vy/sdk/Gr4vy.java +++ b/src/main/java/com/gr4vy/sdk/Gr4vy.java @@ -70,6 +70,10 @@ public String server() { private final AuditLogs auditLogs; + private final Reports reports; + + private final ReportsExecutions reportsExecutions; + private final CheckoutSessions checkoutSessions; private final MerchantAccounts merchantAccounts; @@ -124,6 +128,14 @@ public AuditLogs auditLogs() { return auditLogs; } + public Reports reports() { + return reports; + } + + public ReportsExecutions reportsExecutions() { + return reportsExecutions; + } + public CheckoutSessions checkoutSessions() { return checkoutSessions; } @@ -308,6 +320,8 @@ private Gr4vy(SDKConfiguration sdkConfiguration) { this.paymentServiceDefinitions = new PaymentServiceDefinitions(sdkConfiguration); this.paymentServices = new PaymentServices(sdkConfiguration); this.auditLogs = new AuditLogs(sdkConfiguration); + this.reports = new Reports(sdkConfiguration); + this.reportsExecutions = new ReportsExecutions(sdkConfiguration); this.checkoutSessions = new CheckoutSessions(sdkConfiguration); this.merchantAccounts = new MerchantAccounts(sdkConfiguration); this.payouts = new Payouts(sdkConfiguration); diff --git a/src/main/java/com/gr4vy/sdk/Reports.java b/src/main/java/com/gr4vy/sdk/Reports.java new file mode 100644 index 00000000..8cd1b523 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/Reports.java @@ -0,0 +1,1597 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.models.components.CollectionReport; +import com.gr4vy.sdk.models.components.Report; +import com.gr4vy.sdk.models.components.ReportCreate; +import com.gr4vy.sdk.models.components.ReportUpdate; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.models.errors.Error400; +import com.gr4vy.sdk.models.errors.Error401; +import com.gr4vy.sdk.models.errors.Error403; +import com.gr4vy.sdk.models.errors.Error404; +import com.gr4vy.sdk.models.errors.Error405; +import com.gr4vy.sdk.models.errors.Error409; +import com.gr4vy.sdk.models.errors.Error425; +import com.gr4vy.sdk.models.errors.Error429; +import com.gr4vy.sdk.models.errors.Error500; +import com.gr4vy.sdk.models.errors.Error502; +import com.gr4vy.sdk.models.errors.Error504; +import com.gr4vy.sdk.models.errors.HTTPValidationError; +import com.gr4vy.sdk.models.operations.AddReportRequest; +import com.gr4vy.sdk.models.operations.AddReportRequestBuilder; +import com.gr4vy.sdk.models.operations.AddReportResponse; +import com.gr4vy.sdk.models.operations.GetReportRequest; +import com.gr4vy.sdk.models.operations.GetReportRequestBuilder; +import com.gr4vy.sdk.models.operations.GetReportResponse; +import com.gr4vy.sdk.models.operations.ListReportsRequest; +import com.gr4vy.sdk.models.operations.ListReportsRequestBuilder; +import com.gr4vy.sdk.models.operations.ListReportsResponse; +import com.gr4vy.sdk.models.operations.SDKMethodInterfaces.*; +import com.gr4vy.sdk.models.operations.UpdateReportRequest; +import com.gr4vy.sdk.models.operations.UpdateReportRequestBuilder; +import com.gr4vy.sdk.models.operations.UpdateReportResponse; +import com.gr4vy.sdk.utils.BackoffStrategy; +import com.gr4vy.sdk.utils.HTTPClient; +import com.gr4vy.sdk.utils.HTTPRequest; +import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl; +import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl; +import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.Retries.NonRetryableException; +import com.gr4vy.sdk.utils.Retries; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.SerializedBody; +import com.gr4vy.sdk.utils.Utils.JsonShape; +import com.gr4vy.sdk.utils.Utils; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Option; +import com.jayway.jsonpath.ReadContext; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.Object; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import org.openapitools.jackson.nullable.JsonNullable; + +public class Reports implements + MethodCallListReports, + MethodCallAddReport, + MethodCallGetReport, + MethodCallUpdateReport { + + private final SDKConfiguration sdkConfiguration; + private final Executions executions; + + Reports(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + this.executions = new Executions(this.sdkConfiguration); + } + + public final Executions executions() { + return executions; + } + + + /** + * List configured reports + * + *

List all configured reports that can be generated. + * + * @return The call builder + */ + public ListReportsRequestBuilder list() { + return new ListReportsRequestBuilder(this); + } + + /** + * List configured reports + * + *

List all configured reports that can be generated. + * + * @param request The request object containing all of the parameters for the API call. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ListReportsResponse list( + ListReportsRequest request) throws Exception { + return list(request, Optional.empty()); + } + + /** + * List configured reports + * + *

List all configured reports that can be generated. + * + * @param request The request object containing all of the parameters for the API call. + * @param options additional options + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ListReportsResponse list( + ListReportsRequest request, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + _baseUrl, + "/reports"); + + HTTPRequest _req = new HTTPRequest(_url, "GET"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + + _req.addQueryParams(Utils.getQueryParams( + ListReportsRequest.class, + request, + this.sdkConfiguration.globals)); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HTTPRequest _finalReq = _req; + RetryConfig _retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + _retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig().isPresent()) { + _retryConfig = this.sdkConfiguration.retryConfig().get(); + } else { + _retryConfig = RetryConfig.builder() + .backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double)(1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + List _statusCodes = new ArrayList<>(); + _statusCodes.add("5XX"); + Retries _retries = Retries.builder() + .action(() -> { + HttpRequest _r = null; + try { + _r = sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_reports", + Optional.of(List.of()), + _hookSecuritySource), + _finalReq.build()); + } catch (Exception _e) { + throw new NonRetryableException(_e); + } + try { + return _client.send(_r); + } catch (Exception _e) { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_reports", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + }) + .retryConfig(_retryConfig) + .statusCodes(_statusCodes) + .build(); + HttpResponse _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_reports", + Optional.of(List.of()), + _hookSecuritySource), + _retries.run()); + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + byte[] _fullResponse = Utils.extractByteArrayFromBody(_httpRes); + + @SuppressWarnings("deprecation") + ListReportsResponse.Builder _resBuilder = + ListReportsResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes) + .next(() -> { + if (request == null) { + return Optional.empty(); + } + String _stringBody = new String(_fullResponse, StandardCharsets.UTF_8); + Configuration _config = Configuration.defaultConfiguration() + .addOptions(Option.SUPPRESS_EXCEPTIONS); + ReadContext _body = JsonPath.using(_config).parse(_stringBody); + String _nextCursor = _body.read("$.next_cursor", String.class); + if (_nextCursor == null) { + return Optional.empty(); + } + ListReportsRequestBuilder _nextRequest = list() + .request(new ListReportsRequest( + JsonNullable.of(_nextCursor), + request.limit(), + request.schedule(), + request.scheduleEnabled(), + request.name(), + request.merchantAccountId() + )); + return Optional.of(_nextRequest.call()); + }); + + ListReportsResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + CollectionReport _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _res.withCollectionReport(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + new String(_fullResponse, StandardCharsets.UTF_8), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + _fullResponse); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + _fullResponse); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + _fullResponse); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + _fullResponse); + } + + + + /** + * Add a report + * + *

Create a new report. + * + * @return The call builder + */ + public AddReportRequestBuilder create() { + return new AddReportRequestBuilder(this); + } + + /** + * Add a report + * + *

Create a new report. + * + * @param reportCreate + * @return The response from the API call + * @throws Exception if the API call fails + */ + public AddReportResponse create( + ReportCreate reportCreate) throws Exception { + return create(JsonNullable.undefined(), reportCreate); + } + + /** + * Add a report + * + *

Create a new report. + * + * @param merchantAccountId + * @param reportCreate + * @return The response from the API call + * @throws Exception if the API call fails + */ + public AddReportResponse create( + JsonNullable merchantAccountId, + ReportCreate reportCreate) throws Exception { + AddReportRequest request = + AddReportRequest + .builder() + .merchantAccountId(merchantAccountId) + .reportCreate(reportCreate) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + _baseUrl, + "/reports"); + + HTTPRequest _req = new HTTPRequest(_url, "POST"); + Object _convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() {}); + SerializedBody _serializedRequestBody = Utils.serializeRequestBody( + _convertedRequest, + "reportCreate", + "json", + false); + if (_serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + _req.setBody(Optional.ofNullable(_serializedRequestBody)); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HttpRequest _r = + sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "add_report", + Optional.of(List.of()), + _hookSecuritySource), + _req.build()); + HttpResponse _httpRes; + try { + _httpRes = _client.send(_r); + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "403", "404", "405", "409", "422", "425", "429", "4XX", "500", "502", "504", "5XX")) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "add_report", + Optional.of(List.of()), + _hookSecuritySource), + Optional.of(_httpRes), + Optional.empty()); + } else { + _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "add_report", + Optional.of(List.of()), + _hookSecuritySource), + _httpRes); + } + } catch (Exception _e) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "add_report", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + AddReportResponse.Builder _resBuilder = + AddReportResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + AddReportResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "201")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Report _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _res.withReport(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + + + + /** + * Get a report + * + *

Fetches a report by its ID. + * + * @return The call builder + */ + public GetReportRequestBuilder get() { + return new GetReportRequestBuilder(this); + } + + /** + * Get a report + * + *

Fetches a report by its ID. + * + * @param reportId The ID of the report to retrieve details for. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public GetReportResponse get( + String reportId) throws Exception { + return get(reportId, JsonNullable.undefined(), Optional.empty()); + } + + /** + * Get a report + * + *

Fetches a report by its ID. + * + * @param reportId The ID of the report to retrieve details for. + * @param merchantAccountId + * @param options additional options + * @return The response from the API call + * @throws Exception if the API call fails + */ + public GetReportResponse get( + String reportId, + JsonNullable merchantAccountId, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + GetReportRequest request = + GetReportRequest + .builder() + .reportId(reportId) + .merchantAccountId(merchantAccountId) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + GetReportRequest.class, + _baseUrl, + "/reports/{report_id}", + request, this.sdkConfiguration.globals); + + HTTPRequest _req = new HTTPRequest(_url, "GET"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HTTPRequest _finalReq = _req; + RetryConfig _retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + _retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig().isPresent()) { + _retryConfig = this.sdkConfiguration.retryConfig().get(); + } else { + _retryConfig = RetryConfig.builder() + .backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double)(1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + List _statusCodes = new ArrayList<>(); + _statusCodes.add("5XX"); + Retries _retries = Retries.builder() + .action(() -> { + HttpRequest _r = null; + try { + _r = sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_report", + Optional.of(List.of()), + _hookSecuritySource), + _finalReq.build()); + } catch (Exception _e) { + throw new NonRetryableException(_e); + } + try { + return _client.send(_r); + } catch (Exception _e) { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_report", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + }) + .retryConfig(_retryConfig) + .statusCodes(_statusCodes) + .build(); + HttpResponse _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_report", + Optional.of(List.of()), + _hookSecuritySource), + _retries.run()); + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetReportResponse.Builder _resBuilder = + GetReportResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + GetReportResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Report _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _res.withReport(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + + + + /** + * Update a report + * + *

Updates the configuration of a report. + * + * @return The call builder + */ + public UpdateReportRequestBuilder put() { + return new UpdateReportRequestBuilder(this); + } + + /** + * Update a report + * + *

Updates the configuration of a report. + * + * @param reportId The ID of the report to edit. + * @param reportUpdate + * @return The response from the API call + * @throws Exception if the API call fails + */ + public UpdateReportResponse put( + String reportId, + ReportUpdate reportUpdate) throws Exception { + return put(reportId, JsonNullable.undefined(), reportUpdate); + } + + /** + * Update a report + * + *

Updates the configuration of a report. + * + * @param reportId The ID of the report to edit. + * @param merchantAccountId + * @param reportUpdate + * @return The response from the API call + * @throws Exception if the API call fails + */ + public UpdateReportResponse put( + String reportId, + JsonNullable merchantAccountId, + ReportUpdate reportUpdate) throws Exception { + UpdateReportRequest request = + UpdateReportRequest + .builder() + .reportId(reportId) + .merchantAccountId(merchantAccountId) + .reportUpdate(reportUpdate) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + UpdateReportRequest.class, + _baseUrl, + "/reports/{report_id}", + request, this.sdkConfiguration.globals); + + HTTPRequest _req = new HTTPRequest(_url, "PUT"); + Object _convertedRequest = Utils.convertToShape( + request, + JsonShape.DEFAULT, + new TypeReference() {}); + SerializedBody _serializedRequestBody = Utils.serializeRequestBody( + _convertedRequest, + "reportUpdate", + "json", + false); + if (_serializedRequestBody == null) { + throw new Exception("Request body is required"); + } + _req.setBody(Optional.ofNullable(_serializedRequestBody)); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HttpRequest _r = + sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "update_report", + Optional.of(List.of()), + _hookSecuritySource), + _req.build()); + HttpResponse _httpRes; + try { + _httpRes = _client.send(_r); + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "403", "404", "405", "409", "422", "425", "429", "4XX", "500", "502", "504", "5XX")) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "update_report", + Optional.of(List.of()), + _hookSecuritySource), + Optional.of(_httpRes), + Optional.empty()); + } else { + _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "update_report", + Optional.of(List.of()), + _hookSecuritySource), + _httpRes); + } + } catch (Exception _e) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "update_report", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + UpdateReportResponse.Builder _resBuilder = + UpdateReportResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + UpdateReportResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Report _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _res.withReport(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + +} diff --git a/src/main/java/com/gr4vy/sdk/ReportsExecutions.java b/src/main/java/com/gr4vy/sdk/ReportsExecutions.java new file mode 100644 index 00000000..74d3ab16 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/ReportsExecutions.java @@ -0,0 +1,807 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.models.components.CollectionReportExecution; +import com.gr4vy.sdk.models.components.ReportExecution; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.models.errors.Error400; +import com.gr4vy.sdk.models.errors.Error401; +import com.gr4vy.sdk.models.errors.Error403; +import com.gr4vy.sdk.models.errors.Error404; +import com.gr4vy.sdk.models.errors.Error405; +import com.gr4vy.sdk.models.errors.Error409; +import com.gr4vy.sdk.models.errors.Error425; +import com.gr4vy.sdk.models.errors.Error429; +import com.gr4vy.sdk.models.errors.Error500; +import com.gr4vy.sdk.models.errors.Error502; +import com.gr4vy.sdk.models.errors.Error504; +import com.gr4vy.sdk.models.errors.HTTPValidationError; +import com.gr4vy.sdk.models.operations.GetReportExecutionRequest; +import com.gr4vy.sdk.models.operations.GetReportExecutionRequestBuilder; +import com.gr4vy.sdk.models.operations.GetReportExecutionResponse; +import com.gr4vy.sdk.models.operations.ListAllReportExecutionsRequest; +import com.gr4vy.sdk.models.operations.ListAllReportExecutionsRequestBuilder; +import com.gr4vy.sdk.models.operations.ListAllReportExecutionsResponse; +import com.gr4vy.sdk.models.operations.SDKMethodInterfaces.*; +import com.gr4vy.sdk.utils.BackoffStrategy; +import com.gr4vy.sdk.utils.HTTPClient; +import com.gr4vy.sdk.utils.HTTPRequest; +import com.gr4vy.sdk.utils.Hook.AfterErrorContextImpl; +import com.gr4vy.sdk.utils.Hook.AfterSuccessContextImpl; +import com.gr4vy.sdk.utils.Hook.BeforeRequestContextImpl; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.Retries.NonRetryableException; +import com.gr4vy.sdk.utils.Retries; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ReportsExecutions implements + MethodCallListAllReportExecutions, + MethodCallGetReportExecution { + + private final SDKConfiguration sdkConfiguration; + + ReportsExecutions(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + + /** + * List executed reports + * + *

List all executed reports that have been generated. + * + * @return The call builder + */ + public ListAllReportExecutionsRequestBuilder list() { + return new ListAllReportExecutionsRequestBuilder(this); + } + + /** + * List executed reports + * + *

List all executed reports that have been generated. + * + * @param request The request object containing all of the parameters for the API call. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ListAllReportExecutionsResponse list( + ListAllReportExecutionsRequest request) throws Exception { + return list(request, Optional.empty()); + } + + /** + * List executed reports + * + *

List all executed reports that have been generated. + * + * @param request The request object containing all of the parameters for the API call. + * @param options additional options + * @return The response from the API call + * @throws Exception if the API call fails + */ + public ListAllReportExecutionsResponse list( + ListAllReportExecutionsRequest request, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + _baseUrl, + "/report-executions"); + + HTTPRequest _req = new HTTPRequest(_url, "GET"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + + _req.addQueryParams(Utils.getQueryParams( + ListAllReportExecutionsRequest.class, + request, + this.sdkConfiguration.globals)); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HTTPRequest _finalReq = _req; + RetryConfig _retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + _retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig().isPresent()) { + _retryConfig = this.sdkConfiguration.retryConfig().get(); + } else { + _retryConfig = RetryConfig.builder() + .backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double)(1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + List _statusCodes = new ArrayList<>(); + _statusCodes.add("5XX"); + Retries _retries = Retries.builder() + .action(() -> { + HttpRequest _r = null; + try { + _r = sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_all_report_executions", + Optional.of(List.of()), + _hookSecuritySource), + _finalReq.build()); + } catch (Exception _e) { + throw new NonRetryableException(_e); + } + try { + return _client.send(_r); + } catch (Exception _e) { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_all_report_executions", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + }) + .retryConfig(_retryConfig) + .statusCodes(_statusCodes) + .build(); + HttpResponse _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "list_all_report_executions", + Optional.of(List.of()), + _hookSecuritySource), + _retries.run()); + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + ListAllReportExecutionsResponse.Builder _resBuilder = + ListAllReportExecutionsResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + ListAllReportExecutionsResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + CollectionReportExecution _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _res.withCollectionReportExecution(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + + + + /** + * Get executed report + * + *

Fetch a specific executed report. + * + * @return The call builder + */ + public GetReportExecutionRequestBuilder get() { + return new GetReportExecutionRequestBuilder(this); + } + + /** + * Get executed report + * + *

Fetch a specific executed report. + * + * @param reportExecutionId The ID of the execution of a report to retrieve details for. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public GetReportExecutionResponse get( + String reportExecutionId) throws Exception { + return get(reportExecutionId, JsonNullable.undefined(), Optional.empty()); + } + + /** + * Get executed report + * + *

Fetch a specific executed report. + * + * @param reportExecutionId The ID of the execution of a report to retrieve details for. + * @param merchantAccountId + * @param options additional options + * @return The response from the API call + * @throws Exception if the API call fails + */ + public GetReportExecutionResponse get( + String reportExecutionId, + JsonNullable merchantAccountId, + Optional options) throws Exception { + + if (options.isPresent()) { + options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG)); + } + GetReportExecutionRequest request = + GetReportExecutionRequest + .builder() + .reportExecutionId(reportExecutionId) + .merchantAccountId(merchantAccountId) + .build(); + + String _baseUrl = Utils.templateUrl( + this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults()); + String _url = Utils.generateURL( + GetReportExecutionRequest.class, + _baseUrl, + "/report-executions/{report_execution_id}", + request, this.sdkConfiguration.globals); + + HTTPRequest _req = new HTTPRequest(_url, "GET"); + _req.addHeader("Accept", "application/json") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals)); + + Optional _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource()); + Utils.configureSecurity(_req, + this.sdkConfiguration.securitySource().getSecurity()); + HTTPClient _client = this.sdkConfiguration.client(); + HTTPRequest _finalReq = _req; + RetryConfig _retryConfig; + if (options.isPresent() && options.get().retryConfig().isPresent()) { + _retryConfig = options.get().retryConfig().get(); + } else if (this.sdkConfiguration.retryConfig().isPresent()) { + _retryConfig = this.sdkConfiguration.retryConfig().get(); + } else { + _retryConfig = RetryConfig.builder() + .backoff(BackoffStrategy.builder() + .initialInterval(200, TimeUnit.MILLISECONDS) + .maxInterval(200, TimeUnit.MILLISECONDS) + .baseFactor((double)(1)) + .maxElapsedTime(1000, TimeUnit.MILLISECONDS) + .retryConnectError(true) + .build()) + .build(); + } + List _statusCodes = new ArrayList<>(); + _statusCodes.add("5XX"); + Retries _retries = Retries.builder() + .action(() -> { + HttpRequest _r = null; + try { + _r = sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_report_execution", + Optional.of(List.of()), + _hookSecuritySource), + _finalReq.build()); + } catch (Exception _e) { + throw new NonRetryableException(_e); + } + try { + return _client.send(_r); + } catch (Exception _e) { + return sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_report_execution", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + }) + .retryConfig(_retryConfig) + .statusCodes(_statusCodes) + .build(); + HttpResponse _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + this.sdkConfiguration, + _baseUrl, + "get_report_execution", + Optional.of(List.of()), + _hookSecuritySource), + _retries.run()); + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetReportExecutionResponse.Builder _resBuilder = + GetReportExecutionResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + GetReportExecutionResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + ReportExecution _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _res.withReportExecution(Optional.ofNullable(_out)); + return _res; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error400 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error401 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "403")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error403 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "404")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error404 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "405")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error405 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "409")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error409 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "422")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + HTTPValidationError _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "425")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error425 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "429")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error429 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "500")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error500 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "502")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error502 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "504")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + Error504 _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new APIException( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + +} diff --git a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java index a463f452..5d6e13ba 100644 --- a/src/main/java/com/gr4vy/sdk/SDKConfiguration.java +++ b/src/main/java/com/gr4vy/sdk/SDKConfiguration.java @@ -19,7 +19,7 @@ public class SDKConfiguration { private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "1.0.0"; - public static final String SDK_VERSION = "1.0.0-beta.5"; + public static final String SDK_VERSION = "1.0.0-beta.6"; public static final String GEN_VERSION = "2.618.0"; private static final String BASE_PACKAGE = "com.gr4vy.sdk"; public static final String USER_AGENT = diff --git a/src/main/java/com/gr4vy/sdk/models/components/CollectionReport.java b/src/main/java/com/gr4vy/sdk/models/components/CollectionReport.java new file mode 100644 index 00000000..3d06142d --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/CollectionReport.java @@ -0,0 +1,300 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class CollectionReport { + + /** + * A list of items returned for this request. + */ + @JsonProperty("items") + private List items; + + /** + * The number of items for this page. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("limit") + private Optional limit; + + /** + * The cursor pointing at the next page of items. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("next_cursor") + private JsonNullable nextCursor; + + /** + * The cursor pointing at the previous page of items. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("previous_cursor") + private JsonNullable previousCursor; + + @JsonCreator + public CollectionReport( + @JsonProperty("items") List items, + @JsonProperty("limit") Optional limit, + @JsonProperty("next_cursor") JsonNullable nextCursor, + @JsonProperty("previous_cursor") JsonNullable previousCursor) { + Utils.checkNotNull(items, "items"); + Utils.checkNotNull(limit, "limit"); + Utils.checkNotNull(nextCursor, "nextCursor"); + Utils.checkNotNull(previousCursor, "previousCursor"); + this.items = items; + this.limit = limit; + this.nextCursor = nextCursor; + this.previousCursor = previousCursor; + } + + public CollectionReport( + List items) { + this(items, Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * A list of items returned for this request. + */ + @JsonIgnore + public List items() { + return items; + } + + /** + * The number of items for this page. + */ + @JsonIgnore + public Optional limit() { + return limit; + } + + /** + * The cursor pointing at the next page of items. + */ + @JsonIgnore + public JsonNullable nextCursor() { + return nextCursor; + } + + /** + * The cursor pointing at the previous page of items. + */ + @JsonIgnore + public JsonNullable previousCursor() { + return previousCursor; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * A list of items returned for this request. + */ + public CollectionReport withItems(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + /** + * The number of items for this page. + */ + public CollectionReport withLimit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The number of items for this page. + */ + public CollectionReport withLimit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public CollectionReport withNextCursor(String nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public CollectionReport withNextCursor(JsonNullable nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = nextCursor; + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public CollectionReport withPreviousCursor(String previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = JsonNullable.of(previousCursor); + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public CollectionReport withPreviousCursor(JsonNullable previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = previousCursor; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CollectionReport other = (CollectionReport) o; + return + Objects.deepEquals(this.items, other.items) && + Objects.deepEquals(this.limit, other.limit) && + Objects.deepEquals(this.nextCursor, other.nextCursor) && + Objects.deepEquals(this.previousCursor, other.previousCursor); + } + + @Override + public int hashCode() { + return Objects.hash( + items, + limit, + nextCursor, + previousCursor); + } + + @Override + public String toString() { + return Utils.toString(CollectionReport.class, + "items", items, + "limit", limit, + "nextCursor", nextCursor, + "previousCursor", previousCursor); + } + + public final static class Builder { + + private List items; + + private Optional limit; + + private JsonNullable nextCursor = JsonNullable.undefined(); + + private JsonNullable previousCursor = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * A list of items returned for this request. + */ + public Builder items(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + /** + * The number of items for this page. + */ + public Builder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The number of items for this page. + */ + public Builder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public Builder nextCursor(String nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public Builder nextCursor(JsonNullable nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = nextCursor; + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public Builder previousCursor(String previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = JsonNullable.of(previousCursor); + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public Builder previousCursor(JsonNullable previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = previousCursor; + return this; + } + + public CollectionReport build() { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } + return new CollectionReport( + items, + limit, + nextCursor, + previousCursor); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/CollectionReportExecution.java b/src/main/java/com/gr4vy/sdk/models/components/CollectionReportExecution.java new file mode 100644 index 00000000..c3c47060 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/CollectionReportExecution.java @@ -0,0 +1,300 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class CollectionReportExecution { + + /** + * A list of items returned for this request. + */ + @JsonProperty("items") + private List items; + + /** + * The number of items for this page. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("limit") + private Optional limit; + + /** + * The cursor pointing at the next page of items. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("next_cursor") + private JsonNullable nextCursor; + + /** + * The cursor pointing at the previous page of items. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("previous_cursor") + private JsonNullable previousCursor; + + @JsonCreator + public CollectionReportExecution( + @JsonProperty("items") List items, + @JsonProperty("limit") Optional limit, + @JsonProperty("next_cursor") JsonNullable nextCursor, + @JsonProperty("previous_cursor") JsonNullable previousCursor) { + Utils.checkNotNull(items, "items"); + Utils.checkNotNull(limit, "limit"); + Utils.checkNotNull(nextCursor, "nextCursor"); + Utils.checkNotNull(previousCursor, "previousCursor"); + this.items = items; + this.limit = limit; + this.nextCursor = nextCursor; + this.previousCursor = previousCursor; + } + + public CollectionReportExecution( + List items) { + this(items, Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * A list of items returned for this request. + */ + @JsonIgnore + public List items() { + return items; + } + + /** + * The number of items for this page. + */ + @JsonIgnore + public Optional limit() { + return limit; + } + + /** + * The cursor pointing at the next page of items. + */ + @JsonIgnore + public JsonNullable nextCursor() { + return nextCursor; + } + + /** + * The cursor pointing at the previous page of items. + */ + @JsonIgnore + public JsonNullable previousCursor() { + return previousCursor; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * A list of items returned for this request. + */ + public CollectionReportExecution withItems(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + /** + * The number of items for this page. + */ + public CollectionReportExecution withLimit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The number of items for this page. + */ + public CollectionReportExecution withLimit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public CollectionReportExecution withNextCursor(String nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public CollectionReportExecution withNextCursor(JsonNullable nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = nextCursor; + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public CollectionReportExecution withPreviousCursor(String previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = JsonNullable.of(previousCursor); + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public CollectionReportExecution withPreviousCursor(JsonNullable previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = previousCursor; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CollectionReportExecution other = (CollectionReportExecution) o; + return + Objects.deepEquals(this.items, other.items) && + Objects.deepEquals(this.limit, other.limit) && + Objects.deepEquals(this.nextCursor, other.nextCursor) && + Objects.deepEquals(this.previousCursor, other.previousCursor); + } + + @Override + public int hashCode() { + return Objects.hash( + items, + limit, + nextCursor, + previousCursor); + } + + @Override + public String toString() { + return Utils.toString(CollectionReportExecution.class, + "items", items, + "limit", limit, + "nextCursor", nextCursor, + "previousCursor", previousCursor); + } + + public final static class Builder { + + private List items; + + private Optional limit; + + private JsonNullable nextCursor = JsonNullable.undefined(); + + private JsonNullable previousCursor = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * A list of items returned for this request. + */ + public Builder items(List items) { + Utils.checkNotNull(items, "items"); + this.items = items; + return this; + } + + /** + * The number of items for this page. + */ + public Builder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The number of items for this page. + */ + public Builder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public Builder nextCursor(String nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = JsonNullable.of(nextCursor); + return this; + } + + /** + * The cursor pointing at the next page of items. + */ + public Builder nextCursor(JsonNullable nextCursor) { + Utils.checkNotNull(nextCursor, "nextCursor"); + this.nextCursor = nextCursor; + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public Builder previousCursor(String previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = JsonNullable.of(previousCursor); + return this; + } + + /** + * The cursor pointing at the previous page of items. + */ + public Builder previousCursor(JsonNullable previousCursor) { + Utils.checkNotNull(previousCursor, "previousCursor"); + this.previousCursor = previousCursor; + return this; + } + + public CollectionReportExecution build() { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } + return new CollectionReportExecution( + items, + limit, + nextCursor, + previousCursor); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/DetailedSettlementReportSpec.java b/src/main/java/com/gr4vy/sdk/models/components/DetailedSettlementReportSpec.java new file mode 100644 index 00000000..74c7d012 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/DetailedSettlementReportSpec.java @@ -0,0 +1,131 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +public class DetailedSettlementReportSpec implements Spec { + + /** + * The report model type. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("model") + private Optional model; + + /** + * The parameters for the detailed settlement report model. + */ + @JsonProperty("params") + private Map params; + + @JsonCreator + public DetailedSettlementReportSpec( + @JsonProperty("params") Map params) { + params = Utils.emptyMapIfNull(params); + this.model = Builder._SINGLETON_VALUE_Model.value(); + this.params = params; + } + + /** + * The report model type. + */ + @JsonIgnore + @Override + public String model() { + return Utils.discriminatorToString(model); + } + + /** + * The parameters for the detailed settlement report model. + */ + @JsonIgnore + public Map params() { + return params; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The parameters for the detailed settlement report model. + */ + public DetailedSettlementReportSpec withParams(Map params) { + Utils.checkNotNull(params, "params"); + this.params = params; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + DetailedSettlementReportSpec other = (DetailedSettlementReportSpec) o; + return + Objects.deepEquals(this.model, other.model) && + Objects.deepEquals(this.params, other.params); + } + + @Override + public int hashCode() { + return Objects.hash( + model, + params); + } + + @Override + public String toString() { + return Utils.toString(DetailedSettlementReportSpec.class, + "model", model, + "params", params); + } + + public final static class Builder { + + private Map params; + + private Builder() { + // force use of static builder() method + } + + /** + * The parameters for the detailed settlement report model. + */ + public Builder params(Map params) { + Utils.checkNotNull(params, "params"); + this.params = params; + return this; + } + + public DetailedSettlementReportSpec build() { + return new DetailedSettlementReportSpec( + params); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Model = + new LazySingletonValue<>( + "model", + "\"detailed_settlement\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/Report.java b/src/main/java/com/gr4vy/sdk/models/components/Report.java new file mode 100644 index 00000000..9662b7f5 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/Report.java @@ -0,0 +1,811 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Boolean; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class Report { + + /** + * Always `report`. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("type") + private Optional type; + + /** + * The unique ID for the report. + */ + @JsonProperty("id") + private String id; + + /** + * The merchant account ID this report belongs to. + */ + @JsonProperty("merchant_account_id") + private String merchantAccountId; + + /** + * The name of the report. + */ + @JsonProperty("name") + private String name; + + /** + * The ID of the user who created the report. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("creator_id") + private JsonNullable creatorId; + + /** + * The display name of the report creator. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("creator_display_name") + private JsonNullable creatorDisplayName; + + /** + * The type of the report creator. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("creator_type") + private JsonNullable creatorType; + + /** + * The date this report was created at. + */ + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + /** + * The date this report was last updated. + */ + @JsonProperty("updated_at") + private OffsetDateTime updatedAt; + + /** + * The next scheduled execution time for the report. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("next_execution_at") + private JsonNullable nextExecutionAt; + + /** + * A description of the report. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("description") + private JsonNullable description; + + @JsonProperty("schedule") + private ReportSchedule schedule; + + /** + * Whether the report schedule is enabled. + */ + @JsonProperty("schedule_enabled") + private boolean scheduleEnabled; + + /** + * The timezone for the report schedule. + */ + @JsonProperty("schedule_timezone") + private String scheduleTimezone; + + @JsonProperty("spec") + private ReportSpec spec; + + /** + * The latest execution summary for the report. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("latest_execution") + private JsonNullable latestExecution; + + @JsonCreator + public Report( + @JsonProperty("id") String id, + @JsonProperty("merchant_account_id") String merchantAccountId, + @JsonProperty("name") String name, + @JsonProperty("creator_id") JsonNullable creatorId, + @JsonProperty("creator_display_name") JsonNullable creatorDisplayName, + @JsonProperty("creator_type") JsonNullable creatorType, + @JsonProperty("created_at") OffsetDateTime createdAt, + @JsonProperty("updated_at") OffsetDateTime updatedAt, + @JsonProperty("next_execution_at") JsonNullable nextExecutionAt, + @JsonProperty("description") JsonNullable description, + @JsonProperty("schedule") ReportSchedule schedule, + @JsonProperty("schedule_enabled") boolean scheduleEnabled, + @JsonProperty("schedule_timezone") String scheduleTimezone, + @JsonProperty("spec") ReportSpec spec, + @JsonProperty("latest_execution") JsonNullable latestExecution) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(creatorId, "creatorId"); + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + Utils.checkNotNull(creatorType, "creatorType"); + Utils.checkNotNull(createdAt, "createdAt"); + Utils.checkNotNull(updatedAt, "updatedAt"); + Utils.checkNotNull(nextExecutionAt, "nextExecutionAt"); + Utils.checkNotNull(description, "description"); + Utils.checkNotNull(schedule, "schedule"); + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + Utils.checkNotNull(scheduleTimezone, "scheduleTimezone"); + Utils.checkNotNull(spec, "spec"); + Utils.checkNotNull(latestExecution, "latestExecution"); + this.type = Builder._SINGLETON_VALUE_Type.value(); + this.id = id; + this.merchantAccountId = merchantAccountId; + this.name = name; + this.creatorId = creatorId; + this.creatorDisplayName = creatorDisplayName; + this.creatorType = creatorType; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.nextExecutionAt = nextExecutionAt; + this.description = description; + this.schedule = schedule; + this.scheduleEnabled = scheduleEnabled; + this.scheduleTimezone = scheduleTimezone; + this.spec = spec; + this.latestExecution = latestExecution; + } + + public Report( + String id, + String merchantAccountId, + String name, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + ReportSchedule schedule, + boolean scheduleEnabled, + String scheduleTimezone, + ReportSpec spec) { + this(id, merchantAccountId, name, JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), createdAt, updatedAt, JsonNullable.undefined(), JsonNullable.undefined(), schedule, scheduleEnabled, scheduleTimezone, spec, JsonNullable.undefined()); + } + + /** + * Always `report`. + */ + @JsonIgnore + public Optional type() { + return type; + } + + /** + * The unique ID for the report. + */ + @JsonIgnore + public String id() { + return id; + } + + /** + * The merchant account ID this report belongs to. + */ + @JsonIgnore + public String merchantAccountId() { + return merchantAccountId; + } + + /** + * The name of the report. + */ + @JsonIgnore + public String name() { + return name; + } + + /** + * The ID of the user who created the report. + */ + @JsonIgnore + public JsonNullable creatorId() { + return creatorId; + } + + /** + * The display name of the report creator. + */ + @JsonIgnore + public JsonNullable creatorDisplayName() { + return creatorDisplayName; + } + + /** + * The type of the report creator. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable creatorType() { + return (JsonNullable) creatorType; + } + + /** + * The date this report was created at. + */ + @JsonIgnore + public OffsetDateTime createdAt() { + return createdAt; + } + + /** + * The date this report was last updated. + */ + @JsonIgnore + public OffsetDateTime updatedAt() { + return updatedAt; + } + + /** + * The next scheduled execution time for the report. + */ + @JsonIgnore + public JsonNullable nextExecutionAt() { + return nextExecutionAt; + } + + /** + * A description of the report. + */ + @JsonIgnore + public JsonNullable description() { + return description; + } + + @JsonIgnore + public ReportSchedule schedule() { + return schedule; + } + + /** + * Whether the report schedule is enabled. + */ + @JsonIgnore + public boolean scheduleEnabled() { + return scheduleEnabled; + } + + /** + * The timezone for the report schedule. + */ + @JsonIgnore + public String scheduleTimezone() { + return scheduleTimezone; + } + + @JsonIgnore + public ReportSpec spec() { + return spec; + } + + /** + * The latest execution summary for the report. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable latestExecution() { + return (JsonNullable) latestExecution; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The unique ID for the report. + */ + public Report withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The merchant account ID this report belongs to. + */ + public Report withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + /** + * The name of the report. + */ + public Report withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * The ID of the user who created the report. + */ + public Report withCreatorId(String creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = JsonNullable.of(creatorId); + return this; + } + + /** + * The ID of the user who created the report. + */ + public Report withCreatorId(JsonNullable creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = creatorId; + return this; + } + + /** + * The display name of the report creator. + */ + public Report withCreatorDisplayName(String creatorDisplayName) { + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + this.creatorDisplayName = JsonNullable.of(creatorDisplayName); + return this; + } + + /** + * The display name of the report creator. + */ + public Report withCreatorDisplayName(JsonNullable creatorDisplayName) { + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + this.creatorDisplayName = creatorDisplayName; + return this; + } + + /** + * The type of the report creator. + */ + public Report withCreatorType(ReportCreatorType creatorType) { + Utils.checkNotNull(creatorType, "creatorType"); + this.creatorType = JsonNullable.of(creatorType); + return this; + } + + /** + * The type of the report creator. + */ + public Report withCreatorType(JsonNullable creatorType) { + Utils.checkNotNull(creatorType, "creatorType"); + this.creatorType = creatorType; + return this; + } + + /** + * The date this report was created at. + */ + public Report withCreatedAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date this report was last updated. + */ + public Report withUpdatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + /** + * The next scheduled execution time for the report. + */ + public Report withNextExecutionAt(OffsetDateTime nextExecutionAt) { + Utils.checkNotNull(nextExecutionAt, "nextExecutionAt"); + this.nextExecutionAt = JsonNullable.of(nextExecutionAt); + return this; + } + + /** + * The next scheduled execution time for the report. + */ + public Report withNextExecutionAt(JsonNullable nextExecutionAt) { + Utils.checkNotNull(nextExecutionAt, "nextExecutionAt"); + this.nextExecutionAt = nextExecutionAt; + return this; + } + + /** + * A description of the report. + */ + public Report withDescription(String description) { + Utils.checkNotNull(description, "description"); + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the report. + */ + public Report withDescription(JsonNullable description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + public Report withSchedule(ReportSchedule schedule) { + Utils.checkNotNull(schedule, "schedule"); + this.schedule = schedule; + return this; + } + + /** + * Whether the report schedule is enabled. + */ + public Report withScheduleEnabled(boolean scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = scheduleEnabled; + return this; + } + + /** + * The timezone for the report schedule. + */ + public Report withScheduleTimezone(String scheduleTimezone) { + Utils.checkNotNull(scheduleTimezone, "scheduleTimezone"); + this.scheduleTimezone = scheduleTimezone; + return this; + } + + public Report withSpec(ReportSpec spec) { + Utils.checkNotNull(spec, "spec"); + this.spec = spec; + return this; + } + + /** + * The latest execution summary for the report. + */ + public Report withLatestExecution(ReportExecutionSummary latestExecution) { + Utils.checkNotNull(latestExecution, "latestExecution"); + this.latestExecution = JsonNullable.of(latestExecution); + return this; + } + + /** + * The latest execution summary for the report. + */ + public Report withLatestExecution(JsonNullable latestExecution) { + Utils.checkNotNull(latestExecution, "latestExecution"); + this.latestExecution = latestExecution; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Report other = (Report) o; + return + Objects.deepEquals(this.type, other.type) && + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId) && + Objects.deepEquals(this.name, other.name) && + Objects.deepEquals(this.creatorId, other.creatorId) && + Objects.deepEquals(this.creatorDisplayName, other.creatorDisplayName) && + Objects.deepEquals(this.creatorType, other.creatorType) && + Objects.deepEquals(this.createdAt, other.createdAt) && + Objects.deepEquals(this.updatedAt, other.updatedAt) && + Objects.deepEquals(this.nextExecutionAt, other.nextExecutionAt) && + Objects.deepEquals(this.description, other.description) && + Objects.deepEquals(this.schedule, other.schedule) && + Objects.deepEquals(this.scheduleEnabled, other.scheduleEnabled) && + Objects.deepEquals(this.scheduleTimezone, other.scheduleTimezone) && + Objects.deepEquals(this.spec, other.spec) && + Objects.deepEquals(this.latestExecution, other.latestExecution); + } + + @Override + public int hashCode() { + return Objects.hash( + type, + id, + merchantAccountId, + name, + creatorId, + creatorDisplayName, + creatorType, + createdAt, + updatedAt, + nextExecutionAt, + description, + schedule, + scheduleEnabled, + scheduleTimezone, + spec, + latestExecution); + } + + @Override + public String toString() { + return Utils.toString(Report.class, + "type", type, + "id", id, + "merchantAccountId", merchantAccountId, + "name", name, + "creatorId", creatorId, + "creatorDisplayName", creatorDisplayName, + "creatorType", creatorType, + "createdAt", createdAt, + "updatedAt", updatedAt, + "nextExecutionAt", nextExecutionAt, + "description", description, + "schedule", schedule, + "scheduleEnabled", scheduleEnabled, + "scheduleTimezone", scheduleTimezone, + "spec", spec, + "latestExecution", latestExecution); + } + + public final static class Builder { + + private String id; + + private String merchantAccountId; + + private String name; + + private JsonNullable creatorId = JsonNullable.undefined(); + + private JsonNullable creatorDisplayName = JsonNullable.undefined(); + + private JsonNullable creatorType = JsonNullable.undefined(); + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private JsonNullable nextExecutionAt = JsonNullable.undefined(); + + private JsonNullable description = JsonNullable.undefined(); + + private ReportSchedule schedule; + + private Boolean scheduleEnabled; + + private String scheduleTimezone; + + private ReportSpec spec; + + private JsonNullable latestExecution = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The unique ID for the report. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The merchant account ID this report belongs to. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + /** + * The name of the report. + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * The ID of the user who created the report. + */ + public Builder creatorId(String creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = JsonNullable.of(creatorId); + return this; + } + + /** + * The ID of the user who created the report. + */ + public Builder creatorId(JsonNullable creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = creatorId; + return this; + } + + /** + * The display name of the report creator. + */ + public Builder creatorDisplayName(String creatorDisplayName) { + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + this.creatorDisplayName = JsonNullable.of(creatorDisplayName); + return this; + } + + /** + * The display name of the report creator. + */ + public Builder creatorDisplayName(JsonNullable creatorDisplayName) { + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + this.creatorDisplayName = creatorDisplayName; + return this; + } + + /** + * The type of the report creator. + */ + public Builder creatorType(ReportCreatorType creatorType) { + Utils.checkNotNull(creatorType, "creatorType"); + this.creatorType = JsonNullable.of(creatorType); + return this; + } + + /** + * The type of the report creator. + */ + public Builder creatorType(JsonNullable creatorType) { + Utils.checkNotNull(creatorType, "creatorType"); + this.creatorType = creatorType; + return this; + } + + /** + * The date this report was created at. + */ + public Builder createdAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date this report was last updated. + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + /** + * The next scheduled execution time for the report. + */ + public Builder nextExecutionAt(OffsetDateTime nextExecutionAt) { + Utils.checkNotNull(nextExecutionAt, "nextExecutionAt"); + this.nextExecutionAt = JsonNullable.of(nextExecutionAt); + return this; + } + + /** + * The next scheduled execution time for the report. + */ + public Builder nextExecutionAt(JsonNullable nextExecutionAt) { + Utils.checkNotNull(nextExecutionAt, "nextExecutionAt"); + this.nextExecutionAt = nextExecutionAt; + return this; + } + + /** + * A description of the report. + */ + public Builder description(String description) { + Utils.checkNotNull(description, "description"); + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the report. + */ + public Builder description(JsonNullable description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + public Builder schedule(ReportSchedule schedule) { + Utils.checkNotNull(schedule, "schedule"); + this.schedule = schedule; + return this; + } + + /** + * Whether the report schedule is enabled. + */ + public Builder scheduleEnabled(boolean scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = scheduleEnabled; + return this; + } + + /** + * The timezone for the report schedule. + */ + public Builder scheduleTimezone(String scheduleTimezone) { + Utils.checkNotNull(scheduleTimezone, "scheduleTimezone"); + this.scheduleTimezone = scheduleTimezone; + return this; + } + + public Builder spec(ReportSpec spec) { + Utils.checkNotNull(spec, "spec"); + this.spec = spec; + return this; + } + + /** + * The latest execution summary for the report. + */ + public Builder latestExecution(ReportExecutionSummary latestExecution) { + Utils.checkNotNull(latestExecution, "latestExecution"); + this.latestExecution = JsonNullable.of(latestExecution); + return this; + } + + /** + * The latest execution summary for the report. + */ + public Builder latestExecution(JsonNullable latestExecution) { + Utils.checkNotNull(latestExecution, "latestExecution"); + this.latestExecution = latestExecution; + return this; + } + + public Report build() { + return new Report( + id, + merchantAccountId, + name, + creatorId, + creatorDisplayName, + creatorType, + createdAt, + updatedAt, + nextExecutionAt, + description, + schedule, + scheduleEnabled, + scheduleTimezone, + spec, + latestExecution); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Type = + new LazySingletonValue<>( + "type", + "\"report\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportCreate.java b/src/main/java/com/gr4vy/sdk/models/components/ReportCreate.java new file mode 100644 index 00000000..0ded374a --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportCreate.java @@ -0,0 +1,353 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Boolean; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ReportCreate { + + /** + * The name of the report. + */ + @JsonProperty("name") + private String name; + + /** + * A description of the report. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("description") + private JsonNullable description; + + @JsonProperty("schedule") + private ReportSchedule schedule; + + /** + * Whether the report schedule is enabled. + */ + @JsonProperty("schedule_enabled") + private boolean scheduleEnabled; + + /** + * The timezone for the report schedule. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("schedule_timezone") + private Optional scheduleTimezone; + + /** + * The report specification. + */ + @JsonProperty("spec") + private Spec spec; + + @JsonCreator + public ReportCreate( + @JsonProperty("name") String name, + @JsonProperty("description") JsonNullable description, + @JsonProperty("schedule") ReportSchedule schedule, + @JsonProperty("schedule_enabled") boolean scheduleEnabled, + @JsonProperty("schedule_timezone") Optional scheduleTimezone, + @JsonProperty("spec") Spec spec) { + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(description, "description"); + Utils.checkNotNull(schedule, "schedule"); + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + Utils.checkNotNull(scheduleTimezone, "scheduleTimezone"); + Utils.checkNotNull(spec, "spec"); + this.name = name; + this.description = description; + this.schedule = schedule; + this.scheduleEnabled = scheduleEnabled; + this.scheduleTimezone = scheduleTimezone; + this.spec = spec; + } + + public ReportCreate( + String name, + ReportSchedule schedule, + boolean scheduleEnabled, + Spec spec) { + this(name, JsonNullable.undefined(), schedule, scheduleEnabled, Optional.empty(), spec); + } + + /** + * The name of the report. + */ + @JsonIgnore + public String name() { + return name; + } + + /** + * A description of the report. + */ + @JsonIgnore + public JsonNullable description() { + return description; + } + + @JsonIgnore + public ReportSchedule schedule() { + return schedule; + } + + /** + * Whether the report schedule is enabled. + */ + @JsonIgnore + public boolean scheduleEnabled() { + return scheduleEnabled; + } + + /** + * The timezone for the report schedule. + */ + @JsonIgnore + public Optional scheduleTimezone() { + return scheduleTimezone; + } + + /** + * The report specification. + */ + @JsonIgnore + public Spec spec() { + return spec; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The name of the report. + */ + public ReportCreate withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * A description of the report. + */ + public ReportCreate withDescription(String description) { + Utils.checkNotNull(description, "description"); + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the report. + */ + public ReportCreate withDescription(JsonNullable description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + public ReportCreate withSchedule(ReportSchedule schedule) { + Utils.checkNotNull(schedule, "schedule"); + this.schedule = schedule; + return this; + } + + /** + * Whether the report schedule is enabled. + */ + public ReportCreate withScheduleEnabled(boolean scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = scheduleEnabled; + return this; + } + + /** + * The timezone for the report schedule. + */ + public ReportCreate withScheduleTimezone(String scheduleTimezone) { + Utils.checkNotNull(scheduleTimezone, "scheduleTimezone"); + this.scheduleTimezone = Optional.ofNullable(scheduleTimezone); + return this; + } + + /** + * The timezone for the report schedule. + */ + public ReportCreate withScheduleTimezone(Optional scheduleTimezone) { + Utils.checkNotNull(scheduleTimezone, "scheduleTimezone"); + this.scheduleTimezone = scheduleTimezone; + return this; + } + + /** + * The report specification. + */ + public ReportCreate withSpec(Spec spec) { + Utils.checkNotNull(spec, "spec"); + this.spec = spec; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportCreate other = (ReportCreate) o; + return + Objects.deepEquals(this.name, other.name) && + Objects.deepEquals(this.description, other.description) && + Objects.deepEquals(this.schedule, other.schedule) && + Objects.deepEquals(this.scheduleEnabled, other.scheduleEnabled) && + Objects.deepEquals(this.scheduleTimezone, other.scheduleTimezone) && + Objects.deepEquals(this.spec, other.spec); + } + + @Override + public int hashCode() { + return Objects.hash( + name, + description, + schedule, + scheduleEnabled, + scheduleTimezone, + spec); + } + + @Override + public String toString() { + return Utils.toString(ReportCreate.class, + "name", name, + "description", description, + "schedule", schedule, + "scheduleEnabled", scheduleEnabled, + "scheduleTimezone", scheduleTimezone, + "spec", spec); + } + + public final static class Builder { + + private String name; + + private JsonNullable description = JsonNullable.undefined(); + + private ReportSchedule schedule; + + private Boolean scheduleEnabled; + + private Optional scheduleTimezone; + + private Spec spec; + + private Builder() { + // force use of static builder() method + } + + /** + * The name of the report. + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * A description of the report. + */ + public Builder description(String description) { + Utils.checkNotNull(description, "description"); + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the report. + */ + public Builder description(JsonNullable description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + public Builder schedule(ReportSchedule schedule) { + Utils.checkNotNull(schedule, "schedule"); + this.schedule = schedule; + return this; + } + + /** + * Whether the report schedule is enabled. + */ + public Builder scheduleEnabled(boolean scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = scheduleEnabled; + return this; + } + + /** + * The timezone for the report schedule. + */ + public Builder scheduleTimezone(String scheduleTimezone) { + Utils.checkNotNull(scheduleTimezone, "scheduleTimezone"); + this.scheduleTimezone = Optional.ofNullable(scheduleTimezone); + return this; + } + + /** + * The timezone for the report schedule. + */ + public Builder scheduleTimezone(Optional scheduleTimezone) { + Utils.checkNotNull(scheduleTimezone, "scheduleTimezone"); + this.scheduleTimezone = scheduleTimezone; + return this; + } + + /** + * The report specification. + */ + public Builder spec(Spec spec) { + Utils.checkNotNull(spec, "spec"); + this.spec = spec; + return this; + } + + public ReportCreate build() { + if (scheduleTimezone == null) { + scheduleTimezone = _SINGLETON_VALUE_ScheduleTimezone.value(); + } + return new ReportCreate( + name, + description, + schedule, + scheduleEnabled, + scheduleTimezone, + spec); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_ScheduleTimezone = + new LazySingletonValue<>( + "schedule_timezone", + "\"Etc/UTC\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportCreatorType.java b/src/main/java/com/gr4vy/sdk/models/components/ReportCreatorType.java new file mode 100644 index 00000000..dde0eb32 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportCreatorType.java @@ -0,0 +1,179 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.core.JacksonException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + *

Wrapper class for an "open" enum. "Open" enums are those that are expected + * to evolve (particularly with the addition of enum members over time). If an + * open enum is used then the appearance of unexpected enum values (say in a + * response from an updated an API) will not bring about a runtime error thus + * ensuring that non-updated client versions can continue to work without error. + * + *

Note that instances are immutable and are singletons (an internal thread-safe + * cache is maintained to ensure that). As a consequence instances created with the + * same value will satisfy reference equality (via {@code ==}). + * + *

This class is intended to emulate an enum (in terms of common usage and with + * reference equality) but with the ability to carry unknown values. Unfortunately + * Java does not permit the use of an instance in a switch expression but you can + * use the {@code asEnum()} method (after dealing with the `Optional` appropriately). + * + */ +@JsonDeserialize(using = ReportCreatorType._Deserializer.class) +@JsonSerialize(using = ReportCreatorType._Serializer.class) +public class ReportCreatorType { + + public static final ReportCreatorType USER = new ReportCreatorType("user"); + public static final ReportCreatorType PRIVATE_KEY = new ReportCreatorType("private_key"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private ReportCreatorType(String value) { + this.value = value; + } + + /** + * Returns a ReportCreatorType with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as ReportCreatorType + */ + public static ReportCreatorType of(String value) { + synchronized (ReportCreatorType.class) { + return values.computeIfAbsent(value, v -> new ReportCreatorType(v)); + } + } + + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ReportCreatorType other = (ReportCreatorType) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "ReportCreatorType [value=" + value + "]"; + } + + // return an array just like an enum + public static ReportCreatorType[] values() { + synchronized (ReportCreatorType.class) { + return values.values().toArray(new ReportCreatorType[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("user", USER); + map.put("private_key", PRIVATE_KEY); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("user", ReportCreatorTypeEnum.USER); + map.put("private_key", ReportCreatorTypeEnum.PRIVATE_KEY); + return map; + } + + @SuppressWarnings("serial") + public static final class _Serializer extends StdSerializer { + + protected _Serializer() { + super(ReportCreatorType.class); + } + + @Override + public void serialize(ReportCreatorType value, JsonGenerator g, SerializerProvider provider) + throws IOException, JsonProcessingException { + g.writeObject(value.value); + } + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends StdDeserializer { + + protected _Deserializer() { + super(ReportCreatorType.class); + } + + @Override + public ReportCreatorType deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException, JacksonException { + String v = p.readValueAs(new TypeReference() {}); + // use the factory method to ensure we get singletons + return ReportCreatorType.of(v); + } + } + + public enum ReportCreatorTypeEnum { + + USER("user"), + PRIVATE_KEY("private_key"),; + + private final String value; + + private ReportCreatorTypeEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} + diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportExecution.java b/src/main/java/com/gr4vy/sdk/models/components/ReportExecution.java new file mode 100644 index 00000000..8eb29452 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportExecution.java @@ -0,0 +1,298 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.Optional; + +public class ReportExecution { + + /** + * Always `report-execution`. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("type") + private Optional type; + + /** + * The unique ID for the report execution. + */ + @JsonProperty("id") + private String id; + + /** + * The date this report execution was created at. + */ + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + /** + * The date this report execution was last updated. + */ + @JsonProperty("updated_at") + private OffsetDateTime updatedAt; + + @JsonProperty("status") + private ReportExecutionStatus status; + + @JsonProperty("context") + private ReportExecutionContext context; + + @JsonProperty("report") + private ReportSummary report; + + @JsonCreator + public ReportExecution( + @JsonProperty("id") String id, + @JsonProperty("created_at") OffsetDateTime createdAt, + @JsonProperty("updated_at") OffsetDateTime updatedAt, + @JsonProperty("status") ReportExecutionStatus status, + @JsonProperty("context") ReportExecutionContext context, + @JsonProperty("report") ReportSummary report) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(createdAt, "createdAt"); + Utils.checkNotNull(updatedAt, "updatedAt"); + Utils.checkNotNull(status, "status"); + Utils.checkNotNull(context, "context"); + Utils.checkNotNull(report, "report"); + this.type = Builder._SINGLETON_VALUE_Type.value(); + this.id = id; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.status = status; + this.context = context; + this.report = report; + } + + /** + * Always `report-execution`. + */ + @JsonIgnore + public Optional type() { + return type; + } + + /** + * The unique ID for the report execution. + */ + @JsonIgnore + public String id() { + return id; + } + + /** + * The date this report execution was created at. + */ + @JsonIgnore + public OffsetDateTime createdAt() { + return createdAt; + } + + /** + * The date this report execution was last updated. + */ + @JsonIgnore + public OffsetDateTime updatedAt() { + return updatedAt; + } + + @JsonIgnore + public ReportExecutionStatus status() { + return status; + } + + @JsonIgnore + public ReportExecutionContext context() { + return context; + } + + @JsonIgnore + public ReportSummary report() { + return report; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The unique ID for the report execution. + */ + public ReportExecution withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The date this report execution was created at. + */ + public ReportExecution withCreatedAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date this report execution was last updated. + */ + public ReportExecution withUpdatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + public ReportExecution withStatus(ReportExecutionStatus status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + public ReportExecution withContext(ReportExecutionContext context) { + Utils.checkNotNull(context, "context"); + this.context = context; + return this; + } + + public ReportExecution withReport(ReportSummary report) { + Utils.checkNotNull(report, "report"); + this.report = report; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportExecution other = (ReportExecution) o; + return + Objects.deepEquals(this.type, other.type) && + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.createdAt, other.createdAt) && + Objects.deepEquals(this.updatedAt, other.updatedAt) && + Objects.deepEquals(this.status, other.status) && + Objects.deepEquals(this.context, other.context) && + Objects.deepEquals(this.report, other.report); + } + + @Override + public int hashCode() { + return Objects.hash( + type, + id, + createdAt, + updatedAt, + status, + context, + report); + } + + @Override + public String toString() { + return Utils.toString(ReportExecution.class, + "type", type, + "id", id, + "createdAt", createdAt, + "updatedAt", updatedAt, + "status", status, + "context", context, + "report", report); + } + + public final static class Builder { + + private String id; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private ReportExecutionStatus status; + + private ReportExecutionContext context; + + private ReportSummary report; + + private Builder() { + // force use of static builder() method + } + + /** + * The unique ID for the report execution. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The date this report execution was created at. + */ + public Builder createdAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date this report execution was last updated. + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + public Builder status(ReportExecutionStatus status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + public Builder context(ReportExecutionContext context) { + Utils.checkNotNull(context, "context"); + this.context = context; + return this; + } + + public Builder report(ReportSummary report) { + Utils.checkNotNull(report, "report"); + this.report = report; + return this; + } + + public ReportExecution build() { + return new ReportExecution( + id, + createdAt, + updatedAt, + status, + context, + report); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Type = + new LazySingletonValue<>( + "type", + "\"report-execution\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionContext.java b/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionContext.java new file mode 100644 index 00000000..8731e7e7 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionContext.java @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.time.OffsetDateTime; +import java.util.Objects; + +public class ReportExecutionContext { + + /** + * The reference timestamp for the report execution context. + */ + @JsonProperty("reference_timestamp") + private OffsetDateTime referenceTimestamp; + + /** + * The reference timezone for the report execution context. + */ + @JsonProperty("reference_timezone") + private String referenceTimezone; + + @JsonCreator + public ReportExecutionContext( + @JsonProperty("reference_timestamp") OffsetDateTime referenceTimestamp, + @JsonProperty("reference_timezone") String referenceTimezone) { + Utils.checkNotNull(referenceTimestamp, "referenceTimestamp"); + Utils.checkNotNull(referenceTimezone, "referenceTimezone"); + this.referenceTimestamp = referenceTimestamp; + this.referenceTimezone = referenceTimezone; + } + + /** + * The reference timestamp for the report execution context. + */ + @JsonIgnore + public OffsetDateTime referenceTimestamp() { + return referenceTimestamp; + } + + /** + * The reference timezone for the report execution context. + */ + @JsonIgnore + public String referenceTimezone() { + return referenceTimezone; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The reference timestamp for the report execution context. + */ + public ReportExecutionContext withReferenceTimestamp(OffsetDateTime referenceTimestamp) { + Utils.checkNotNull(referenceTimestamp, "referenceTimestamp"); + this.referenceTimestamp = referenceTimestamp; + return this; + } + + /** + * The reference timezone for the report execution context. + */ + public ReportExecutionContext withReferenceTimezone(String referenceTimezone) { + Utils.checkNotNull(referenceTimezone, "referenceTimezone"); + this.referenceTimezone = referenceTimezone; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportExecutionContext other = (ReportExecutionContext) o; + return + Objects.deepEquals(this.referenceTimestamp, other.referenceTimestamp) && + Objects.deepEquals(this.referenceTimezone, other.referenceTimezone); + } + + @Override + public int hashCode() { + return Objects.hash( + referenceTimestamp, + referenceTimezone); + } + + @Override + public String toString() { + return Utils.toString(ReportExecutionContext.class, + "referenceTimestamp", referenceTimestamp, + "referenceTimezone", referenceTimezone); + } + + public final static class Builder { + + private OffsetDateTime referenceTimestamp; + + private String referenceTimezone; + + private Builder() { + // force use of static builder() method + } + + /** + * The reference timestamp for the report execution context. + */ + public Builder referenceTimestamp(OffsetDateTime referenceTimestamp) { + Utils.checkNotNull(referenceTimestamp, "referenceTimestamp"); + this.referenceTimestamp = referenceTimestamp; + return this; + } + + /** + * The reference timezone for the report execution context. + */ + public Builder referenceTimezone(String referenceTimezone) { + Utils.checkNotNull(referenceTimezone, "referenceTimezone"); + this.referenceTimezone = referenceTimezone; + return this; + } + + public ReportExecutionContext build() { + return new ReportExecutionContext( + referenceTimestamp, + referenceTimezone); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionStatus.java b/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionStatus.java new file mode 100644 index 00000000..76311532 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionStatus.java @@ -0,0 +1,191 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.core.JacksonException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + *

Wrapper class for an "open" enum. "Open" enums are those that are expected + * to evolve (particularly with the addition of enum members over time). If an + * open enum is used then the appearance of unexpected enum values (say in a + * response from an updated an API) will not bring about a runtime error thus + * ensuring that non-updated client versions can continue to work without error. + * + *

Note that instances are immutable and are singletons (an internal thread-safe + * cache is maintained to ensure that). As a consequence instances created with the + * same value will satisfy reference equality (via {@code ==}). + * + *

This class is intended to emulate an enum (in terms of common usage and with + * reference equality) but with the ability to carry unknown values. Unfortunately + * Java does not permit the use of an instance in a switch expression but you can + * use the {@code asEnum()} method (after dealing with the `Optional` appropriately). + * + */ +@JsonDeserialize(using = ReportExecutionStatus._Deserializer.class) +@JsonSerialize(using = ReportExecutionStatus._Serializer.class) +public class ReportExecutionStatus { + + public static final ReportExecutionStatus DISPATCHED = new ReportExecutionStatus("dispatched"); + public static final ReportExecutionStatus FAILED = new ReportExecutionStatus("failed"); + public static final ReportExecutionStatus PENDING = new ReportExecutionStatus("pending"); + public static final ReportExecutionStatus PROCESSING = new ReportExecutionStatus("processing"); + public static final ReportExecutionStatus SUCCEEDED = new ReportExecutionStatus("succeeded"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private ReportExecutionStatus(String value) { + this.value = value; + } + + /** + * Returns a ReportExecutionStatus with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as ReportExecutionStatus + */ + public static ReportExecutionStatus of(String value) { + synchronized (ReportExecutionStatus.class) { + return values.computeIfAbsent(value, v -> new ReportExecutionStatus(v)); + } + } + + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ReportExecutionStatus other = (ReportExecutionStatus) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "ReportExecutionStatus [value=" + value + "]"; + } + + // return an array just like an enum + public static ReportExecutionStatus[] values() { + synchronized (ReportExecutionStatus.class) { + return values.values().toArray(new ReportExecutionStatus[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("dispatched", DISPATCHED); + map.put("failed", FAILED); + map.put("pending", PENDING); + map.put("processing", PROCESSING); + map.put("succeeded", SUCCEEDED); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("dispatched", ReportExecutionStatusEnum.DISPATCHED); + map.put("failed", ReportExecutionStatusEnum.FAILED); + map.put("pending", ReportExecutionStatusEnum.PENDING); + map.put("processing", ReportExecutionStatusEnum.PROCESSING); + map.put("succeeded", ReportExecutionStatusEnum.SUCCEEDED); + return map; + } + + @SuppressWarnings("serial") + public static final class _Serializer extends StdSerializer { + + protected _Serializer() { + super(ReportExecutionStatus.class); + } + + @Override + public void serialize(ReportExecutionStatus value, JsonGenerator g, SerializerProvider provider) + throws IOException, JsonProcessingException { + g.writeObject(value.value); + } + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends StdDeserializer { + + protected _Deserializer() { + super(ReportExecutionStatus.class); + } + + @Override + public ReportExecutionStatus deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException, JacksonException { + String v = p.readValueAs(new TypeReference() {}); + // use the factory method to ensure we get singletons + return ReportExecutionStatus.of(v); + } + } + + public enum ReportExecutionStatusEnum { + + DISPATCHED("dispatched"), + FAILED("failed"), + PENDING("pending"), + PROCESSING("processing"), + SUCCEEDED("succeeded"),; + + private final String value; + + private ReportExecutionStatusEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} + diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionSummary.java b/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionSummary.java new file mode 100644 index 00000000..76f30cb1 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionSummary.java @@ -0,0 +1,269 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.time.OffsetDateTime; +import java.util.Objects; +import java.util.Optional; + +public class ReportExecutionSummary { + + /** + * Always `report-execution`. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("type") + private Optional type; + + /** + * The unique ID for the report execution. + */ + @JsonProperty("id") + private String id; + + /** + * The date this report execution was created at. + */ + @JsonProperty("created_at") + private OffsetDateTime createdAt; + + /** + * The date this report execution was last updated. + */ + @JsonProperty("updated_at") + private OffsetDateTime updatedAt; + + @JsonProperty("status") + private ReportExecutionStatus status; + + @JsonProperty("context") + private ReportExecutionContext context; + + @JsonCreator + public ReportExecutionSummary( + @JsonProperty("id") String id, + @JsonProperty("created_at") OffsetDateTime createdAt, + @JsonProperty("updated_at") OffsetDateTime updatedAt, + @JsonProperty("status") ReportExecutionStatus status, + @JsonProperty("context") ReportExecutionContext context) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(createdAt, "createdAt"); + Utils.checkNotNull(updatedAt, "updatedAt"); + Utils.checkNotNull(status, "status"); + Utils.checkNotNull(context, "context"); + this.type = Builder._SINGLETON_VALUE_Type.value(); + this.id = id; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.status = status; + this.context = context; + } + + /** + * Always `report-execution`. + */ + @JsonIgnore + public Optional type() { + return type; + } + + /** + * The unique ID for the report execution. + */ + @JsonIgnore + public String id() { + return id; + } + + /** + * The date this report execution was created at. + */ + @JsonIgnore + public OffsetDateTime createdAt() { + return createdAt; + } + + /** + * The date this report execution was last updated. + */ + @JsonIgnore + public OffsetDateTime updatedAt() { + return updatedAt; + } + + @JsonIgnore + public ReportExecutionStatus status() { + return status; + } + + @JsonIgnore + public ReportExecutionContext context() { + return context; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The unique ID for the report execution. + */ + public ReportExecutionSummary withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The date this report execution was created at. + */ + public ReportExecutionSummary withCreatedAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date this report execution was last updated. + */ + public ReportExecutionSummary withUpdatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + public ReportExecutionSummary withStatus(ReportExecutionStatus status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + public ReportExecutionSummary withContext(ReportExecutionContext context) { + Utils.checkNotNull(context, "context"); + this.context = context; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportExecutionSummary other = (ReportExecutionSummary) o; + return + Objects.deepEquals(this.type, other.type) && + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.createdAt, other.createdAt) && + Objects.deepEquals(this.updatedAt, other.updatedAt) && + Objects.deepEquals(this.status, other.status) && + Objects.deepEquals(this.context, other.context); + } + + @Override + public int hashCode() { + return Objects.hash( + type, + id, + createdAt, + updatedAt, + status, + context); + } + + @Override + public String toString() { + return Utils.toString(ReportExecutionSummary.class, + "type", type, + "id", id, + "createdAt", createdAt, + "updatedAt", updatedAt, + "status", status, + "context", context); + } + + public final static class Builder { + + private String id; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private ReportExecutionStatus status; + + private ReportExecutionContext context; + + private Builder() { + // force use of static builder() method + } + + /** + * The unique ID for the report execution. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The date this report execution was created at. + */ + public Builder createdAt(OffsetDateTime createdAt) { + Utils.checkNotNull(createdAt, "createdAt"); + this.createdAt = createdAt; + return this; + } + + /** + * The date this report execution was last updated. + */ + public Builder updatedAt(OffsetDateTime updatedAt) { + Utils.checkNotNull(updatedAt, "updatedAt"); + this.updatedAt = updatedAt; + return this; + } + + public Builder status(ReportExecutionStatus status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + public Builder context(ReportExecutionContext context) { + Utils.checkNotNull(context, "context"); + this.context = context; + return this; + } + + public ReportExecutionSummary build() { + return new ReportExecutionSummary( + id, + createdAt, + updatedAt, + status, + context); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Type = + new LazySingletonValue<>( + "type", + "\"report-execution\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionUrl.java b/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionUrl.java new file mode 100644 index 00000000..5e089e9a --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportExecutionUrl.java @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.time.OffsetDateTime; +import java.util.Objects; + +public class ReportExecutionUrl { + + /** + * A signed URL to download the report execution file. + */ + @JsonProperty("url") + private String url; + + /** + * The date and time when the download URL expires. + */ + @JsonProperty("expires_at") + private OffsetDateTime expiresAt; + + @JsonCreator + public ReportExecutionUrl( + @JsonProperty("url") String url, + @JsonProperty("expires_at") OffsetDateTime expiresAt) { + Utils.checkNotNull(url, "url"); + Utils.checkNotNull(expiresAt, "expiresAt"); + this.url = url; + this.expiresAt = expiresAt; + } + + /** + * A signed URL to download the report execution file. + */ + @JsonIgnore + public String url() { + return url; + } + + /** + * The date and time when the download URL expires. + */ + @JsonIgnore + public OffsetDateTime expiresAt() { + return expiresAt; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * A signed URL to download the report execution file. + */ + public ReportExecutionUrl withUrl(String url) { + Utils.checkNotNull(url, "url"); + this.url = url; + return this; + } + + /** + * The date and time when the download URL expires. + */ + public ReportExecutionUrl withExpiresAt(OffsetDateTime expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = expiresAt; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportExecutionUrl other = (ReportExecutionUrl) o; + return + Objects.deepEquals(this.url, other.url) && + Objects.deepEquals(this.expiresAt, other.expiresAt); + } + + @Override + public int hashCode() { + return Objects.hash( + url, + expiresAt); + } + + @Override + public String toString() { + return Utils.toString(ReportExecutionUrl.class, + "url", url, + "expiresAt", expiresAt); + } + + public final static class Builder { + + private String url; + + private OffsetDateTime expiresAt; + + private Builder() { + // force use of static builder() method + } + + /** + * A signed URL to download the report execution file. + */ + public Builder url(String url) { + Utils.checkNotNull(url, "url"); + this.url = url; + return this; + } + + /** + * The date and time when the download URL expires. + */ + public Builder expiresAt(OffsetDateTime expiresAt) { + Utils.checkNotNull(expiresAt, "expiresAt"); + this.expiresAt = expiresAt; + return this; + } + + public ReportExecutionUrl build() { + return new ReportExecutionUrl( + url, + expiresAt); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportSchedule.java b/src/main/java/com/gr4vy/sdk/models/components/ReportSchedule.java new file mode 100644 index 00000000..ae428f17 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportSchedule.java @@ -0,0 +1,187 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.core.JacksonException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + *

Wrapper class for an "open" enum. "Open" enums are those that are expected + * to evolve (particularly with the addition of enum members over time). If an + * open enum is used then the appearance of unexpected enum values (say in a + * response from an updated an API) will not bring about a runtime error thus + * ensuring that non-updated client versions can continue to work without error. + * + *

Note that instances are immutable and are singletons (an internal thread-safe + * cache is maintained to ensure that). As a consequence instances created with the + * same value will satisfy reference equality (via {@code ==}). + * + *

This class is intended to emulate an enum (in terms of common usage and with + * reference equality) but with the ability to carry unknown values. Unfortunately + * Java does not permit the use of an instance in a switch expression but you can + * use the {@code asEnum()} method (after dealing with the `Optional` appropriately). + * + */ +@JsonDeserialize(using = ReportSchedule._Deserializer.class) +@JsonSerialize(using = ReportSchedule._Serializer.class) +public class ReportSchedule { + + public static final ReportSchedule DAILY = new ReportSchedule("daily"); + public static final ReportSchedule MONTHLY = new ReportSchedule("monthly"); + public static final ReportSchedule ONCE = new ReportSchedule("once"); + public static final ReportSchedule WEEKLY = new ReportSchedule("weekly"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private ReportSchedule(String value) { + this.value = value; + } + + /** + * Returns a ReportSchedule with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as ReportSchedule + */ + public static ReportSchedule of(String value) { + synchronized (ReportSchedule.class) { + return values.computeIfAbsent(value, v -> new ReportSchedule(v)); + } + } + + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ReportSchedule other = (ReportSchedule) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "ReportSchedule [value=" + value + "]"; + } + + // return an array just like an enum + public static ReportSchedule[] values() { + synchronized (ReportSchedule.class) { + return values.values().toArray(new ReportSchedule[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("daily", DAILY); + map.put("monthly", MONTHLY); + map.put("once", ONCE); + map.put("weekly", WEEKLY); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("daily", ReportScheduleEnum.DAILY); + map.put("monthly", ReportScheduleEnum.MONTHLY); + map.put("once", ReportScheduleEnum.ONCE); + map.put("weekly", ReportScheduleEnum.WEEKLY); + return map; + } + + @SuppressWarnings("serial") + public static final class _Serializer extends StdSerializer { + + protected _Serializer() { + super(ReportSchedule.class); + } + + @Override + public void serialize(ReportSchedule value, JsonGenerator g, SerializerProvider provider) + throws IOException, JsonProcessingException { + g.writeObject(value.value); + } + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends StdDeserializer { + + protected _Deserializer() { + super(ReportSchedule.class); + } + + @Override + public ReportSchedule deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException, JacksonException { + String v = p.readValueAs(new TypeReference() {}); + // use the factory method to ensure we get singletons + return ReportSchedule.of(v); + } + } + + public enum ReportScheduleEnum { + + DAILY("daily"), + MONTHLY("monthly"), + ONCE("once"), + WEEKLY("weekly"),; + + private final String value; + + private ReportScheduleEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} + diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportSpec.java b/src/main/java/com/gr4vy/sdk/models/components/ReportSpec.java new file mode 100644 index 00000000..d4ad3621 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportSpec.java @@ -0,0 +1,129 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; + +public class ReportSpec { + + @JsonProperty("model") + private ReportSpecModel model; + + /** + * The parameters for the report model. + */ + @JsonProperty("params") + private Map params; + + @JsonCreator + public ReportSpec( + @JsonProperty("model") ReportSpecModel model, + @JsonProperty("params") Map params) { + Utils.checkNotNull(model, "model"); + params = Utils.emptyMapIfNull(params); + this.model = model; + this.params = params; + } + + @JsonIgnore + public ReportSpecModel model() { + return model; + } + + /** + * The parameters for the report model. + */ + @JsonIgnore + public Map params() { + return params; + } + + public final static Builder builder() { + return new Builder(); + } + + public ReportSpec withModel(ReportSpecModel model) { + Utils.checkNotNull(model, "model"); + this.model = model; + return this; + } + + /** + * The parameters for the report model. + */ + public ReportSpec withParams(Map params) { + Utils.checkNotNull(params, "params"); + this.params = params; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportSpec other = (ReportSpec) o; + return + Objects.deepEquals(this.model, other.model) && + Objects.deepEquals(this.params, other.params); + } + + @Override + public int hashCode() { + return Objects.hash( + model, + params); + } + + @Override + public String toString() { + return Utils.toString(ReportSpec.class, + "model", model, + "params", params); + } + + public final static class Builder { + + private ReportSpecModel model; + + private Map params; + + private Builder() { + // force use of static builder() method + } + + public Builder model(ReportSpecModel model) { + Utils.checkNotNull(model, "model"); + this.model = model; + return this; + } + + /** + * The parameters for the report model. + */ + public Builder params(Map params) { + Utils.checkNotNull(params, "params"); + this.params = params; + return this; + } + + public ReportSpec build() { + return new ReportSpec( + model, + params); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportSpecModel.java b/src/main/java/com/gr4vy/sdk/models/components/ReportSpecModel.java new file mode 100644 index 00000000..d5020a55 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportSpecModel.java @@ -0,0 +1,183 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.core.JacksonException; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + *

Wrapper class for an "open" enum. "Open" enums are those that are expected + * to evolve (particularly with the addition of enum members over time). If an + * open enum is used then the appearance of unexpected enum values (say in a + * response from an updated an API) will not bring about a runtime error thus + * ensuring that non-updated client versions can continue to work without error. + * + *

Note that instances are immutable and are singletons (an internal thread-safe + * cache is maintained to ensure that). As a consequence instances created with the + * same value will satisfy reference equality (via {@code ==}). + * + *

This class is intended to emulate an enum (in terms of common usage and with + * reference equality) but with the ability to carry unknown values. Unfortunately + * Java does not permit the use of an instance in a switch expression but you can + * use the {@code asEnum()} method (after dealing with the `Optional` appropriately). + * + */ +@JsonDeserialize(using = ReportSpecModel._Deserializer.class) +@JsonSerialize(using = ReportSpecModel._Serializer.class) +public class ReportSpecModel { + + public static final ReportSpecModel TRANSACTIONS = new ReportSpecModel("transactions"); + public static final ReportSpecModel TRANSACTION_RETRIES = new ReportSpecModel("transaction_retries"); + public static final ReportSpecModel DETAILED_SETTLEMENT = new ReportSpecModel("detailed_settlement"); + + // This map will grow whenever a Color gets created with a new + // unrecognized value (a potential memory leak if the user is not + // careful). Keep this field lower case to avoid clashing with + // generated member names which will always be upper cased (Java + // convention) + private static final Map values = createValuesMap(); + private static final Map enums = createEnumsMap(); + + private final String value; + + private ReportSpecModel(String value) { + this.value = value; + } + + /** + * Returns a ReportSpecModel with the given value. For a specific value the + * returned object will always be a singleton so reference equality + * is satisfied when the values are the same. + * + * @param value value to be wrapped as ReportSpecModel + */ + public static ReportSpecModel of(String value) { + synchronized (ReportSpecModel.class) { + return values.computeIfAbsent(value, v -> new ReportSpecModel(v)); + } + } + + public String value() { + return value; + } + + public Optional asEnum() { + return Optional.ofNullable(enums.getOrDefault(value, null)); + } + + public boolean isKnown() { + return asEnum().isPresent(); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public boolean equals(java.lang.Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ReportSpecModel other = (ReportSpecModel) obj; + return Objects.equals(value, other.value); + } + + @Override + public String toString() { + return "ReportSpecModel [value=" + value + "]"; + } + + // return an array just like an enum + public static ReportSpecModel[] values() { + synchronized (ReportSpecModel.class) { + return values.values().toArray(new ReportSpecModel[] {}); + } + } + + private static final Map createValuesMap() { + Map map = new LinkedHashMap<>(); + map.put("transactions", TRANSACTIONS); + map.put("transaction_retries", TRANSACTION_RETRIES); + map.put("detailed_settlement", DETAILED_SETTLEMENT); + return map; + } + + private static final Map createEnumsMap() { + Map map = new HashMap<>(); + map.put("transactions", ReportSpecModelEnum.TRANSACTIONS); + map.put("transaction_retries", ReportSpecModelEnum.TRANSACTION_RETRIES); + map.put("detailed_settlement", ReportSpecModelEnum.DETAILED_SETTLEMENT); + return map; + } + + @SuppressWarnings("serial") + public static final class _Serializer extends StdSerializer { + + protected _Serializer() { + super(ReportSpecModel.class); + } + + @Override + public void serialize(ReportSpecModel value, JsonGenerator g, SerializerProvider provider) + throws IOException, JsonProcessingException { + g.writeObject(value.value); + } + } + + @SuppressWarnings("serial") + public static final class _Deserializer extends StdDeserializer { + + protected _Deserializer() { + super(ReportSpecModel.class); + } + + @Override + public ReportSpecModel deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException, JacksonException { + String v = p.readValueAs(new TypeReference() {}); + // use the factory method to ensure we get singletons + return ReportSpecModel.of(v); + } + } + + public enum ReportSpecModelEnum { + + TRANSACTIONS("transactions"), + TRANSACTION_RETRIES("transaction_retries"), + DETAILED_SETTLEMENT("detailed_settlement"),; + + private final String value; + + private ReportSpecModelEnum(String value) { + this.value = value; + } + + public String value() { + return value; + } + } +} + diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportSummary.java b/src/main/java/com/gr4vy/sdk/models/components/ReportSummary.java new file mode 100644 index 00000000..1a07dcd8 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportSummary.java @@ -0,0 +1,400 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ReportSummary { + + /** + * Always `report`. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("type") + private Optional type; + + /** + * The unique ID for the report. + */ + @JsonProperty("id") + private String id; + + /** + * The merchant account ID this report belongs to. + */ + @JsonProperty("merchant_account_id") + private String merchantAccountId; + + /** + * The name of the report. + */ + @JsonProperty("name") + private String name; + + /** + * The ID of the user who created the report. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("creator_id") + private JsonNullable creatorId; + + /** + * The display name of the report creator. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("creator_display_name") + private JsonNullable creatorDisplayName; + + /** + * The type of the report creator. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("creator_type") + private JsonNullable creatorType; + + @JsonCreator + public ReportSummary( + @JsonProperty("id") String id, + @JsonProperty("merchant_account_id") String merchantAccountId, + @JsonProperty("name") String name, + @JsonProperty("creator_id") JsonNullable creatorId, + @JsonProperty("creator_display_name") JsonNullable creatorDisplayName, + @JsonProperty("creator_type") JsonNullable creatorType) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(creatorId, "creatorId"); + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + Utils.checkNotNull(creatorType, "creatorType"); + this.type = Builder._SINGLETON_VALUE_Type.value(); + this.id = id; + this.merchantAccountId = merchantAccountId; + this.name = name; + this.creatorId = creatorId; + this.creatorDisplayName = creatorDisplayName; + this.creatorType = creatorType; + } + + public ReportSummary( + String id, + String merchantAccountId, + String name) { + this(id, merchantAccountId, name, JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * Always `report`. + */ + @JsonIgnore + public Optional type() { + return type; + } + + /** + * The unique ID for the report. + */ + @JsonIgnore + public String id() { + return id; + } + + /** + * The merchant account ID this report belongs to. + */ + @JsonIgnore + public String merchantAccountId() { + return merchantAccountId; + } + + /** + * The name of the report. + */ + @JsonIgnore + public String name() { + return name; + } + + /** + * The ID of the user who created the report. + */ + @JsonIgnore + public JsonNullable creatorId() { + return creatorId; + } + + /** + * The display name of the report creator. + */ + @JsonIgnore + public JsonNullable creatorDisplayName() { + return creatorDisplayName; + } + + /** + * The type of the report creator. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable creatorType() { + return (JsonNullable) creatorType; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The unique ID for the report. + */ + public ReportSummary withId(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The merchant account ID this report belongs to. + */ + public ReportSummary withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + /** + * The name of the report. + */ + public ReportSummary withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * The ID of the user who created the report. + */ + public ReportSummary withCreatorId(String creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = JsonNullable.of(creatorId); + return this; + } + + /** + * The ID of the user who created the report. + */ + public ReportSummary withCreatorId(JsonNullable creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = creatorId; + return this; + } + + /** + * The display name of the report creator. + */ + public ReportSummary withCreatorDisplayName(String creatorDisplayName) { + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + this.creatorDisplayName = JsonNullable.of(creatorDisplayName); + return this; + } + + /** + * The display name of the report creator. + */ + public ReportSummary withCreatorDisplayName(JsonNullable creatorDisplayName) { + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + this.creatorDisplayName = creatorDisplayName; + return this; + } + + /** + * The type of the report creator. + */ + public ReportSummary withCreatorType(ReportCreatorType creatorType) { + Utils.checkNotNull(creatorType, "creatorType"); + this.creatorType = JsonNullable.of(creatorType); + return this; + } + + /** + * The type of the report creator. + */ + public ReportSummary withCreatorType(JsonNullable creatorType) { + Utils.checkNotNull(creatorType, "creatorType"); + this.creatorType = creatorType; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportSummary other = (ReportSummary) o; + return + Objects.deepEquals(this.type, other.type) && + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId) && + Objects.deepEquals(this.name, other.name) && + Objects.deepEquals(this.creatorId, other.creatorId) && + Objects.deepEquals(this.creatorDisplayName, other.creatorDisplayName) && + Objects.deepEquals(this.creatorType, other.creatorType); + } + + @Override + public int hashCode() { + return Objects.hash( + type, + id, + merchantAccountId, + name, + creatorId, + creatorDisplayName, + creatorType); + } + + @Override + public String toString() { + return Utils.toString(ReportSummary.class, + "type", type, + "id", id, + "merchantAccountId", merchantAccountId, + "name", name, + "creatorId", creatorId, + "creatorDisplayName", creatorDisplayName, + "creatorType", creatorType); + } + + public final static class Builder { + + private String id; + + private String merchantAccountId; + + private String name; + + private JsonNullable creatorId = JsonNullable.undefined(); + + private JsonNullable creatorDisplayName = JsonNullable.undefined(); + + private JsonNullable creatorType = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The unique ID for the report. + */ + public Builder id(String id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * The merchant account ID this report belongs to. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + /** + * The name of the report. + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * The ID of the user who created the report. + */ + public Builder creatorId(String creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = JsonNullable.of(creatorId); + return this; + } + + /** + * The ID of the user who created the report. + */ + public Builder creatorId(JsonNullable creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = creatorId; + return this; + } + + /** + * The display name of the report creator. + */ + public Builder creatorDisplayName(String creatorDisplayName) { + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + this.creatorDisplayName = JsonNullable.of(creatorDisplayName); + return this; + } + + /** + * The display name of the report creator. + */ + public Builder creatorDisplayName(JsonNullable creatorDisplayName) { + Utils.checkNotNull(creatorDisplayName, "creatorDisplayName"); + this.creatorDisplayName = creatorDisplayName; + return this; + } + + /** + * The type of the report creator. + */ + public Builder creatorType(ReportCreatorType creatorType) { + Utils.checkNotNull(creatorType, "creatorType"); + this.creatorType = JsonNullable.of(creatorType); + return this; + } + + /** + * The type of the report creator. + */ + public Builder creatorType(JsonNullable creatorType) { + Utils.checkNotNull(creatorType, "creatorType"); + this.creatorType = creatorType; + return this; + } + + public ReportSummary build() { + return new ReportSummary( + id, + merchantAccountId, + name, + creatorId, + creatorDisplayName, + creatorType); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Type = + new LazySingletonValue<>( + "type", + "\"report\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/ReportUpdate.java b/src/main/java/com/gr4vy/sdk/models/components/ReportUpdate.java new file mode 100644 index 00000000..b5eee488 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/ReportUpdate.java @@ -0,0 +1,245 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Boolean; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ReportUpdate { + + /** + * The name of the report. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("name") + private JsonNullable name; + + /** + * A description of the report. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("description") + private JsonNullable description; + + /** + * Whether the report schedule is enabled. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("schedule_enabled") + private JsonNullable scheduleEnabled; + + @JsonCreator + public ReportUpdate( + @JsonProperty("name") JsonNullable name, + @JsonProperty("description") JsonNullable description, + @JsonProperty("schedule_enabled") JsonNullable scheduleEnabled) { + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(description, "description"); + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.name = name; + this.description = description; + this.scheduleEnabled = scheduleEnabled; + } + + public ReportUpdate() { + this(JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * The name of the report. + */ + @JsonIgnore + public JsonNullable name() { + return name; + } + + /** + * A description of the report. + */ + @JsonIgnore + public JsonNullable description() { + return description; + } + + /** + * Whether the report schedule is enabled. + */ + @JsonIgnore + public JsonNullable scheduleEnabled() { + return scheduleEnabled; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The name of the report. + */ + public ReportUpdate withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = JsonNullable.of(name); + return this; + } + + /** + * The name of the report. + */ + public ReportUpdate withName(JsonNullable name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * A description of the report. + */ + public ReportUpdate withDescription(String description) { + Utils.checkNotNull(description, "description"); + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the report. + */ + public ReportUpdate withDescription(JsonNullable description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + /** + * Whether the report schedule is enabled. + */ + public ReportUpdate withScheduleEnabled(boolean scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = JsonNullable.of(scheduleEnabled); + return this; + } + + /** + * Whether the report schedule is enabled. + */ + public ReportUpdate withScheduleEnabled(JsonNullable scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = scheduleEnabled; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportUpdate other = (ReportUpdate) o; + return + Objects.deepEquals(this.name, other.name) && + Objects.deepEquals(this.description, other.description) && + Objects.deepEquals(this.scheduleEnabled, other.scheduleEnabled); + } + + @Override + public int hashCode() { + return Objects.hash( + name, + description, + scheduleEnabled); + } + + @Override + public String toString() { + return Utils.toString(ReportUpdate.class, + "name", name, + "description", description, + "scheduleEnabled", scheduleEnabled); + } + + public final static class Builder { + + private JsonNullable name = JsonNullable.undefined(); + + private JsonNullable description = JsonNullable.undefined(); + + private JsonNullable scheduleEnabled = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The name of the report. + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = JsonNullable.of(name); + return this; + } + + /** + * The name of the report. + */ + public Builder name(JsonNullable name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * A description of the report. + */ + public Builder description(String description) { + Utils.checkNotNull(description, "description"); + this.description = JsonNullable.of(description); + return this; + } + + /** + * A description of the report. + */ + public Builder description(JsonNullable description) { + Utils.checkNotNull(description, "description"); + this.description = description; + return this; + } + + /** + * Whether the report schedule is enabled. + */ + public Builder scheduleEnabled(boolean scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = JsonNullable.of(scheduleEnabled); + return this; + } + + /** + * Whether the report schedule is enabled. + */ + public Builder scheduleEnabled(JsonNullable scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = scheduleEnabled; + return this; + } + + public ReportUpdate build() { + return new ReportUpdate( + name, + description, + scheduleEnabled); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/Spec.java b/src/main/java/com/gr4vy/sdk/models/components/Spec.java new file mode 100644 index 00000000..5c4de692 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/Spec.java @@ -0,0 +1,28 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonSubTypes.Type; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo.As; +import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import java.lang.String; + +/** + * Spec + * + *

The report specification. + */ +@JsonTypeInfo(use = Id.NAME, property = "model", include = As.EXISTING_PROPERTY, visible = true) +@JsonSubTypes({ + @Type(value = TransactionsReportSpec.class, name="transactions"), + @Type(value = TransactionRetriesReportSpec.class, name="transaction_retries"), + @Type(value = DetailedSettlementReportSpec.class, name="detailed_settlement")}) +public interface Spec { + + String model(); + +} + diff --git a/src/main/java/com/gr4vy/sdk/models/components/TransactionRetriesReportSpec.java b/src/main/java/com/gr4vy/sdk/models/components/TransactionRetriesReportSpec.java new file mode 100644 index 00000000..dbc28ac6 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/TransactionRetriesReportSpec.java @@ -0,0 +1,131 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +public class TransactionRetriesReportSpec implements Spec { + + /** + * The report model type. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("model") + private Optional model; + + /** + * The parameters for the transaction retries report model. + */ + @JsonProperty("params") + private Map params; + + @JsonCreator + public TransactionRetriesReportSpec( + @JsonProperty("params") Map params) { + params = Utils.emptyMapIfNull(params); + this.model = Builder._SINGLETON_VALUE_Model.value(); + this.params = params; + } + + /** + * The report model type. + */ + @JsonIgnore + @Override + public String model() { + return Utils.discriminatorToString(model); + } + + /** + * The parameters for the transaction retries report model. + */ + @JsonIgnore + public Map params() { + return params; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The parameters for the transaction retries report model. + */ + public TransactionRetriesReportSpec withParams(Map params) { + Utils.checkNotNull(params, "params"); + this.params = params; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionRetriesReportSpec other = (TransactionRetriesReportSpec) o; + return + Objects.deepEquals(this.model, other.model) && + Objects.deepEquals(this.params, other.params); + } + + @Override + public int hashCode() { + return Objects.hash( + model, + params); + } + + @Override + public String toString() { + return Utils.toString(TransactionRetriesReportSpec.class, + "model", model, + "params", params); + } + + public final static class Builder { + + private Map params; + + private Builder() { + // force use of static builder() method + } + + /** + * The parameters for the transaction retries report model. + */ + public Builder params(Map params) { + Utils.checkNotNull(params, "params"); + this.params = params; + return this; + } + + public TransactionRetriesReportSpec build() { + return new TransactionRetriesReportSpec( + params); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Model = + new LazySingletonValue<>( + "model", + "\"transaction_retries\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/components/TransactionsReportSpec.java b/src/main/java/com/gr4vy/sdk/models/components/TransactionsReportSpec.java new file mode 100644 index 00000000..9576da37 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/components/TransactionsReportSpec.java @@ -0,0 +1,131 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.components; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Object; +import java.lang.Override; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +public class TransactionsReportSpec implements Spec { + + /** + * The report model type. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("model") + private Optional model; + + /** + * The parameters for the transactions report model. + */ + @JsonProperty("params") + private Map params; + + @JsonCreator + public TransactionsReportSpec( + @JsonProperty("params") Map params) { + params = Utils.emptyMapIfNull(params); + this.model = Builder._SINGLETON_VALUE_Model.value(); + this.params = params; + } + + /** + * The report model type. + */ + @JsonIgnore + @Override + public String model() { + return Utils.discriminatorToString(model); + } + + /** + * The parameters for the transactions report model. + */ + @JsonIgnore + public Map params() { + return params; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The parameters for the transactions report model. + */ + public TransactionsReportSpec withParams(Map params) { + Utils.checkNotNull(params, "params"); + this.params = params; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransactionsReportSpec other = (TransactionsReportSpec) o; + return + Objects.deepEquals(this.model, other.model) && + Objects.deepEquals(this.params, other.params); + } + + @Override + public int hashCode() { + return Objects.hash( + model, + params); + } + + @Override + public String toString() { + return Utils.toString(TransactionsReportSpec.class, + "model", model, + "params", params); + } + + public final static class Builder { + + private Map params; + + private Builder() { + // force use of static builder() method + } + + /** + * The parameters for the transactions report model. + */ + public Builder params(Map params) { + Utils.checkNotNull(params, "params"); + this.params = params; + return this; + } + + public TransactionsReportSpec build() { + return new TransactionsReportSpec( + params); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Model = + new LazySingletonValue<>( + "model", + "\"transactions\"", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/AddReportRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/AddReportRequest.java new file mode 100644 index 00000000..36a881c9 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/AddReportRequest.java @@ -0,0 +1,152 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.ReportCreate; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class AddReportRequest { + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @SpeakeasyMetadata("request:mediaType=application/json") + private ReportCreate reportCreate; + + @JsonCreator + public AddReportRequest( + JsonNullable merchantAccountId, + ReportCreate reportCreate) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + Utils.checkNotNull(reportCreate, "reportCreate"); + this.merchantAccountId = merchantAccountId; + this.reportCreate = reportCreate; + } + + public AddReportRequest( + ReportCreate reportCreate) { + this(JsonNullable.undefined(), reportCreate); + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + @JsonIgnore + public ReportCreate reportCreate() { + return reportCreate; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The ID of the merchant account to use for this request. + */ + public AddReportRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public AddReportRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public AddReportRequest withReportCreate(ReportCreate reportCreate) { + Utils.checkNotNull(reportCreate, "reportCreate"); + this.reportCreate = reportCreate; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddReportRequest other = (AddReportRequest) o; + return + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId) && + Objects.deepEquals(this.reportCreate, other.reportCreate); + } + + @Override + public int hashCode() { + return Objects.hash( + merchantAccountId, + reportCreate); + } + + @Override + public String toString() { + return Utils.toString(AddReportRequest.class, + "merchantAccountId", merchantAccountId, + "reportCreate", reportCreate); + } + + public final static class Builder { + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private ReportCreate reportCreate; + + private Builder() { + // force use of static builder() method + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public Builder reportCreate(ReportCreate reportCreate) { + Utils.checkNotNull(reportCreate, "reportCreate"); + this.reportCreate = reportCreate; + return this; + } + + public AddReportRequest build() { + return new AddReportRequest( + merchantAccountId, + reportCreate); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/AddReportRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/AddReportRequestBuilder.java new file mode 100644 index 00000000..3f66efae --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/AddReportRequestBuilder.java @@ -0,0 +1,46 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.models.components.ReportCreate; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + +public class AddReportRequestBuilder { + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private ReportCreate reportCreate; + private final SDKMethodInterfaces.MethodCallAddReport sdk; + + public AddReportRequestBuilder(SDKMethodInterfaces.MethodCallAddReport sdk) { + this.sdk = sdk; + } + + public AddReportRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public AddReportRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public AddReportRequestBuilder reportCreate(ReportCreate reportCreate) { + Utils.checkNotNull(reportCreate, "reportCreate"); + this.reportCreate = reportCreate; + return this; + } + + public AddReportResponse call() throws Exception { + + return sdk.create( + merchantAccountId, + reportCreate); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/AddReportResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/AddReportResponse.java new file mode 100644 index 00000000..59e0ffd2 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/AddReportResponse.java @@ -0,0 +1,249 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.Report; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + +public class AddReportResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional report; + + @JsonCreator + public AddReportResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional report) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(report, "report"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.report = report; + } + + public AddReportResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional report() { + return (Optional) report; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public AddReportResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public AddReportResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public AddReportResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public AddReportResponse withReport(Report report) { + Utils.checkNotNull(report, "report"); + this.report = Optional.ofNullable(report); + return this; + } + + /** + * Successful Response + */ + public AddReportResponse withReport(Optional report) { + Utils.checkNotNull(report, "report"); + this.report = report; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddReportResponse other = (AddReportResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.report, other.report); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + report); + } + + @Override + public String toString() { + return Utils.toString(AddReportResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "report", report); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional report = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder report(Report report) { + Utils.checkNotNull(report, "report"); + this.report = Optional.ofNullable(report); + return this; + } + + /** + * Successful Response + */ + public Builder report(Optional report) { + Utils.checkNotNull(report, "report"); + this.report = report; + return this; + } + + public AddReportResponse build() { + return new AddReportResponse( + contentType, + statusCode, + rawResponse, + report); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlRequest.java new file mode 100644 index 00000000..820ea4fd --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlRequest.java @@ -0,0 +1,205 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class CreateReportExecutionUrlRequest { + + /** + * The ID of the report to retrieve a URL for. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=report_id") + private String reportId; + + /** + * The ID of the execution of a report to retrieve a URL for. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=report_execution_id") + private String reportExecutionId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public CreateReportExecutionUrlRequest( + String reportId, + String reportExecutionId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(reportId, "reportId"); + Utils.checkNotNull(reportExecutionId, "reportExecutionId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.reportId = reportId; + this.reportExecutionId = reportExecutionId; + this.merchantAccountId = merchantAccountId; + } + + public CreateReportExecutionUrlRequest( + String reportId, + String reportExecutionId) { + this(reportId, reportExecutionId, JsonNullable.undefined()); + } + + /** + * The ID of the report to retrieve a URL for. + */ + @JsonIgnore + public String reportId() { + return reportId; + } + + /** + * The ID of the execution of a report to retrieve a URL for. + */ + @JsonIgnore + public String reportExecutionId() { + return reportExecutionId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The ID of the report to retrieve a URL for. + */ + public CreateReportExecutionUrlRequest withReportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + /** + * The ID of the execution of a report to retrieve a URL for. + */ + public CreateReportExecutionUrlRequest withReportExecutionId(String reportExecutionId) { + Utils.checkNotNull(reportExecutionId, "reportExecutionId"); + this.reportExecutionId = reportExecutionId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public CreateReportExecutionUrlRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public CreateReportExecutionUrlRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReportExecutionUrlRequest other = (CreateReportExecutionUrlRequest) o; + return + Objects.deepEquals(this.reportId, other.reportId) && + Objects.deepEquals(this.reportExecutionId, other.reportExecutionId) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + reportId, + reportExecutionId, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(CreateReportExecutionUrlRequest.class, + "reportId", reportId, + "reportExecutionId", reportExecutionId, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private String reportId; + + private String reportExecutionId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The ID of the report to retrieve a URL for. + */ + public Builder reportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + /** + * The ID of the execution of a report to retrieve a URL for. + */ + public Builder reportExecutionId(String reportExecutionId) { + Utils.checkNotNull(reportExecutionId, "reportExecutionId"); + this.reportExecutionId = reportExecutionId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public CreateReportExecutionUrlRequest build() { + return new CreateReportExecutionUrlRequest( + reportId, + reportExecutionId, + merchantAccountId); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlRequestBuilder.java new file mode 100644 index 00000000..f9b90ed0 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlRequestBuilder.java @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + +public class CreateReportExecutionUrlRequestBuilder { + + private String reportId; + private String reportExecutionId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private final SDKMethodInterfaces.MethodCallCreateReportExecutionUrl sdk; + + public CreateReportExecutionUrlRequestBuilder(SDKMethodInterfaces.MethodCallCreateReportExecutionUrl sdk) { + this.sdk = sdk; + } + + public CreateReportExecutionUrlRequestBuilder reportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + public CreateReportExecutionUrlRequestBuilder reportExecutionId(String reportExecutionId) { + Utils.checkNotNull(reportExecutionId, "reportExecutionId"); + this.reportExecutionId = reportExecutionId; + return this; + } + + public CreateReportExecutionUrlRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public CreateReportExecutionUrlRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public CreateReportExecutionUrlResponse call() throws Exception { + + return sdk.url( + reportId, + reportExecutionId, + merchantAccountId); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlResponse.java new file mode 100644 index 00000000..a9f7356b --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/CreateReportExecutionUrlResponse.java @@ -0,0 +1,249 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.ReportExecutionUrl; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + +public class CreateReportExecutionUrlResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional reportExecutionUrl; + + @JsonCreator + public CreateReportExecutionUrlResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional reportExecutionUrl) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(reportExecutionUrl, "reportExecutionUrl"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.reportExecutionUrl = reportExecutionUrl; + } + + public CreateReportExecutionUrlResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional reportExecutionUrl() { + return (Optional) reportExecutionUrl; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public CreateReportExecutionUrlResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public CreateReportExecutionUrlResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public CreateReportExecutionUrlResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public CreateReportExecutionUrlResponse withReportExecutionUrl(ReportExecutionUrl reportExecutionUrl) { + Utils.checkNotNull(reportExecutionUrl, "reportExecutionUrl"); + this.reportExecutionUrl = Optional.ofNullable(reportExecutionUrl); + return this; + } + + /** + * Successful Response + */ + public CreateReportExecutionUrlResponse withReportExecutionUrl(Optional reportExecutionUrl) { + Utils.checkNotNull(reportExecutionUrl, "reportExecutionUrl"); + this.reportExecutionUrl = reportExecutionUrl; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateReportExecutionUrlResponse other = (CreateReportExecutionUrlResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.reportExecutionUrl, other.reportExecutionUrl); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + reportExecutionUrl); + } + + @Override + public String toString() { + return Utils.toString(CreateReportExecutionUrlResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "reportExecutionUrl", reportExecutionUrl); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional reportExecutionUrl = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder reportExecutionUrl(ReportExecutionUrl reportExecutionUrl) { + Utils.checkNotNull(reportExecutionUrl, "reportExecutionUrl"); + this.reportExecutionUrl = Optional.ofNullable(reportExecutionUrl); + return this; + } + + /** + * Successful Response + */ + public Builder reportExecutionUrl(Optional reportExecutionUrl) { + Utils.checkNotNull(reportExecutionUrl, "reportExecutionUrl"); + this.reportExecutionUrl = reportExecutionUrl; + return this; + } + + public CreateReportExecutionUrlResponse build() { + return new CreateReportExecutionUrlResponse( + contentType, + statusCode, + rawResponse, + reportExecutionUrl); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionRequest.java new file mode 100644 index 00000000..63b8ac82 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionRequest.java @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class GetReportExecutionRequest { + + /** + * The ID of the execution of a report to retrieve details for. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=report_execution_id") + private String reportExecutionId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public GetReportExecutionRequest( + String reportExecutionId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(reportExecutionId, "reportExecutionId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.reportExecutionId = reportExecutionId; + this.merchantAccountId = merchantAccountId; + } + + public GetReportExecutionRequest( + String reportExecutionId) { + this(reportExecutionId, JsonNullable.undefined()); + } + + /** + * The ID of the execution of a report to retrieve details for. + */ + @JsonIgnore + public String reportExecutionId() { + return reportExecutionId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The ID of the execution of a report to retrieve details for. + */ + public GetReportExecutionRequest withReportExecutionId(String reportExecutionId) { + Utils.checkNotNull(reportExecutionId, "reportExecutionId"); + this.reportExecutionId = reportExecutionId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public GetReportExecutionRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public GetReportExecutionRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetReportExecutionRequest other = (GetReportExecutionRequest) o; + return + Objects.deepEquals(this.reportExecutionId, other.reportExecutionId) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + reportExecutionId, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(GetReportExecutionRequest.class, + "reportExecutionId", reportExecutionId, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private String reportExecutionId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The ID of the execution of a report to retrieve details for. + */ + public Builder reportExecutionId(String reportExecutionId) { + Utils.checkNotNull(reportExecutionId, "reportExecutionId"); + this.reportExecutionId = reportExecutionId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetReportExecutionRequest build() { + return new GetReportExecutionRequest( + reportExecutionId, + merchantAccountId); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionRequestBuilder.java new file mode 100644 index 00000000..6eaef659 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionRequestBuilder.java @@ -0,0 +1,64 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.String; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class GetReportExecutionRequestBuilder { + + private String reportExecutionId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallGetReportExecution sdk; + + public GetReportExecutionRequestBuilder(SDKMethodInterfaces.MethodCallGetReportExecution sdk) { + this.sdk = sdk; + } + + public GetReportExecutionRequestBuilder reportExecutionId(String reportExecutionId) { + Utils.checkNotNull(reportExecutionId, "reportExecutionId"); + this.reportExecutionId = reportExecutionId; + return this; + } + + public GetReportExecutionRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public GetReportExecutionRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetReportExecutionRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public GetReportExecutionRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public GetReportExecutionResponse call() throws Exception { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.get( + reportExecutionId, + merchantAccountId, + options); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionResponse.java new file mode 100644 index 00000000..05c9dd76 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetReportExecutionResponse.java @@ -0,0 +1,249 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.ReportExecution; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + +public class GetReportExecutionResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional reportExecution; + + @JsonCreator + public GetReportExecutionResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional reportExecution) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(reportExecution, "reportExecution"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.reportExecution = reportExecution; + } + + public GetReportExecutionResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional reportExecution() { + return (Optional) reportExecution; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public GetReportExecutionResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetReportExecutionResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetReportExecutionResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public GetReportExecutionResponse withReportExecution(ReportExecution reportExecution) { + Utils.checkNotNull(reportExecution, "reportExecution"); + this.reportExecution = Optional.ofNullable(reportExecution); + return this; + } + + /** + * Successful Response + */ + public GetReportExecutionResponse withReportExecution(Optional reportExecution) { + Utils.checkNotNull(reportExecution, "reportExecution"); + this.reportExecution = reportExecution; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetReportExecutionResponse other = (GetReportExecutionResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.reportExecution, other.reportExecution); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + reportExecution); + } + + @Override + public String toString() { + return Utils.toString(GetReportExecutionResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "reportExecution", reportExecution); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional reportExecution = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder reportExecution(ReportExecution reportExecution) { + Utils.checkNotNull(reportExecution, "reportExecution"); + this.reportExecution = Optional.ofNullable(reportExecution); + return this; + } + + /** + * Successful Response + */ + public Builder reportExecution(Optional reportExecution) { + Utils.checkNotNull(reportExecution, "reportExecution"); + this.reportExecution = reportExecution; + return this; + } + + public GetReportExecutionResponse build() { + return new GetReportExecutionResponse( + contentType, + statusCode, + rawResponse, + reportExecution); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetReportRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/GetReportRequest.java new file mode 100644 index 00000000..8e7cf42b --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetReportRequest.java @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class GetReportRequest { + + /** + * The ID of the report to retrieve details for. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=report_id") + private String reportId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public GetReportRequest( + String reportId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(reportId, "reportId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.reportId = reportId; + this.merchantAccountId = merchantAccountId; + } + + public GetReportRequest( + String reportId) { + this(reportId, JsonNullable.undefined()); + } + + /** + * The ID of the report to retrieve details for. + */ + @JsonIgnore + public String reportId() { + return reportId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The ID of the report to retrieve details for. + */ + public GetReportRequest withReportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public GetReportRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public GetReportRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetReportRequest other = (GetReportRequest) o; + return + Objects.deepEquals(this.reportId, other.reportId) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + reportId, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(GetReportRequest.class, + "reportId", reportId, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private String reportId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The ID of the report to retrieve details for. + */ + public Builder reportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetReportRequest build() { + return new GetReportRequest( + reportId, + merchantAccountId); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetReportRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/GetReportRequestBuilder.java new file mode 100644 index 00000000..306a3f8d --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetReportRequestBuilder.java @@ -0,0 +1,64 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.String; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class GetReportRequestBuilder { + + private String reportId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallGetReport sdk; + + public GetReportRequestBuilder(SDKMethodInterfaces.MethodCallGetReport sdk) { + this.sdk = sdk; + } + + public GetReportRequestBuilder reportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + public GetReportRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public GetReportRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public GetReportRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public GetReportRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public GetReportResponse call() throws Exception { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.get( + reportId, + merchantAccountId, + options); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/GetReportResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/GetReportResponse.java new file mode 100644 index 00000000..9d664c8b --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/GetReportResponse.java @@ -0,0 +1,249 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.Report; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + +public class GetReportResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional report; + + @JsonCreator + public GetReportResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional report) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(report, "report"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.report = report; + } + + public GetReportResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional report() { + return (Optional) report; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public GetReportResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetReportResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetReportResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public GetReportResponse withReport(Report report) { + Utils.checkNotNull(report, "report"); + this.report = Optional.ofNullable(report); + return this; + } + + /** + * Successful Response + */ + public GetReportResponse withReport(Optional report) { + Utils.checkNotNull(report, "report"); + this.report = report; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetReportResponse other = (GetReportResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.report, other.report); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + report); + } + + @Override + public String toString() { + return Utils.toString(GetReportResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "report", report); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional report = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder report(Report report) { + Utils.checkNotNull(report, "report"); + this.report = Optional.ofNullable(report); + return this; + } + + /** + * Successful Response + */ + public Builder report(Optional report) { + Utils.checkNotNull(report, "report"); + this.report = report; + return this; + } + + public GetReportResponse build() { + return new GetReportResponse( + contentType, + statusCode, + rawResponse, + report); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequest.java new file mode 100644 index 00000000..f4ba6709 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequest.java @@ -0,0 +1,553 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.models.components.ReportExecutionStatus; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListAllReportExecutionsRequest { + + /** + * A pointer to the page of results to return. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=cursor") + private JsonNullable cursor; + + /** + * The maximum number of items that are at returned. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=limit") + private Optional limit; + + /** + * Filters the reports by searching their name for (partial) matches. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=report_name") + private JsonNullable reportName; + + /** + * Filters the results to only reports created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=created_at_lte") + private JsonNullable createdAtLte; + + /** + * Filters the results to only reports created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=created_at_gte") + private JsonNullable createdAtGte; + + /** + * Filters the results to only the reports that have a `status` that matches with any of the provided status values. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=status") + private JsonNullable> status; + + /** + * Filters the results to only the reports that were created by the users with these IDs. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=creator_id") + private JsonNullable> creatorId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public ListAllReportExecutionsRequest( + JsonNullable cursor, + Optional limit, + JsonNullable reportName, + JsonNullable createdAtLte, + JsonNullable createdAtGte, + JsonNullable> status, + JsonNullable> creatorId, + JsonNullable merchantAccountId) { + Utils.checkNotNull(cursor, "cursor"); + Utils.checkNotNull(limit, "limit"); + Utils.checkNotNull(reportName, "reportName"); + Utils.checkNotNull(createdAtLte, "createdAtLte"); + Utils.checkNotNull(createdAtGte, "createdAtGte"); + Utils.checkNotNull(status, "status"); + Utils.checkNotNull(creatorId, "creatorId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.cursor = cursor; + this.limit = limit; + this.reportName = reportName; + this.createdAtLte = createdAtLte; + this.createdAtGte = createdAtGte; + this.status = status; + this.creatorId = creatorId; + this.merchantAccountId = merchantAccountId; + } + + public ListAllReportExecutionsRequest() { + this(JsonNullable.undefined(), Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * A pointer to the page of results to return. + */ + @JsonIgnore + public JsonNullable cursor() { + return cursor; + } + + /** + * The maximum number of items that are at returned. + */ + @JsonIgnore + public Optional limit() { + return limit; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + @JsonIgnore + public JsonNullable reportName() { + return reportName; + } + + /** + * Filters the results to only reports created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + @JsonIgnore + public JsonNullable createdAtLte() { + return createdAtLte; + } + + /** + * Filters the results to only reports created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + @JsonIgnore + public JsonNullable createdAtGte() { + return createdAtGte; + } + + /** + * Filters the results to only the reports that have a `status` that matches with any of the provided status values. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable> status() { + return (JsonNullable>) status; + } + + /** + * Filters the results to only the reports that were created by the users with these IDs. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable> creatorId() { + return (JsonNullable>) creatorId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * A pointer to the page of results to return. + */ + public ListAllReportExecutionsRequest withCursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + /** + * A pointer to the page of results to return. + */ + public ListAllReportExecutionsRequest withCursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public ListAllReportExecutionsRequest withLimit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public ListAllReportExecutionsRequest withLimit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + public ListAllReportExecutionsRequest withReportName(String reportName) { + Utils.checkNotNull(reportName, "reportName"); + this.reportName = JsonNullable.of(reportName); + return this; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + public ListAllReportExecutionsRequest withReportName(JsonNullable reportName) { + Utils.checkNotNull(reportName, "reportName"); + this.reportName = reportName; + return this; + } + + /** + * Filters the results to only reports created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + public ListAllReportExecutionsRequest withCreatedAtLte(OffsetDateTime createdAtLte) { + Utils.checkNotNull(createdAtLte, "createdAtLte"); + this.createdAtLte = JsonNullable.of(createdAtLte); + return this; + } + + /** + * Filters the results to only reports created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + public ListAllReportExecutionsRequest withCreatedAtLte(JsonNullable createdAtLte) { + Utils.checkNotNull(createdAtLte, "createdAtLte"); + this.createdAtLte = createdAtLte; + return this; + } + + /** + * Filters the results to only reports created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + public ListAllReportExecutionsRequest withCreatedAtGte(OffsetDateTime createdAtGte) { + Utils.checkNotNull(createdAtGte, "createdAtGte"); + this.createdAtGte = JsonNullable.of(createdAtGte); + return this; + } + + /** + * Filters the results to only reports created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + public ListAllReportExecutionsRequest withCreatedAtGte(JsonNullable createdAtGte) { + Utils.checkNotNull(createdAtGte, "createdAtGte"); + this.createdAtGte = createdAtGte; + return this; + } + + /** + * Filters the results to only the reports that have a `status` that matches with any of the provided status values. + */ + public ListAllReportExecutionsRequest withStatus(List status) { + Utils.checkNotNull(status, "status"); + this.status = JsonNullable.of(status); + return this; + } + + /** + * Filters the results to only the reports that have a `status` that matches with any of the provided status values. + */ + public ListAllReportExecutionsRequest withStatus(JsonNullable> status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + /** + * Filters the results to only the reports that were created by the users with these IDs. + */ + public ListAllReportExecutionsRequest withCreatorId(List creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = JsonNullable.of(creatorId); + return this; + } + + /** + * Filters the results to only the reports that were created by the users with these IDs. + */ + public ListAllReportExecutionsRequest withCreatorId(JsonNullable> creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = creatorId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListAllReportExecutionsRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListAllReportExecutionsRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListAllReportExecutionsRequest other = (ListAllReportExecutionsRequest) o; + return + Objects.deepEquals(this.cursor, other.cursor) && + Objects.deepEquals(this.limit, other.limit) && + Objects.deepEquals(this.reportName, other.reportName) && + Objects.deepEquals(this.createdAtLte, other.createdAtLte) && + Objects.deepEquals(this.createdAtGte, other.createdAtGte) && + Objects.deepEquals(this.status, other.status) && + Objects.deepEquals(this.creatorId, other.creatorId) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + cursor, + limit, + reportName, + createdAtLte, + createdAtGte, + status, + creatorId, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(ListAllReportExecutionsRequest.class, + "cursor", cursor, + "limit", limit, + "reportName", reportName, + "createdAtLte", createdAtLte, + "createdAtGte", createdAtGte, + "status", status, + "creatorId", creatorId, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private JsonNullable cursor = JsonNullable.undefined(); + + private Optional limit; + + private JsonNullable reportName = JsonNullable.undefined(); + + private JsonNullable createdAtLte = JsonNullable.undefined(); + + private JsonNullable createdAtGte = JsonNullable.undefined(); + + private JsonNullable> status = JsonNullable.undefined(); + + private JsonNullable> creatorId = JsonNullable.undefined(); + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * A pointer to the page of results to return. + */ + public Builder cursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + /** + * A pointer to the page of results to return. + */ + public Builder cursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public Builder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public Builder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + public Builder reportName(String reportName) { + Utils.checkNotNull(reportName, "reportName"); + this.reportName = JsonNullable.of(reportName); + return this; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + public Builder reportName(JsonNullable reportName) { + Utils.checkNotNull(reportName, "reportName"); + this.reportName = reportName; + return this; + } + + /** + * Filters the results to only reports created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + public Builder createdAtLte(OffsetDateTime createdAtLte) { + Utils.checkNotNull(createdAtLte, "createdAtLte"); + this.createdAtLte = JsonNullable.of(createdAtLte); + return this; + } + + /** + * Filters the results to only reports created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + public Builder createdAtLte(JsonNullable createdAtLte) { + Utils.checkNotNull(createdAtLte, "createdAtLte"); + this.createdAtLte = createdAtLte; + return this; + } + + /** + * Filters the results to only reports created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + public Builder createdAtGte(OffsetDateTime createdAtGte) { + Utils.checkNotNull(createdAtGte, "createdAtGte"); + this.createdAtGte = JsonNullable.of(createdAtGte); + return this; + } + + /** + * Filters the results to only reports created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. + */ + public Builder createdAtGte(JsonNullable createdAtGte) { + Utils.checkNotNull(createdAtGte, "createdAtGte"); + this.createdAtGte = createdAtGte; + return this; + } + + /** + * Filters the results to only the reports that have a `status` that matches with any of the provided status values. + */ + public Builder status(List status) { + Utils.checkNotNull(status, "status"); + this.status = JsonNullable.of(status); + return this; + } + + /** + * Filters the results to only the reports that have a `status` that matches with any of the provided status values. + */ + public Builder status(JsonNullable> status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + /** + * Filters the results to only the reports that were created by the users with these IDs. + */ + public Builder creatorId(List creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = JsonNullable.of(creatorId); + return this; + } + + /** + * Filters the results to only the reports that were created by the users with these IDs. + */ + public Builder creatorId(JsonNullable> creatorId) { + Utils.checkNotNull(creatorId, "creatorId"); + this.creatorId = creatorId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListAllReportExecutionsRequest build() { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } + return new ListAllReportExecutionsRequest( + cursor, + limit, + reportName, + createdAtLte, + createdAtGte, + status, + creatorId, + merchantAccountId); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequestBuilder.java new file mode 100644 index 00000000..87641236 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsRequestBuilder.java @@ -0,0 +1,48 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.util.Optional; + +public class ListAllReportExecutionsRequestBuilder { + + private ListAllReportExecutionsRequest request; + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallListAllReportExecutions sdk; + + public ListAllReportExecutionsRequestBuilder(SDKMethodInterfaces.MethodCallListAllReportExecutions sdk) { + this.sdk = sdk; + } + + public ListAllReportExecutionsRequestBuilder request(ListAllReportExecutionsRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public ListAllReportExecutionsRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public ListAllReportExecutionsRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public ListAllReportExecutionsResponse call() throws Exception { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.list( + request, + options); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsResponse.java new file mode 100644 index 00000000..a7b9588b --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListAllReportExecutionsResponse.java @@ -0,0 +1,249 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.CollectionReportExecution; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + +public class ListAllReportExecutionsResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional collectionReportExecution; + + @JsonCreator + public ListAllReportExecutionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional collectionReportExecution) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.collectionReportExecution = collectionReportExecution; + } + + public ListAllReportExecutionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional collectionReportExecution() { + return (Optional) collectionReportExecution; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public ListAllReportExecutionsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ListAllReportExecutionsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ListAllReportExecutionsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public ListAllReportExecutionsResponse withCollectionReportExecution(CollectionReportExecution collectionReportExecution) { + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.collectionReportExecution = Optional.ofNullable(collectionReportExecution); + return this; + } + + /** + * Successful Response + */ + public ListAllReportExecutionsResponse withCollectionReportExecution(Optional collectionReportExecution) { + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.collectionReportExecution = collectionReportExecution; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListAllReportExecutionsResponse other = (ListAllReportExecutionsResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.collectionReportExecution, other.collectionReportExecution); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + collectionReportExecution); + } + + @Override + public String toString() { + return Utils.toString(ListAllReportExecutionsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "collectionReportExecution", collectionReportExecution); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional collectionReportExecution = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder collectionReportExecution(CollectionReportExecution collectionReportExecution) { + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.collectionReportExecution = Optional.ofNullable(collectionReportExecution); + return this; + } + + /** + * Successful Response + */ + public Builder collectionReportExecution(Optional collectionReportExecution) { + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.collectionReportExecution = collectionReportExecution; + return this; + } + + public ListAllReportExecutionsResponse build() { + return new ListAllReportExecutionsResponse( + contentType, + statusCode, + rawResponse, + collectionReportExecution); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsRequest.java new file mode 100644 index 00000000..c4c9d62f --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsRequest.java @@ -0,0 +1,294 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListReportExecutionsRequest { + + /** + * The ID of the report to retrieve details for. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=report_id") + private String reportId; + + /** + * A pointer to the page of results to return. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=cursor") + private JsonNullable cursor; + + /** + * The maximum number of items that are at returned. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=limit") + private Optional limit; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public ListReportExecutionsRequest( + String reportId, + JsonNullable cursor, + Optional limit, + JsonNullable merchantAccountId) { + Utils.checkNotNull(reportId, "reportId"); + Utils.checkNotNull(cursor, "cursor"); + Utils.checkNotNull(limit, "limit"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.reportId = reportId; + this.cursor = cursor; + this.limit = limit; + this.merchantAccountId = merchantAccountId; + } + + public ListReportExecutionsRequest( + String reportId) { + this(reportId, JsonNullable.undefined(), Optional.empty(), JsonNullable.undefined()); + } + + /** + * The ID of the report to retrieve details for. + */ + @JsonIgnore + public String reportId() { + return reportId; + } + + /** + * A pointer to the page of results to return. + */ + @JsonIgnore + public JsonNullable cursor() { + return cursor; + } + + /** + * The maximum number of items that are at returned. + */ + @JsonIgnore + public Optional limit() { + return limit; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The ID of the report to retrieve details for. + */ + public ListReportExecutionsRequest withReportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + /** + * A pointer to the page of results to return. + */ + public ListReportExecutionsRequest withCursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + /** + * A pointer to the page of results to return. + */ + public ListReportExecutionsRequest withCursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public ListReportExecutionsRequest withLimit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public ListReportExecutionsRequest withLimit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListReportExecutionsRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListReportExecutionsRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListReportExecutionsRequest other = (ListReportExecutionsRequest) o; + return + Objects.deepEquals(this.reportId, other.reportId) && + Objects.deepEquals(this.cursor, other.cursor) && + Objects.deepEquals(this.limit, other.limit) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + reportId, + cursor, + limit, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(ListReportExecutionsRequest.class, + "reportId", reportId, + "cursor", cursor, + "limit", limit, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private String reportId; + + private JsonNullable cursor = JsonNullable.undefined(); + + private Optional limit; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * The ID of the report to retrieve details for. + */ + public Builder reportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + /** + * A pointer to the page of results to return. + */ + public Builder cursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + /** + * A pointer to the page of results to return. + */ + public Builder cursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public Builder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public Builder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListReportExecutionsRequest build() { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } + return new ListReportExecutionsRequest( + reportId, + cursor, + limit, + merchantAccountId); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsRequestBuilder.java new file mode 100644 index 00000000..737914fd --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsRequestBuilder.java @@ -0,0 +1,129 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.Long; +import java.lang.String; +import java.util.Optional; +import java.util.stream.Stream; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListReportExecutionsRequestBuilder { + + private String reportId; + private JsonNullable cursor = JsonNullable.undefined(); + private Optional limit = Utils.readDefaultOrConstValue( + "limit", + "20", + new TypeReference>() {}); + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallListReportExecutions sdk; + + public ListReportExecutionsRequestBuilder(SDKMethodInterfaces.MethodCallListReportExecutions sdk) { + this.sdk = sdk; + } + + public ListReportExecutionsRequestBuilder reportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + public ListReportExecutionsRequestBuilder cursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + public ListReportExecutionsRequestBuilder cursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + public ListReportExecutionsRequestBuilder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.of(limit); + return this; + } + + public ListReportExecutionsRequestBuilder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + public ListReportExecutionsRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public ListReportExecutionsRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListReportExecutionsRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public ListReportExecutionsRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public ListReportExecutionsResponse call() throws Exception { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.list( + reportId, + cursor, + limit, + merchantAccountId, + options); + } + + /** + * Returns a stream that performs next page calls till no more pages + * are returned. Unlike the {@link #call()} method this method will + * throw an {@link APIException} if any page retrieval has an HTTP status + * code >= 300 (Note that 3XX is not an error range but will need + * special handling by the user if for example the HTTP client is + * not configured to follow redirects). + * + * @throws {@link APIException} if HTTP status code >= 300 is encountered + **/ + public Stream callAsStream() { + return Utils.stream(() -> Optional.of(call()), x -> { + if (x.statusCode() >= 300) { + byte[] body = Utils.toByteArrayAndClose(x.rawResponse().body()); + throw new APIException(x.rawResponse(), x.statusCode(), x.contentType(), body); + } else { + return x.next(); + } + }); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsResponse.java new file mode 100644 index 00000000..e85f21ca --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListReportExecutionsResponse.java @@ -0,0 +1,278 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.CollectionReportExecution; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.lang.Exception; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.Callable; + +public class ListReportExecutionsResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional collectionReportExecution; + + private Callable> next = () -> Optional.empty(); + + @JsonCreator + public ListReportExecutionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional collectionReportExecution) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.collectionReportExecution = collectionReportExecution; + } + + public ListReportExecutionsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional collectionReportExecution() { + return (Optional) collectionReportExecution; + } + + public Optional next() throws Exception { + return this.next.call(); + } + + // internal use only + private ListReportExecutionsResponse withNext(Callable> next) { + this.next = next; + return this; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public ListReportExecutionsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ListReportExecutionsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ListReportExecutionsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public ListReportExecutionsResponse withCollectionReportExecution(CollectionReportExecution collectionReportExecution) { + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.collectionReportExecution = Optional.ofNullable(collectionReportExecution); + return this; + } + + /** + * Successful Response + */ + public ListReportExecutionsResponse withCollectionReportExecution(Optional collectionReportExecution) { + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.collectionReportExecution = collectionReportExecution; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListReportExecutionsResponse other = (ListReportExecutionsResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.collectionReportExecution, other.collectionReportExecution); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + collectionReportExecution); + } + + @Override + public String toString() { + return Utils.toString(ListReportExecutionsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "collectionReportExecution", collectionReportExecution); + } + + public final static class Builder { + private Callable> next; + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional collectionReportExecution = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder collectionReportExecution(CollectionReportExecution collectionReportExecution) { + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.collectionReportExecution = Optional.ofNullable(collectionReportExecution); + return this; + } + + /** + * Successful Response + */ + public Builder collectionReportExecution(Optional collectionReportExecution) { + Utils.checkNotNull(collectionReportExecution, "collectionReportExecution"); + this.collectionReportExecution = collectionReportExecution; + return this; + } + + /** + * Internal API. Not for public use. Sets the provider of the next page. + * + * @deprecated not part of the public API, may be removed without notice + */ + @Deprecated + public Builder next(Callable> next) { + Utils.checkNotNull(next, "next"); + this.next = next; + return this; + } + + public ListReportExecutionsResponse build() { + return new ListReportExecutionsResponse( + contentType, + statusCode, + rawResponse, + collectionReportExecution) + .withNext(next); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListReportsRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/ListReportsRequest.java new file mode 100644 index 00000000..edac424f --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListReportsRequest.java @@ -0,0 +1,434 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.type.TypeReference; +import com.gr4vy.sdk.models.components.ReportSchedule; +import com.gr4vy.sdk.utils.LazySingletonValue; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Boolean; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; + +public class ListReportsRequest { + + /** + * A pointer to the page of results to return. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=cursor") + private JsonNullable cursor; + + /** + * The maximum number of items that are at returned. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=limit") + private Optional limit; + + /** + * Filters the reports by the type of schedule at which they run. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=schedule") + private JsonNullable> schedule; + + /** + * Filters the reports by wether their schedule is enabled. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=schedule_enabled") + private JsonNullable scheduleEnabled; + + /** + * Filters the reports by searching their name for (partial) matches. + */ + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=name") + private JsonNullable name; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @JsonCreator + public ListReportsRequest( + JsonNullable cursor, + Optional limit, + JsonNullable> schedule, + JsonNullable scheduleEnabled, + JsonNullable name, + JsonNullable merchantAccountId) { + Utils.checkNotNull(cursor, "cursor"); + Utils.checkNotNull(limit, "limit"); + Utils.checkNotNull(schedule, "schedule"); + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.cursor = cursor; + this.limit = limit; + this.schedule = schedule; + this.scheduleEnabled = scheduleEnabled; + this.name = name; + this.merchantAccountId = merchantAccountId; + } + + public ListReportsRequest() { + this(JsonNullable.undefined(), Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined()); + } + + /** + * A pointer to the page of results to return. + */ + @JsonIgnore + public JsonNullable cursor() { + return cursor; + } + + /** + * The maximum number of items that are at returned. + */ + @JsonIgnore + public Optional limit() { + return limit; + } + + /** + * Filters the reports by the type of schedule at which they run. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public JsonNullable> schedule() { + return (JsonNullable>) schedule; + } + + /** + * Filters the reports by wether their schedule is enabled. + */ + @JsonIgnore + public JsonNullable scheduleEnabled() { + return scheduleEnabled; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + @JsonIgnore + public JsonNullable name() { + return name; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * A pointer to the page of results to return. + */ + public ListReportsRequest withCursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + /** + * A pointer to the page of results to return. + */ + public ListReportsRequest withCursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public ListReportsRequest withLimit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public ListReportsRequest withLimit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * Filters the reports by the type of schedule at which they run. + */ + public ListReportsRequest withSchedule(List schedule) { + Utils.checkNotNull(schedule, "schedule"); + this.schedule = JsonNullable.of(schedule); + return this; + } + + /** + * Filters the reports by the type of schedule at which they run. + */ + public ListReportsRequest withSchedule(JsonNullable> schedule) { + Utils.checkNotNull(schedule, "schedule"); + this.schedule = schedule; + return this; + } + + /** + * Filters the reports by wether their schedule is enabled. + */ + public ListReportsRequest withScheduleEnabled(boolean scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = JsonNullable.of(scheduleEnabled); + return this; + } + + /** + * Filters the reports by wether their schedule is enabled. + */ + public ListReportsRequest withScheduleEnabled(JsonNullable scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = scheduleEnabled; + return this; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + public ListReportsRequest withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = JsonNullable.of(name); + return this; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + public ListReportsRequest withName(JsonNullable name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListReportsRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public ListReportsRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListReportsRequest other = (ListReportsRequest) o; + return + Objects.deepEquals(this.cursor, other.cursor) && + Objects.deepEquals(this.limit, other.limit) && + Objects.deepEquals(this.schedule, other.schedule) && + Objects.deepEquals(this.scheduleEnabled, other.scheduleEnabled) && + Objects.deepEquals(this.name, other.name) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId); + } + + @Override + public int hashCode() { + return Objects.hash( + cursor, + limit, + schedule, + scheduleEnabled, + name, + merchantAccountId); + } + + @Override + public String toString() { + return Utils.toString(ListReportsRequest.class, + "cursor", cursor, + "limit", limit, + "schedule", schedule, + "scheduleEnabled", scheduleEnabled, + "name", name, + "merchantAccountId", merchantAccountId); + } + + public final static class Builder { + + private JsonNullable cursor = JsonNullable.undefined(); + + private Optional limit; + + private JsonNullable> schedule = JsonNullable.undefined(); + + private JsonNullable scheduleEnabled = JsonNullable.undefined(); + + private JsonNullable name = JsonNullable.undefined(); + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private Builder() { + // force use of static builder() method + } + + /** + * A pointer to the page of results to return. + */ + public Builder cursor(String cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = JsonNullable.of(cursor); + return this; + } + + /** + * A pointer to the page of results to return. + */ + public Builder cursor(JsonNullable cursor) { + Utils.checkNotNull(cursor, "cursor"); + this.cursor = cursor; + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public Builder limit(long limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + * The maximum number of items that are at returned. + */ + public Builder limit(Optional limit) { + Utils.checkNotNull(limit, "limit"); + this.limit = limit; + return this; + } + + /** + * Filters the reports by the type of schedule at which they run. + */ + public Builder schedule(List schedule) { + Utils.checkNotNull(schedule, "schedule"); + this.schedule = JsonNullable.of(schedule); + return this; + } + + /** + * Filters the reports by the type of schedule at which they run. + */ + public Builder schedule(JsonNullable> schedule) { + Utils.checkNotNull(schedule, "schedule"); + this.schedule = schedule; + return this; + } + + /** + * Filters the reports by wether their schedule is enabled. + */ + public Builder scheduleEnabled(boolean scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = JsonNullable.of(scheduleEnabled); + return this; + } + + /** + * Filters the reports by wether their schedule is enabled. + */ + public Builder scheduleEnabled(JsonNullable scheduleEnabled) { + Utils.checkNotNull(scheduleEnabled, "scheduleEnabled"); + this.scheduleEnabled = scheduleEnabled; + return this; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = JsonNullable.of(name); + return this; + } + + /** + * Filters the reports by searching their name for (partial) matches. + */ + public Builder name(JsonNullable name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public ListReportsRequest build() { + if (limit == null) { + limit = _SINGLETON_VALUE_Limit.value(); + } + return new ListReportsRequest( + cursor, + limit, + schedule, + scheduleEnabled, + name, + merchantAccountId); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_Limit = + new LazySingletonValue<>( + "limit", + "20", + new TypeReference>() {}); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListReportsRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/ListReportsRequestBuilder.java new file mode 100644 index 00000000..314d9f52 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListReportsRequestBuilder.java @@ -0,0 +1,71 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.models.errors.APIException; +import com.gr4vy.sdk.utils.Options; +import com.gr4vy.sdk.utils.RetryConfig; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.util.Optional; +import java.util.stream.Stream; + +public class ListReportsRequestBuilder { + + private ListReportsRequest request; + private Optional retryConfig = Optional.empty(); + private final SDKMethodInterfaces.MethodCallListReports sdk; + + public ListReportsRequestBuilder(SDKMethodInterfaces.MethodCallListReports sdk) { + this.sdk = sdk; + } + + public ListReportsRequestBuilder request(ListReportsRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public ListReportsRequestBuilder retryConfig(RetryConfig retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = Optional.of(retryConfig); + return this; + } + + public ListReportsRequestBuilder retryConfig(Optional retryConfig) { + Utils.checkNotNull(retryConfig, "retryConfig"); + this.retryConfig = retryConfig; + return this; + } + + public ListReportsResponse call() throws Exception { + Optional options = Optional.of(Options.builder() + .retryConfig(retryConfig) + .build()); + return sdk.list( + request, + options); + } + + /** + * Returns a stream that performs next page calls till no more pages + * are returned. Unlike the {@link #call()} method this method will + * throw an {@link APIException} if any page retrieval has an HTTP status + * code >= 300 (Note that 3XX is not an error range but will need + * special handling by the user if for example the HTTP client is + * not configured to follow redirects). + * + * @throws {@link APIException} if HTTP status code >= 300 is encountered + **/ + public Stream callAsStream() { + return Utils.stream(() -> Optional.of(call()), x -> { + if (x.statusCode() >= 300) { + byte[] body = Utils.toByteArrayAndClose(x.rawResponse().body()); + throw new APIException(x.rawResponse(), x.statusCode(), x.contentType(), body); + } else { + return x.next(); + } + }); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/ListReportsResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/ListReportsResponse.java new file mode 100644 index 00000000..bbca3bb2 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/ListReportsResponse.java @@ -0,0 +1,278 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.CollectionReport; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Deprecated; +import java.lang.Exception; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; +import java.util.concurrent.Callable; + +public class ListReportsResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional collectionReport; + + private Callable> next = () -> Optional.empty(); + + @JsonCreator + public ListReportsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional collectionReport) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(collectionReport, "collectionReport"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.collectionReport = collectionReport; + } + + public ListReportsResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional collectionReport() { + return (Optional) collectionReport; + } + + public Optional next() throws Exception { + return this.next.call(); + } + + // internal use only + private ListReportsResponse withNext(Callable> next) { + this.next = next; + return this; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public ListReportsResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public ListReportsResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public ListReportsResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public ListReportsResponse withCollectionReport(CollectionReport collectionReport) { + Utils.checkNotNull(collectionReport, "collectionReport"); + this.collectionReport = Optional.ofNullable(collectionReport); + return this; + } + + /** + * Successful Response + */ + public ListReportsResponse withCollectionReport(Optional collectionReport) { + Utils.checkNotNull(collectionReport, "collectionReport"); + this.collectionReport = collectionReport; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListReportsResponse other = (ListReportsResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.collectionReport, other.collectionReport); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + collectionReport); + } + + @Override + public String toString() { + return Utils.toString(ListReportsResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "collectionReport", collectionReport); + } + + public final static class Builder { + private Callable> next; + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional collectionReport = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder collectionReport(CollectionReport collectionReport) { + Utils.checkNotNull(collectionReport, "collectionReport"); + this.collectionReport = Optional.ofNullable(collectionReport); + return this; + } + + /** + * Successful Response + */ + public Builder collectionReport(Optional collectionReport) { + Utils.checkNotNull(collectionReport, "collectionReport"); + this.collectionReport = collectionReport; + return this; + } + + /** + * Internal API. Not for public use. Sets the provider of the next page. + * + * @deprecated not part of the public API, may be removed without notice + */ + @Deprecated + public Builder next(Callable> next) { + Utils.checkNotNull(next, "next"); + this.next = next; + return this; + } + + public ListReportsResponse build() { + return new ListReportsResponse( + contentType, + statusCode, + rawResponse, + collectionReport) + .withNext(next); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/SDKMethodInterfaces.java b/src/main/java/com/gr4vy/sdk/models/operations/SDKMethodInterfaces.java index b2c7b7e3..6aaf3d29 100644 --- a/src/main/java/com/gr4vy/sdk/models/operations/SDKMethodInterfaces.java +++ b/src/main/java/com/gr4vy/sdk/models/operations/SDKMethodInterfaces.java @@ -24,6 +24,8 @@ import com.gr4vy.sdk.models.components.PaymentServiceTokenCreate; import com.gr4vy.sdk.models.components.PaymentServiceUpdate; import com.gr4vy.sdk.models.components.PayoutCreate; +import com.gr4vy.sdk.models.components.ReportCreate; +import com.gr4vy.sdk.models.components.ReportUpdate; import com.gr4vy.sdk.models.components.ShippingDetailsCreate; import com.gr4vy.sdk.models.components.ShippingDetailsUpdate; import com.gr4vy.sdk.models.components.TransactionCapture; @@ -481,6 +483,61 @@ ListAuditLogsResponse list( Optional options) throws Exception; } + public interface MethodCallListReports { + ListReportsResponse list( + ListReportsRequest request, + Optional options) throws Exception; + } + + public interface MethodCallAddReport { + AddReportResponse create( + JsonNullable merchantAccountId, + ReportCreate reportCreate) throws Exception; + } + + public interface MethodCallGetReport { + GetReportResponse get( + String reportId, + JsonNullable merchantAccountId, + Optional options) throws Exception; + } + + public interface MethodCallUpdateReport { + UpdateReportResponse put( + String reportId, + JsonNullable merchantAccountId, + ReportUpdate reportUpdate) throws Exception; + } + + public interface MethodCallListReportExecutions { + ListReportExecutionsResponse list( + String reportId, + JsonNullable cursor, + Optional limit, + JsonNullable merchantAccountId, + Optional options) throws Exception; + } + + public interface MethodCallCreateReportExecutionUrl { + CreateReportExecutionUrlResponse url( + String reportId, + String reportExecutionId, + JsonNullable merchantAccountId) throws Exception; + } + + public interface MethodCallListAllReportExecutions { + ListAllReportExecutionsResponse list( + ListAllReportExecutionsRequest request, + Optional options) throws Exception; + } + + public interface MethodCallGetReportExecution { + GetReportExecutionResponse get( + String reportExecutionId, + JsonNullable merchantAccountId, + Optional options) throws Exception; + } + public interface MethodCallCreateCheckoutSession { CreateCheckoutSessionResponse create( JsonNullable merchantAccountId, diff --git a/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportRequest.java b/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportRequest.java new file mode 100644 index 00000000..9cbfa0df --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportRequest.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.ReportUpdate; +import com.gr4vy.sdk.utils.SpeakeasyMetadata; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +public class UpdateReportRequest { + + /** + * The ID of the report to edit. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=report_id") + private String reportId; + + /** + * The ID of the merchant account to use for this request. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=x-gr4vy-merchant-account-id") + private JsonNullable merchantAccountId; + + @SpeakeasyMetadata("request:mediaType=application/json") + private ReportUpdate reportUpdate; + + @JsonCreator + public UpdateReportRequest( + String reportId, + JsonNullable merchantAccountId, + ReportUpdate reportUpdate) { + Utils.checkNotNull(reportId, "reportId"); + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + Utils.checkNotNull(reportUpdate, "reportUpdate"); + this.reportId = reportId; + this.merchantAccountId = merchantAccountId; + this.reportUpdate = reportUpdate; + } + + public UpdateReportRequest( + String reportId, + ReportUpdate reportUpdate) { + this(reportId, JsonNullable.undefined(), reportUpdate); + } + + /** + * The ID of the report to edit. + */ + @JsonIgnore + public String reportId() { + return reportId; + } + + /** + * The ID of the merchant account to use for this request. + */ + @JsonIgnore + public JsonNullable merchantAccountId() { + return merchantAccountId; + } + + @JsonIgnore + public ReportUpdate reportUpdate() { + return reportUpdate; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The ID of the report to edit. + */ + public UpdateReportRequest withReportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public UpdateReportRequest withMerchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public UpdateReportRequest withMerchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public UpdateReportRequest withReportUpdate(ReportUpdate reportUpdate) { + Utils.checkNotNull(reportUpdate, "reportUpdate"); + this.reportUpdate = reportUpdate; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateReportRequest other = (UpdateReportRequest) o; + return + Objects.deepEquals(this.reportId, other.reportId) && + Objects.deepEquals(this.merchantAccountId, other.merchantAccountId) && + Objects.deepEquals(this.reportUpdate, other.reportUpdate); + } + + @Override + public int hashCode() { + return Objects.hash( + reportId, + merchantAccountId, + reportUpdate); + } + + @Override + public String toString() { + return Utils.toString(UpdateReportRequest.class, + "reportId", reportId, + "merchantAccountId", merchantAccountId, + "reportUpdate", reportUpdate); + } + + public final static class Builder { + + private String reportId; + + private JsonNullable merchantAccountId = JsonNullable.undefined(); + + private ReportUpdate reportUpdate; + + private Builder() { + // force use of static builder() method + } + + /** + * The ID of the report to edit. + */ + public Builder reportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + /** + * The ID of the merchant account to use for this request. + */ + public Builder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public Builder reportUpdate(ReportUpdate reportUpdate) { + Utils.checkNotNull(reportUpdate, "reportUpdate"); + this.reportUpdate = reportUpdate; + return this; + } + + public UpdateReportRequest build() { + return new UpdateReportRequest( + reportId, + merchantAccountId, + reportUpdate); + } + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportRequestBuilder.java b/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportRequestBuilder.java new file mode 100644 index 00000000..6e224394 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportRequestBuilder.java @@ -0,0 +1,54 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.gr4vy.sdk.models.components.ReportUpdate; +import com.gr4vy.sdk.utils.Utils; +import java.lang.Exception; +import java.lang.String; +import org.openapitools.jackson.nullable.JsonNullable; + +public class UpdateReportRequestBuilder { + + private String reportId; + private JsonNullable merchantAccountId = JsonNullable.undefined(); + private ReportUpdate reportUpdate; + private final SDKMethodInterfaces.MethodCallUpdateReport sdk; + + public UpdateReportRequestBuilder(SDKMethodInterfaces.MethodCallUpdateReport sdk) { + this.sdk = sdk; + } + + public UpdateReportRequestBuilder reportId(String reportId) { + Utils.checkNotNull(reportId, "reportId"); + this.reportId = reportId; + return this; + } + + public UpdateReportRequestBuilder merchantAccountId(String merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = JsonNullable.of(merchantAccountId); + return this; + } + + public UpdateReportRequestBuilder merchantAccountId(JsonNullable merchantAccountId) { + Utils.checkNotNull(merchantAccountId, "merchantAccountId"); + this.merchantAccountId = merchantAccountId; + return this; + } + + public UpdateReportRequestBuilder reportUpdate(ReportUpdate reportUpdate) { + Utils.checkNotNull(reportUpdate, "reportUpdate"); + this.reportUpdate = reportUpdate; + return this; + } + + public UpdateReportResponse call() throws Exception { + + return sdk.put( + reportId, + merchantAccountId, + reportUpdate); + } +} diff --git a/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportResponse.java b/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportResponse.java new file mode 100644 index 00000000..1d2c8e31 --- /dev/null +++ b/src/main/java/com/gr4vy/sdk/models/operations/UpdateReportResponse.java @@ -0,0 +1,249 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ +package com.gr4vy.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.gr4vy.sdk.models.components.Report; +import com.gr4vy.sdk.utils.Response; +import com.gr4vy.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + +public class UpdateReportResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + /** + * Successful Response + */ + private Optional report; + + @JsonCreator + public UpdateReportResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional report) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(report, "report"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.report = report; + } + + public UpdateReportResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + /** + * Successful Response + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional report() { + return (Optional) report; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public UpdateReportResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public UpdateReportResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public UpdateReportResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public UpdateReportResponse withReport(Report report) { + Utils.checkNotNull(report, "report"); + this.report = Optional.ofNullable(report); + return this; + } + + /** + * Successful Response + */ + public UpdateReportResponse withReport(Optional report) { + Utils.checkNotNull(report, "report"); + this.report = report; + return this; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateReportResponse other = (UpdateReportResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.report, other.report); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + report); + } + + @Override + public String toString() { + return Utils.toString(UpdateReportResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "report", report); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional report = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + /** + * Successful Response + */ + public Builder report(Report report) { + Utils.checkNotNull(report, "report"); + this.report = Optional.ofNullable(report); + return this; + } + + /** + * Successful Response + */ + public Builder report(Optional report) { + Utils.checkNotNull(report, "report"); + this.report = report; + return this; + } + + public UpdateReportResponse build() { + return new UpdateReportResponse( + contentType, + statusCode, + rawResponse, + report); + } + } +}