From 88e1227e33d1c5e49a3625012bc41374fffc7b28 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 05:10:44 +0000 Subject: [PATCH] Release v0.0.23 --- .github/workflows/ci.yml | 11 + LICENSE | 21 - alert_rule.go | 39 - alert_strategy.go | 48 - api_error_response.go | 14 - api_error_response_data.go | 6 - api_key_integration_configs.go | 8 - attached_integration_to_source.go | 7 - attempt_error_codes.go | 150 - attempt_state.go | 65 - attempt_status.go | 60 - attempt_trigger.go | 66 - attempts.go | 12 + attempts_client.go => attempts/client.go | 69 +- bad_request_error.go | 27 - basic_auth_integration_configs.go | 8 - batch_operation.go | 35 - batch_operation_paginated_result.go | 9 - batch_operation_plan.go | 12 - batch_operation_query.go | 66 - bookmark.go | 25 - bookmark_paginated_result.go | 9 - bookmarks.go | 48 + bookmarks_client.go => bookmarks/client.go | 173 +- bulk_retry_events.go | 26 + bulk_retry_ignored_events.go | 26 + bulk_retry_requests.go | 26 + .../client.go | 152 +- .../client.go | 152 +- .../client.go | 152 +- client.go | 141 - client/client.go | 149 + client_options.go => client/options.go | 12 +- connection.go | 27 - connection_filter_property.go | 98 - ...ter_property_connection_filter_property.go | 6 - connection_paginated_result.go | 9 - connections.go | 55 + rulesets_client.go => connections/client.go | 224 +- connections_client.go | 515 - console_line.go | 8 - console_line_type.go | 65 - core/client_option.go | 16 +- core/core.go | 60 +- core/core_test.go | 217 + create_bookmark_request.go | 15 - create_connection_request.go | 23 - create_connection_request_destination.go | 18 - ...n_request_destination_rate_limit_period.go | 54 - create_connection_request_ruleset.go | 12 - create_connection_request_source.go | 9 - create_destination_request.go | 18 - ...e_destination_request_rate_limit_period.go | 54 - create_event_bulk_retry_request.go | 9 - create_event_bulk_retry_request_query.go | 42 - ...event_bulk_retry_request_query_attempts.go | 66 - ...event_bulk_retry_request_query_attempts.go | 12 - create_event_bulk_retry_request_query_body.go | 66 - ...ate_event_bulk_retry_request_query_body.go | 6 - ..._bulk_retry_request_query_bulk_retry_id.go | 66 - ...e_event_bulk_retry_request_query_cli_id.go | 82 - ...e_event_bulk_retry_request_query_cli_id.go | 7 - ...nt_bulk_retry_request_query_cli_user_id.go | 65 - ...ent_bulk_retry_request_query_created_at.go | 66 - ...ent_bulk_retry_request_query_created_at.go | 11 - ...bulk_retry_request_query_destination_id.go | 67 - ...ent_bulk_retry_request_query_error_code.go | 66 - ..._bulk_retry_request_query_event_data_id.go | 66 - ..._event_bulk_retry_request_query_headers.go | 66 - ..._event_bulk_retry_request_query_headers.go | 6 - create_event_bulk_retry_request_query_id.go | 67 - ...event_bulk_retry_request_query_issue_id.go | 66 - ...ulk_retry_request_query_last_attempt_at.go | 66 - ...ulk_retry_request_query_last_attempt_at.go | 11 - ...t_bulk_retry_request_query_parsed_query.go | 66 - ...t_bulk_retry_request_query_parsed_query.go | 6 - ...ulk_retry_request_query_response_status.go | 82 - ...ulk_retry_request_query_response_status.go | 12 - ...vent_bulk_retry_request_query_source_id.go | 67 - ...e_event_bulk_retry_request_query_status.go | 66 - ..._bulk_retry_request_query_successful_at.go | 66 - ..._bulk_retry_request_query_successful_at.go | 11 - ...ent_bulk_retry_request_query_webhook_id.go | 67 - create_ignored_event_bulk_retry_request.go | 9 - ..._ignored_event_bulk_retry_request_query.go | 13 - ...ed_event_bulk_retry_request_query_cause.go | 67 - ...ent_bulk_retry_request_query_webhook_id.go | 67 - create_integration_request.go | 14 - create_integration_request_configs.go | 114 - create_issue_trigger_request.go | 13 - create_issue_trigger_request_configs.go | 82 - create_request_bulk_retry_request.go | 9 - create_request_bulk_retry_request_query.go | 29 - ...e_request_bulk_retry_request_query_body.go | 66 - ...e_request_bulk_retry_request_query_body.go | 6 - ..._bulk_retry_request_query_bulk_retry_id.go | 66 - ...est_bulk_retry_request_query_created_at.go | 65 - ...est_bulk_retry_request_query_created_at.go | 11 - ...t_bulk_retry_request_query_events_count.go | 81 - ...t_bulk_retry_request_query_events_count.go | 12 - ...equest_bulk_retry_request_query_headers.go | 66 - ...equest_bulk_retry_request_query_headers.go | 6 - create_request_bulk_retry_request_query_id.go | 67 - ..._bulk_retry_request_query_ignored_count.go | 81 - ..._bulk_retry_request_query_ignored_count.go | 12 - ...st_bulk_retry_request_query_ingested_at.go | 65 - ...st_bulk_retry_request_query_ingested_at.go | 11 - ...t_bulk_retry_request_query_parsed_query.go | 66 - ...t_bulk_retry_request_query_parsed_query.go | 6 - ...ulk_retry_request_query_rejection_cause.go | 82 - ...ulk_retry_request_query_rejection_cause.go | 12 - ...uest_bulk_retry_request_query_source_id.go | 67 - ...request_bulk_retry_request_query_status.go | 47 - create_ruleset_request.go | 12 - create_source_request.go | 9 - create_transformation_request.go | 13 - create_transformation_request_env_value.go | 65 - delay_rule.go | 40 - deleted_bookmark_response.go | 8 - deleted_integration.go | 7 - deleted_issue_trigger_response.go | 7 - delivery_issue.go | 62 - delivery_issue_aggregation_keys.go | 10 - delivery_issue_data.go | 9 - delivery_issue_reference.go | 9 - delivery_issue_with_data.go | 63 - destination.go | 27 - destination_paginated_result.go | 9 - destination_rate_limit_period.go | 54 - destinations.go | 75 + .../client.go | 234 +- detached_integration_from_source.go | 6 - doc.go | 4 + environments.go | 2 +- errors.go | 65 + event.go | 40 - event_array.go | 5 - event_attempt.go | 43 - event_attempt_body.go | 7 - event_attempt_paginated_result.go | 9 - event_data.go | 12 - event_data_body.go | 81 - event_data_body_event_data_body.go | 6 - event_data_headers.go | 65 - event_data_parsed_query.go | 65 - ...ta_parsed_query_event_data_parsed_query.go | 6 - event_paginated_result.go | 9 - event_status.go | 65 - events.go | 37 + events_client.go => events/client.go | 210 +- filter_rule.go | 42 - filtered_meta.go | 59 - get_attempts_request.go | 13 - ...ts_request_dir_get_attempts_request_dir.go | 47 - get_bookmarks_request.go | 18 - ...s_request_dir_get_bookmarks_request_dir.go | 47 - get_connections_request.go | 20 - ...request_dir_get_connections_request_dir.go | 47 - get_destinations_request.go | 18 - ...equest_dir_get_destinations_request_dir.go | 47 - get_event_bulk_retries_request.go | 18 - ..._dir_get_event_bulk_retries_request_dir.go | 47 - get_events_request.go | 33 - ...ents_request_dir_get_events_request_dir.go | 47 - ...st_order_by_get_events_request_order_by.go | 53 - get_ignored_event_bulk_retries_request.go | 18 - ..._ignored_event_bulk_retries_request_dir.go | 47 - get_integrations_request.go | 9 - get_issue_count_request.go | 21 - ...request_dir_get_issue_count_request_dir.go | 47 - ...der_by_get_issue_count_request_order_by.go | 65 - ...t_status_get_issue_count_request_status.go | 60 - ...quest_type_get_issue_count_request_type.go | 54 - get_issue_triggers_request.go | 15 - ...uest_dir_get_issue_triggers_request_dir.go | 47 - ..._by_get_issue_triggers_request_order_by.go | 47 - get_issues_request.go | 21 - ...sues_request_dir_get_issues_request_dir.go | 47 - ...st_order_by_get_issues_request_order_by.go | 65 - ...equest_status_get_issues_request_status.go | 60 - ...es_request_type_get_issues_request_type.go | 54 - get_request_bulk_retries_request.go | 18 - ...ir_get_request_bulk_retries_request_dir.go | 47 - get_request_events_request.go | 33 - ...uest_dir_get_request_events_request_dir.go | 47 - ..._by_get_request_events_request_order_by.go | 53 - get_request_ignored_events_request.go | 13 - ..._get_request_ignored_events_request_dir.go | 47 - get_requests_request.go | 27 - ...ts_request_dir_get_requests_request_dir.go | 47 - ..._order_by_get_requests_request_order_by.go | 47 - get_requests_request_status.go | 47 - get_rulesets_request.go | 16 - ...ts_request_dir_get_rulesets_request_dir.go | 47 - get_sources_request.go | 17 - ...ces_request_dir_get_sources_request_dir.go | 47 - get_transformation_executions_request.go | 16 - ...t_transformation_executions_request_dir.go | 47 - ...sformation_executions_request_log_level.go | 65 - get_transformations_request.go | 14 - ...est_dir_get_transformations_request_dir.go | 47 - go.mod | 8 + go.sum | 10 + handled_hmac_configs.go | 7 - hmac_algorithms.go | 59 - hmac_integration_configs.go | 10 - hmac_integration_configs_encoding.go | 47 - ignored_event.go | 14 - ignored_event_cause.go | 59 - ignored_event_meta.go | 65 - ignored_event_paginated_result.go | 9 - integration.go | 23 - integration_configs.go | 114 - integration_feature.go | 53 - integration_paginated_result.go | 9 - integration_provider.go | 174 - integrations.go | 28 + .../client.go | 162 +- issue.go | 66 - issue_count.go | 8 - issue_status.go | 60 - issue_trigger.go | 23 - issue_trigger_backpressure_configs.go | 10 - ...igger_backpressure_configs_destinations.go | 66 - issue_trigger_backpressure_delay.go | 6 - issue_trigger_channels.go | 10 - issue_trigger_delivery_configs.go | 10 - issue_trigger_delivery_configs_connections.go | 66 - issue_trigger_email_channel.go | 7 - issue_trigger_integration_channel.go | 7 - issue_trigger_paginated_result.go | 9 - issue_trigger_reference.go | 82 - issue_trigger_slack_channel.go | 9 - issue_trigger_strategy.go | 48 - issue_trigger_transformation_configs.go | 10 - ..._transformation_configs_transformations.go | 66 - issue_triggers.go | 46 + issue_type.go | 54 - issue_with_data.go | 65 - issue_with_data_paginated_result.go | 9 - issues.go | 46 + issues_client.go => issues/client.go | 211 +- .../client.go | 198 +- not_found_error.go | 27 - notifications/client.go | 107 + notifications_client.go | 54 - order_by_direction.go | 59 - raw_body.go | 7 - request.go | 36 - request_data.go | 12 - request_data_body.go | 81 - request_data_body_request_data_body.go | 6 - request_data_headers.go | 65 - request_data_parsed_query.go | 65 - ..._parsed_query_request_data_parsed_query.go | 6 - request_ingest_priority.go | 48 - request_paginated_result.go | 9 - request_rejection_cause.go | 89 - requests.go | 74 + requests_client.go => requests/client.go | 331 +- retried_event.go | 8 - retry_request.go | 8 - retry_request_request.go | 9 - retry_rule.go | 43 - retry_strategy.go | 48 - rule.go | 113 - ruleset.go | 23 - ruleset_paginated_result.go | 9 - seek_pagination.go | 11 - seek_pagination_dir.go | 65 - seek_pagination_order_by.go | 65 - shopify_integration_configs.go | 12 - ...y_integration_configs_rate_limit_period.go | 47 - short_event_data.go | 12 - short_event_data_body.go | 81 - ...t_event_data_body_short_event_data_body.go | 6 - short_event_data_headers.go | 65 - short_event_data_parsed_query.go | 65 - ...sed_query_short_event_data_parsed_query.go | 6 - source.go | 25 - source_integration.go | 14 - source_paginated_result.go | 9 - sources.go | 53 + sources_client.go => sources/client.go | 242 +- test_transformation_request.go | 18 - test_transformation_request_env.go | 7 - test_transformation_request_request.go | 17 - test_transformation_request_request_body.go | 66 - ...est_transformation_request_request_body.go | 6 - ...sformation_request_request_parsed_query.go | 7 - toggle_webhook_notifications.go | 9 - toggle_webhook_notifications_request.go | 13 - topics_value.go | 60 - transform_full.go | 42 - transform_full_transformation.go | 13 - transform_reference.go | 40 - transform_rule.go | 65 - transformation.go | 22 - transformation_execution.go | 19 - transformation_execution_log_level.go | 66 - transformation_execution_paginated_result.go | 9 - transformation_executor_output.go | 12 - transformation_executor_output_request.go | 11 - ...sformation_executor_output_request_body.go | 65 - ...sformation_executor_output_request_body.go | 6 - ...rmation_executor_output_request_headers.go | 65 - ...on_executor_output_request_parsed_query.go | 65 - ...on_executor_output_request_parsed_query.go | 6 - ...formation_executor_output_request_query.go | 65 - ...formation_executor_output_request_query.go | 6 - transformation_failed_meta.go | 7 - transformation_issue.go | 62 - transformation_issue_aggregation_keys.go | 9 - transformation_issue_data.go | 9 - transformation_issue_reference.go | 10 - transformation_issue_with_data.go | 63 - transformation_paginated_result.go | 9 - transformations.go | 70 + .../client.go | 228 +- trigger_bookmark_request.go | 9 - trigger_bookmark_request_target.go | 48 - types.go | 10555 ++++++++++++++++ unprocessable_entity_error.go | 27 - update_bookmark_request.go | 15 - update_connection_request.go | 15 - update_connection_request_ruleset.go | 12 - update_destination_request.go | 20 - ...e_destination_request_rate_limit_period.go | 54 - update_integration_request.go | 14 - update_integration_request_configs.go | 114 - update_issue_request.go | 9 - update_issue_request_status.go | 60 - update_issue_trigger_request.go | 14 - update_issue_trigger_request_configs.go | 82 - update_ruleset_request.go | 14 - update_source_request.go | 11 - update_transformation_request.go | 13 - update_transformation_request_env_value.go | 65 - upsert_connection_request.go | 23 - upsert_connection_request_destination.go | 18 - ...n_request_destination_rate_limit_period.go | 54 - upsert_connection_request_ruleset.go | 12 - upsert_connection_request_source.go | 9 - upsert_destination_request.go | 18 - ...t_destination_request_rate_limit_period.go | 54 - upsert_issue_trigger_request.go | 13 - upsert_issue_trigger_request_configs.go | 82 - upsert_ruleset_request.go | 12 - upsert_source_request.go | 9 - upsert_transformation_request.go | 13 - upsert_transformation_request_env_value.go | 65 - 351 files changed, 13159 insertions(+), 13265 deletions(-) delete mode 100644 LICENSE delete mode 100644 alert_rule.go delete mode 100644 alert_strategy.go delete mode 100644 api_error_response.go delete mode 100644 api_error_response_data.go delete mode 100644 api_key_integration_configs.go delete mode 100644 attached_integration_to_source.go delete mode 100644 attempt_error_codes.go delete mode 100644 attempt_state.go delete mode 100644 attempt_status.go delete mode 100644 attempt_trigger.go create mode 100644 attempts.go rename attempts_client.go => attempts/client.go (62%) delete mode 100644 bad_request_error.go delete mode 100644 basic_auth_integration_configs.go delete mode 100644 batch_operation.go delete mode 100644 batch_operation_paginated_result.go delete mode 100644 batch_operation_plan.go delete mode 100644 batch_operation_query.go delete mode 100644 bookmark.go delete mode 100644 bookmark_paginated_result.go create mode 100644 bookmarks.go rename bookmarks_client.go => bookmarks/client.go (61%) create mode 100644 bulk_retry_events.go create mode 100644 bulk_retry_ignored_events.go create mode 100644 bulk_retry_requests.go rename bulk_retry_events_client.go => bulkretryevents/client.go (58%) rename bulk_retry_ignored_events_client.go => bulkretryignoredevents/client.go (57%) rename bulk_retry_requests_client.go => bulkretryrequests/client.go (57%) delete mode 100644 client.go create mode 100644 client/client.go rename client_options.go => client/options.go (72%) delete mode 100644 connection.go delete mode 100644 connection_filter_property.go delete mode 100644 connection_filter_property_connection_filter_property.go delete mode 100644 connection_paginated_result.go create mode 100644 connections.go rename rulesets_client.go => connections/client.go (55%) delete mode 100644 connections_client.go delete mode 100644 console_line.go delete mode 100644 console_line_type.go create mode 100644 core/core_test.go delete mode 100644 create_bookmark_request.go delete mode 100644 create_connection_request.go delete mode 100644 create_connection_request_destination.go delete mode 100644 create_connection_request_destination_rate_limit_period.go delete mode 100644 create_connection_request_ruleset.go delete mode 100644 create_connection_request_source.go delete mode 100644 create_destination_request.go delete mode 100644 create_destination_request_rate_limit_period.go delete mode 100644 create_event_bulk_retry_request.go delete mode 100644 create_event_bulk_retry_request_query.go delete mode 100644 create_event_bulk_retry_request_query_attempts.go delete mode 100644 create_event_bulk_retry_request_query_attempts_create_event_bulk_retry_request_query_attempts.go delete mode 100644 create_event_bulk_retry_request_query_body.go delete mode 100644 create_event_bulk_retry_request_query_body_create_event_bulk_retry_request_query_body.go delete mode 100644 create_event_bulk_retry_request_query_bulk_retry_id.go delete mode 100644 create_event_bulk_retry_request_query_cli_id.go delete mode 100644 create_event_bulk_retry_request_query_cli_id_create_event_bulk_retry_request_query_cli_id.go delete mode 100644 create_event_bulk_retry_request_query_cli_user_id.go delete mode 100644 create_event_bulk_retry_request_query_created_at.go delete mode 100644 create_event_bulk_retry_request_query_created_at_create_event_bulk_retry_request_query_created_at.go delete mode 100644 create_event_bulk_retry_request_query_destination_id.go delete mode 100644 create_event_bulk_retry_request_query_error_code.go delete mode 100644 create_event_bulk_retry_request_query_event_data_id.go delete mode 100644 create_event_bulk_retry_request_query_headers.go delete mode 100644 create_event_bulk_retry_request_query_headers_create_event_bulk_retry_request_query_headers.go delete mode 100644 create_event_bulk_retry_request_query_id.go delete mode 100644 create_event_bulk_retry_request_query_issue_id.go delete mode 100644 create_event_bulk_retry_request_query_last_attempt_at.go delete mode 100644 create_event_bulk_retry_request_query_last_attempt_at_create_event_bulk_retry_request_query_last_attempt_at.go delete mode 100644 create_event_bulk_retry_request_query_parsed_query.go delete mode 100644 create_event_bulk_retry_request_query_parsed_query_create_event_bulk_retry_request_query_parsed_query.go delete mode 100644 create_event_bulk_retry_request_query_response_status.go delete mode 100644 create_event_bulk_retry_request_query_response_status_create_event_bulk_retry_request_query_response_status.go delete mode 100644 create_event_bulk_retry_request_query_source_id.go delete mode 100644 create_event_bulk_retry_request_query_status.go delete mode 100644 create_event_bulk_retry_request_query_successful_at.go delete mode 100644 create_event_bulk_retry_request_query_successful_at_create_event_bulk_retry_request_query_successful_at.go delete mode 100644 create_event_bulk_retry_request_query_webhook_id.go delete mode 100644 create_ignored_event_bulk_retry_request.go delete mode 100644 create_ignored_event_bulk_retry_request_query.go delete mode 100644 create_ignored_event_bulk_retry_request_query_cause.go delete mode 100644 create_ignored_event_bulk_retry_request_query_webhook_id.go delete mode 100644 create_integration_request.go delete mode 100644 create_integration_request_configs.go delete mode 100644 create_issue_trigger_request.go delete mode 100644 create_issue_trigger_request_configs.go delete mode 100644 create_request_bulk_retry_request.go delete mode 100644 create_request_bulk_retry_request_query.go delete mode 100644 create_request_bulk_retry_request_query_body.go delete mode 100644 create_request_bulk_retry_request_query_body_create_request_bulk_retry_request_query_body.go delete mode 100644 create_request_bulk_retry_request_query_bulk_retry_id.go delete mode 100644 create_request_bulk_retry_request_query_created_at.go delete mode 100644 create_request_bulk_retry_request_query_created_at_create_request_bulk_retry_request_query_created_at.go delete mode 100644 create_request_bulk_retry_request_query_events_count.go delete mode 100644 create_request_bulk_retry_request_query_events_count_create_request_bulk_retry_request_query_events_count.go delete mode 100644 create_request_bulk_retry_request_query_headers.go delete mode 100644 create_request_bulk_retry_request_query_headers_create_request_bulk_retry_request_query_headers.go delete mode 100644 create_request_bulk_retry_request_query_id.go delete mode 100644 create_request_bulk_retry_request_query_ignored_count.go delete mode 100644 create_request_bulk_retry_request_query_ignored_count_create_request_bulk_retry_request_query_ignored_count.go delete mode 100644 create_request_bulk_retry_request_query_ingested_at.go delete mode 100644 create_request_bulk_retry_request_query_ingested_at_create_request_bulk_retry_request_query_ingested_at.go delete mode 100644 create_request_bulk_retry_request_query_parsed_query.go delete mode 100644 create_request_bulk_retry_request_query_parsed_query_create_request_bulk_retry_request_query_parsed_query.go delete mode 100644 create_request_bulk_retry_request_query_rejection_cause.go delete mode 100644 create_request_bulk_retry_request_query_rejection_cause_create_request_bulk_retry_request_query_rejection_cause.go delete mode 100644 create_request_bulk_retry_request_query_source_id.go delete mode 100644 create_request_bulk_retry_request_query_status.go delete mode 100644 create_ruleset_request.go delete mode 100644 create_source_request.go delete mode 100644 create_transformation_request.go delete mode 100644 create_transformation_request_env_value.go delete mode 100644 delay_rule.go delete mode 100644 deleted_bookmark_response.go delete mode 100644 deleted_integration.go delete mode 100644 deleted_issue_trigger_response.go delete mode 100644 delivery_issue.go delete mode 100644 delivery_issue_aggregation_keys.go delete mode 100644 delivery_issue_data.go delete mode 100644 delivery_issue_reference.go delete mode 100644 delivery_issue_with_data.go delete mode 100644 destination.go delete mode 100644 destination_paginated_result.go delete mode 100644 destination_rate_limit_period.go create mode 100644 destinations.go rename destinations_client.go => destinations/client.go (56%) delete mode 100644 detached_integration_from_source.go create mode 100644 doc.go create mode 100644 errors.go delete mode 100644 event.go delete mode 100644 event_array.go delete mode 100644 event_attempt.go delete mode 100644 event_attempt_body.go delete mode 100644 event_attempt_paginated_result.go delete mode 100644 event_data.go delete mode 100644 event_data_body.go delete mode 100644 event_data_body_event_data_body.go delete mode 100644 event_data_headers.go delete mode 100644 event_data_parsed_query.go delete mode 100644 event_data_parsed_query_event_data_parsed_query.go delete mode 100644 event_paginated_result.go delete mode 100644 event_status.go create mode 100644 events.go rename events_client.go => events/client.go (56%) delete mode 100644 filter_rule.go delete mode 100644 filtered_meta.go delete mode 100644 get_attempts_request.go delete mode 100644 get_attempts_request_dir_get_attempts_request_dir.go delete mode 100644 get_bookmarks_request.go delete mode 100644 get_bookmarks_request_dir_get_bookmarks_request_dir.go delete mode 100644 get_connections_request.go delete mode 100644 get_connections_request_dir_get_connections_request_dir.go delete mode 100644 get_destinations_request.go delete mode 100644 get_destinations_request_dir_get_destinations_request_dir.go delete mode 100644 get_event_bulk_retries_request.go delete mode 100644 get_event_bulk_retries_request_dir_get_event_bulk_retries_request_dir.go delete mode 100644 get_events_request.go delete mode 100644 get_events_request_dir_get_events_request_dir.go delete mode 100644 get_events_request_order_by_get_events_request_order_by.go delete mode 100644 get_ignored_event_bulk_retries_request.go delete mode 100644 get_ignored_event_bulk_retries_request_dir_get_ignored_event_bulk_retries_request_dir.go delete mode 100644 get_integrations_request.go delete mode 100644 get_issue_count_request.go delete mode 100644 get_issue_count_request_dir_get_issue_count_request_dir.go delete mode 100644 get_issue_count_request_order_by_get_issue_count_request_order_by.go delete mode 100644 get_issue_count_request_status_get_issue_count_request_status.go delete mode 100644 get_issue_count_request_type_get_issue_count_request_type.go delete mode 100644 get_issue_triggers_request.go delete mode 100644 get_issue_triggers_request_dir_get_issue_triggers_request_dir.go delete mode 100644 get_issue_triggers_request_order_by_get_issue_triggers_request_order_by.go delete mode 100644 get_issues_request.go delete mode 100644 get_issues_request_dir_get_issues_request_dir.go delete mode 100644 get_issues_request_order_by_get_issues_request_order_by.go delete mode 100644 get_issues_request_status_get_issues_request_status.go delete mode 100644 get_issues_request_type_get_issues_request_type.go delete mode 100644 get_request_bulk_retries_request.go delete mode 100644 get_request_bulk_retries_request_dir_get_request_bulk_retries_request_dir.go delete mode 100644 get_request_events_request.go delete mode 100644 get_request_events_request_dir_get_request_events_request_dir.go delete mode 100644 get_request_events_request_order_by_get_request_events_request_order_by.go delete mode 100644 get_request_ignored_events_request.go delete mode 100644 get_request_ignored_events_request_dir_get_request_ignored_events_request_dir.go delete mode 100644 get_requests_request.go delete mode 100644 get_requests_request_dir_get_requests_request_dir.go delete mode 100644 get_requests_request_order_by_get_requests_request_order_by.go delete mode 100644 get_requests_request_status.go delete mode 100644 get_rulesets_request.go delete mode 100644 get_rulesets_request_dir_get_rulesets_request_dir.go delete mode 100644 get_sources_request.go delete mode 100644 get_sources_request_dir_get_sources_request_dir.go delete mode 100644 get_transformation_executions_request.go delete mode 100644 get_transformation_executions_request_dir_get_transformation_executions_request_dir.go delete mode 100644 get_transformation_executions_request_log_level_get_transformation_executions_request_log_level.go delete mode 100644 get_transformations_request.go delete mode 100644 get_transformations_request_dir_get_transformations_request_dir.go delete mode 100644 handled_hmac_configs.go delete mode 100644 hmac_algorithms.go delete mode 100644 hmac_integration_configs.go delete mode 100644 hmac_integration_configs_encoding.go delete mode 100644 ignored_event.go delete mode 100644 ignored_event_cause.go delete mode 100644 ignored_event_meta.go delete mode 100644 ignored_event_paginated_result.go delete mode 100644 integration.go delete mode 100644 integration_configs.go delete mode 100644 integration_feature.go delete mode 100644 integration_paginated_result.go delete mode 100644 integration_provider.go create mode 100644 integrations.go rename integrations_client.go => integrations/client.go (63%) delete mode 100644 issue.go delete mode 100644 issue_count.go delete mode 100644 issue_status.go delete mode 100644 issue_trigger.go delete mode 100644 issue_trigger_backpressure_configs.go delete mode 100644 issue_trigger_backpressure_configs_destinations.go delete mode 100644 issue_trigger_backpressure_delay.go delete mode 100644 issue_trigger_channels.go delete mode 100644 issue_trigger_delivery_configs.go delete mode 100644 issue_trigger_delivery_configs_connections.go delete mode 100644 issue_trigger_email_channel.go delete mode 100644 issue_trigger_integration_channel.go delete mode 100644 issue_trigger_paginated_result.go delete mode 100644 issue_trigger_reference.go delete mode 100644 issue_trigger_slack_channel.go delete mode 100644 issue_trigger_strategy.go delete mode 100644 issue_trigger_transformation_configs.go delete mode 100644 issue_trigger_transformation_configs_transformations.go create mode 100644 issue_triggers.go delete mode 100644 issue_type.go delete mode 100644 issue_with_data.go delete mode 100644 issue_with_data_paginated_result.go create mode 100644 issues.go rename issues_client.go => issues/client.go (51%) rename issue_triggers_client.go => issuetriggers/client.go (61%) delete mode 100644 not_found_error.go create mode 100644 notifications/client.go delete mode 100644 notifications_client.go delete mode 100644 order_by_direction.go delete mode 100644 raw_body.go delete mode 100644 request.go delete mode 100644 request_data.go delete mode 100644 request_data_body.go delete mode 100644 request_data_body_request_data_body.go delete mode 100644 request_data_headers.go delete mode 100644 request_data_parsed_query.go delete mode 100644 request_data_parsed_query_request_data_parsed_query.go delete mode 100644 request_ingest_priority.go delete mode 100644 request_paginated_result.go delete mode 100644 request_rejection_cause.go create mode 100644 requests.go rename requests_client.go => requests/client.go (54%) delete mode 100644 retried_event.go delete mode 100644 retry_request.go delete mode 100644 retry_request_request.go delete mode 100644 retry_rule.go delete mode 100644 retry_strategy.go delete mode 100644 rule.go delete mode 100644 ruleset.go delete mode 100644 ruleset_paginated_result.go delete mode 100644 seek_pagination.go delete mode 100644 seek_pagination_dir.go delete mode 100644 seek_pagination_order_by.go delete mode 100644 shopify_integration_configs.go delete mode 100644 shopify_integration_configs_rate_limit_period.go delete mode 100644 short_event_data.go delete mode 100644 short_event_data_body.go delete mode 100644 short_event_data_body_short_event_data_body.go delete mode 100644 short_event_data_headers.go delete mode 100644 short_event_data_parsed_query.go delete mode 100644 short_event_data_parsed_query_short_event_data_parsed_query.go delete mode 100644 source.go delete mode 100644 source_integration.go delete mode 100644 source_paginated_result.go create mode 100644 sources.go rename sources_client.go => sources/client.go (55%) delete mode 100644 test_transformation_request.go delete mode 100644 test_transformation_request_env.go delete mode 100644 test_transformation_request_request.go delete mode 100644 test_transformation_request_request_body.go delete mode 100644 test_transformation_request_request_body_test_transformation_request_request_body.go delete mode 100644 test_transformation_request_request_parsed_query.go delete mode 100644 toggle_webhook_notifications.go delete mode 100644 toggle_webhook_notifications_request.go delete mode 100644 topics_value.go delete mode 100644 transform_full.go delete mode 100644 transform_full_transformation.go delete mode 100644 transform_reference.go delete mode 100644 transform_rule.go delete mode 100644 transformation.go delete mode 100644 transformation_execution.go delete mode 100644 transformation_execution_log_level.go delete mode 100644 transformation_execution_paginated_result.go delete mode 100644 transformation_executor_output.go delete mode 100644 transformation_executor_output_request.go delete mode 100644 transformation_executor_output_request_body.go delete mode 100644 transformation_executor_output_request_body_transformation_executor_output_request_body.go delete mode 100644 transformation_executor_output_request_headers.go delete mode 100644 transformation_executor_output_request_parsed_query.go delete mode 100644 transformation_executor_output_request_parsed_query_transformation_executor_output_request_parsed_query.go delete mode 100644 transformation_executor_output_request_query.go delete mode 100644 transformation_executor_output_request_query_transformation_executor_output_request_query.go delete mode 100644 transformation_failed_meta.go delete mode 100644 transformation_issue.go delete mode 100644 transformation_issue_aggregation_keys.go delete mode 100644 transformation_issue_data.go delete mode 100644 transformation_issue_reference.go delete mode 100644 transformation_issue_with_data.go delete mode 100644 transformation_paginated_result.go create mode 100644 transformations.go rename transformations_client.go => transformations/client.go (59%) delete mode 100644 trigger_bookmark_request.go delete mode 100644 trigger_bookmark_request_target.go create mode 100644 types.go delete mode 100644 unprocessable_entity_error.go delete mode 100644 update_bookmark_request.go delete mode 100644 update_connection_request.go delete mode 100644 update_connection_request_ruleset.go delete mode 100644 update_destination_request.go delete mode 100644 update_destination_request_rate_limit_period.go delete mode 100644 update_integration_request.go delete mode 100644 update_integration_request_configs.go delete mode 100644 update_issue_request.go delete mode 100644 update_issue_request_status.go delete mode 100644 update_issue_trigger_request.go delete mode 100644 update_issue_trigger_request_configs.go delete mode 100644 update_ruleset_request.go delete mode 100644 update_source_request.go delete mode 100644 update_transformation_request.go delete mode 100644 update_transformation_request_env_value.go delete mode 100644 upsert_connection_request.go delete mode 100644 upsert_connection_request_destination.go delete mode 100644 upsert_connection_request_destination_rate_limit_period.go delete mode 100644 upsert_connection_request_ruleset.go delete mode 100644 upsert_connection_request_source.go delete mode 100644 upsert_destination_request.go delete mode 100644 upsert_destination_request_rate_limit_period.go delete mode 100644 upsert_issue_trigger_request.go delete mode 100644 upsert_issue_trigger_request_configs.go delete mode 100644 upsert_ruleset_request.go delete mode 100644 upsert_source_request.go delete mode 100644 upsert_transformation_request.go delete mode 100644 upsert_transformation_request_env_value.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa105d4..d4c0a5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,3 +14,14 @@ jobs: - name: Compile run: go build ./... + test: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up go + uses: actions/setup-go@v4 + + - name: Test + run: go test ./... diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a09c223..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Fern - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/alert_rule.go b/alert_rule.go deleted file mode 100644 index 458f5a4..0000000 --- a/alert_rule.go +++ /dev/null @@ -1,39 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -type AlertRule struct { - Strategy AlertStrategy `json:"strategy,omitempty"` - type_ string -} - -func (a *AlertRule) Type() string { - return a.type_ -} - -func (a *AlertRule) UnmarshalJSON(data []byte) error { - type unmarshaler AlertRule - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *a = AlertRule(value) - a.type_ = "alert" - return nil -} - -func (a *AlertRule) MarshalJSON() ([]byte, error) { - type embed AlertRule - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*a), - Type: "alert", - } - return json.Marshal(marshaler) -} diff --git a/alert_strategy.go b/alert_strategy.go deleted file mode 100644 index 788da4c..0000000 --- a/alert_strategy.go +++ /dev/null @@ -1,48 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Alert strategy to use -type AlertStrategy uint8 - -const ( - AlertStrategyEachAttempt AlertStrategy = iota + 1 - AlertStrategyLastAttempt -) - -func (a AlertStrategy) String() string { - switch a { - default: - return strconv.Itoa(int(a)) - case AlertStrategyEachAttempt: - return "each_attempt" - case AlertStrategyLastAttempt: - return "last_attempt" - } -} - -func (a AlertStrategy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", a.String())), nil -} - -func (a *AlertStrategy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "each_attempt": - value := AlertStrategyEachAttempt - *a = value - case "last_attempt": - value := AlertStrategyLastAttempt - *a = value - } - return nil -} diff --git a/api_error_response.go b/api_error_response.go deleted file mode 100644 index 5a3d771..0000000 --- a/api_error_response.go +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Error response model -type ApiErrorResponse struct { - // Error code - Code string `json:"code"` - // Status code - Status float64 `json:"status"` - // Error description - Message string `json:"message"` - Data *ApiErrorResponseData `json:"data,omitempty"` -} diff --git a/api_error_response_data.go b/api_error_response_data.go deleted file mode 100644 index 2eaaeb6..0000000 --- a/api_error_response_data.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ApiErrorResponseData struct { -} diff --git a/api_key_integration_configs.go b/api_key_integration_configs.go deleted file mode 100644 index 52ee542..0000000 --- a/api_key_integration_configs.go +++ /dev/null @@ -1,8 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ApiKeyIntegrationConfigs struct { - HeaderKey string `json:"header_key"` - ApiKey string `json:"api_key"` -} diff --git a/attached_integration_to_source.go b/attached_integration_to_source.go deleted file mode 100644 index cfad144..0000000 --- a/attached_integration_to_source.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type AttachedIntegrationToSource struct { - Success bool `json:"success"` -} diff --git a/attempt_error_codes.go b/attempt_error_codes.go deleted file mode 100644 index 6c5f687..0000000 --- a/attempt_error_codes.go +++ /dev/null @@ -1,150 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Attempt could not complete because of an error -type AttemptErrorCodes uint8 - -const ( - AttemptErrorCodesTimeout AttemptErrorCodes = iota + 1 - AttemptErrorCodesNotFound - AttemptErrorCodesConnectionRefused - AttemptErrorCodesConnectionReset - AttemptErrorCodesMissingUrl - AttemptErrorCodesCli - AttemptErrorCodesCliUnavailable - AttemptErrorCodesSelfSignedCert - AttemptErrorCodesErrTlsCertAltnameInvalid - AttemptErrorCodesSslErrorCaUnknown - AttemptErrorCodesTtlExpired - AttemptErrorCodesDataArchived - AttemptErrorCodesSslCertExpired - AttemptErrorCodesBulkRetryCancelled - AttemptErrorCodesDnsLookupFailed - AttemptErrorCodesHostUnreachable - AttemptErrorCodesProtocolError - AttemptErrorCodesSocketClosed - AttemptErrorCodesUnknown -) - -func (a AttemptErrorCodes) String() string { - switch a { - default: - return strconv.Itoa(int(a)) - case AttemptErrorCodesTimeout: - return "TIMEOUT" - case AttemptErrorCodesNotFound: - return "NOT_FOUND" - case AttemptErrorCodesConnectionRefused: - return "CONNECTION_REFUSED" - case AttemptErrorCodesConnectionReset: - return "CONNECTION_RESET" - case AttemptErrorCodesMissingUrl: - return "MISSING_URL" - case AttemptErrorCodesCli: - return "CLI" - case AttemptErrorCodesCliUnavailable: - return "CLI_UNAVAILABLE" - case AttemptErrorCodesSelfSignedCert: - return "SELF_SIGNED_CERT" - case AttemptErrorCodesErrTlsCertAltnameInvalid: - return "ERR_TLS_CERT_ALTNAME_INVALID" - case AttemptErrorCodesSslErrorCaUnknown: - return "SSL_ERROR_CA_UNKNOWN" - case AttemptErrorCodesTtlExpired: - return "TTL_EXPIRED" - case AttemptErrorCodesDataArchived: - return "DATA_ARCHIVED" - case AttemptErrorCodesSslCertExpired: - return "SSL_CERT_EXPIRED" - case AttemptErrorCodesBulkRetryCancelled: - return "BULK_RETRY_CANCELLED" - case AttemptErrorCodesDnsLookupFailed: - return "DNS_LOOKUP_FAILED" - case AttemptErrorCodesHostUnreachable: - return "HOST_UNREACHABLE" - case AttemptErrorCodesProtocolError: - return "PROTOCOL_ERROR" - case AttemptErrorCodesSocketClosed: - return "SOCKET_CLOSED" - case AttemptErrorCodesUnknown: - return "UNKNOWN" - } -} - -func (a AttemptErrorCodes) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", a.String())), nil -} - -func (a *AttemptErrorCodes) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "TIMEOUT": - value := AttemptErrorCodesTimeout - *a = value - case "NOT_FOUND": - value := AttemptErrorCodesNotFound - *a = value - case "CONNECTION_REFUSED": - value := AttemptErrorCodesConnectionRefused - *a = value - case "CONNECTION_RESET": - value := AttemptErrorCodesConnectionReset - *a = value - case "MISSING_URL": - value := AttemptErrorCodesMissingUrl - *a = value - case "CLI": - value := AttemptErrorCodesCli - *a = value - case "CLI_UNAVAILABLE": - value := AttemptErrorCodesCliUnavailable - *a = value - case "SELF_SIGNED_CERT": - value := AttemptErrorCodesSelfSignedCert - *a = value - case "ERR_TLS_CERT_ALTNAME_INVALID": - value := AttemptErrorCodesErrTlsCertAltnameInvalid - *a = value - case "SSL_ERROR_CA_UNKNOWN": - value := AttemptErrorCodesSslErrorCaUnknown - *a = value - case "TTL_EXPIRED": - value := AttemptErrorCodesTtlExpired - *a = value - case "DATA_ARCHIVED": - value := AttemptErrorCodesDataArchived - *a = value - case "SSL_CERT_EXPIRED": - value := AttemptErrorCodesSslCertExpired - *a = value - case "BULK_RETRY_CANCELLED": - value := AttemptErrorCodesBulkRetryCancelled - *a = value - case "DNS_LOOKUP_FAILED": - value := AttemptErrorCodesDnsLookupFailed - *a = value - case "HOST_UNREACHABLE": - value := AttemptErrorCodesHostUnreachable - *a = value - case "PROTOCOL_ERROR": - value := AttemptErrorCodesProtocolError - *a = value - case "SOCKET_CLOSED": - value := AttemptErrorCodesSocketClosed - *a = value - case "UNKNOWN": - value := AttemptErrorCodesUnknown - *a = value - } - return nil -} diff --git a/attempt_state.go b/attempt_state.go deleted file mode 100644 index dc8a395..0000000 --- a/attempt_state.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type AttemptState uint8 - -const ( - AttemptStateDelivering AttemptState = iota + 1 - AttemptStateQueued - AttemptStatePending - AttemptStateCompleted - AttemptStateHold -) - -func (a AttemptState) String() string { - switch a { - default: - return strconv.Itoa(int(a)) - case AttemptStateDelivering: - return "DELIVERING" - case AttemptStateQueued: - return "QUEUED" - case AttemptStatePending: - return "PENDING" - case AttemptStateCompleted: - return "COMPLETED" - case AttemptStateHold: - return "HOLD" - } -} - -func (a AttemptState) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", a.String())), nil -} - -func (a *AttemptState) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "DELIVERING": - value := AttemptStateDelivering - *a = value - case "QUEUED": - value := AttemptStateQueued - *a = value - case "PENDING": - value := AttemptStatePending - *a = value - case "COMPLETED": - value := AttemptStateCompleted - *a = value - case "HOLD": - value := AttemptStateHold - *a = value - } - return nil -} diff --git a/attempt_status.go b/attempt_status.go deleted file mode 100644 index d9f4b92..0000000 --- a/attempt_status.go +++ /dev/null @@ -1,60 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Attempt status -type AttemptStatus uint8 - -const ( - AttemptStatusQueued AttemptStatus = iota + 1 - AttemptStatusFailed - AttemptStatusSuccessful - AttemptStatusHold -) - -func (a AttemptStatus) String() string { - switch a { - default: - return strconv.Itoa(int(a)) - case AttemptStatusQueued: - return "QUEUED" - case AttemptStatusFailed: - return "FAILED" - case AttemptStatusSuccessful: - return "SUCCESSFUL" - case AttemptStatusHold: - return "HOLD" - } -} - -func (a AttemptStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", a.String())), nil -} - -func (a *AttemptStatus) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "QUEUED": - value := AttemptStatusQueued - *a = value - case "FAILED": - value := AttemptStatusFailed - *a = value - case "SUCCESSFUL": - value := AttemptStatusSuccessful - *a = value - case "HOLD": - value := AttemptStatusHold - *a = value - } - return nil -} diff --git a/attempt_trigger.go b/attempt_trigger.go deleted file mode 100644 index d27e381..0000000 --- a/attempt_trigger.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// How the attempt was triggered -type AttemptTrigger uint8 - -const ( - AttemptTriggerInitial AttemptTrigger = iota + 1 - AttemptTriggerManual - AttemptTriggerBulkRetry - AttemptTriggerUnpause - AttemptTriggerAutomatic -) - -func (a AttemptTrigger) String() string { - switch a { - default: - return strconv.Itoa(int(a)) - case AttemptTriggerInitial: - return "INITIAL" - case AttemptTriggerManual: - return "MANUAL" - case AttemptTriggerBulkRetry: - return "BULK_RETRY" - case AttemptTriggerUnpause: - return "UNPAUSE" - case AttemptTriggerAutomatic: - return "AUTOMATIC" - } -} - -func (a AttemptTrigger) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", a.String())), nil -} - -func (a *AttemptTrigger) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "INITIAL": - value := AttemptTriggerInitial - *a = value - case "MANUAL": - value := AttemptTriggerManual - *a = value - case "BULK_RETRY": - value := AttemptTriggerBulkRetry - *a = value - case "UNPAUSE": - value := AttemptTriggerUnpause - *a = value - case "AUTOMATIC": - value := AttemptTriggerAutomatic - *a = value - } - return nil -} diff --git a/attempts.go b/attempts.go new file mode 100644 index 0000000..f60e819 --- /dev/null +++ b/attempts.go @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +type GetAttemptsRequest struct { + EventId *string `json:"-"` + OrderBy *string `json:"-"` + Dir *GetAttemptsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} diff --git a/attempts_client.go b/attempts/client.go similarity index 62% rename from attempts_client.go rename to attempts/client.go index ec239ff..2e6c2e9 100644 --- a/attempts_client.go +++ b/attempts/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package attempts import ( bytes "bytes" @@ -8,65 +8,60 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" ) -type AttemptsClient interface { - GetAttempts(ctx context.Context, request *GetAttemptsRequest) (*EventAttemptPaginatedResult, error) - GetAttempt(ctx context.Context, id string) (*EventAttempt, error) +type Client interface { + GetAttempts(ctx context.Context, request *hookdeckgo.GetAttemptsRequest) (*hookdeckgo.EventAttemptPaginatedResult, error) + GetAttempt(ctx context.Context, id string) (*hookdeckgo.EventAttempt, error) } -func NewAttemptsClient(opts ...core.ClientOption) AttemptsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &attemptsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type attemptsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (a *attemptsClient) GetAttempts(ctx context.Context, request *GetAttemptsRequest) (*EventAttemptPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if a.baseURL != "" { - baseURL = a.baseURL +func (c *client) GetAttempts(ctx context.Context, request *hookdeckgo.GetAttemptsRequest) (*hookdeckgo.EventAttemptPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "attempts" queryParams := make(url.Values) - var eventIdDefaultValue *string - if request.EventId != eventIdDefaultValue { + if request.EventId != nil { queryParams.Add("event_id", fmt.Sprintf("%v", *request.EventId)) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetAttemptsRequestDirGetAttemptsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -82,14 +77,14 @@ func (a *attemptsClient) GetAttempts(ctx context.Context, request *GetAttemptsRe decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -99,15 +94,16 @@ func (a *attemptsClient) GetAttempts(ctx context.Context, request *GetAttemptsRe return apiError } - response := new(EventAttemptPaginatedResult) + var response *hookdeckgo.EventAttemptPaginatedResult if err := core.DoRequest( ctx, - a.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - a.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -115,10 +111,10 @@ func (a *attemptsClient) GetAttempts(ctx context.Context, request *GetAttemptsRe return response, nil } -func (a *attemptsClient) GetAttempt(ctx context.Context, id string) (*EventAttempt, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if a.baseURL != "" { - baseURL = a.baseURL +func (c *client) GetAttempt(ctx context.Context, id string) (*hookdeckgo.EventAttempt, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"attempts/%v", id) @@ -131,7 +127,7 @@ func (a *attemptsClient) GetAttempt(ctx context.Context, id string) (*EventAttem decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -141,15 +137,16 @@ func (a *attemptsClient) GetAttempt(ctx context.Context, id string) (*EventAttem return apiError } - response := new(EventAttempt) + var response *hookdeckgo.EventAttempt if err := core.DoRequest( ctx, - a.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - a.header, + true, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/bad_request_error.go b/bad_request_error.go deleted file mode 100644 index 5f281c8..0000000 --- a/bad_request_error.go +++ /dev/null @@ -1,27 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - core "github.com/fern-hookdeck/hookdeck-go/core" -) - -type BadRequestError struct { - *core.APIError - Body *ApiErrorResponse -} - -func (b *BadRequestError) UnmarshalJSON(data []byte) error { - body := new(ApiErrorResponse) - if err := json.Unmarshal(data, &body); err != nil { - return err - } - b.StatusCode = 400 - b.Body = body - return nil -} - -func (b *BadRequestError) MarshalJSON() ([]byte, error) { - return json.Marshal(b.Body) -} diff --git a/basic_auth_integration_configs.go b/basic_auth_integration_configs.go deleted file mode 100644 index c7539e5..0000000 --- a/basic_auth_integration_configs.go +++ /dev/null @@ -1,8 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type BasicAuthIntegrationConfigs struct { - Name string `json:"name"` - Password string `json:"password"` -} diff --git a/batch_operation.go b/batch_operation.go deleted file mode 100644 index db184fd..0000000 --- a/batch_operation.go +++ /dev/null @@ -1,35 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type BatchOperation struct { - // ID of the bulk retry - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - // Query object to filter records - Query *BatchOperationQuery `json:"query,omitempty"` - // Date the bulk retry was created - CreatedAt string `json:"created_at"` - // Last time the bulk retry was updated - UpdatedAt string `json:"updated_at"` - // Date the bulk retry was cancelled - CancelledAt *string `json:"cancelled_at,omitempty"` - // Date the bulk retry was completed - CompletedAt *string `json:"completed_at,omitempty"` - // Number of batches required to complete the bulk retry - EstimatedBatch *int `json:"estimated_batch,omitempty"` - // Number of estimated events to be retried - EstimatedCount *int `json:"estimated_count,omitempty"` - // Number of batches currently processed - ProcessedBatch *int `json:"processed_batch,omitempty"` - // Number of events that were successfully delivered - CompletedCount *int `json:"completed_count,omitempty"` - // Indicates if the bulk retry is currently in progress - InProgress bool `json:"in_progress"` - // Progression of the batch operations, values 0 - 1 - Progress *float64 `json:"progress,omitempty"` - // Number of events that failed to be delivered - FailedCount *int `json:"failed_count,omitempty"` - Number *float64 `json:"number,omitempty"` -} diff --git a/batch_operation_paginated_result.go b/batch_operation_paginated_result.go deleted file mode 100644 index 0cdf20d..0000000 --- a/batch_operation_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type BatchOperationPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*BatchOperation `json:"models,omitempty"` -} diff --git a/batch_operation_plan.go b/batch_operation_plan.go deleted file mode 100644 index 8913385..0000000 --- a/batch_operation_plan.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type BatchOperationPlan struct { - // Number of batches required to complete the bulk retry - EstimatedBatch *int `json:"estimated_batch,omitempty"` - // Number of estimated events to be retried - EstimatedCount *int `json:"estimated_count,omitempty"` - // Progression of the batch operations, values 0 - 1 - Progress *float64 `json:"progress,omitempty"` -} diff --git a/batch_operation_query.go b/batch_operation_query.go deleted file mode 100644 index ac9f51b..0000000 --- a/batch_operation_query.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Query object to filter records -type BatchOperationQuery struct { - typeName string - StringUnknownMap map[string]any - StringOptional *string -} - -func NewBatchOperationQueryFromStringUnknownMap(value map[string]any) *BatchOperationQuery { - return &BatchOperationQuery{typeName: "stringUnknownMap", StringUnknownMap: value} -} - -func NewBatchOperationQueryFromStringOptional(value *string) *BatchOperationQuery { - return &BatchOperationQuery{typeName: "stringOptional", StringOptional: value} -} - -func (b *BatchOperationQuery) UnmarshalJSON(data []byte) error { - var valueStringUnknownMap map[string]any - if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { - b.typeName = "stringUnknownMap" - b.StringUnknownMap = valueStringUnknownMap - return nil - } - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - b.typeName = "stringOptional" - b.StringOptional = valueStringOptional - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, b) -} - -func (b BatchOperationQuery) MarshalJSON() ([]byte, error) { - switch b.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", b.typeName, b) - case "stringUnknownMap": - return json.Marshal(b.StringUnknownMap) - case "stringOptional": - return json.Marshal(b.StringOptional) - } -} - -type BatchOperationQueryVisitor interface { - VisitStringUnknownMap(map[string]any) error - VisitStringOptional(*string) error -} - -func (b *BatchOperationQuery) Accept(v BatchOperationQueryVisitor) error { - switch b.typeName { - default: - return fmt.Errorf("invalid type %s in %T", b.typeName, b) - case "stringUnknownMap": - return v.VisitStringUnknownMap(b.StringUnknownMap) - case "stringOptional": - return v.VisitStringOptional(b.StringOptional) - } -} diff --git a/bookmark.go b/bookmark.go deleted file mode 100644 index 87abaa4..0000000 --- a/bookmark.go +++ /dev/null @@ -1,25 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type Bookmark struct { - // ID of the bookmark - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - // ID of the associated connection - WebhookId string `json:"webhook_id"` - // ID of the bookmarked event data - EventDataId string `json:"event_data_id"` - // Descriptive name of the bookmark - Label string `json:"label"` - // Alternate alias for the bookmark - Alias *string `json:"alias,omitempty"` - Data *ShortEventData `json:"data,omitempty"` - // Date the bookmark was last manually triggered - LastUsedAt *string `json:"last_used_at,omitempty"` - // Date the bookmark was last updated - UpdatedAt string `json:"updated_at"` - // Date the bookmark was created - CreatedAt string `json:"created_at"` -} diff --git a/bookmark_paginated_result.go b/bookmark_paginated_result.go deleted file mode 100644 index b78b8a3..0000000 --- a/bookmark_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type BookmarkPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Bookmark `json:"models,omitempty"` -} diff --git a/bookmarks.go b/bookmarks.go new file mode 100644 index 0000000..e9dc240 --- /dev/null +++ b/bookmarks.go @@ -0,0 +1,48 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateBookmarkRequest struct { + // ID of the event data to bookmark `<= 255 characters` + EventDataId string `json:"event_data_id"` + // ID of the associated connection `<= 255 characters` + WebhookId string `json:"webhook_id"` + // Descriptive name of the bookmark `<= 255 characters` + Label string `json:"label"` + // A unique, human-friendly name for the bookmark `<= 155 characters` + Name *string `json:"name,omitempty"` +} + +type GetBookmarksRequest struct { + Id *string `json:"-"` + Name *string `json:"-"` + WebhookId *string `json:"-"` + EventDataId *string `json:"-"` + Label *string `json:"-"` + LastUsedAt *time.Time `json:"-"` + OrderBy *string `json:"-"` + Dir *GetBookmarksRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type TriggerBookmarkRequest struct { + // Bookmark target + Target *TriggerBookmarkRequestTarget `json:"target,omitempty"` +} + +type UpdateBookmarkRequest struct { + // ID of the event data to bookmark `<= 255 characters` + EventDataId *string `json:"event_data_id,omitempty"` + // ID of the associated connection `<= 255 characters` + WebhookId *string `json:"webhook_id,omitempty"` + // Descriptive name of the bookmark `<= 255 characters` + Label *string `json:"label,omitempty"` + // A unique, human-friendly name for the bookmark `<= 155 characters` + Name *string `json:"name,omitempty"` +} diff --git a/bookmarks_client.go b/bookmarks/client.go similarity index 61% rename from bookmarks_client.go rename to bookmarks/client.go index 01c5b04..9ddfb3f 100644 --- a/bookmarks_client.go +++ b/bookmarks/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package bookmarks import ( bytes "bytes" @@ -8,89 +8,80 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type BookmarksClient interface { - GetBookmarks(ctx context.Context, request *GetBookmarksRequest) (*BookmarkPaginatedResult, error) - CreateBookmark(ctx context.Context, request *CreateBookmarkRequest) (*Bookmark, error) - GetBookmark(ctx context.Context, id string) (*Bookmark, error) - UpdateBookmark(ctx context.Context, id string, request *UpdateBookmarkRequest) (*Bookmark, error) - DeleteBookmark(ctx context.Context, id string) (*DeletedBookmarkResponse, error) - TriggerBookmark(ctx context.Context, id string, request *TriggerBookmarkRequest) (EventArray, error) +type Client interface { + GetBookmarks(ctx context.Context, request *hookdeckgo.GetBookmarksRequest) (*hookdeckgo.BookmarkPaginatedResult, error) + CreateBookmark(ctx context.Context, request *hookdeckgo.CreateBookmarkRequest) (*hookdeckgo.Bookmark, error) + GetBookmark(ctx context.Context, id string) (*hookdeckgo.Bookmark, error) + UpdateBookmark(ctx context.Context, id string, request *hookdeckgo.UpdateBookmarkRequest) (*hookdeckgo.Bookmark, error) + DeleteBookmark(ctx context.Context, id string) (*hookdeckgo.DeletedBookmarkResponse, error) + TriggerBookmark(ctx context.Context, id string, request *hookdeckgo.TriggerBookmarkRequest) (hookdeckgo.EventArray, error) } -func NewBookmarksClient(opts ...core.ClientOption) BookmarksClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &bookmarksClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type bookmarksClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (b *bookmarksClient) GetBookmarks(ctx context.Context, request *GetBookmarksRequest) (*BookmarkPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GetBookmarks(ctx context.Context, request *hookdeckgo.GetBookmarksRequest) (*hookdeckgo.BookmarkPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bookmarks" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var nameDefaultValue *string - if request.Name != nameDefaultValue { + if request.Name != nil { queryParams.Add("name", fmt.Sprintf("%v", *request.Name)) } - var webhookIdDefaultValue *string - if request.WebhookId != webhookIdDefaultValue { + if request.WebhookId != nil { queryParams.Add("webhook_id", fmt.Sprintf("%v", *request.WebhookId)) } - var eventDataIdDefaultValue *string - if request.EventDataId != eventDataIdDefaultValue { + if request.EventDataId != nil { queryParams.Add("event_data_id", fmt.Sprintf("%v", *request.EventDataId)) } - var labelDefaultValue *string - if request.Label != labelDefaultValue { + if request.Label != nil { queryParams.Add("label", fmt.Sprintf("%v", *request.Label)) } - var lastUsedAtDefaultValue *string - if request.LastUsedAt != lastUsedAtDefaultValue { - queryParams.Add("last_used_at", fmt.Sprintf("%v", *request.LastUsedAt)) + if request.LastUsedAt != nil { + queryParams.Add("last_used_at", fmt.Sprintf("%v", request.LastUsedAt.Format(time.RFC3339))) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetBookmarksRequestDirGetBookmarksRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -106,14 +97,14 @@ func (b *bookmarksClient) GetBookmarks(ctx context.Context, request *GetBookmark decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -123,15 +114,16 @@ func (b *bookmarksClient) GetBookmarks(ctx context.Context, request *GetBookmark return apiError } - response := new(BookmarkPaginatedResult) + var response *hookdeckgo.BookmarkPaginatedResult if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -139,10 +131,10 @@ func (b *bookmarksClient) GetBookmarks(ctx context.Context, request *GetBookmark return response, nil } -func (b *bookmarksClient) CreateBookmark(ctx context.Context, request *CreateBookmarkRequest) (*Bookmark, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) CreateBookmark(ctx context.Context, request *hookdeckgo.CreateBookmarkRequest) (*hookdeckgo.Bookmark, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bookmarks" @@ -155,14 +147,14 @@ func (b *bookmarksClient) CreateBookmark(ctx context.Context, request *CreateBoo decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -172,15 +164,16 @@ func (b *bookmarksClient) CreateBookmark(ctx context.Context, request *CreateBoo return apiError } - response := new(Bookmark) + var response *hookdeckgo.Bookmark if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -188,10 +181,10 @@ func (b *bookmarksClient) CreateBookmark(ctx context.Context, request *CreateBoo return response, nil } -func (b *bookmarksClient) GetBookmark(ctx context.Context, id string) (*Bookmark, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GetBookmark(ctx context.Context, id string) (*hookdeckgo.Bookmark, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bookmarks/%v", id) @@ -204,7 +197,7 @@ func (b *bookmarksClient) GetBookmark(ctx context.Context, id string) (*Bookmark decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -214,15 +207,16 @@ func (b *bookmarksClient) GetBookmark(ctx context.Context, id string) (*Bookmark return apiError } - response := new(Bookmark) + var response *hookdeckgo.Bookmark if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -230,10 +224,10 @@ func (b *bookmarksClient) GetBookmark(ctx context.Context, id string) (*Bookmark return response, nil } -func (b *bookmarksClient) UpdateBookmark(ctx context.Context, id string, request *UpdateBookmarkRequest) (*Bookmark, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) UpdateBookmark(ctx context.Context, id string, request *hookdeckgo.UpdateBookmarkRequest) (*hookdeckgo.Bookmark, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bookmarks/%v", id) @@ -246,21 +240,21 @@ func (b *bookmarksClient) UpdateBookmark(ctx context.Context, id string, request decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -270,15 +264,16 @@ func (b *bookmarksClient) UpdateBookmark(ctx context.Context, id string, request return apiError } - response := new(Bookmark) + var response *hookdeckgo.Bookmark if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -286,10 +281,10 @@ func (b *bookmarksClient) UpdateBookmark(ctx context.Context, id string, request return response, nil } -func (b *bookmarksClient) DeleteBookmark(ctx context.Context, id string) (*DeletedBookmarkResponse, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) DeleteBookmark(ctx context.Context, id string) (*hookdeckgo.DeletedBookmarkResponse, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bookmarks/%v", id) @@ -302,7 +297,7 @@ func (b *bookmarksClient) DeleteBookmark(ctx context.Context, id string) (*Delet decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -312,15 +307,16 @@ func (b *bookmarksClient) DeleteBookmark(ctx context.Context, id string) (*Delet return apiError } - response := new(DeletedBookmarkResponse) + var response *hookdeckgo.DeletedBookmarkResponse if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodDelete, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -328,10 +324,10 @@ func (b *bookmarksClient) DeleteBookmark(ctx context.Context, id string) (*Delet return response, nil } -func (b *bookmarksClient) TriggerBookmark(ctx context.Context, id string, request *TriggerBookmarkRequest) (EventArray, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) TriggerBookmark(ctx context.Context, id string, request *hookdeckgo.TriggerBookmarkRequest) (hookdeckgo.EventArray, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bookmarks/%v/trigger", id) @@ -344,21 +340,21 @@ func (b *bookmarksClient) TriggerBookmark(ctx context.Context, id string, reques decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -368,15 +364,16 @@ func (b *bookmarksClient) TriggerBookmark(ctx context.Context, id string, reques return apiError } - var response EventArray + var response hookdeckgo.EventArray if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/bulk_retry_events.go b/bulk_retry_events.go new file mode 100644 index 0000000..ab1f2bc --- /dev/null +++ b/bulk_retry_events.go @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateEventBulkRetryRequest struct { + // Filter properties for the events to be included in the bulk retry + Query *CreateEventBulkRetryRequestQuery `json:"query,omitempty"` +} + +type GetEventBulkRetriesRequest struct { + CancelledAt *time.Time `json:"-"` + CompletedAt *time.Time `json:"-"` + CreatedAt *time.Time `json:"-"` + Id *string `json:"-"` + QueryPartialMatch *bool `json:"-"` + InProgress *bool `json:"-"` + OrderBy *string `json:"-"` + Dir *GetEventBulkRetriesRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} diff --git a/bulk_retry_ignored_events.go b/bulk_retry_ignored_events.go new file mode 100644 index 0000000..7e9ff13 --- /dev/null +++ b/bulk_retry_ignored_events.go @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateIgnoredEventBulkRetryRequest struct { + // Filter by the bulk retry ignored event query object + Query *CreateIgnoredEventBulkRetryRequestQuery `json:"query,omitempty"` +} + +type GetIgnoredEventBulkRetriesRequest struct { + CancelledAt *time.Time `json:"-"` + CompletedAt *time.Time `json:"-"` + CreatedAt *time.Time `json:"-"` + Id *string `json:"-"` + QueryPartialMatch *bool `json:"-"` + InProgress *bool `json:"-"` + OrderBy *string `json:"-"` + Dir *GetIgnoredEventBulkRetriesRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} diff --git a/bulk_retry_requests.go b/bulk_retry_requests.go new file mode 100644 index 0000000..882dfad --- /dev/null +++ b/bulk_retry_requests.go @@ -0,0 +1,26 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateRequestBulkRetryRequest struct { + // Filter properties for the events to be included in the bulk retry, use query parameters of [Requests](#requests) + Query *CreateRequestBulkRetryRequestQuery `json:"query,omitempty"` +} + +type GetRequestBulkRetriesRequest struct { + CancelledAt *time.Time `json:"-"` + CompletedAt *time.Time `json:"-"` + CreatedAt *time.Time `json:"-"` + Id *string `json:"-"` + InProgress *bool `json:"-"` + QueryPartialMatch *bool `json:"-"` + OrderBy *string `json:"-"` + Dir *GetRequestBulkRetriesRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} diff --git a/bulk_retry_events_client.go b/bulkretryevents/client.go similarity index 58% rename from bulk_retry_events_client.go rename to bulkretryevents/client.go index 66bb1c3..385db9e 100644 --- a/bulk_retry_events_client.go +++ b/bulkretryevents/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package bulkretryevents import ( bytes "bytes" @@ -8,88 +8,79 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type BulkRetryEventsClient interface { - GetEventBulkRetries(ctx context.Context, request *GetEventBulkRetriesRequest) (*BatchOperationPaginatedResult, error) - CreateEventBulkRetry(ctx context.Context, request *CreateEventBulkRetryRequest) (*BatchOperation, error) - GenerateEventBulkRetryPlan(ctx context.Context) (*BatchOperationPlan, error) - GetEventBulkRetry(ctx context.Context, id string) (*BatchOperation, error) - CancelEventBulkRetry(ctx context.Context, id string) (*BatchOperation, error) +type Client interface { + GetEventBulkRetries(ctx context.Context, request *hookdeckgo.GetEventBulkRetriesRequest) (*hookdeckgo.BatchOperationPaginatedResult, error) + CreateEventBulkRetry(ctx context.Context, request *hookdeckgo.CreateEventBulkRetryRequest) (*hookdeckgo.BatchOperation, error) + GenerateEventBulkRetryPlan(ctx context.Context) (*hookdeckgo.GenerateEventBulkRetryPlanResponse, error) + GetEventBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) + CancelEventBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) } -func NewBulkRetryEventsClient(opts ...core.ClientOption) BulkRetryEventsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &bulkRetryEventsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type bulkRetryEventsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (b *bulkRetryEventsClient) GetEventBulkRetries(ctx context.Context, request *GetEventBulkRetriesRequest) (*BatchOperationPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GetEventBulkRetries(ctx context.Context, request *hookdeckgo.GetEventBulkRetriesRequest) (*hookdeckgo.BatchOperationPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/events/retry" queryParams := make(url.Values) - var cancelledAtDefaultValue *string - if request.CancelledAt != cancelledAtDefaultValue { - queryParams.Add("cancelled_at", fmt.Sprintf("%v", *request.CancelledAt)) + if request.CancelledAt != nil { + queryParams.Add("cancelled_at", fmt.Sprintf("%v", request.CancelledAt.Format(time.RFC3339))) } - var completedAtDefaultValue *string - if request.CompletedAt != completedAtDefaultValue { - queryParams.Add("completed_at", fmt.Sprintf("%v", *request.CompletedAt)) + if request.CompletedAt != nil { + queryParams.Add("completed_at", fmt.Sprintf("%v", request.CompletedAt.Format(time.RFC3339))) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.CreatedAt != nil { + queryParams.Add("created_at", fmt.Sprintf("%v", request.CreatedAt.Format(time.RFC3339))) } - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var queryPartialMatchDefaultValue *bool - if request.QueryPartialMatch != queryPartialMatchDefaultValue { + if request.QueryPartialMatch != nil { queryParams.Add("query_partial_match", fmt.Sprintf("%v", *request.QueryPartialMatch)) } - var inProgressDefaultValue *bool - if request.InProgress != inProgressDefaultValue { + if request.InProgress != nil { queryParams.Add("in_progress", fmt.Sprintf("%v", *request.InProgress)) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -105,14 +96,14 @@ func (b *bulkRetryEventsClient) GetEventBulkRetries(ctx context.Context, request decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -122,15 +113,16 @@ func (b *bulkRetryEventsClient) GetEventBulkRetries(ctx context.Context, request return apiError } - response := new(BatchOperationPaginatedResult) + var response *hookdeckgo.BatchOperationPaginatedResult if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -138,10 +130,10 @@ func (b *bulkRetryEventsClient) GetEventBulkRetries(ctx context.Context, request return response, nil } -func (b *bulkRetryEventsClient) CreateEventBulkRetry(ctx context.Context, request *CreateEventBulkRetryRequest) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) CreateEventBulkRetry(ctx context.Context, request *hookdeckgo.CreateEventBulkRetryRequest) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/events/retry" @@ -154,14 +146,14 @@ func (b *bulkRetryEventsClient) CreateEventBulkRetry(ctx context.Context, reques decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -171,15 +163,16 @@ func (b *bulkRetryEventsClient) CreateEventBulkRetry(ctx context.Context, reques return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -187,10 +180,10 @@ func (b *bulkRetryEventsClient) CreateEventBulkRetry(ctx context.Context, reques return response, nil } -func (b *bulkRetryEventsClient) GenerateEventBulkRetryPlan(ctx context.Context) (*BatchOperationPlan, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GenerateEventBulkRetryPlan(ctx context.Context) (*hookdeckgo.GenerateEventBulkRetryPlanResponse, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/events/retry/plan" @@ -203,14 +196,14 @@ func (b *bulkRetryEventsClient) GenerateEventBulkRetryPlan(ctx context.Context) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -220,15 +213,16 @@ func (b *bulkRetryEventsClient) GenerateEventBulkRetryPlan(ctx context.Context) return apiError } - response := new(BatchOperationPlan) + var response *hookdeckgo.GenerateEventBulkRetryPlanResponse if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -236,10 +230,10 @@ func (b *bulkRetryEventsClient) GenerateEventBulkRetryPlan(ctx context.Context) return response, nil } -func (b *bulkRetryEventsClient) GetEventBulkRetry(ctx context.Context, id string) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GetEventBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bulk/events/retry/%v", id) @@ -252,7 +246,7 @@ func (b *bulkRetryEventsClient) GetEventBulkRetry(ctx context.Context, id string decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -262,15 +256,16 @@ func (b *bulkRetryEventsClient) GetEventBulkRetry(ctx context.Context, id string return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -278,10 +273,10 @@ func (b *bulkRetryEventsClient) GetEventBulkRetry(ctx context.Context, id string return response, nil } -func (b *bulkRetryEventsClient) CancelEventBulkRetry(ctx context.Context, id string) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) CancelEventBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bulk/events/retry/%v/cancel", id) @@ -294,7 +289,7 @@ func (b *bulkRetryEventsClient) CancelEventBulkRetry(ctx context.Context, id str decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -304,15 +299,16 @@ func (b *bulkRetryEventsClient) CancelEventBulkRetry(ctx context.Context, id str return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPost, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/bulk_retry_ignored_events_client.go b/bulkretryignoredevents/client.go similarity index 57% rename from bulk_retry_ignored_events_client.go rename to bulkretryignoredevents/client.go index 965e3fd..56cee2f 100644 --- a/bulk_retry_ignored_events_client.go +++ b/bulkretryignoredevents/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package bulkretryignoredevents import ( bytes "bytes" @@ -8,88 +8,79 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type BulkRetryIgnoredEventsClient interface { - GetIgnoredEventBulkRetries(ctx context.Context, request *GetIgnoredEventBulkRetriesRequest) (*BatchOperationPaginatedResult, error) - CreateIgnoredEventBulkRetry(ctx context.Context, request *CreateIgnoredEventBulkRetryRequest) (*BatchOperation, error) - GenerateIgnoredEventBulkRetryPlan(ctx context.Context) (*BatchOperationPlan, error) - GetIgnoredEventBulkRetry(ctx context.Context, id string) (*BatchOperation, error) - CancelIgnoredEventBulkRetry(ctx context.Context, id string) (*BatchOperation, error) +type Client interface { + GetIgnoredEventBulkRetries(ctx context.Context, request *hookdeckgo.GetIgnoredEventBulkRetriesRequest) (*hookdeckgo.BatchOperationPaginatedResult, error) + CreateIgnoredEventBulkRetry(ctx context.Context, request *hookdeckgo.CreateIgnoredEventBulkRetryRequest) (*hookdeckgo.BatchOperation, error) + GenerateIgnoredEventBulkRetryPlan(ctx context.Context) (*hookdeckgo.GenerateIgnoredEventBulkRetryPlanResponse, error) + GetIgnoredEventBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) + CancelIgnoredEventBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) } -func NewBulkRetryIgnoredEventsClient(opts ...core.ClientOption) BulkRetryIgnoredEventsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &bulkRetryIgnoredEventsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type bulkRetryIgnoredEventsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (b *bulkRetryIgnoredEventsClient) GetIgnoredEventBulkRetries(ctx context.Context, request *GetIgnoredEventBulkRetriesRequest) (*BatchOperationPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GetIgnoredEventBulkRetries(ctx context.Context, request *hookdeckgo.GetIgnoredEventBulkRetriesRequest) (*hookdeckgo.BatchOperationPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/ignored-events/retry" queryParams := make(url.Values) - var cancelledAtDefaultValue *string - if request.CancelledAt != cancelledAtDefaultValue { - queryParams.Add("cancelled_at", fmt.Sprintf("%v", *request.CancelledAt)) + if request.CancelledAt != nil { + queryParams.Add("cancelled_at", fmt.Sprintf("%v", request.CancelledAt.Format(time.RFC3339))) } - var completedAtDefaultValue *string - if request.CompletedAt != completedAtDefaultValue { - queryParams.Add("completed_at", fmt.Sprintf("%v", *request.CompletedAt)) + if request.CompletedAt != nil { + queryParams.Add("completed_at", fmt.Sprintf("%v", request.CompletedAt.Format(time.RFC3339))) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.CreatedAt != nil { + queryParams.Add("created_at", fmt.Sprintf("%v", request.CreatedAt.Format(time.RFC3339))) } - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var queryPartialMatchDefaultValue *bool - if request.QueryPartialMatch != queryPartialMatchDefaultValue { + if request.QueryPartialMatch != nil { queryParams.Add("query_partial_match", fmt.Sprintf("%v", *request.QueryPartialMatch)) } - var inProgressDefaultValue *bool - if request.InProgress != inProgressDefaultValue { + if request.InProgress != nil { queryParams.Add("in_progress", fmt.Sprintf("%v", *request.InProgress)) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -105,14 +96,14 @@ func (b *bulkRetryIgnoredEventsClient) GetIgnoredEventBulkRetries(ctx context.Co decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -122,15 +113,16 @@ func (b *bulkRetryIgnoredEventsClient) GetIgnoredEventBulkRetries(ctx context.Co return apiError } - response := new(BatchOperationPaginatedResult) + var response *hookdeckgo.BatchOperationPaginatedResult if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -138,10 +130,10 @@ func (b *bulkRetryIgnoredEventsClient) GetIgnoredEventBulkRetries(ctx context.Co return response, nil } -func (b *bulkRetryIgnoredEventsClient) CreateIgnoredEventBulkRetry(ctx context.Context, request *CreateIgnoredEventBulkRetryRequest) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) CreateIgnoredEventBulkRetry(ctx context.Context, request *hookdeckgo.CreateIgnoredEventBulkRetryRequest) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/ignored-events/retry" @@ -154,14 +146,14 @@ func (b *bulkRetryIgnoredEventsClient) CreateIgnoredEventBulkRetry(ctx context.C decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -171,15 +163,16 @@ func (b *bulkRetryIgnoredEventsClient) CreateIgnoredEventBulkRetry(ctx context.C return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -187,10 +180,10 @@ func (b *bulkRetryIgnoredEventsClient) CreateIgnoredEventBulkRetry(ctx context.C return response, nil } -func (b *bulkRetryIgnoredEventsClient) GenerateIgnoredEventBulkRetryPlan(ctx context.Context) (*BatchOperationPlan, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GenerateIgnoredEventBulkRetryPlan(ctx context.Context) (*hookdeckgo.GenerateIgnoredEventBulkRetryPlanResponse, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/ignored-events/retry/plan" @@ -203,14 +196,14 @@ func (b *bulkRetryIgnoredEventsClient) GenerateIgnoredEventBulkRetryPlan(ctx con decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -220,15 +213,16 @@ func (b *bulkRetryIgnoredEventsClient) GenerateIgnoredEventBulkRetryPlan(ctx con return apiError } - response := new(BatchOperationPlan) + var response *hookdeckgo.GenerateIgnoredEventBulkRetryPlanResponse if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -236,10 +230,10 @@ func (b *bulkRetryIgnoredEventsClient) GenerateIgnoredEventBulkRetryPlan(ctx con return response, nil } -func (b *bulkRetryIgnoredEventsClient) GetIgnoredEventBulkRetry(ctx context.Context, id string) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GetIgnoredEventBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bulk/ignored-events/retry/%v", id) @@ -252,7 +246,7 @@ func (b *bulkRetryIgnoredEventsClient) GetIgnoredEventBulkRetry(ctx context.Cont decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -262,15 +256,16 @@ func (b *bulkRetryIgnoredEventsClient) GetIgnoredEventBulkRetry(ctx context.Cont return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -278,10 +273,10 @@ func (b *bulkRetryIgnoredEventsClient) GetIgnoredEventBulkRetry(ctx context.Cont return response, nil } -func (b *bulkRetryIgnoredEventsClient) CancelIgnoredEventBulkRetry(ctx context.Context, id string) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) CancelIgnoredEventBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bulk/ignored-events/retry/%v/cancel", id) @@ -294,7 +289,7 @@ func (b *bulkRetryIgnoredEventsClient) CancelIgnoredEventBulkRetry(ctx context.C decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -304,15 +299,16 @@ func (b *bulkRetryIgnoredEventsClient) CancelIgnoredEventBulkRetry(ctx context.C return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPost, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/bulk_retry_requests_client.go b/bulkretryrequests/client.go similarity index 57% rename from bulk_retry_requests_client.go rename to bulkretryrequests/client.go index 805ff06..92e75d8 100644 --- a/bulk_retry_requests_client.go +++ b/bulkretryrequests/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package bulkretryrequests import ( bytes "bytes" @@ -8,88 +8,79 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type BulkRetryRequestsClient interface { - GetRequestBulkRetries(ctx context.Context, request *GetRequestBulkRetriesRequest) (*BatchOperationPaginatedResult, error) - CreateRequestBulkRetry(ctx context.Context, request *CreateRequestBulkRetryRequest) (*BatchOperation, error) - GenerateRequestBulkRetryPlan(ctx context.Context) (*BatchOperationPlan, error) - GetRequestBulkRetry(ctx context.Context, id string) (*BatchOperation, error) - CancelRequestBulkRetry(ctx context.Context, id string) (*BatchOperation, error) +type Client interface { + GetRequestBulkRetries(ctx context.Context, request *hookdeckgo.GetRequestBulkRetriesRequest) (*hookdeckgo.BatchOperationPaginatedResult, error) + CreateRequestBulkRetry(ctx context.Context, request *hookdeckgo.CreateRequestBulkRetryRequest) (*hookdeckgo.BatchOperation, error) + GenerateRequestBulkRetryPlan(ctx context.Context) (*hookdeckgo.GenerateRequestBulkRetryPlanResponse, error) + GetRequestBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) + CancelRequestBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) } -func NewBulkRetryRequestsClient(opts ...core.ClientOption) BulkRetryRequestsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &bulkRetryRequestsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type bulkRetryRequestsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (b *bulkRetryRequestsClient) GetRequestBulkRetries(ctx context.Context, request *GetRequestBulkRetriesRequest) (*BatchOperationPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GetRequestBulkRetries(ctx context.Context, request *hookdeckgo.GetRequestBulkRetriesRequest) (*hookdeckgo.BatchOperationPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/requests/retry" queryParams := make(url.Values) - var cancelledAtDefaultValue *string - if request.CancelledAt != cancelledAtDefaultValue { - queryParams.Add("cancelled_at", fmt.Sprintf("%v", *request.CancelledAt)) + if request.CancelledAt != nil { + queryParams.Add("cancelled_at", fmt.Sprintf("%v", request.CancelledAt.Format(time.RFC3339))) } - var completedAtDefaultValue *string - if request.CompletedAt != completedAtDefaultValue { - queryParams.Add("completed_at", fmt.Sprintf("%v", *request.CompletedAt)) + if request.CompletedAt != nil { + queryParams.Add("completed_at", fmt.Sprintf("%v", request.CompletedAt.Format(time.RFC3339))) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.CreatedAt != nil { + queryParams.Add("created_at", fmt.Sprintf("%v", request.CreatedAt.Format(time.RFC3339))) } - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var inProgressDefaultValue *bool - if request.InProgress != inProgressDefaultValue { + if request.InProgress != nil { queryParams.Add("in_progress", fmt.Sprintf("%v", *request.InProgress)) } - var queryPartialMatchDefaultValue *bool - if request.QueryPartialMatch != queryPartialMatchDefaultValue { + if request.QueryPartialMatch != nil { queryParams.Add("query_partial_match", fmt.Sprintf("%v", *request.QueryPartialMatch)) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -105,14 +96,14 @@ func (b *bulkRetryRequestsClient) GetRequestBulkRetries(ctx context.Context, req decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -122,15 +113,16 @@ func (b *bulkRetryRequestsClient) GetRequestBulkRetries(ctx context.Context, req return apiError } - response := new(BatchOperationPaginatedResult) + var response *hookdeckgo.BatchOperationPaginatedResult if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -138,10 +130,10 @@ func (b *bulkRetryRequestsClient) GetRequestBulkRetries(ctx context.Context, req return response, nil } -func (b *bulkRetryRequestsClient) CreateRequestBulkRetry(ctx context.Context, request *CreateRequestBulkRetryRequest) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) CreateRequestBulkRetry(ctx context.Context, request *hookdeckgo.CreateRequestBulkRetryRequest) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/requests/retry" @@ -154,14 +146,14 @@ func (b *bulkRetryRequestsClient) CreateRequestBulkRetry(ctx context.Context, re decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -171,15 +163,16 @@ func (b *bulkRetryRequestsClient) CreateRequestBulkRetry(ctx context.Context, re return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -187,10 +180,10 @@ func (b *bulkRetryRequestsClient) CreateRequestBulkRetry(ctx context.Context, re return response, nil } -func (b *bulkRetryRequestsClient) GenerateRequestBulkRetryPlan(ctx context.Context) (*BatchOperationPlan, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GenerateRequestBulkRetryPlan(ctx context.Context) (*hookdeckgo.GenerateRequestBulkRetryPlanResponse, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "bulk/requests/retry/plan" @@ -203,14 +196,14 @@ func (b *bulkRetryRequestsClient) GenerateRequestBulkRetryPlan(ctx context.Conte decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -220,15 +213,16 @@ func (b *bulkRetryRequestsClient) GenerateRequestBulkRetryPlan(ctx context.Conte return apiError } - response := new(BatchOperationPlan) + var response *hookdeckgo.GenerateRequestBulkRetryPlanResponse if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -236,10 +230,10 @@ func (b *bulkRetryRequestsClient) GenerateRequestBulkRetryPlan(ctx context.Conte return response, nil } -func (b *bulkRetryRequestsClient) GetRequestBulkRetry(ctx context.Context, id string) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) GetRequestBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bulk/requests/retry/%v", id) @@ -252,7 +246,7 @@ func (b *bulkRetryRequestsClient) GetRequestBulkRetry(ctx context.Context, id st decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -262,15 +256,16 @@ func (b *bulkRetryRequestsClient) GetRequestBulkRetry(ctx context.Context, id st return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -278,10 +273,10 @@ func (b *bulkRetryRequestsClient) GetRequestBulkRetry(ctx context.Context, id st return response, nil } -func (b *bulkRetryRequestsClient) CancelRequestBulkRetry(ctx context.Context, id string) (*BatchOperation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if b.baseURL != "" { - baseURL = b.baseURL +func (c *client) CancelRequestBulkRetry(ctx context.Context, id string) (*hookdeckgo.BatchOperation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"bulk/requests/retry/%v/cancel", id) @@ -294,7 +289,7 @@ func (b *bulkRetryRequestsClient) CancelRequestBulkRetry(ctx context.Context, id decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -304,15 +299,16 @@ func (b *bulkRetryRequestsClient) CancelRequestBulkRetry(ctx context.Context, id return apiError } - response := new(BatchOperation) + var response *hookdeckgo.BatchOperation if err := core.DoRequest( ctx, - b.httpClient, + c.httpClient, endpointURL, http.MethodPost, nil, &response, - b.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/client.go b/client.go deleted file mode 100644 index 5b2ebfb..0000000 --- a/client.go +++ /dev/null @@ -1,141 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - core "github.com/fern-hookdeck/hookdeck-go/core" - http "net/http" -) - -type Client interface { - IssueTriggers() IssueTriggersClient - Attempts() AttemptsClient - Bookmarks() BookmarksClient - Destinations() DestinationsClient - Events() EventsClient - BulkRetryEvents() BulkRetryEventsClient - BulkRetryIgnoredEvents() BulkRetryIgnoredEventsClient - Integrations() IntegrationsClient - Issues() IssuesClient - Requests() RequestsClient - BulkRetryRequests() BulkRetryRequestsClient - Rulesets() RulesetsClient - Sources() SourcesClient - Notifications() NotificationsClient - Transformations() TransformationsClient - Connections() ConnectionsClient -} - -func NewClient(opts ...core.ClientOption) Client { - options := core.NewClientOptions() - for _, opt := range opts { - opt(options) - } - return &client{ - baseURL: options.BaseURL, - httpClient: options.HTTPClient, - header: options.ToHeader(), - issueTriggersClient: NewIssueTriggersClient(opts...), - attemptsClient: NewAttemptsClient(opts...), - bookmarksClient: NewBookmarksClient(opts...), - destinationsClient: NewDestinationsClient(opts...), - eventsClient: NewEventsClient(opts...), - bulkRetryEventsClient: NewBulkRetryEventsClient(opts...), - bulkRetryIgnoredEventsClient: NewBulkRetryIgnoredEventsClient(opts...), - integrationsClient: NewIntegrationsClient(opts...), - issuesClient: NewIssuesClient(opts...), - requestsClient: NewRequestsClient(opts...), - bulkRetryRequestsClient: NewBulkRetryRequestsClient(opts...), - rulesetsClient: NewRulesetsClient(opts...), - sourcesClient: NewSourcesClient(opts...), - notificationsClient: NewNotificationsClient(opts...), - transformationsClient: NewTransformationsClient(opts...), - connectionsClient: NewConnectionsClient(opts...), - } -} - -type client struct { - baseURL string - httpClient core.HTTPClient - header http.Header - issueTriggersClient IssueTriggersClient - attemptsClient AttemptsClient - bookmarksClient BookmarksClient - destinationsClient DestinationsClient - eventsClient EventsClient - bulkRetryEventsClient BulkRetryEventsClient - bulkRetryIgnoredEventsClient BulkRetryIgnoredEventsClient - integrationsClient IntegrationsClient - issuesClient IssuesClient - requestsClient RequestsClient - bulkRetryRequestsClient BulkRetryRequestsClient - rulesetsClient RulesetsClient - sourcesClient SourcesClient - notificationsClient NotificationsClient - transformationsClient TransformationsClient - connectionsClient ConnectionsClient -} - -func (c *client) IssueTriggers() IssueTriggersClient { - return c.issueTriggersClient -} - -func (c *client) Attempts() AttemptsClient { - return c.attemptsClient -} - -func (c *client) Bookmarks() BookmarksClient { - return c.bookmarksClient -} - -func (c *client) Destinations() DestinationsClient { - return c.destinationsClient -} - -func (c *client) Events() EventsClient { - return c.eventsClient -} - -func (c *client) BulkRetryEvents() BulkRetryEventsClient { - return c.bulkRetryEventsClient -} - -func (c *client) BulkRetryIgnoredEvents() BulkRetryIgnoredEventsClient { - return c.bulkRetryIgnoredEventsClient -} - -func (c *client) Integrations() IntegrationsClient { - return c.integrationsClient -} - -func (c *client) Issues() IssuesClient { - return c.issuesClient -} - -func (c *client) Requests() RequestsClient { - return c.requestsClient -} - -func (c *client) BulkRetryRequests() BulkRetryRequestsClient { - return c.bulkRetryRequestsClient -} - -func (c *client) Rulesets() RulesetsClient { - return c.rulesetsClient -} - -func (c *client) Sources() SourcesClient { - return c.sourcesClient -} - -func (c *client) Notifications() NotificationsClient { - return c.notificationsClient -} - -func (c *client) Transformations() TransformationsClient { - return c.transformationsClient -} - -func (c *client) Connections() ConnectionsClient { - return c.connectionsClient -} diff --git a/client/client.go b/client/client.go new file mode 100644 index 0000000..33c7900 --- /dev/null +++ b/client/client.go @@ -0,0 +1,149 @@ +// This file was auto-generated by Fern from our API Definition. + +package client + +import ( + attempts "github.com/fern-hookdeck/hookdeck-go/attempts" + bookmarks "github.com/fern-hookdeck/hookdeck-go/bookmarks" + bulkretryevents "github.com/fern-hookdeck/hookdeck-go/bulkretryevents" + bulkretryignoredevents "github.com/fern-hookdeck/hookdeck-go/bulkretryignoredevents" + bulkretryrequests "github.com/fern-hookdeck/hookdeck-go/bulkretryrequests" + connections "github.com/fern-hookdeck/hookdeck-go/connections" + core "github.com/fern-hookdeck/hookdeck-go/core" + destinations "github.com/fern-hookdeck/hookdeck-go/destinations" + events "github.com/fern-hookdeck/hookdeck-go/events" + integrations "github.com/fern-hookdeck/hookdeck-go/integrations" + issues "github.com/fern-hookdeck/hookdeck-go/issues" + issuetriggers "github.com/fern-hookdeck/hookdeck-go/issuetriggers" + notifications "github.com/fern-hookdeck/hookdeck-go/notifications" + requests "github.com/fern-hookdeck/hookdeck-go/requests" + sources "github.com/fern-hookdeck/hookdeck-go/sources" + transformations "github.com/fern-hookdeck/hookdeck-go/transformations" + http "net/http" +) + +type Client interface { + IssueTriggers() issuetriggers.Client + Attempts() attempts.Client + Bookmarks() bookmarks.Client + Destinations() destinations.Client + BulkRetryEvents() bulkretryevents.Client + Events() events.Client + BulkRetryIgnoredEvents() bulkretryignoredevents.Client + Integrations() integrations.Client + Issues() issues.Client + Requests() requests.Client + BulkRetryRequests() bulkretryrequests.Client + Sources() sources.Client + Notifications() notifications.Client + Transformations() transformations.Client + Connections() connections.Client +} + +func NewClient(opts ...core.ClientOption) Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &client{ + baseURL: options.BaseURL, + httpClient: options.HTTPClient, + header: options.ToHeader(), + issueTriggersClient: issuetriggers.NewClient(opts...), + attemptsClient: attempts.NewClient(opts...), + bookmarksClient: bookmarks.NewClient(opts...), + destinationsClient: destinations.NewClient(opts...), + bulkRetryEventsClient: bulkretryevents.NewClient(opts...), + eventsClient: events.NewClient(opts...), + bulkRetryIgnoredEventsClient: bulkretryignoredevents.NewClient(opts...), + integrationsClient: integrations.NewClient(opts...), + issuesClient: issues.NewClient(opts...), + requestsClient: requests.NewClient(opts...), + bulkRetryRequestsClient: bulkretryrequests.NewClient(opts...), + sourcesClient: sources.NewClient(opts...), + notificationsClient: notifications.NewClient(opts...), + transformationsClient: transformations.NewClient(opts...), + connectionsClient: connections.NewClient(opts...), + } +} + +type client struct { + baseURL string + httpClient core.HTTPClient + header http.Header + issueTriggersClient issuetriggers.Client + attemptsClient attempts.Client + bookmarksClient bookmarks.Client + destinationsClient destinations.Client + bulkRetryEventsClient bulkretryevents.Client + eventsClient events.Client + bulkRetryIgnoredEventsClient bulkretryignoredevents.Client + integrationsClient integrations.Client + issuesClient issues.Client + requestsClient requests.Client + bulkRetryRequestsClient bulkretryrequests.Client + sourcesClient sources.Client + notificationsClient notifications.Client + transformationsClient transformations.Client + connectionsClient connections.Client +} + +func (c *client) IssueTriggers() issuetriggers.Client { + return c.issueTriggersClient +} + +func (c *client) Attempts() attempts.Client { + return c.attemptsClient +} + +func (c *client) Bookmarks() bookmarks.Client { + return c.bookmarksClient +} + +func (c *client) Destinations() destinations.Client { + return c.destinationsClient +} + +func (c *client) BulkRetryEvents() bulkretryevents.Client { + return c.bulkRetryEventsClient +} + +func (c *client) Events() events.Client { + return c.eventsClient +} + +func (c *client) BulkRetryIgnoredEvents() bulkretryignoredevents.Client { + return c.bulkRetryIgnoredEventsClient +} + +func (c *client) Integrations() integrations.Client { + return c.integrationsClient +} + +func (c *client) Issues() issues.Client { + return c.issuesClient +} + +func (c *client) Requests() requests.Client { + return c.requestsClient +} + +func (c *client) BulkRetryRequests() bulkretryrequests.Client { + return c.bulkRetryRequestsClient +} + +func (c *client) Sources() sources.Client { + return c.sourcesClient +} + +func (c *client) Notifications() notifications.Client { + return c.notificationsClient +} + +func (c *client) Transformations() transformations.Client { + return c.transformationsClient +} + +func (c *client) Connections() connections.Client { + return c.connectionsClient +} diff --git a/client_options.go b/client/options.go similarity index 72% rename from client_options.go rename to client/options.go index 202fb15..101a48f 100644 --- a/client_options.go +++ b/client/options.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package client import ( core "github.com/fern-hookdeck/hookdeck-go/core" @@ -23,9 +23,7 @@ func ClientWithHTTPClient(httpClient core.HTTPClient) core.ClientOption { } // ClientWithHTTPHeader adds the given http.Header to all requests -// issued by the client. The given headers are added to the final set -// after the standard headers (e.g. Content-Type), but before the -// endpoint-specific headers. +// issued by the client. func ClientWithHTTPHeader(httpHeader http.Header) core.ClientOption { return func(opts *core.ClientOptions) { // Clone the headers so they can't be modified after the option call. @@ -33,9 +31,9 @@ func ClientWithHTTPHeader(httpHeader http.Header) core.ClientOption { } } -// ClientWithAuthBearer sets the 'Authorization: Bearer ' header on every request. -func ClientWithAuthBearer(bearer string) core.ClientOption { +// ClientWithAuthToken sets the 'Authorization: Bearer ' header on every request. +func ClientWithAuthToken(token string) core.ClientOption { return func(opts *core.ClientOptions) { - opts.Bearer = bearer + opts.Token = token } } diff --git a/connection.go b/connection.go deleted file mode 100644 index 0fe2bdc..0000000 --- a/connection.go +++ /dev/null @@ -1,27 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type Connection struct { - // ID of the connection - Id string `json:"id"` - // Unique name of the connection for this source - Name string `json:"name"` - // ID of the workspace - TeamId string `json:"team_id"` - Destination *Destination `json:"destination,omitempty"` - Source *Source `json:"source,omitempty"` - Ruleset *Ruleset `json:"ruleset,omitempty"` - // Array of rules applied to connection after factoring for the ruleset - ResolvedRules *[]*Rule `json:"resolved_rules,omitempty"` - // Array of rules configured on the connection - Rules *[]*Rule `json:"rules,omitempty"` - // Date the connection was archived - ArchivedAt *string `json:"archived_at,omitempty"` - // Date the connection was paused - PausedAt *string `json:"paused_at,omitempty"` - // Date the connection was last updated - UpdatedAt string `json:"updated_at"` - // Date the connection was created - CreatedAt string `json:"created_at"` -} diff --git a/connection_filter_property.go b/connection_filter_property.go deleted file mode 100644 index 573725b..0000000 --- a/connection_filter_property.go +++ /dev/null @@ -1,98 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// JSON using our filter syntax to filter on request headers -type ConnectionFilterProperty struct { - typeName string - StringOptional *string - Double float64 - Boolean bool - ConnectionFilterPropertyConnectionFilterProperty *ConnectionFilterPropertyConnectionFilterProperty -} - -func NewConnectionFilterPropertyFromStringOptional(value *string) *ConnectionFilterProperty { - return &ConnectionFilterProperty{typeName: "stringOptional", StringOptional: value} -} - -func NewConnectionFilterPropertyFromDouble(value float64) *ConnectionFilterProperty { - return &ConnectionFilterProperty{typeName: "double", Double: value} -} - -func NewConnectionFilterPropertyFromBoolean(value bool) *ConnectionFilterProperty { - return &ConnectionFilterProperty{typeName: "boolean", Boolean: value} -} - -func NewConnectionFilterPropertyFromConnectionFilterPropertyConnectionFilterProperty(value *ConnectionFilterPropertyConnectionFilterProperty) *ConnectionFilterProperty { - return &ConnectionFilterProperty{typeName: "connectionFilterPropertyConnectionFilterProperty", ConnectionFilterPropertyConnectionFilterProperty: value} -} - -func (c *ConnectionFilterProperty) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - c.typeName = "stringOptional" - c.StringOptional = valueStringOptional - return nil - } - var valueDouble float64 - if err := json.Unmarshal(data, &valueDouble); err == nil { - c.typeName = "double" - c.Double = valueDouble - return nil - } - var valueBoolean bool - if err := json.Unmarshal(data, &valueBoolean); err == nil { - c.typeName = "boolean" - c.Boolean = valueBoolean - return nil - } - valueConnectionFilterPropertyConnectionFilterProperty := new(ConnectionFilterPropertyConnectionFilterProperty) - if err := json.Unmarshal(data, &valueConnectionFilterPropertyConnectionFilterProperty); err == nil { - c.typeName = "connectionFilterPropertyConnectionFilterProperty" - c.ConnectionFilterPropertyConnectionFilterProperty = valueConnectionFilterPropertyConnectionFilterProperty - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c ConnectionFilterProperty) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "stringOptional": - return json.Marshal(c.StringOptional) - case "double": - return json.Marshal(c.Double) - case "boolean": - return json.Marshal(c.Boolean) - case "connectionFilterPropertyConnectionFilterProperty": - return json.Marshal(c.ConnectionFilterPropertyConnectionFilterProperty) - } -} - -type ConnectionFilterPropertyVisitor interface { - VisitStringOptional(*string) error - VisitDouble(float64) error - VisitBoolean(bool) error - VisitConnectionFilterPropertyConnectionFilterProperty(*ConnectionFilterPropertyConnectionFilterProperty) error -} - -func (c *ConnectionFilterProperty) Accept(v ConnectionFilterPropertyVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "stringOptional": - return v.VisitStringOptional(c.StringOptional) - case "double": - return v.VisitDouble(c.Double) - case "boolean": - return v.VisitBoolean(c.Boolean) - case "connectionFilterPropertyConnectionFilterProperty": - return v.VisitConnectionFilterPropertyConnectionFilterProperty(c.ConnectionFilterPropertyConnectionFilterProperty) - } -} diff --git a/connection_filter_property_connection_filter_property.go b/connection_filter_property_connection_filter_property.go deleted file mode 100644 index 300a0f4..0000000 --- a/connection_filter_property_connection_filter_property.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ConnectionFilterPropertyConnectionFilterProperty struct { -} diff --git a/connection_paginated_result.go b/connection_paginated_result.go deleted file mode 100644 index 5ccf72c..0000000 --- a/connection_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ConnectionPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Connection `json:"models,omitempty"` -} diff --git a/connections.go b/connections.go new file mode 100644 index 0000000..200b345 --- /dev/null +++ b/connections.go @@ -0,0 +1,55 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateConnectionRequest struct { + // A unique name of the connection for the source + Name *string `json:"name,omitempty"` + // Description for the connection + Description *string `json:"description,omitempty"` + // ID of a destination to bind to the connection + DestinationId *string `json:"destination_id,omitempty"` + // ID of a source to bind to the connection + SourceId *string `json:"source_id,omitempty"` + // Destination input object + Destination *CreateConnectionRequestDestination `json:"destination,omitempty"` + // Source input object + Source *CreateConnectionRequestSource `json:"source,omitempty"` + Rules []*Rule `json:"rules,omitempty"` +} + +type GetConnectionsRequest struct { + Id *string `json:"-"` + Name *string `json:"-"` + DestinationId *string `json:"-"` + SourceId *string `json:"-"` + Archived *bool `json:"-"` + ArchivedAt *time.Time `json:"-"` + FullName *string `json:"-"` + PausedAt *time.Time `json:"-"` + OrderBy *GetConnectionsRequestOrderBy `json:"-"` + Dir *GetConnectionsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type UpsertConnectionRequest struct { + // A unique name of the connection for the source + Name *string `json:"name,omitempty"` + // Description for the connection + Description *string `json:"description,omitempty"` + // ID of a destination to bind to the connection + DestinationId *string `json:"destination_id,omitempty"` + // ID of a source to bind to the connection + SourceId *string `json:"source_id,omitempty"` + // Destination input object + Destination *UpsertConnectionRequestDestination `json:"destination,omitempty"` + // Source input object + Source *UpsertConnectionRequestSource `json:"source,omitempty"` + Rules []*Rule `json:"rules,omitempty"` +} diff --git a/rulesets_client.go b/connections/client.go similarity index 55% rename from rulesets_client.go rename to connections/client.go index 19237fd..6f9b534 100644 --- a/rulesets_client.go +++ b/connections/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package connections import ( bytes "bytes" @@ -8,82 +8,87 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type RulesetsClient interface { - GetRulesets(ctx context.Context, request *GetRulesetsRequest) (*RulesetPaginatedResult, error) - CreateRuleset(ctx context.Context, request *CreateRulesetRequest) (*Ruleset, error) - UpsertRuleset(ctx context.Context, request *UpsertRulesetRequest) (*Ruleset, error) - GetRuleset(ctx context.Context, id string) (*Ruleset, error) - UpdateRuleset(ctx context.Context, id string, request *UpdateRulesetRequest) (*Ruleset, error) - ArchiveRuleset(ctx context.Context, id string) (*Ruleset, error) - UnarchiveRuleset(ctx context.Context, id string) (*Ruleset, error) +type Client interface { + GetConnections(ctx context.Context, request *hookdeckgo.GetConnectionsRequest) (*hookdeckgo.ConnectionPaginatedResult, error) + CreateConnection(ctx context.Context, request *hookdeckgo.CreateConnectionRequest) (*hookdeckgo.Connection, error) + UpsertConnection(ctx context.Context, request *hookdeckgo.UpsertConnectionRequest) (*hookdeckgo.Connection, error) + ArchiveConnection(ctx context.Context, id string) (*hookdeckgo.Connection, error) + UnarchiveConnection(ctx context.Context, id string) (*hookdeckgo.Connection, error) + PauseConnection(ctx context.Context, id string) (*hookdeckgo.Connection, error) + UnpauseConnection(ctx context.Context, id string) (*hookdeckgo.Connection, error) } -func NewRulesetsClient(opts ...core.ClientOption) RulesetsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &rulesetsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type rulesetsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (r *rulesetsClient) GetRulesets(ctx context.Context, request *GetRulesetsRequest) (*RulesetPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) GetConnections(ctx context.Context, request *hookdeckgo.GetConnectionsRequest) (*hookdeckgo.ConnectionPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } - endpointURL := baseURL + "/" + "rulesets" + endpointURL := baseURL + "/" + "connections" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var nameDefaultValue *string - if request.Name != nameDefaultValue { + if request.Name != nil { queryParams.Add("name", fmt.Sprintf("%v", *request.Name)) } - var archivedDefaultValue *bool - if request.Archived != archivedDefaultValue { + if request.DestinationId != nil { + queryParams.Add("destination_id", fmt.Sprintf("%v", *request.DestinationId)) + } + if request.SourceId != nil { + queryParams.Add("source_id", fmt.Sprintf("%v", *request.SourceId)) + } + if request.Archived != nil { queryParams.Add("archived", fmt.Sprintf("%v", *request.Archived)) } - var archivedAtDefaultValue *string - if request.ArchivedAt != archivedAtDefaultValue { - queryParams.Add("archived_at", fmt.Sprintf("%v", *request.ArchivedAt)) + if request.ArchivedAt != nil { + queryParams.Add("archived_at", fmt.Sprintf("%v", request.ArchivedAt.Format(time.RFC3339))) + } + if request.FullName != nil { + queryParams.Add("full_name", fmt.Sprintf("%v", *request.FullName)) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.PausedAt != nil { + queryParams.Add("paused_at", fmt.Sprintf("%v", request.PausedAt.Format(time.RFC3339))) + } + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetRulesetsRequestDirGetRulesetsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -99,14 +104,14 @@ func (r *rulesetsClient) GetRulesets(ctx context.Context, request *GetRulesetsRe decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -116,15 +121,16 @@ func (r *rulesetsClient) GetRulesets(ctx context.Context, request *GetRulesetsRe return apiError } - response := new(RulesetPaginatedResult) + var response *hookdeckgo.ConnectionPaginatedResult if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -132,12 +138,12 @@ func (r *rulesetsClient) GetRulesets(ctx context.Context, request *GetRulesetsRe return response, nil } -func (r *rulesetsClient) CreateRuleset(ctx context.Context, request *CreateRulesetRequest) (*Ruleset, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) CreateConnection(ctx context.Context, request *hookdeckgo.CreateConnectionRequest) (*hookdeckgo.Connection, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } - endpointURL := baseURL + "/" + "rulesets" + endpointURL := baseURL + "/" + "connections" errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -148,14 +154,14 @@ func (r *rulesetsClient) CreateRuleset(ctx context.Context, request *CreateRules decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -165,15 +171,16 @@ func (r *rulesetsClient) CreateRuleset(ctx context.Context, request *CreateRules return apiError } - response := new(Ruleset) + var response *hookdeckgo.Connection if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -181,12 +188,12 @@ func (r *rulesetsClient) CreateRuleset(ctx context.Context, request *CreateRules return response, nil } -func (r *rulesetsClient) UpsertRuleset(ctx context.Context, request *UpsertRulesetRequest) (*Ruleset, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) UpsertConnection(ctx context.Context, request *hookdeckgo.UpsertConnectionRequest) (*hookdeckgo.Connection, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } - endpointURL := baseURL + "/" + "rulesets" + endpointURL := baseURL + "/" + "connections" errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -197,14 +204,14 @@ func (r *rulesetsClient) UpsertRuleset(ctx context.Context, request *UpsertRules decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -214,15 +221,16 @@ func (r *rulesetsClient) UpsertRuleset(ctx context.Context, request *UpsertRules return apiError } - response := new(Ruleset) + var response *hookdeckgo.Connection if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -230,12 +238,12 @@ func (r *rulesetsClient) UpsertRuleset(ctx context.Context, request *UpsertRules return response, nil } -func (r *rulesetsClient) GetRuleset(ctx context.Context, id string) (*Ruleset, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) ArchiveConnection(ctx context.Context, id string) (*hookdeckgo.Connection, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"rulesets/%v", id) + endpointURL := fmt.Sprintf(baseURL+"/"+"connections/%v/archive", id) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -246,7 +254,7 @@ func (r *rulesetsClient) GetRuleset(ctx context.Context, id string) (*Ruleset, e decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -256,15 +264,16 @@ func (r *rulesetsClient) GetRuleset(ctx context.Context, id string) (*Ruleset, e return apiError } - response := new(Ruleset) + var response *hookdeckgo.Connection if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, - http.MethodGet, + http.MethodPut, nil, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -272,12 +281,12 @@ func (r *rulesetsClient) GetRuleset(ctx context.Context, id string) (*Ruleset, e return response, nil } -func (r *rulesetsClient) UpdateRuleset(ctx context.Context, id string, request *UpdateRulesetRequest) (*Ruleset, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) UnarchiveConnection(ctx context.Context, id string) (*hookdeckgo.Connection, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"rulesets/%v", id) + endpointURL := fmt.Sprintf(baseURL+"/"+"connections/%v/unarchive", id) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -287,22 +296,8 @@ func (r *rulesetsClient) UpdateRuleset(ctx context.Context, id string, request * apiError := core.NewAPIError(statusCode, errors.New(string(raw))) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -312,15 +307,16 @@ func (r *rulesetsClient) UpdateRuleset(ctx context.Context, id string, request * return apiError } - response := new(Ruleset) + var response *hookdeckgo.Connection if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodPut, - request, + nil, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -328,12 +324,12 @@ func (r *rulesetsClient) UpdateRuleset(ctx context.Context, id string, request * return response, nil } -func (r *rulesetsClient) ArchiveRuleset(ctx context.Context, id string) (*Ruleset, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) PauseConnection(ctx context.Context, id string) (*hookdeckgo.Connection, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"rulesets/%v/archive", id) + endpointURL := fmt.Sprintf(baseURL+"/"+"connections/%v/pause", id) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -344,7 +340,7 @@ func (r *rulesetsClient) ArchiveRuleset(ctx context.Context, id string) (*Rulese decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -354,15 +350,16 @@ func (r *rulesetsClient) ArchiveRuleset(ctx context.Context, id string) (*Rulese return apiError } - response := new(Ruleset) + var response *hookdeckgo.Connection if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -370,12 +367,12 @@ func (r *rulesetsClient) ArchiveRuleset(ctx context.Context, id string) (*Rulese return response, nil } -func (r *rulesetsClient) UnarchiveRuleset(ctx context.Context, id string) (*Ruleset, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) UnpauseConnection(ctx context.Context, id string) (*hookdeckgo.Connection, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"rulesets/%v/unarchive", id) + endpointURL := fmt.Sprintf(baseURL+"/"+"connections/%v/unpause", id) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -386,7 +383,7 @@ func (r *rulesetsClient) UnarchiveRuleset(ctx context.Context, id string) (*Rule decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -396,15 +393,16 @@ func (r *rulesetsClient) UnarchiveRuleset(ctx context.Context, id string) (*Rule return apiError } - response := new(Ruleset) + var response *hookdeckgo.Connection if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/connections_client.go b/connections_client.go deleted file mode 100644 index e6bc198..0000000 --- a/connections_client.go +++ /dev/null @@ -1,515 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - bytes "bytes" - context "context" - json "encoding/json" - errors "errors" - fmt "fmt" - core "github.com/fern-hookdeck/hookdeck-go/core" - io "io" - http "net/http" - url "net/url" -) - -type ConnectionsClient interface { - GetConnections(ctx context.Context, request *GetConnectionsRequest) (*ConnectionPaginatedResult, error) - CreateConnection(ctx context.Context, request *CreateConnectionRequest) (*Connection, error) - UpsertConnection(ctx context.Context, request *UpsertConnectionRequest) (*Connection, error) - GetConnection(ctx context.Context, id string) (*Connection, error) - UpdateConnection(ctx context.Context, id string, request *UpdateConnectionRequest) (*Connection, error) - ArchiveConnection(ctx context.Context, id string) (*Connection, error) - UnarchiveConnection(ctx context.Context, id string) (*Connection, error) - PauseConnection(ctx context.Context, id string) (*Connection, error) - UnpauseConnection(ctx context.Context, id string) (*Connection, error) -} - -func NewConnectionsClient(opts ...core.ClientOption) ConnectionsClient { - options := core.NewClientOptions() - for _, opt := range opts { - opt(options) - } - return &connectionsClient{ - baseURL: options.BaseURL, - httpClient: options.HTTPClient, - header: options.ToHeader(), - } -} - -type connectionsClient struct { - baseURL string - httpClient core.HTTPClient - header http.Header -} - -func (c *connectionsClient) GetConnections(ctx context.Context, request *GetConnectionsRequest) (*ConnectionPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := baseURL + "/" + "webhooks" - - queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { - queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) - } - var nameDefaultValue *string - if request.Name != nameDefaultValue { - queryParams.Add("name", fmt.Sprintf("%v", *request.Name)) - } - var destinationIdDefaultValue *string - if request.DestinationId != destinationIdDefaultValue { - queryParams.Add("destination_id", fmt.Sprintf("%v", *request.DestinationId)) - } - var sourceIdDefaultValue *string - if request.SourceId != sourceIdDefaultValue { - queryParams.Add("source_id", fmt.Sprintf("%v", *request.SourceId)) - } - var archivedDefaultValue *bool - if request.Archived != archivedDefaultValue { - queryParams.Add("archived", fmt.Sprintf("%v", *request.Archived)) - } - var archivedAtDefaultValue *string - if request.ArchivedAt != archivedAtDefaultValue { - queryParams.Add("archived_at", fmt.Sprintf("%v", *request.ArchivedAt)) - } - var fullNameDefaultValue *string - if request.FullName != fullNameDefaultValue { - queryParams.Add("full_name", fmt.Sprintf("%v", *request.FullName)) - } - var pausedAtDefaultValue *string - if request.PausedAt != pausedAtDefaultValue { - queryParams.Add("paused_at", fmt.Sprintf("%v", *request.PausedAt)) - } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { - queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) - } - var dirDefaultValue *GetConnectionsRequestDirGetConnectionsRequestDir - if request.Dir != dirDefaultValue { - queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) - } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { - queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) - } - var nextDefaultValue *string - if request.Next != nextDefaultValue { - queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) - } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { - queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) - } - if len(queryParams) > 0 { - endpointURL += "?" + queryParams.Encode() - } - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 422: - value := new(UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(ConnectionPaginatedResult) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodGet, - request, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -func (c *connectionsClient) CreateConnection(ctx context.Context, request *CreateConnectionRequest) (*Connection, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := baseURL + "/" + "webhooks" - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 422: - value := new(UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(Connection) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodPost, - request, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -func (c *connectionsClient) UpsertConnection(ctx context.Context, request *UpsertConnectionRequest) (*Connection, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := baseURL + "/" + "webhooks" - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 422: - value := new(UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(Connection) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodPut, - request, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -func (c *connectionsClient) GetConnection(ctx context.Context, id string) (*Connection, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"webhooks/%v", id) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(Connection) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodGet, - nil, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -func (c *connectionsClient) UpdateConnection(ctx context.Context, id string, request *UpdateConnectionRequest) (*Connection, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"webhooks/%v", id) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 422: - value := new(UnprocessableEntityError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(Connection) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodPut, - request, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -func (c *connectionsClient) ArchiveConnection(ctx context.Context, id string) (*Connection, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"webhooks/%v/archive", id) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(Connection) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodPut, - nil, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -func (c *connectionsClient) UnarchiveConnection(ctx context.Context, id string) (*Connection, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"webhooks/%v/unarchive", id) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(Connection) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodPut, - nil, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -func (c *connectionsClient) PauseConnection(ctx context.Context, id string) (*Connection, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"webhooks/%v/pause", id) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(Connection) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodPut, - nil, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -func (c *connectionsClient) UnpauseConnection(ctx context.Context, id string) (*Connection, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if c.baseURL != "" { - baseURL = c.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"webhooks/%v/unpause", id) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - response := new(Connection) - if err := core.DoRequest( - ctx, - c.httpClient, - endpointURL, - http.MethodPut, - nil, - &response, - c.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} diff --git a/console_line.go b/console_line.go deleted file mode 100644 index 5d5861e..0000000 --- a/console_line.go +++ /dev/null @@ -1,8 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ConsoleLine struct { - Type ConsoleLineType `json:"type,omitempty"` - Message string `json:"message"` -} diff --git a/console_line_type.go b/console_line_type.go deleted file mode 100644 index 0c629f6..0000000 --- a/console_line_type.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type ConsoleLineType uint8 - -const ( - ConsoleLineTypeError ConsoleLineType = iota + 1 - ConsoleLineTypeLog - ConsoleLineTypeWarn - ConsoleLineTypeInfo - ConsoleLineTypeDebug -) - -func (c ConsoleLineType) String() string { - switch c { - default: - return strconv.Itoa(int(c)) - case ConsoleLineTypeError: - return "error" - case ConsoleLineTypeLog: - return "log" - case ConsoleLineTypeWarn: - return "warn" - case ConsoleLineTypeInfo: - return "info" - case ConsoleLineTypeDebug: - return "debug" - } -} - -func (c ConsoleLineType) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", c.String())), nil -} - -func (c *ConsoleLineType) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "error": - value := ConsoleLineTypeError - *c = value - case "log": - value := ConsoleLineTypeLog - *c = value - case "warn": - value := ConsoleLineTypeWarn - *c = value - case "info": - value := ConsoleLineTypeInfo - *c = value - case "debug": - value := ConsoleLineTypeDebug - *c = value - } - return nil -} diff --git a/core/client_option.go b/core/client_option.go index 485cf93..2ab283e 100644 --- a/core/client_option.go +++ b/core/client_option.go @@ -16,7 +16,7 @@ type ClientOptions struct { BaseURL string HTTPClient HTTPClient HTTPHeader http.Header - Bearer string + Token string } // NewClientOptions returns a new *ClientOptions value. @@ -32,9 +32,17 @@ func NewClientOptions() *ClientOptions { // ToHeader maps the configured client options into a http.Header issued // on every request. func (c *ClientOptions) ToHeader() http.Header { - header := c.HTTPHeader.Clone() - if c.Bearer != "" { - header.Set("Authorization", "Bearer "+c.Bearer) + header := c.cloneHeader() + if c.Token != "" { + header.Set("Authorization", "Bearer "+c.Token) } return header } + +func (c *ClientOptions) cloneHeader() http.Header { + headers := c.HTTPHeader.Clone() + headers.Set("X-Fern-Language", "Go") + headers.Set("X-Fern-SDK-Name", "github.com/fern-hookdeck/hookdeck-go") + headers.Set("X-Fern-SDK-Version", "0.0.23") + return headers +} diff --git a/core/core.go b/core/core.go index aab1edd..694e02b 100644 --- a/core/core.go +++ b/core/core.go @@ -14,29 +14,8 @@ const ( // contentType specifies the JSON Content-Type header value. contentType = "application/json" contentTypeHeader = "Content-Type" - - // fernLanguage specifies the value of the X-Fern-Language header. - fernLanguage = "go" - fernLanguageHeader = "X-Fern-Language" - - // fernSDKName specifies the name of this Fern SDK. - fernSDKName = "fern-go-sdk" - fernSDKNameHeader = "X-Fern-SDK-Name" - - // fernSDKVersion specifies the version of this Fern SDK. - fernSDKVersion = "0.0.1" - fernSDKVersionHeader = "X-Fern-SDK-Version" ) -// fernHeaders specifies all of the standard Fern headers in -// a set so that they're easier to access and reference. -var fernHeaders = map[string]string{ - contentTypeHeader: contentType, - fernLanguageHeader: fernLanguage, - fernSDKNameHeader: fernSDKName, - fernSDKVersionHeader: fernSDKVersion, -} - // HTTPClient is an interface for a subset of the *http.Client. type HTTPClient interface { Do(*http.Request) (*http.Response, error) @@ -81,6 +60,10 @@ func (a *APIError) Error() string { return fmt.Sprintf("%d: %s", a.StatusCode, a.err.Error()) } +// ErrorDecoder decodes *http.Response errors and returns a +// typed API error (e.g. *APIError). +type ErrorDecoder func(statusCode int, body io.Reader) error + // DoRequest issues a JSON request to the given url. func DoRequest( ctx context.Context, @@ -89,8 +72,9 @@ func DoRequest( method string, request any, response any, + responseIsOptional bool, endpointHeaders http.Header, - errorDecoder func(int, io.Reader) error, + errorDecoder ErrorDecoder, ) error { var requestBody io.Reader if request != nil { @@ -123,7 +107,7 @@ func DoRequest( // Check if the call was cancelled before we return the error // associated with the call and/or unmarshal the response data. - if err = ctx.Err(); err != nil { + if err := ctx.Err(); err != nil { return err } @@ -138,23 +122,35 @@ func DoRequest( // types, so we just read the body as-is, and // put it into a normal error. bytes, err := io.ReadAll(resp.Body) - if err != nil { + if err != nil && err != io.EOF { return err } + if err == io.EOF { + // The error didn't have a response body, + // so all we can do is return an error + // with the status code. + return NewAPIError(resp.StatusCode, nil) + } return NewAPIError(resp.StatusCode, errors.New(string(bytes))) } // Mutate the response parameter in-place. if response != nil { if writer, ok := response.(io.Writer); ok { - if _, err := io.Copy(writer, resp.Body); err != nil { - return err - } + _, err = io.Copy(writer, resp.Body) } else { - decoder := json.NewDecoder(resp.Body) - if err := decoder.Decode(response); err != nil { - return err + err = json.NewDecoder(resp.Body).Decode(response) + } + if err != nil { + if err == io.EOF { + if responseIsOptional { + // The response is optional, so we should ignore the + // io.EOF error + return nil + } + return fmt.Errorf("expected a %T response, but the server responded with nothing", response) } + return err } } @@ -175,9 +171,7 @@ func newRequest( return nil, err } req = req.WithContext(ctx) - for name, value := range fernHeaders { - req.Header.Set(name, value) - } + req.Header.Set(contentTypeHeader, contentType) for name, values := range endpointHeaders { req.Header[name] = values } diff --git a/core/core_test.go b/core/core_test.go new file mode 100644 index 0000000..e76344f --- /dev/null +++ b/core/core_test.go @@ -0,0 +1,217 @@ +package core + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "io" + "net/http" + "net/http/httptest" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +// TestCase represents a single test case. +type TestCase struct { + description string + + // Server-side assertions. + giveMethod string + giveResponseIsOptional bool + giveHeader http.Header + giveErrorDecoder ErrorDecoder + giveRequest *Request + + // Client-side assertions. + wantResponse *Response + wantError error +} + +// Request a simple request body. +type Request struct { + Id string `json:"id"` +} + +// Response a simple response body. +type Response struct { + Id string `json:"id"` +} + +// NotFoundError represents a 404. +type NotFoundError struct { + *APIError + + Message string `json:"message"` +} + +func TestDoRequest(t *testing.T) { + tests := []*TestCase{ + { + description: "GET success", + giveMethod: http.MethodGet, + giveHeader: http.Header{ + "X-API-Status": []string{"success"}, + }, + giveRequest: &Request{ + Id: "123", + }, + wantResponse: &Response{ + Id: "123", + }, + }, + { + description: "GET not found", + giveMethod: http.MethodGet, + giveHeader: http.Header{ + "X-API-Status": []string{"fail"}, + }, + giveRequest: &Request{ + Id: strconv.Itoa(http.StatusNotFound), + }, + giveErrorDecoder: newTestErrorDecoder(t), + wantError: &NotFoundError{ + APIError: NewAPIError( + http.StatusNotFound, + errors.New(`{"message":"ID \"404\" not found"}`), + ), + }, + }, + { + description: "POST optional response", + giveMethod: http.MethodPost, + giveHeader: http.Header{ + "X-API-Status": []string{"success"}, + }, + giveRequest: &Request{ + Id: "123", + }, + giveResponseIsOptional: true, + }, + { + description: "POST API error", + giveMethod: http.MethodPost, + giveHeader: http.Header{ + "X-API-Status": []string{"fail"}, + }, + giveRequest: &Request{ + Id: strconv.Itoa(http.StatusInternalServerError), + }, + wantError: NewAPIError( + http.StatusInternalServerError, + errors.New("failed to process request"), + ), + }, + } + for _, test := range tests { + t.Run(test.description, func(t *testing.T) { + var ( + server = newTestServer(t, test) + client = server.Client() + ) + var response *Response + err := DoRequest( + context.Background(), + client, + server.URL, + test.giveMethod, + test.giveRequest, + &response, + test.giveResponseIsOptional, + test.giveHeader, + test.giveErrorDecoder, + ) + if test.wantError != nil { + assert.EqualError(t, err, test.wantError.Error()) + return + } + require.NoError(t, err) + assert.Equal(t, test.wantResponse, response) + }) + } +} + +// newTestServer returns a new *httptest.Server configured with the +// given test parameters. +func newTestServer(t *testing.T, tc *TestCase) *httptest.Server { + return httptest.NewServer( + http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + assert.Equal(t, tc.giveMethod, r.Method) + assert.Equal(t, contentType, r.Header.Get(contentTypeHeader)) + for header, value := range tc.giveHeader { + assert.Equal(t, value, r.Header.Values(header)) + } + + bytes, err := io.ReadAll(r.Body) + require.NoError(t, err) + + request := new(Request) + require.NoError(t, json.Unmarshal(bytes, request)) + + switch request.Id { + case strconv.Itoa(http.StatusNotFound): + notFoundError := &NotFoundError{ + APIError: &APIError{ + StatusCode: http.StatusNotFound, + }, + Message: fmt.Sprintf("ID %q not found", request.Id), + } + bytes, err = json.Marshal(notFoundError) + require.NoError(t, err) + + w.WriteHeader(http.StatusNotFound) + _, err = w.Write(bytes) + require.NoError(t, err) + return + + case strconv.Itoa(http.StatusInternalServerError): + w.WriteHeader(http.StatusInternalServerError) + _, err = w.Write([]byte("failed to process request")) + require.NoError(t, err) + return + } + + if tc.giveResponseIsOptional { + w.WriteHeader(http.StatusOK) + return + } + + response := &Response{ + Id: request.Id, + } + bytes, err = json.Marshal(response) + require.NoError(t, err) + + _, err = w.Write(bytes) + require.NoError(t, err) + }, + ), + ) +} + +// newTestErrorDecoder returns an error decoder suitable for tests. +func newTestErrorDecoder(t *testing.T) func(int, io.Reader) error { + return func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + require.NoError(t, err) + + var ( + apiError = NewAPIError(statusCode, errors.New(string(raw))) + decoder = json.NewDecoder(bytes.NewReader(raw)) + ) + switch statusCode { + case 404: + value := new(NotFoundError) + value.APIError = apiError + require.NoError(t, decoder.Decode(value)) + + return value + } + return apiError + } +} diff --git a/create_bookmark_request.go b/create_bookmark_request.go deleted file mode 100644 index 2aa6284..0000000 --- a/create_bookmark_request.go +++ /dev/null @@ -1,15 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateBookmarkRequest is an in-lined request used by the CreateBookmark endpoint. -type CreateBookmarkRequest struct { - // ID of the event data to bookmark `<= 255 characters` - EventDataId string `json:"event_data_id"` - // ID of the associated connection `<= 255 characters` - WebhookId string `json:"webhook_id"` - // Descriptive name of the bookmark `<= 255 characters` - Label string `json:"label"` - // A unique, human-friendly name for the bookmark `<= 155 characters` - Name *string `json:"name,omitempty"` -} diff --git a/create_connection_request.go b/create_connection_request.go deleted file mode 100644 index cf48b2b..0000000 --- a/create_connection_request.go +++ /dev/null @@ -1,23 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateConnectionRequest is an in-lined request used by the CreateConnection endpoint. -type CreateConnectionRequest struct { - // A unique name of the connection for the source `<= 155 characters` - Name string `json:"name"` - // ID of a destination to bind to the connection - DestinationId *string `json:"destination_id,omitempty"` - // ID of a source to bind to the connection - SourceId *string `json:"source_id,omitempty"` - // Destination input object - Destination *CreateConnectionRequestDestination `json:"destination,omitempty"` - // Source input object - Source *CreateConnectionRequestSource `json:"source,omitempty"` - // Ruleset input object - Ruleset *CreateConnectionRequestRuleset `json:"ruleset,omitempty"` - // ID of a rule to bind to the connection. Default to the Workspace default ruleset - RulesetId *string `json:"ruleset_id,omitempty"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` -} diff --git a/create_connection_request_destination.go b/create_connection_request_destination.go deleted file mode 100644 index 27d706d..0000000 --- a/create_connection_request_destination.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Destination input object -type CreateConnectionRequestDestination struct { - // Name for the destination `<= 155 characters` - Name string `json:"name"` - // Endpoint of the destination - Url *string `json:"url,omitempty"` - // Path for the CLI destination - CliPath *string `json:"cli_path,omitempty"` - // Period to rate limit attempts - RateLimitPeriod *CreateConnectionRequestDestinationRateLimitPeriod `json:"rate_limit_period,omitempty"` - // Limit event attempts to receive per period - RateLimit *int `json:"rate_limit,omitempty"` - PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` -} diff --git a/create_connection_request_destination_rate_limit_period.go b/create_connection_request_destination_rate_limit_period.go deleted file mode 100644 index f0f33b5..0000000 --- a/create_connection_request_destination_rate_limit_period.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Period to rate limit attempts -type CreateConnectionRequestDestinationRateLimitPeriod uint8 - -const ( - CreateConnectionRequestDestinationRateLimitPeriodSecond CreateConnectionRequestDestinationRateLimitPeriod = iota + 1 - CreateConnectionRequestDestinationRateLimitPeriodMinute - CreateConnectionRequestDestinationRateLimitPeriodHour -) - -func (c CreateConnectionRequestDestinationRateLimitPeriod) String() string { - switch c { - default: - return strconv.Itoa(int(c)) - case CreateConnectionRequestDestinationRateLimitPeriodSecond: - return "second" - case CreateConnectionRequestDestinationRateLimitPeriodMinute: - return "minute" - case CreateConnectionRequestDestinationRateLimitPeriodHour: - return "hour" - } -} - -func (c CreateConnectionRequestDestinationRateLimitPeriod) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", c.String())), nil -} - -func (c *CreateConnectionRequestDestinationRateLimitPeriod) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "second": - value := CreateConnectionRequestDestinationRateLimitPeriodSecond - *c = value - case "minute": - value := CreateConnectionRequestDestinationRateLimitPeriodMinute - *c = value - case "hour": - value := CreateConnectionRequestDestinationRateLimitPeriodHour - *c = value - } - return nil -} diff --git a/create_connection_request_ruleset.go b/create_connection_request_ruleset.go deleted file mode 100644 index 1762a83..0000000 --- a/create_connection_request_ruleset.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Ruleset input object -type CreateConnectionRequestRuleset struct { - // Name for the ruleset `<= 155 characters` - Name string `json:"name"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` - IsTeamDefault *bool `json:"is_team_default,omitempty"` -} diff --git a/create_connection_request_source.go b/create_connection_request_source.go deleted file mode 100644 index 3f30035..0000000 --- a/create_connection_request_source.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Source input object -type CreateConnectionRequestSource struct { - // A unique name for the source `<= 155 characters` - Name string `json:"name"` -} diff --git a/create_destination_request.go b/create_destination_request.go deleted file mode 100644 index 927089c..0000000 --- a/create_destination_request.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateDestinationRequest is an in-lined request used by the CreateDestination endpoint. -type CreateDestinationRequest struct { - // Name for the destination `<= 155 characters` - Name string `json:"name"` - // Endpoint of the destination - Url *string `json:"url,omitempty"` - // Path for the CLI destination - CliPath *string `json:"cli_path,omitempty"` - // Period to rate limit attempts - RateLimitPeriod *CreateDestinationRequestRateLimitPeriod `json:"rate_limit_period,omitempty"` - // Limit event attempts to receive per period - RateLimit *int `json:"rate_limit,omitempty"` - PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` -} diff --git a/create_destination_request_rate_limit_period.go b/create_destination_request_rate_limit_period.go deleted file mode 100644 index 8162c5e..0000000 --- a/create_destination_request_rate_limit_period.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Period to rate limit attempts -type CreateDestinationRequestRateLimitPeriod uint8 - -const ( - CreateDestinationRequestRateLimitPeriodSecond CreateDestinationRequestRateLimitPeriod = iota + 1 - CreateDestinationRequestRateLimitPeriodMinute - CreateDestinationRequestRateLimitPeriodHour -) - -func (c CreateDestinationRequestRateLimitPeriod) String() string { - switch c { - default: - return strconv.Itoa(int(c)) - case CreateDestinationRequestRateLimitPeriodSecond: - return "second" - case CreateDestinationRequestRateLimitPeriodMinute: - return "minute" - case CreateDestinationRequestRateLimitPeriodHour: - return "hour" - } -} - -func (c CreateDestinationRequestRateLimitPeriod) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", c.String())), nil -} - -func (c *CreateDestinationRequestRateLimitPeriod) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "second": - value := CreateDestinationRequestRateLimitPeriodSecond - *c = value - case "minute": - value := CreateDestinationRequestRateLimitPeriodMinute - *c = value - case "hour": - value := CreateDestinationRequestRateLimitPeriodHour - *c = value - } - return nil -} diff --git a/create_event_bulk_retry_request.go b/create_event_bulk_retry_request.go deleted file mode 100644 index 82567d9..0000000 --- a/create_event_bulk_retry_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateEventBulkRetryRequest is an in-lined request used by the CreateEventBulkRetry endpoint. -type CreateEventBulkRetryRequest struct { - // Filter properties for the events to be included in the bulk retry - Query *CreateEventBulkRetryRequestQuery `json:"query,omitempty"` -} diff --git a/create_event_bulk_retry_request_query.go b/create_event_bulk_retry_request_query.go deleted file mode 100644 index a4e15c6..0000000 --- a/create_event_bulk_retry_request_query.go +++ /dev/null @@ -1,42 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Filter properties for the events to be included in the bulk retry -type CreateEventBulkRetryRequestQuery struct { - // Filter by event IDs - Id *CreateEventBulkRetryRequestQueryId `json:"id,omitempty"` - // Lifecyle status of the event - Status *CreateEventBulkRetryRequestQueryStatus `json:"status,omitempty"` - IssueId *CreateEventBulkRetryRequestQueryIssueId `json:"issue_id,omitempty"` - // Filter by webhook connection IDs - WebhookId *CreateEventBulkRetryRequestQueryWebhookId `json:"webhook_id,omitempty"` - // Filter by destination IDs - DestinationId *CreateEventBulkRetryRequestQueryDestinationId `json:"destination_id,omitempty"` - // Filter by source IDs - SourceId *CreateEventBulkRetryRequestQuerySourceId `json:"source_id,omitempty"` - // Filter by number of attempts - Attempts *CreateEventBulkRetryRequestQueryAttempts `json:"attempts,omitempty"` - // Filter by HTTP response status code - ResponseStatus *CreateEventBulkRetryRequestQueryResponseStatus `json:"response_status,omitempty"` - // Filter by `successful_at` date using a date operator - SuccessfulAt *CreateEventBulkRetryRequestQuerySuccessfulAt `json:"successful_at,omitempty"` - // Filter by `created_at` date using a date operator - CreatedAt *CreateEventBulkRetryRequestQueryCreatedAt `json:"created_at,omitempty"` - ErrorCode *CreateEventBulkRetryRequestQueryErrorCode `json:"error_code,omitempty"` - // Filter by CLI IDs. `?[any]=true` operator for any CLI. - CliId *CreateEventBulkRetryRequestQueryCliId `json:"cli_id,omitempty"` - CliUserId *CreateEventBulkRetryRequestQueryCliUserId `json:"cli_user_id,omitempty"` - // Filter by `last_attempt_at` date using a date operator - LastAttemptAt *CreateEventBulkRetryRequestQueryLastAttemptAt `json:"last_attempt_at,omitempty"` - EventDataId *CreateEventBulkRetryRequestQueryEventDataId `json:"event_data_id,omitempty"` - // URL Encoded string of the JSON to match to the data headers - Headers *CreateEventBulkRetryRequestQueryHeaders `json:"headers,omitempty"` - // URL Encoded string of the JSON to match to the data body - Body *CreateEventBulkRetryRequestQueryBody `json:"body,omitempty"` - // URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) - ParsedQuery *CreateEventBulkRetryRequestQueryParsedQuery `json:"parsed_query,omitempty"` - BulkRetryId *CreateEventBulkRetryRequestQueryBulkRetryId `json:"bulk_retry_id,omitempty"` - // URL Encoded string of the string to match partially to the path - Path *string `json:"path,omitempty"` -} diff --git a/create_event_bulk_retry_request_query_attempts.go b/create_event_bulk_retry_request_query_attempts.go deleted file mode 100644 index 2508d07..0000000 --- a/create_event_bulk_retry_request_query_attempts.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by number of attempts -type CreateEventBulkRetryRequestQueryAttempts struct { - typeName string - Integer int - CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts *CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts -} - -func NewCreateEventBulkRetryRequestQueryAttemptsFromInteger(value int) *CreateEventBulkRetryRequestQueryAttempts { - return &CreateEventBulkRetryRequestQueryAttempts{typeName: "integer", Integer: value} -} - -func NewCreateEventBulkRetryRequestQueryAttemptsFromCreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts(value *CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts) *CreateEventBulkRetryRequestQueryAttempts { - return &CreateEventBulkRetryRequestQueryAttempts{typeName: "createEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts", CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts: value} -} - -func (c *CreateEventBulkRetryRequestQueryAttempts) UnmarshalJSON(data []byte) error { - var valueInteger int - if err := json.Unmarshal(data, &valueInteger); err == nil { - c.typeName = "integer" - c.Integer = valueInteger - return nil - } - valueCreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts := new(CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts); err == nil { - c.typeName = "createEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts" - c.CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts = valueCreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryAttempts) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "integer": - return json.Marshal(c.Integer) - case "createEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts": - return json.Marshal(c.CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts) - } -} - -type CreateEventBulkRetryRequestQueryAttemptsVisitor interface { - VisitInteger(int) error - VisitCreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts(*CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts) error -} - -func (c *CreateEventBulkRetryRequestQueryAttempts) Accept(v CreateEventBulkRetryRequestQueryAttemptsVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "integer": - return v.VisitInteger(c.Integer) - case "createEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts": - return v.VisitCreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts(c.CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts) - } -} diff --git a/create_event_bulk_retry_request_query_attempts_create_event_bulk_retry_request_query_attempts.go b/create_event_bulk_retry_request_query_attempts_create_event_bulk_retry_request_query_attempts.go deleted file mode 100644 index 314d1d3..0000000 --- a/create_event_bulk_retry_request_query_attempts_create_event_bulk_retry_request_query_attempts.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQueryAttemptsCreateEventBulkRetryRequestQueryAttempts struct { - Gt *int `json:"gt,omitempty"` - Gte *int `json:"gte,omitempty"` - Le *int `json:"le,omitempty"` - Lte *int `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` - Contains *int `json:"contains,omitempty"` -} diff --git a/create_event_bulk_retry_request_query_body.go b/create_event_bulk_retry_request_query_body.go deleted file mode 100644 index a74f9af..0000000 --- a/create_event_bulk_retry_request_query_body.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// URL Encoded string of the JSON to match to the data body -type CreateEventBulkRetryRequestQueryBody struct { - typeName string - String string - CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody *CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody -} - -func NewCreateEventBulkRetryRequestQueryBodyFromString(value string) *CreateEventBulkRetryRequestQueryBody { - return &CreateEventBulkRetryRequestQueryBody{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryBodyFromCreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody(value *CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody) *CreateEventBulkRetryRequestQueryBody { - return &CreateEventBulkRetryRequestQueryBody{typeName: "createEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody", CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody: value} -} - -func (c *CreateEventBulkRetryRequestQueryBody) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody := new(CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody); err == nil { - c.typeName = "createEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody" - c.CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody = valueCreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryBody) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody": - return json.Marshal(c.CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody) - } -} - -type CreateEventBulkRetryRequestQueryBodyVisitor interface { - VisitString(string) error - VisitCreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody(*CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody) error -} - -func (c *CreateEventBulkRetryRequestQueryBody) Accept(v CreateEventBulkRetryRequestQueryBodyVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody": - return v.VisitCreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody(c.CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody) - } -} diff --git a/create_event_bulk_retry_request_query_body_create_event_bulk_retry_request_query_body.go b/create_event_bulk_retry_request_query_body_create_event_bulk_retry_request_query_body.go deleted file mode 100644 index 4fd3e35..0000000 --- a/create_event_bulk_retry_request_query_body_create_event_bulk_retry_request_query_body.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQueryBodyCreateEventBulkRetryRequestQueryBody struct { -} diff --git a/create_event_bulk_retry_request_query_bulk_retry_id.go b/create_event_bulk_retry_request_query_bulk_retry_id.go deleted file mode 100644 index 4fdd5d0..0000000 --- a/create_event_bulk_retry_request_query_bulk_retry_id.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateEventBulkRetryRequestQueryBulkRetryId struct { - typeName string - // `<= 255 characters` - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryBulkRetryIdFromString(value string) *CreateEventBulkRetryRequestQueryBulkRetryId { - return &CreateEventBulkRetryRequestQueryBulkRetryId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryBulkRetryIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryBulkRetryId { - return &CreateEventBulkRetryRequestQueryBulkRetryId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryBulkRetryId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryBulkRetryId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryBulkRetryIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryBulkRetryId) Accept(v CreateEventBulkRetryRequestQueryBulkRetryIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_cli_id.go b/create_event_bulk_retry_request_query_cli_id.go deleted file mode 100644 index 10b9819..0000000 --- a/create_event_bulk_retry_request_query_cli_id.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by CLI IDs. `?[any]=true` operator for any CLI. -type CreateEventBulkRetryRequestQueryCliId struct { - typeName string - String string - CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId *CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryCliIdFromString(value string) *CreateEventBulkRetryRequestQueryCliId { - return &CreateEventBulkRetryRequestQueryCliId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryCliIdFromCreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId(value *CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId) *CreateEventBulkRetryRequestQueryCliId { - return &CreateEventBulkRetryRequestQueryCliId{typeName: "createEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId", CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId: value} -} - -func NewCreateEventBulkRetryRequestQueryCliIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryCliId { - return &CreateEventBulkRetryRequestQueryCliId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryCliId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId := new(CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId); err == nil { - c.typeName = "createEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId" - c.CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId = valueCreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryCliId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId": - return json.Marshal(c.CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryCliIdVisitor interface { - VisitString(string) error - VisitCreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId(*CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryCliId) Accept(v CreateEventBulkRetryRequestQueryCliIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId": - return v.VisitCreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId(c.CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_cli_id_create_event_bulk_retry_request_query_cli_id.go b/create_event_bulk_retry_request_query_cli_id_create_event_bulk_retry_request_query_cli_id.go deleted file mode 100644 index 6baa8c5..0000000 --- a/create_event_bulk_retry_request_query_cli_id_create_event_bulk_retry_request_query_cli_id.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQueryCliIdCreateEventBulkRetryRequestQueryCliId struct { - Any *bool `json:"any,omitempty"` -} diff --git a/create_event_bulk_retry_request_query_cli_user_id.go b/create_event_bulk_retry_request_query_cli_user_id.go deleted file mode 100644 index 232a21c..0000000 --- a/create_event_bulk_retry_request_query_cli_user_id.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateEventBulkRetryRequestQueryCliUserId struct { - typeName string - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryCliUserIdFromString(value string) *CreateEventBulkRetryRequestQueryCliUserId { - return &CreateEventBulkRetryRequestQueryCliUserId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryCliUserIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryCliUserId { - return &CreateEventBulkRetryRequestQueryCliUserId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryCliUserId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryCliUserId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryCliUserIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryCliUserId) Accept(v CreateEventBulkRetryRequestQueryCliUserIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_created_at.go b/create_event_bulk_retry_request_query_created_at.go deleted file mode 100644 index 19ba2c6..0000000 --- a/create_event_bulk_retry_request_query_created_at.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by `created_at` date using a date operator -type CreateEventBulkRetryRequestQueryCreatedAt struct { - typeName string - String string - CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt *CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt -} - -func NewCreateEventBulkRetryRequestQueryCreatedAtFromString(value string) *CreateEventBulkRetryRequestQueryCreatedAt { - return &CreateEventBulkRetryRequestQueryCreatedAt{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryCreatedAtFromCreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt(value *CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt) *CreateEventBulkRetryRequestQueryCreatedAt { - return &CreateEventBulkRetryRequestQueryCreatedAt{typeName: "createEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt", CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt: value} -} - -func (c *CreateEventBulkRetryRequestQueryCreatedAt) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt := new(CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt); err == nil { - c.typeName = "createEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt" - c.CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt = valueCreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryCreatedAt) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt": - return json.Marshal(c.CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt) - } -} - -type CreateEventBulkRetryRequestQueryCreatedAtVisitor interface { - VisitString(string) error - VisitCreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt(*CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt) error -} - -func (c *CreateEventBulkRetryRequestQueryCreatedAt) Accept(v CreateEventBulkRetryRequestQueryCreatedAtVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt": - return v.VisitCreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt(c.CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt) - } -} diff --git a/create_event_bulk_retry_request_query_created_at_create_event_bulk_retry_request_query_created_at.go b/create_event_bulk_retry_request_query_created_at_create_event_bulk_retry_request_query_created_at.go deleted file mode 100644 index 525eed3..0000000 --- a/create_event_bulk_retry_request_query_created_at_create_event_bulk_retry_request_query_created_at.go +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQueryCreatedAtCreateEventBulkRetryRequestQueryCreatedAt struct { - Gt *string `json:"gt,omitempty"` - Gte *string `json:"gte,omitempty"` - Le *string `json:"le,omitempty"` - Lte *string `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` -} diff --git a/create_event_bulk_retry_request_query_destination_id.go b/create_event_bulk_retry_request_query_destination_id.go deleted file mode 100644 index b33e289..0000000 --- a/create_event_bulk_retry_request_query_destination_id.go +++ /dev/null @@ -1,67 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by destination IDs -type CreateEventBulkRetryRequestQueryDestinationId struct { - typeName string - // Destination ID `<= 255 characters` - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryDestinationIdFromString(value string) *CreateEventBulkRetryRequestQueryDestinationId { - return &CreateEventBulkRetryRequestQueryDestinationId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryDestinationIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryDestinationId { - return &CreateEventBulkRetryRequestQueryDestinationId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryDestinationId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryDestinationId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryDestinationIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryDestinationId) Accept(v CreateEventBulkRetryRequestQueryDestinationIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_error_code.go b/create_event_bulk_retry_request_query_error_code.go deleted file mode 100644 index f1aaad7..0000000 --- a/create_event_bulk_retry_request_query_error_code.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateEventBulkRetryRequestQueryErrorCode struct { - typeName string - // `<= 255 characters` - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryErrorCodeFromString(value string) *CreateEventBulkRetryRequestQueryErrorCode { - return &CreateEventBulkRetryRequestQueryErrorCode{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryErrorCodeFromStringList(value []string) *CreateEventBulkRetryRequestQueryErrorCode { - return &CreateEventBulkRetryRequestQueryErrorCode{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryErrorCode) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryErrorCode) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryErrorCodeVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryErrorCode) Accept(v CreateEventBulkRetryRequestQueryErrorCodeVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_event_data_id.go b/create_event_bulk_retry_request_query_event_data_id.go deleted file mode 100644 index 0dea716..0000000 --- a/create_event_bulk_retry_request_query_event_data_id.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateEventBulkRetryRequestQueryEventDataId struct { - typeName string - // `<= 255 characters` - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryEventDataIdFromString(value string) *CreateEventBulkRetryRequestQueryEventDataId { - return &CreateEventBulkRetryRequestQueryEventDataId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryEventDataIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryEventDataId { - return &CreateEventBulkRetryRequestQueryEventDataId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryEventDataId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryEventDataId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryEventDataIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryEventDataId) Accept(v CreateEventBulkRetryRequestQueryEventDataIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_headers.go b/create_event_bulk_retry_request_query_headers.go deleted file mode 100644 index 3cebbc3..0000000 --- a/create_event_bulk_retry_request_query_headers.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// URL Encoded string of the JSON to match to the data headers -type CreateEventBulkRetryRequestQueryHeaders struct { - typeName string - String string - CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders *CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders -} - -func NewCreateEventBulkRetryRequestQueryHeadersFromString(value string) *CreateEventBulkRetryRequestQueryHeaders { - return &CreateEventBulkRetryRequestQueryHeaders{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryHeadersFromCreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders(value *CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders) *CreateEventBulkRetryRequestQueryHeaders { - return &CreateEventBulkRetryRequestQueryHeaders{typeName: "createEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders", CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders: value} -} - -func (c *CreateEventBulkRetryRequestQueryHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders := new(CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders); err == nil { - c.typeName = "createEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders" - c.CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders = valueCreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryHeaders) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders": - return json.Marshal(c.CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders) - } -} - -type CreateEventBulkRetryRequestQueryHeadersVisitor interface { - VisitString(string) error - VisitCreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders(*CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders) error -} - -func (c *CreateEventBulkRetryRequestQueryHeaders) Accept(v CreateEventBulkRetryRequestQueryHeadersVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders": - return v.VisitCreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders(c.CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders) - } -} diff --git a/create_event_bulk_retry_request_query_headers_create_event_bulk_retry_request_query_headers.go b/create_event_bulk_retry_request_query_headers_create_event_bulk_retry_request_query_headers.go deleted file mode 100644 index a0e715c..0000000 --- a/create_event_bulk_retry_request_query_headers_create_event_bulk_retry_request_query_headers.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQueryHeadersCreateEventBulkRetryRequestQueryHeaders struct { -} diff --git a/create_event_bulk_retry_request_query_id.go b/create_event_bulk_retry_request_query_id.go deleted file mode 100644 index 3511226..0000000 --- a/create_event_bulk_retry_request_query_id.go +++ /dev/null @@ -1,67 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by event IDs -type CreateEventBulkRetryRequestQueryId struct { - typeName string - // Event ID `<= 255 characters` - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryIdFromString(value string) *CreateEventBulkRetryRequestQueryId { - return &CreateEventBulkRetryRequestQueryId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryId { - return &CreateEventBulkRetryRequestQueryId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryId) Accept(v CreateEventBulkRetryRequestQueryIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_issue_id.go b/create_event_bulk_retry_request_query_issue_id.go deleted file mode 100644 index 4650491..0000000 --- a/create_event_bulk_retry_request_query_issue_id.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateEventBulkRetryRequestQueryIssueId struct { - typeName string - // `<= 255 characters` - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryIssueIdFromString(value string) *CreateEventBulkRetryRequestQueryIssueId { - return &CreateEventBulkRetryRequestQueryIssueId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryIssueIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryIssueId { - return &CreateEventBulkRetryRequestQueryIssueId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryIssueId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryIssueId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryIssueIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryIssueId) Accept(v CreateEventBulkRetryRequestQueryIssueIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_last_attempt_at.go b/create_event_bulk_retry_request_query_last_attempt_at.go deleted file mode 100644 index d51847c..0000000 --- a/create_event_bulk_retry_request_query_last_attempt_at.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by `last_attempt_at` date using a date operator -type CreateEventBulkRetryRequestQueryLastAttemptAt struct { - typeName string - String string - CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt *CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt -} - -func NewCreateEventBulkRetryRequestQueryLastAttemptAtFromString(value string) *CreateEventBulkRetryRequestQueryLastAttemptAt { - return &CreateEventBulkRetryRequestQueryLastAttemptAt{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryLastAttemptAtFromCreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt(value *CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt) *CreateEventBulkRetryRequestQueryLastAttemptAt { - return &CreateEventBulkRetryRequestQueryLastAttemptAt{typeName: "createEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt", CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt: value} -} - -func (c *CreateEventBulkRetryRequestQueryLastAttemptAt) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt := new(CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt); err == nil { - c.typeName = "createEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt" - c.CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt = valueCreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryLastAttemptAt) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt": - return json.Marshal(c.CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt) - } -} - -type CreateEventBulkRetryRequestQueryLastAttemptAtVisitor interface { - VisitString(string) error - VisitCreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt(*CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt) error -} - -func (c *CreateEventBulkRetryRequestQueryLastAttemptAt) Accept(v CreateEventBulkRetryRequestQueryLastAttemptAtVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt": - return v.VisitCreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt(c.CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt) - } -} diff --git a/create_event_bulk_retry_request_query_last_attempt_at_create_event_bulk_retry_request_query_last_attempt_at.go b/create_event_bulk_retry_request_query_last_attempt_at_create_event_bulk_retry_request_query_last_attempt_at.go deleted file mode 100644 index 28f5ae4..0000000 --- a/create_event_bulk_retry_request_query_last_attempt_at_create_event_bulk_retry_request_query_last_attempt_at.go +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQueryLastAttemptAtCreateEventBulkRetryRequestQueryLastAttemptAt struct { - Gt *string `json:"gt,omitempty"` - Gte *string `json:"gte,omitempty"` - Le *string `json:"le,omitempty"` - Lte *string `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` -} diff --git a/create_event_bulk_retry_request_query_parsed_query.go b/create_event_bulk_retry_request_query_parsed_query.go deleted file mode 100644 index 327918b..0000000 --- a/create_event_bulk_retry_request_query_parsed_query.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) -type CreateEventBulkRetryRequestQueryParsedQuery struct { - typeName string - String string - CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery *CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery -} - -func NewCreateEventBulkRetryRequestQueryParsedQueryFromString(value string) *CreateEventBulkRetryRequestQueryParsedQuery { - return &CreateEventBulkRetryRequestQueryParsedQuery{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryParsedQueryFromCreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery(value *CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery) *CreateEventBulkRetryRequestQueryParsedQuery { - return &CreateEventBulkRetryRequestQueryParsedQuery{typeName: "createEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery", CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery: value} -} - -func (c *CreateEventBulkRetryRequestQueryParsedQuery) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery := new(CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery); err == nil { - c.typeName = "createEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery" - c.CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery = valueCreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryParsedQuery) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery": - return json.Marshal(c.CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery) - } -} - -type CreateEventBulkRetryRequestQueryParsedQueryVisitor interface { - VisitString(string) error - VisitCreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery(*CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery) error -} - -func (c *CreateEventBulkRetryRequestQueryParsedQuery) Accept(v CreateEventBulkRetryRequestQueryParsedQueryVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery": - return v.VisitCreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery(c.CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery) - } -} diff --git a/create_event_bulk_retry_request_query_parsed_query_create_event_bulk_retry_request_query_parsed_query.go b/create_event_bulk_retry_request_query_parsed_query_create_event_bulk_retry_request_query_parsed_query.go deleted file mode 100644 index 2081853..0000000 --- a/create_event_bulk_retry_request_query_parsed_query_create_event_bulk_retry_request_query_parsed_query.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQueryParsedQueryCreateEventBulkRetryRequestQueryParsedQuery struct { -} diff --git a/create_event_bulk_retry_request_query_response_status.go b/create_event_bulk_retry_request_query_response_status.go deleted file mode 100644 index 884ed9f..0000000 --- a/create_event_bulk_retry_request_query_response_status.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by HTTP response status code -type CreateEventBulkRetryRequestQueryResponseStatus struct { - typeName string - Integer int - CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus *CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus - IntegerList []int -} - -func NewCreateEventBulkRetryRequestQueryResponseStatusFromInteger(value int) *CreateEventBulkRetryRequestQueryResponseStatus { - return &CreateEventBulkRetryRequestQueryResponseStatus{typeName: "integer", Integer: value} -} - -func NewCreateEventBulkRetryRequestQueryResponseStatusFromCreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus(value *CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus) *CreateEventBulkRetryRequestQueryResponseStatus { - return &CreateEventBulkRetryRequestQueryResponseStatus{typeName: "createEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus", CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus: value} -} - -func NewCreateEventBulkRetryRequestQueryResponseStatusFromIntegerList(value []int) *CreateEventBulkRetryRequestQueryResponseStatus { - return &CreateEventBulkRetryRequestQueryResponseStatus{typeName: "integerList", IntegerList: value} -} - -func (c *CreateEventBulkRetryRequestQueryResponseStatus) UnmarshalJSON(data []byte) error { - var valueInteger int - if err := json.Unmarshal(data, &valueInteger); err == nil { - c.typeName = "integer" - c.Integer = valueInteger - return nil - } - valueCreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus := new(CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus); err == nil { - c.typeName = "createEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus" - c.CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus = valueCreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus - return nil - } - var valueIntegerList []int - if err := json.Unmarshal(data, &valueIntegerList); err == nil { - c.typeName = "integerList" - c.IntegerList = valueIntegerList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryResponseStatus) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "integer": - return json.Marshal(c.Integer) - case "createEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus": - return json.Marshal(c.CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus) - case "integerList": - return json.Marshal(c.IntegerList) - } -} - -type CreateEventBulkRetryRequestQueryResponseStatusVisitor interface { - VisitInteger(int) error - VisitCreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus(*CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus) error - VisitIntegerList([]int) error -} - -func (c *CreateEventBulkRetryRequestQueryResponseStatus) Accept(v CreateEventBulkRetryRequestQueryResponseStatusVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "integer": - return v.VisitInteger(c.Integer) - case "createEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus": - return v.VisitCreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus(c.CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus) - case "integerList": - return v.VisitIntegerList(c.IntegerList) - } -} diff --git a/create_event_bulk_retry_request_query_response_status_create_event_bulk_retry_request_query_response_status.go b/create_event_bulk_retry_request_query_response_status_create_event_bulk_retry_request_query_response_status.go deleted file mode 100644 index 3ba7dfe..0000000 --- a/create_event_bulk_retry_request_query_response_status_create_event_bulk_retry_request_query_response_status.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQueryResponseStatusCreateEventBulkRetryRequestQueryResponseStatus struct { - Gt *int `json:"gt,omitempty"` - Gte *int `json:"gte,omitempty"` - Le *int `json:"le,omitempty"` - Lte *int `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` - Contains *int `json:"contains,omitempty"` -} diff --git a/create_event_bulk_retry_request_query_source_id.go b/create_event_bulk_retry_request_query_source_id.go deleted file mode 100644 index d3df014..0000000 --- a/create_event_bulk_retry_request_query_source_id.go +++ /dev/null @@ -1,67 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by source IDs -type CreateEventBulkRetryRequestQuerySourceId struct { - typeName string - // Source ID `<= 255 characters` - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQuerySourceIdFromString(value string) *CreateEventBulkRetryRequestQuerySourceId { - return &CreateEventBulkRetryRequestQuerySourceId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQuerySourceIdFromStringList(value []string) *CreateEventBulkRetryRequestQuerySourceId { - return &CreateEventBulkRetryRequestQuerySourceId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQuerySourceId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQuerySourceId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQuerySourceIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQuerySourceId) Accept(v CreateEventBulkRetryRequestQuerySourceIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_event_bulk_retry_request_query_status.go b/create_event_bulk_retry_request_query_status.go deleted file mode 100644 index 420bc27..0000000 --- a/create_event_bulk_retry_request_query_status.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Lifecyle status of the event -type CreateEventBulkRetryRequestQueryStatus struct { - typeName string - EventStatus EventStatus - EventStatusList []EventStatus -} - -func NewCreateEventBulkRetryRequestQueryStatusFromEventStatus(value EventStatus) *CreateEventBulkRetryRequestQueryStatus { - return &CreateEventBulkRetryRequestQueryStatus{typeName: "eventStatus", EventStatus: value} -} - -func NewCreateEventBulkRetryRequestQueryStatusFromEventStatusList(value []EventStatus) *CreateEventBulkRetryRequestQueryStatus { - return &CreateEventBulkRetryRequestQueryStatus{typeName: "eventStatusList", EventStatusList: value} -} - -func (c *CreateEventBulkRetryRequestQueryStatus) UnmarshalJSON(data []byte) error { - var valueEventStatus EventStatus - if err := json.Unmarshal(data, &valueEventStatus); err == nil { - c.typeName = "eventStatus" - c.EventStatus = valueEventStatus - return nil - } - var valueEventStatusList []EventStatus - if err := json.Unmarshal(data, &valueEventStatusList); err == nil { - c.typeName = "eventStatusList" - c.EventStatusList = valueEventStatusList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryStatus) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "eventStatus": - return json.Marshal(c.EventStatus) - case "eventStatusList": - return json.Marshal(c.EventStatusList) - } -} - -type CreateEventBulkRetryRequestQueryStatusVisitor interface { - VisitEventStatus(EventStatus) error - VisitEventStatusList([]EventStatus) error -} - -func (c *CreateEventBulkRetryRequestQueryStatus) Accept(v CreateEventBulkRetryRequestQueryStatusVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "eventStatus": - return v.VisitEventStatus(c.EventStatus) - case "eventStatusList": - return v.VisitEventStatusList(c.EventStatusList) - } -} diff --git a/create_event_bulk_retry_request_query_successful_at.go b/create_event_bulk_retry_request_query_successful_at.go deleted file mode 100644 index 469bbe1..0000000 --- a/create_event_bulk_retry_request_query_successful_at.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by `successful_at` date using a date operator -type CreateEventBulkRetryRequestQuerySuccessfulAt struct { - typeName string - String string - CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt *CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt -} - -func NewCreateEventBulkRetryRequestQuerySuccessfulAtFromString(value string) *CreateEventBulkRetryRequestQuerySuccessfulAt { - return &CreateEventBulkRetryRequestQuerySuccessfulAt{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQuerySuccessfulAtFromCreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt(value *CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt) *CreateEventBulkRetryRequestQuerySuccessfulAt { - return &CreateEventBulkRetryRequestQuerySuccessfulAt{typeName: "createEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt", CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt: value} -} - -func (c *CreateEventBulkRetryRequestQuerySuccessfulAt) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt := new(CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt) - if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt); err == nil { - c.typeName = "createEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt" - c.CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt = valueCreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQuerySuccessfulAt) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt": - return json.Marshal(c.CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt) - } -} - -type CreateEventBulkRetryRequestQuerySuccessfulAtVisitor interface { - VisitString(string) error - VisitCreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt(*CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt) error -} - -func (c *CreateEventBulkRetryRequestQuerySuccessfulAt) Accept(v CreateEventBulkRetryRequestQuerySuccessfulAtVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt": - return v.VisitCreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt(c.CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt) - } -} diff --git a/create_event_bulk_retry_request_query_successful_at_create_event_bulk_retry_request_query_successful_at.go b/create_event_bulk_retry_request_query_successful_at_create_event_bulk_retry_request_query_successful_at.go deleted file mode 100644 index 024dff9..0000000 --- a/create_event_bulk_retry_request_query_successful_at_create_event_bulk_retry_request_query_successful_at.go +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateEventBulkRetryRequestQuerySuccessfulAtCreateEventBulkRetryRequestQuerySuccessfulAt struct { - Gt *string `json:"gt,omitempty"` - Gte *string `json:"gte,omitempty"` - Le *string `json:"le,omitempty"` - Lte *string `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` -} diff --git a/create_event_bulk_retry_request_query_webhook_id.go b/create_event_bulk_retry_request_query_webhook_id.go deleted file mode 100644 index eafc6be..0000000 --- a/create_event_bulk_retry_request_query_webhook_id.go +++ /dev/null @@ -1,67 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by webhook connection IDs -type CreateEventBulkRetryRequestQueryWebhookId struct { - typeName string - // Webhook ID `<= 255 characters` - String string - StringList []string -} - -func NewCreateEventBulkRetryRequestQueryWebhookIdFromString(value string) *CreateEventBulkRetryRequestQueryWebhookId { - return &CreateEventBulkRetryRequestQueryWebhookId{typeName: "string", String: value} -} - -func NewCreateEventBulkRetryRequestQueryWebhookIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryWebhookId { - return &CreateEventBulkRetryRequestQueryWebhookId{typeName: "stringList", StringList: value} -} - -func (c *CreateEventBulkRetryRequestQueryWebhookId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateEventBulkRetryRequestQueryWebhookId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateEventBulkRetryRequestQueryWebhookIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateEventBulkRetryRequestQueryWebhookId) Accept(v CreateEventBulkRetryRequestQueryWebhookIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_ignored_event_bulk_retry_request.go b/create_ignored_event_bulk_retry_request.go deleted file mode 100644 index ba246f7..0000000 --- a/create_ignored_event_bulk_retry_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateIgnoredEventBulkRetryRequest is an in-lined request used by the CreateIgnoredEventBulkRetry endpoint. -type CreateIgnoredEventBulkRetryRequest struct { - // Filter by the bulk retry ignored event query object - Query *CreateIgnoredEventBulkRetryRequestQuery `json:"query,omitempty"` -} diff --git a/create_ignored_event_bulk_retry_request_query.go b/create_ignored_event_bulk_retry_request_query.go deleted file mode 100644 index 61da152..0000000 --- a/create_ignored_event_bulk_retry_request_query.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Filter by the bulk retry ignored event query object -type CreateIgnoredEventBulkRetryRequestQuery struct { - // The cause of the ignored event - Cause *CreateIgnoredEventBulkRetryRequestQueryCause `json:"cause,omitempty"` - // Connection ID of the ignored event - WebhookId *CreateIgnoredEventBulkRetryRequestQueryWebhookId `json:"webhook_id,omitempty"` - // The associated transformation ID (only applicable to the cause `TRANSFORMATION_FAILED`) `<= 255 characters` - TransformationId *string `json:"transformation_id,omitempty"` -} diff --git a/create_ignored_event_bulk_retry_request_query_cause.go b/create_ignored_event_bulk_retry_request_query_cause.go deleted file mode 100644 index a12eb33..0000000 --- a/create_ignored_event_bulk_retry_request_query_cause.go +++ /dev/null @@ -1,67 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// The cause of the ignored event -type CreateIgnoredEventBulkRetryRequestQueryCause struct { - typeName string - // `<= 255 characters` - String string - StringList []string -} - -func NewCreateIgnoredEventBulkRetryRequestQueryCauseFromString(value string) *CreateIgnoredEventBulkRetryRequestQueryCause { - return &CreateIgnoredEventBulkRetryRequestQueryCause{typeName: "string", String: value} -} - -func NewCreateIgnoredEventBulkRetryRequestQueryCauseFromStringList(value []string) *CreateIgnoredEventBulkRetryRequestQueryCause { - return &CreateIgnoredEventBulkRetryRequestQueryCause{typeName: "stringList", StringList: value} -} - -func (c *CreateIgnoredEventBulkRetryRequestQueryCause) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateIgnoredEventBulkRetryRequestQueryCause) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateIgnoredEventBulkRetryRequestQueryCauseVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateIgnoredEventBulkRetryRequestQueryCause) Accept(v CreateIgnoredEventBulkRetryRequestQueryCauseVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_ignored_event_bulk_retry_request_query_webhook_id.go b/create_ignored_event_bulk_retry_request_query_webhook_id.go deleted file mode 100644 index ecf27bd..0000000 --- a/create_ignored_event_bulk_retry_request_query_webhook_id.go +++ /dev/null @@ -1,67 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Connection ID of the ignored event -type CreateIgnoredEventBulkRetryRequestQueryWebhookId struct { - typeName string - // `<= 255 characters` - String string - StringList []string -} - -func NewCreateIgnoredEventBulkRetryRequestQueryWebhookIdFromString(value string) *CreateIgnoredEventBulkRetryRequestQueryWebhookId { - return &CreateIgnoredEventBulkRetryRequestQueryWebhookId{typeName: "string", String: value} -} - -func NewCreateIgnoredEventBulkRetryRequestQueryWebhookIdFromStringList(value []string) *CreateIgnoredEventBulkRetryRequestQueryWebhookId { - return &CreateIgnoredEventBulkRetryRequestQueryWebhookId{typeName: "stringList", StringList: value} -} - -func (c *CreateIgnoredEventBulkRetryRequestQueryWebhookId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateIgnoredEventBulkRetryRequestQueryWebhookId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateIgnoredEventBulkRetryRequestQueryWebhookIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateIgnoredEventBulkRetryRequestQueryWebhookId) Accept(v CreateIgnoredEventBulkRetryRequestQueryWebhookIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_integration_request.go b/create_integration_request.go deleted file mode 100644 index 9be2e5e..0000000 --- a/create_integration_request.go +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateIntegrationRequest is an in-lined request used by the CreateIntegration endpoint. -type CreateIntegrationRequest struct { - // Label of the integration - Label string `json:"label"` - // Decrypted Key/Value object of the associated configuration for that provider - Configs *CreateIntegrationRequestConfigs `json:"configs,omitempty"` - Provider IntegrationProvider `json:"provider,omitempty"` - // List of features to enable (see features list above) - Features []IntegrationFeature `json:"features,omitempty"` -} diff --git a/create_integration_request_configs.go b/create_integration_request_configs.go deleted file mode 100644 index e7cd9e4..0000000 --- a/create_integration_request_configs.go +++ /dev/null @@ -1,114 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Decrypted Key/Value object of the associated configuration for that provider -type CreateIntegrationRequestConfigs struct { - typeName string - HmacIntegrationConfigs *HmacIntegrationConfigs - ApiKeyIntegrationConfigs *ApiKeyIntegrationConfigs - HandledHmacConfigs *HandledHmacConfigs - BasicAuthIntegrationConfigs *BasicAuthIntegrationConfigs - ShopifyIntegrationConfigs *ShopifyIntegrationConfigs -} - -func NewCreateIntegrationRequestConfigsFromHmacIntegrationConfigs(value *HmacIntegrationConfigs) *CreateIntegrationRequestConfigs { - return &CreateIntegrationRequestConfigs{typeName: "hmacIntegrationConfigs", HmacIntegrationConfigs: value} -} - -func NewCreateIntegrationRequestConfigsFromApiKeyIntegrationConfigs(value *ApiKeyIntegrationConfigs) *CreateIntegrationRequestConfigs { - return &CreateIntegrationRequestConfigs{typeName: "apiKeyIntegrationConfigs", ApiKeyIntegrationConfigs: value} -} - -func NewCreateIntegrationRequestConfigsFromHandledHmacConfigs(value *HandledHmacConfigs) *CreateIntegrationRequestConfigs { - return &CreateIntegrationRequestConfigs{typeName: "handledHmacConfigs", HandledHmacConfigs: value} -} - -func NewCreateIntegrationRequestConfigsFromBasicAuthIntegrationConfigs(value *BasicAuthIntegrationConfigs) *CreateIntegrationRequestConfigs { - return &CreateIntegrationRequestConfigs{typeName: "basicAuthIntegrationConfigs", BasicAuthIntegrationConfigs: value} -} - -func NewCreateIntegrationRequestConfigsFromShopifyIntegrationConfigs(value *ShopifyIntegrationConfigs) *CreateIntegrationRequestConfigs { - return &CreateIntegrationRequestConfigs{typeName: "shopifyIntegrationConfigs", ShopifyIntegrationConfigs: value} -} - -func (c *CreateIntegrationRequestConfigs) UnmarshalJSON(data []byte) error { - valueHmacIntegrationConfigs := new(HmacIntegrationConfigs) - if err := json.Unmarshal(data, &valueHmacIntegrationConfigs); err == nil { - c.typeName = "hmacIntegrationConfigs" - c.HmacIntegrationConfigs = valueHmacIntegrationConfigs - return nil - } - valueApiKeyIntegrationConfigs := new(ApiKeyIntegrationConfigs) - if err := json.Unmarshal(data, &valueApiKeyIntegrationConfigs); err == nil { - c.typeName = "apiKeyIntegrationConfigs" - c.ApiKeyIntegrationConfigs = valueApiKeyIntegrationConfigs - return nil - } - valueHandledHmacConfigs := new(HandledHmacConfigs) - if err := json.Unmarshal(data, &valueHandledHmacConfigs); err == nil { - c.typeName = "handledHmacConfigs" - c.HandledHmacConfigs = valueHandledHmacConfigs - return nil - } - valueBasicAuthIntegrationConfigs := new(BasicAuthIntegrationConfigs) - if err := json.Unmarshal(data, &valueBasicAuthIntegrationConfigs); err == nil { - c.typeName = "basicAuthIntegrationConfigs" - c.BasicAuthIntegrationConfigs = valueBasicAuthIntegrationConfigs - return nil - } - valueShopifyIntegrationConfigs := new(ShopifyIntegrationConfigs) - if err := json.Unmarshal(data, &valueShopifyIntegrationConfigs); err == nil { - c.typeName = "shopifyIntegrationConfigs" - c.ShopifyIntegrationConfigs = valueShopifyIntegrationConfigs - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateIntegrationRequestConfigs) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "hmacIntegrationConfigs": - return json.Marshal(c.HmacIntegrationConfigs) - case "apiKeyIntegrationConfigs": - return json.Marshal(c.ApiKeyIntegrationConfigs) - case "handledHmacConfigs": - return json.Marshal(c.HandledHmacConfigs) - case "basicAuthIntegrationConfigs": - return json.Marshal(c.BasicAuthIntegrationConfigs) - case "shopifyIntegrationConfigs": - return json.Marshal(c.ShopifyIntegrationConfigs) - } -} - -type CreateIntegrationRequestConfigsVisitor interface { - VisitHmacIntegrationConfigs(*HmacIntegrationConfigs) error - VisitApiKeyIntegrationConfigs(*ApiKeyIntegrationConfigs) error - VisitHandledHmacConfigs(*HandledHmacConfigs) error - VisitBasicAuthIntegrationConfigs(*BasicAuthIntegrationConfigs) error - VisitShopifyIntegrationConfigs(*ShopifyIntegrationConfigs) error -} - -func (c *CreateIntegrationRequestConfigs) Accept(v CreateIntegrationRequestConfigsVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "hmacIntegrationConfigs": - return v.VisitHmacIntegrationConfigs(c.HmacIntegrationConfigs) - case "apiKeyIntegrationConfigs": - return v.VisitApiKeyIntegrationConfigs(c.ApiKeyIntegrationConfigs) - case "handledHmacConfigs": - return v.VisitHandledHmacConfigs(c.HandledHmacConfigs) - case "basicAuthIntegrationConfigs": - return v.VisitBasicAuthIntegrationConfigs(c.BasicAuthIntegrationConfigs) - case "shopifyIntegrationConfigs": - return v.VisitShopifyIntegrationConfigs(c.ShopifyIntegrationConfigs) - } -} diff --git a/create_issue_trigger_request.go b/create_issue_trigger_request.go deleted file mode 100644 index 09dd092..0000000 --- a/create_issue_trigger_request.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateIssueTriggerRequest is an in-lined request used by the CreateIssueTrigger endpoint. -type CreateIssueTriggerRequest struct { - Type IssueType `json:"type,omitempty"` - // Configuration object for the specific issue type selected - Configs *CreateIssueTriggerRequestConfigs `json:"configs,omitempty"` - Channels *IssueTriggerChannels `json:"channels,omitempty"` - // Optional unique name to use as reference when using the API `<= 255 characters` - Name *string `json:"name,omitempty"` -} diff --git a/create_issue_trigger_request_configs.go b/create_issue_trigger_request_configs.go deleted file mode 100644 index 2c0f6d9..0000000 --- a/create_issue_trigger_request_configs.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Configuration object for the specific issue type selected -type CreateIssueTriggerRequestConfigs struct { - typeName string - IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs - IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs - IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs -} - -func NewCreateIssueTriggerRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *CreateIssueTriggerRequestConfigs { - return &CreateIssueTriggerRequestConfigs{typeName: "issueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} -} - -func NewCreateIssueTriggerRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *CreateIssueTriggerRequestConfigs { - return &CreateIssueTriggerRequestConfigs{typeName: "issueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} -} - -func NewCreateIssueTriggerRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *CreateIssueTriggerRequestConfigs { - return &CreateIssueTriggerRequestConfigs{typeName: "issueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} -} - -func (c *CreateIssueTriggerRequestConfigs) UnmarshalJSON(data []byte) error { - valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { - c.typeName = "issueTriggerDeliveryConfigs" - c.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs - return nil - } - valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { - c.typeName = "issueTriggerTransformationConfigs" - c.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs - return nil - } - valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { - c.typeName = "issueTriggerBackpressureConfigs" - c.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateIssueTriggerRequestConfigs) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "issueTriggerDeliveryConfigs": - return json.Marshal(c.IssueTriggerDeliveryConfigs) - case "issueTriggerTransformationConfigs": - return json.Marshal(c.IssueTriggerTransformationConfigs) - case "issueTriggerBackpressureConfigs": - return json.Marshal(c.IssueTriggerBackpressureConfigs) - } -} - -type CreateIssueTriggerRequestConfigsVisitor interface { - VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error - VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error - VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error -} - -func (c *CreateIssueTriggerRequestConfigs) Accept(v CreateIssueTriggerRequestConfigsVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "issueTriggerDeliveryConfigs": - return v.VisitIssueTriggerDeliveryConfigs(c.IssueTriggerDeliveryConfigs) - case "issueTriggerTransformationConfigs": - return v.VisitIssueTriggerTransformationConfigs(c.IssueTriggerTransformationConfigs) - case "issueTriggerBackpressureConfigs": - return v.VisitIssueTriggerBackpressureConfigs(c.IssueTriggerBackpressureConfigs) - } -} diff --git a/create_request_bulk_retry_request.go b/create_request_bulk_retry_request.go deleted file mode 100644 index ca610d9..0000000 --- a/create_request_bulk_retry_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateRequestBulkRetryRequest is an in-lined request used by the CreateRequestBulkRetry endpoint. -type CreateRequestBulkRetryRequest struct { - // Filter properties for the events to be included in the bulk retry, use query parameters of [Requests](#requests) - Query *CreateRequestBulkRetryRequestQuery `json:"query,omitempty"` -} diff --git a/create_request_bulk_retry_request_query.go b/create_request_bulk_retry_request_query.go deleted file mode 100644 index 831cf41..0000000 --- a/create_request_bulk_retry_request_query.go +++ /dev/null @@ -1,29 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Filter properties for the events to be included in the bulk retry, use query parameters of [Requests](#requests) -type CreateRequestBulkRetryRequestQuery struct { - // Filter by requests IDs - Id *CreateRequestBulkRetryRequestQueryId `json:"id,omitempty"` - Status *CreateRequestBulkRetryRequestQueryStatus `json:"status,omitempty"` - // Filter by rejection cause - RejectionCause *CreateRequestBulkRetryRequestQueryRejectionCause `json:"rejection_cause,omitempty"` - IgnoredCount *CreateRequestBulkRetryRequestQueryIgnoredCount `json:"ignored_count,omitempty"` - EventsCount *CreateRequestBulkRetryRequestQueryEventsCount `json:"events_count,omitempty"` - // Filter by source IDs - SourceId *CreateRequestBulkRetryRequestQuerySourceId `json:"source_id,omitempty"` - // Filter by verification status - Verified *bool `json:"verified,omitempty"` - // URL Encoded string of the JSON to match to the data headers - Headers *CreateRequestBulkRetryRequestQueryHeaders `json:"headers,omitempty"` - // URL Encoded string of the JSON to match to the data body - Body *CreateRequestBulkRetryRequestQueryBody `json:"body,omitempty"` - // URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) - ParsedQuery *CreateRequestBulkRetryRequestQueryParsedQuery `json:"parsed_query,omitempty"` - // URL Encoded string of the string to match partially to the path - Path *string `json:"path,omitempty"` - CreatedAt *CreateRequestBulkRetryRequestQueryCreatedAt `json:"created_at,omitempty"` - IngestedAt *CreateRequestBulkRetryRequestQueryIngestedAt `json:"ingested_at,omitempty"` - BulkRetryId *CreateRequestBulkRetryRequestQueryBulkRetryId `json:"bulk_retry_id,omitempty"` -} diff --git a/create_request_bulk_retry_request_query_body.go b/create_request_bulk_retry_request_query_body.go deleted file mode 100644 index 993e295..0000000 --- a/create_request_bulk_retry_request_query_body.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// URL Encoded string of the JSON to match to the data body -type CreateRequestBulkRetryRequestQueryBody struct { - typeName string - String string - CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody *CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody -} - -func NewCreateRequestBulkRetryRequestQueryBodyFromString(value string) *CreateRequestBulkRetryRequestQueryBody { - return &CreateRequestBulkRetryRequestQueryBody{typeName: "string", String: value} -} - -func NewCreateRequestBulkRetryRequestQueryBodyFromCreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody(value *CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody) *CreateRequestBulkRetryRequestQueryBody { - return &CreateRequestBulkRetryRequestQueryBody{typeName: "createRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody", CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody: value} -} - -func (c *CreateRequestBulkRetryRequestQueryBody) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody := new(CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody) - if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody); err == nil { - c.typeName = "createRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody" - c.CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody = valueCreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryBody) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody": - return json.Marshal(c.CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody) - } -} - -type CreateRequestBulkRetryRequestQueryBodyVisitor interface { - VisitString(string) error - VisitCreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody(*CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody) error -} - -func (c *CreateRequestBulkRetryRequestQueryBody) Accept(v CreateRequestBulkRetryRequestQueryBodyVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody": - return v.VisitCreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody(c.CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody) - } -} diff --git a/create_request_bulk_retry_request_query_body_create_request_bulk_retry_request_query_body.go b/create_request_bulk_retry_request_query_body_create_request_bulk_retry_request_query_body.go deleted file mode 100644 index 823aa71..0000000 --- a/create_request_bulk_retry_request_query_body_create_request_bulk_retry_request_query_body.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateRequestBulkRetryRequestQueryBodyCreateRequestBulkRetryRequestQueryBody struct { -} diff --git a/create_request_bulk_retry_request_query_bulk_retry_id.go b/create_request_bulk_retry_request_query_bulk_retry_id.go deleted file mode 100644 index 704c224..0000000 --- a/create_request_bulk_retry_request_query_bulk_retry_id.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateRequestBulkRetryRequestQueryBulkRetryId struct { - typeName string - // `<= 255 characters` - String string - StringList []string -} - -func NewCreateRequestBulkRetryRequestQueryBulkRetryIdFromString(value string) *CreateRequestBulkRetryRequestQueryBulkRetryId { - return &CreateRequestBulkRetryRequestQueryBulkRetryId{typeName: "string", String: value} -} - -func NewCreateRequestBulkRetryRequestQueryBulkRetryIdFromStringList(value []string) *CreateRequestBulkRetryRequestQueryBulkRetryId { - return &CreateRequestBulkRetryRequestQueryBulkRetryId{typeName: "stringList", StringList: value} -} - -func (c *CreateRequestBulkRetryRequestQueryBulkRetryId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryBulkRetryId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateRequestBulkRetryRequestQueryBulkRetryIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateRequestBulkRetryRequestQueryBulkRetryId) Accept(v CreateRequestBulkRetryRequestQueryBulkRetryIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_request_bulk_retry_request_query_created_at.go b/create_request_bulk_retry_request_query_created_at.go deleted file mode 100644 index 11ad24f..0000000 --- a/create_request_bulk_retry_request_query_created_at.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateRequestBulkRetryRequestQueryCreatedAt struct { - typeName string - String string - CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt *CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt -} - -func NewCreateRequestBulkRetryRequestQueryCreatedAtFromString(value string) *CreateRequestBulkRetryRequestQueryCreatedAt { - return &CreateRequestBulkRetryRequestQueryCreatedAt{typeName: "string", String: value} -} - -func NewCreateRequestBulkRetryRequestQueryCreatedAtFromCreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt(value *CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt) *CreateRequestBulkRetryRequestQueryCreatedAt { - return &CreateRequestBulkRetryRequestQueryCreatedAt{typeName: "createRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt", CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt: value} -} - -func (c *CreateRequestBulkRetryRequestQueryCreatedAt) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt := new(CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt) - if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt); err == nil { - c.typeName = "createRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt" - c.CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt = valueCreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryCreatedAt) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt": - return json.Marshal(c.CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt) - } -} - -type CreateRequestBulkRetryRequestQueryCreatedAtVisitor interface { - VisitString(string) error - VisitCreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt(*CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt) error -} - -func (c *CreateRequestBulkRetryRequestQueryCreatedAt) Accept(v CreateRequestBulkRetryRequestQueryCreatedAtVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt": - return v.VisitCreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt(c.CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt) - } -} diff --git a/create_request_bulk_retry_request_query_created_at_create_request_bulk_retry_request_query_created_at.go b/create_request_bulk_retry_request_query_created_at_create_request_bulk_retry_request_query_created_at.go deleted file mode 100644 index fe19fd2..0000000 --- a/create_request_bulk_retry_request_query_created_at_create_request_bulk_retry_request_query_created_at.go +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateRequestBulkRetryRequestQueryCreatedAtCreateRequestBulkRetryRequestQueryCreatedAt struct { - Gt *string `json:"gt,omitempty"` - Gte *string `json:"gte,omitempty"` - Le *string `json:"le,omitempty"` - Lte *string `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` -} diff --git a/create_request_bulk_retry_request_query_events_count.go b/create_request_bulk_retry_request_query_events_count.go deleted file mode 100644 index 0eae382..0000000 --- a/create_request_bulk_retry_request_query_events_count.go +++ /dev/null @@ -1,81 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateRequestBulkRetryRequestQueryEventsCount struct { - typeName string - Integer int - CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount *CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount - IntegerList []int -} - -func NewCreateRequestBulkRetryRequestQueryEventsCountFromInteger(value int) *CreateRequestBulkRetryRequestQueryEventsCount { - return &CreateRequestBulkRetryRequestQueryEventsCount{typeName: "integer", Integer: value} -} - -func NewCreateRequestBulkRetryRequestQueryEventsCountFromCreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount(value *CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount) *CreateRequestBulkRetryRequestQueryEventsCount { - return &CreateRequestBulkRetryRequestQueryEventsCount{typeName: "createRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount", CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount: value} -} - -func NewCreateRequestBulkRetryRequestQueryEventsCountFromIntegerList(value []int) *CreateRequestBulkRetryRequestQueryEventsCount { - return &CreateRequestBulkRetryRequestQueryEventsCount{typeName: "integerList", IntegerList: value} -} - -func (c *CreateRequestBulkRetryRequestQueryEventsCount) UnmarshalJSON(data []byte) error { - var valueInteger int - if err := json.Unmarshal(data, &valueInteger); err == nil { - c.typeName = "integer" - c.Integer = valueInteger - return nil - } - valueCreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount := new(CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount) - if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount); err == nil { - c.typeName = "createRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount" - c.CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount = valueCreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount - return nil - } - var valueIntegerList []int - if err := json.Unmarshal(data, &valueIntegerList); err == nil { - c.typeName = "integerList" - c.IntegerList = valueIntegerList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryEventsCount) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "integer": - return json.Marshal(c.Integer) - case "createRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount": - return json.Marshal(c.CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount) - case "integerList": - return json.Marshal(c.IntegerList) - } -} - -type CreateRequestBulkRetryRequestQueryEventsCountVisitor interface { - VisitInteger(int) error - VisitCreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount(*CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount) error - VisitIntegerList([]int) error -} - -func (c *CreateRequestBulkRetryRequestQueryEventsCount) Accept(v CreateRequestBulkRetryRequestQueryEventsCountVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "integer": - return v.VisitInteger(c.Integer) - case "createRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount": - return v.VisitCreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount(c.CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount) - case "integerList": - return v.VisitIntegerList(c.IntegerList) - } -} diff --git a/create_request_bulk_retry_request_query_events_count_create_request_bulk_retry_request_query_events_count.go b/create_request_bulk_retry_request_query_events_count_create_request_bulk_retry_request_query_events_count.go deleted file mode 100644 index f75259a..0000000 --- a/create_request_bulk_retry_request_query_events_count_create_request_bulk_retry_request_query_events_count.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateRequestBulkRetryRequestQueryEventsCountCreateRequestBulkRetryRequestQueryEventsCount struct { - Gt *int `json:"gt,omitempty"` - Gte *int `json:"gte,omitempty"` - Le *int `json:"le,omitempty"` - Lte *int `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` - Contains *int `json:"contains,omitempty"` -} diff --git a/create_request_bulk_retry_request_query_headers.go b/create_request_bulk_retry_request_query_headers.go deleted file mode 100644 index 7aa5be7..0000000 --- a/create_request_bulk_retry_request_query_headers.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// URL Encoded string of the JSON to match to the data headers -type CreateRequestBulkRetryRequestQueryHeaders struct { - typeName string - String string - CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders *CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders -} - -func NewCreateRequestBulkRetryRequestQueryHeadersFromString(value string) *CreateRequestBulkRetryRequestQueryHeaders { - return &CreateRequestBulkRetryRequestQueryHeaders{typeName: "string", String: value} -} - -func NewCreateRequestBulkRetryRequestQueryHeadersFromCreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders(value *CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders) *CreateRequestBulkRetryRequestQueryHeaders { - return &CreateRequestBulkRetryRequestQueryHeaders{typeName: "createRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders", CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders: value} -} - -func (c *CreateRequestBulkRetryRequestQueryHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders := new(CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders) - if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders); err == nil { - c.typeName = "createRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders" - c.CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders = valueCreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryHeaders) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders": - return json.Marshal(c.CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders) - } -} - -type CreateRequestBulkRetryRequestQueryHeadersVisitor interface { - VisitString(string) error - VisitCreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders(*CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders) error -} - -func (c *CreateRequestBulkRetryRequestQueryHeaders) Accept(v CreateRequestBulkRetryRequestQueryHeadersVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders": - return v.VisitCreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders(c.CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders) - } -} diff --git a/create_request_bulk_retry_request_query_headers_create_request_bulk_retry_request_query_headers.go b/create_request_bulk_retry_request_query_headers_create_request_bulk_retry_request_query_headers.go deleted file mode 100644 index bd73ab2..0000000 --- a/create_request_bulk_retry_request_query_headers_create_request_bulk_retry_request_query_headers.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateRequestBulkRetryRequestQueryHeadersCreateRequestBulkRetryRequestQueryHeaders struct { -} diff --git a/create_request_bulk_retry_request_query_id.go b/create_request_bulk_retry_request_query_id.go deleted file mode 100644 index cffc41b..0000000 --- a/create_request_bulk_retry_request_query_id.go +++ /dev/null @@ -1,67 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by requests IDs -type CreateRequestBulkRetryRequestQueryId struct { - typeName string - // Request ID `<= 255 characters` - String string - StringList []string -} - -func NewCreateRequestBulkRetryRequestQueryIdFromString(value string) *CreateRequestBulkRetryRequestQueryId { - return &CreateRequestBulkRetryRequestQueryId{typeName: "string", String: value} -} - -func NewCreateRequestBulkRetryRequestQueryIdFromStringList(value []string) *CreateRequestBulkRetryRequestQueryId { - return &CreateRequestBulkRetryRequestQueryId{typeName: "stringList", StringList: value} -} - -func (c *CreateRequestBulkRetryRequestQueryId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateRequestBulkRetryRequestQueryIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateRequestBulkRetryRequestQueryId) Accept(v CreateRequestBulkRetryRequestQueryIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_request_bulk_retry_request_query_ignored_count.go b/create_request_bulk_retry_request_query_ignored_count.go deleted file mode 100644 index 8b06c05..0000000 --- a/create_request_bulk_retry_request_query_ignored_count.go +++ /dev/null @@ -1,81 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateRequestBulkRetryRequestQueryIgnoredCount struct { - typeName string - Integer int - CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount *CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount - IntegerList []int -} - -func NewCreateRequestBulkRetryRequestQueryIgnoredCountFromInteger(value int) *CreateRequestBulkRetryRequestQueryIgnoredCount { - return &CreateRequestBulkRetryRequestQueryIgnoredCount{typeName: "integer", Integer: value} -} - -func NewCreateRequestBulkRetryRequestQueryIgnoredCountFromCreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount(value *CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount) *CreateRequestBulkRetryRequestQueryIgnoredCount { - return &CreateRequestBulkRetryRequestQueryIgnoredCount{typeName: "createRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount", CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount: value} -} - -func NewCreateRequestBulkRetryRequestQueryIgnoredCountFromIntegerList(value []int) *CreateRequestBulkRetryRequestQueryIgnoredCount { - return &CreateRequestBulkRetryRequestQueryIgnoredCount{typeName: "integerList", IntegerList: value} -} - -func (c *CreateRequestBulkRetryRequestQueryIgnoredCount) UnmarshalJSON(data []byte) error { - var valueInteger int - if err := json.Unmarshal(data, &valueInteger); err == nil { - c.typeName = "integer" - c.Integer = valueInteger - return nil - } - valueCreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount := new(CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount) - if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount); err == nil { - c.typeName = "createRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount" - c.CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount = valueCreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount - return nil - } - var valueIntegerList []int - if err := json.Unmarshal(data, &valueIntegerList); err == nil { - c.typeName = "integerList" - c.IntegerList = valueIntegerList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryIgnoredCount) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "integer": - return json.Marshal(c.Integer) - case "createRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount": - return json.Marshal(c.CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount) - case "integerList": - return json.Marshal(c.IntegerList) - } -} - -type CreateRequestBulkRetryRequestQueryIgnoredCountVisitor interface { - VisitInteger(int) error - VisitCreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount(*CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount) error - VisitIntegerList([]int) error -} - -func (c *CreateRequestBulkRetryRequestQueryIgnoredCount) Accept(v CreateRequestBulkRetryRequestQueryIgnoredCountVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "integer": - return v.VisitInteger(c.Integer) - case "createRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount": - return v.VisitCreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount(c.CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount) - case "integerList": - return v.VisitIntegerList(c.IntegerList) - } -} diff --git a/create_request_bulk_retry_request_query_ignored_count_create_request_bulk_retry_request_query_ignored_count.go b/create_request_bulk_retry_request_query_ignored_count_create_request_bulk_retry_request_query_ignored_count.go deleted file mode 100644 index adfccec..0000000 --- a/create_request_bulk_retry_request_query_ignored_count_create_request_bulk_retry_request_query_ignored_count.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateRequestBulkRetryRequestQueryIgnoredCountCreateRequestBulkRetryRequestQueryIgnoredCount struct { - Gt *int `json:"gt,omitempty"` - Gte *int `json:"gte,omitempty"` - Le *int `json:"le,omitempty"` - Lte *int `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` - Contains *int `json:"contains,omitempty"` -} diff --git a/create_request_bulk_retry_request_query_ingested_at.go b/create_request_bulk_retry_request_query_ingested_at.go deleted file mode 100644 index d7c4de8..0000000 --- a/create_request_bulk_retry_request_query_ingested_at.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateRequestBulkRetryRequestQueryIngestedAt struct { - typeName string - String string - CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt *CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt -} - -func NewCreateRequestBulkRetryRequestQueryIngestedAtFromString(value string) *CreateRequestBulkRetryRequestQueryIngestedAt { - return &CreateRequestBulkRetryRequestQueryIngestedAt{typeName: "string", String: value} -} - -func NewCreateRequestBulkRetryRequestQueryIngestedAtFromCreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt(value *CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt) *CreateRequestBulkRetryRequestQueryIngestedAt { - return &CreateRequestBulkRetryRequestQueryIngestedAt{typeName: "createRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt", CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt: value} -} - -func (c *CreateRequestBulkRetryRequestQueryIngestedAt) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt := new(CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt) - if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt); err == nil { - c.typeName = "createRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt" - c.CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt = valueCreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryIngestedAt) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt": - return json.Marshal(c.CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt) - } -} - -type CreateRequestBulkRetryRequestQueryIngestedAtVisitor interface { - VisitString(string) error - VisitCreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt(*CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt) error -} - -func (c *CreateRequestBulkRetryRequestQueryIngestedAt) Accept(v CreateRequestBulkRetryRequestQueryIngestedAtVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt": - return v.VisitCreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt(c.CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt) - } -} diff --git a/create_request_bulk_retry_request_query_ingested_at_create_request_bulk_retry_request_query_ingested_at.go b/create_request_bulk_retry_request_query_ingested_at_create_request_bulk_retry_request_query_ingested_at.go deleted file mode 100644 index d3b46c2..0000000 --- a/create_request_bulk_retry_request_query_ingested_at_create_request_bulk_retry_request_query_ingested_at.go +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateRequestBulkRetryRequestQueryIngestedAtCreateRequestBulkRetryRequestQueryIngestedAt struct { - Gt *string `json:"gt,omitempty"` - Gte *string `json:"gte,omitempty"` - Le *string `json:"le,omitempty"` - Lte *string `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` -} diff --git a/create_request_bulk_retry_request_query_parsed_query.go b/create_request_bulk_retry_request_query_parsed_query.go deleted file mode 100644 index 8ce72ce..0000000 --- a/create_request_bulk_retry_request_query_parsed_query.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) -type CreateRequestBulkRetryRequestQueryParsedQuery struct { - typeName string - String string - CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery *CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery -} - -func NewCreateRequestBulkRetryRequestQueryParsedQueryFromString(value string) *CreateRequestBulkRetryRequestQueryParsedQuery { - return &CreateRequestBulkRetryRequestQueryParsedQuery{typeName: "string", String: value} -} - -func NewCreateRequestBulkRetryRequestQueryParsedQueryFromCreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery(value *CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery) *CreateRequestBulkRetryRequestQueryParsedQuery { - return &CreateRequestBulkRetryRequestQueryParsedQuery{typeName: "createRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery", CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery: value} -} - -func (c *CreateRequestBulkRetryRequestQueryParsedQuery) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - valueCreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery := new(CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery) - if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery); err == nil { - c.typeName = "createRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery" - c.CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery = valueCreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryParsedQuery) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "createRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery": - return json.Marshal(c.CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery) - } -} - -type CreateRequestBulkRetryRequestQueryParsedQueryVisitor interface { - VisitString(string) error - VisitCreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery(*CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery) error -} - -func (c *CreateRequestBulkRetryRequestQueryParsedQuery) Accept(v CreateRequestBulkRetryRequestQueryParsedQueryVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "createRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery": - return v.VisitCreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery(c.CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery) - } -} diff --git a/create_request_bulk_retry_request_query_parsed_query_create_request_bulk_retry_request_query_parsed_query.go b/create_request_bulk_retry_request_query_parsed_query_create_request_bulk_retry_request_query_parsed_query.go deleted file mode 100644 index ba66771..0000000 --- a/create_request_bulk_retry_request_query_parsed_query_create_request_bulk_retry_request_query_parsed_query.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateRequestBulkRetryRequestQueryParsedQueryCreateRequestBulkRetryRequestQueryParsedQuery struct { -} diff --git a/create_request_bulk_retry_request_query_rejection_cause.go b/create_request_bulk_retry_request_query_rejection_cause.go deleted file mode 100644 index 5c9b782..0000000 --- a/create_request_bulk_retry_request_query_rejection_cause.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by rejection cause -type CreateRequestBulkRetryRequestQueryRejectionCause struct { - typeName string - RequestRejectionCause RequestRejectionCause - CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause *CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause - RequestRejectionCauseList []RequestRejectionCause -} - -func NewCreateRequestBulkRetryRequestQueryRejectionCauseFromRequestRejectionCause(value RequestRejectionCause) *CreateRequestBulkRetryRequestQueryRejectionCause { - return &CreateRequestBulkRetryRequestQueryRejectionCause{typeName: "requestRejectionCause", RequestRejectionCause: value} -} - -func NewCreateRequestBulkRetryRequestQueryRejectionCauseFromCreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause(value *CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause) *CreateRequestBulkRetryRequestQueryRejectionCause { - return &CreateRequestBulkRetryRequestQueryRejectionCause{typeName: "createRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause", CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause: value} -} - -func NewCreateRequestBulkRetryRequestQueryRejectionCauseFromRequestRejectionCauseList(value []RequestRejectionCause) *CreateRequestBulkRetryRequestQueryRejectionCause { - return &CreateRequestBulkRetryRequestQueryRejectionCause{typeName: "requestRejectionCauseList", RequestRejectionCauseList: value} -} - -func (c *CreateRequestBulkRetryRequestQueryRejectionCause) UnmarshalJSON(data []byte) error { - var valueRequestRejectionCause RequestRejectionCause - if err := json.Unmarshal(data, &valueRequestRejectionCause); err == nil { - c.typeName = "requestRejectionCause" - c.RequestRejectionCause = valueRequestRejectionCause - return nil - } - valueCreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause := new(CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause) - if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause); err == nil { - c.typeName = "createRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause" - c.CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause = valueCreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause - return nil - } - var valueRequestRejectionCauseList []RequestRejectionCause - if err := json.Unmarshal(data, &valueRequestRejectionCauseList); err == nil { - c.typeName = "requestRejectionCauseList" - c.RequestRejectionCauseList = valueRequestRejectionCauseList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQueryRejectionCause) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "requestRejectionCause": - return json.Marshal(c.RequestRejectionCause) - case "createRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause": - return json.Marshal(c.CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause) - case "requestRejectionCauseList": - return json.Marshal(c.RequestRejectionCauseList) - } -} - -type CreateRequestBulkRetryRequestQueryRejectionCauseVisitor interface { - VisitRequestRejectionCause(RequestRejectionCause) error - VisitCreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause(*CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause) error - VisitRequestRejectionCauseList([]RequestRejectionCause) error -} - -func (c *CreateRequestBulkRetryRequestQueryRejectionCause) Accept(v CreateRequestBulkRetryRequestQueryRejectionCauseVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "requestRejectionCause": - return v.VisitRequestRejectionCause(c.RequestRejectionCause) - case "createRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause": - return v.VisitCreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause(c.CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause) - case "requestRejectionCauseList": - return v.VisitRequestRejectionCauseList(c.RequestRejectionCauseList) - } -} diff --git a/create_request_bulk_retry_request_query_rejection_cause_create_request_bulk_retry_request_query_rejection_cause.go b/create_request_bulk_retry_request_query_rejection_cause_create_request_bulk_retry_request_query_rejection_cause.go deleted file mode 100644 index ca0c44a..0000000 --- a/create_request_bulk_retry_request_query_rejection_cause_create_request_bulk_retry_request_query_rejection_cause.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type CreateRequestBulkRetryRequestQueryRejectionCauseCreateRequestBulkRetryRequestQueryRejectionCause struct { - Gt *RequestRejectionCause `json:"gt,omitempty"` - Gte *RequestRejectionCause `json:"gte,omitempty"` - Le *RequestRejectionCause `json:"le,omitempty"` - Lte *RequestRejectionCause `json:"lte,omitempty"` - Any *bool `json:"any,omitempty"` - Contains *RequestRejectionCause `json:"contains,omitempty"` -} diff --git a/create_request_bulk_retry_request_query_source_id.go b/create_request_bulk_retry_request_query_source_id.go deleted file mode 100644 index 3c39da2..0000000 --- a/create_request_bulk_retry_request_query_source_id.go +++ /dev/null @@ -1,67 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Filter by source IDs -type CreateRequestBulkRetryRequestQuerySourceId struct { - typeName string - // Source ID `<= 255 characters` - String string - StringList []string -} - -func NewCreateRequestBulkRetryRequestQuerySourceIdFromString(value string) *CreateRequestBulkRetryRequestQuerySourceId { - return &CreateRequestBulkRetryRequestQuerySourceId{typeName: "string", String: value} -} - -func NewCreateRequestBulkRetryRequestQuerySourceIdFromStringList(value []string) *CreateRequestBulkRetryRequestQuerySourceId { - return &CreateRequestBulkRetryRequestQuerySourceId{typeName: "stringList", StringList: value} -} - -func (c *CreateRequestBulkRetryRequestQuerySourceId) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - c.typeName = "stringList" - c.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateRequestBulkRetryRequestQuerySourceId) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "stringList": - return json.Marshal(c.StringList) - } -} - -type CreateRequestBulkRetryRequestQuerySourceIdVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (c *CreateRequestBulkRetryRequestQuerySourceId) Accept(v CreateRequestBulkRetryRequestQuerySourceIdVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "stringList": - return v.VisitStringList(c.StringList) - } -} diff --git a/create_request_bulk_retry_request_query_status.go b/create_request_bulk_retry_request_query_status.go deleted file mode 100644 index 4e722ee..0000000 --- a/create_request_bulk_retry_request_query_status.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type CreateRequestBulkRetryRequestQueryStatus uint8 - -const ( - CreateRequestBulkRetryRequestQueryStatusAccepted CreateRequestBulkRetryRequestQueryStatus = iota + 1 - CreateRequestBulkRetryRequestQueryStatusRejected -) - -func (c CreateRequestBulkRetryRequestQueryStatus) String() string { - switch c { - default: - return strconv.Itoa(int(c)) - case CreateRequestBulkRetryRequestQueryStatusAccepted: - return "accepted" - case CreateRequestBulkRetryRequestQueryStatusRejected: - return "rejected" - } -} - -func (c CreateRequestBulkRetryRequestQueryStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", c.String())), nil -} - -func (c *CreateRequestBulkRetryRequestQueryStatus) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "accepted": - value := CreateRequestBulkRetryRequestQueryStatusAccepted - *c = value - case "rejected": - value := CreateRequestBulkRetryRequestQueryStatusRejected - *c = value - } - return nil -} diff --git a/create_ruleset_request.go b/create_ruleset_request.go deleted file mode 100644 index 81d0e36..0000000 --- a/create_ruleset_request.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateRulesetRequest is an in-lined request used by the CreateRuleset endpoint. -type CreateRulesetRequest struct { - // Name for the ruleset `<= 155 characters` - Name string `json:"name"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` - IsTeamDefault *bool `json:"is_team_default,omitempty"` -} diff --git a/create_source_request.go b/create_source_request.go deleted file mode 100644 index 8cef0e4..0000000 --- a/create_source_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateSourceRequest is an in-lined request used by the CreateSource endpoint. -type CreateSourceRequest struct { - // A unique name for the source `<= 155 characters` - Name string `json:"name"` -} diff --git a/create_transformation_request.go b/create_transformation_request.go deleted file mode 100644 index 9fd68f9..0000000 --- a/create_transformation_request.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// CreateTransformationRequest is an in-lined request used by the CreateTransformation endpoint. -type CreateTransformationRequest struct { - // A unique, human-friendly name for the transformation `<= 155 characters` - Name string `json:"name"` - // JavaScript code to be executed - Code string `json:"code"` - // Key-value environment variables to be passed to the transformation - Env *map[string]*CreateTransformationRequestEnvValue `json:"env,omitempty"` -} diff --git a/create_transformation_request_env_value.go b/create_transformation_request_env_value.go deleted file mode 100644 index 71aa8ec..0000000 --- a/create_transformation_request_env_value.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type CreateTransformationRequestEnvValue struct { - typeName string - String string - Double float64 -} - -func NewCreateTransformationRequestEnvValueFromString(value string) *CreateTransformationRequestEnvValue { - return &CreateTransformationRequestEnvValue{typeName: "string", String: value} -} - -func NewCreateTransformationRequestEnvValueFromDouble(value float64) *CreateTransformationRequestEnvValue { - return &CreateTransformationRequestEnvValue{typeName: "double", Double: value} -} - -func (c *CreateTransformationRequestEnvValue) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - c.typeName = "string" - c.String = valueString - return nil - } - var valueDouble float64 - if err := json.Unmarshal(data, &valueDouble); err == nil { - c.typeName = "double" - c.Double = valueDouble - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, c) -} - -func (c CreateTransformationRequestEnvValue) MarshalJSON() ([]byte, error) { - switch c.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return json.Marshal(c.String) - case "double": - return json.Marshal(c.Double) - } -} - -type CreateTransformationRequestEnvValueVisitor interface { - VisitString(string) error - VisitDouble(float64) error -} - -func (c *CreateTransformationRequestEnvValue) Accept(v CreateTransformationRequestEnvValueVisitor) error { - switch c.typeName { - default: - return fmt.Errorf("invalid type %s in %T", c.typeName, c) - case "string": - return v.VisitString(c.String) - case "double": - return v.VisitDouble(c.Double) - } -} diff --git a/delay_rule.go b/delay_rule.go deleted file mode 100644 index e409542..0000000 --- a/delay_rule.go +++ /dev/null @@ -1,40 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -type DelayRule struct { - // Delay to introduce in MS - Delay int `json:"delay"` - type_ string -} - -func (d *DelayRule) Type() string { - return d.type_ -} - -func (d *DelayRule) UnmarshalJSON(data []byte) error { - type unmarshaler DelayRule - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DelayRule(value) - d.type_ = "delay" - return nil -} - -func (d *DelayRule) MarshalJSON() ([]byte, error) { - type embed DelayRule - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*d), - Type: "delay", - } - return json.Marshal(marshaler) -} diff --git a/deleted_bookmark_response.go b/deleted_bookmark_response.go deleted file mode 100644 index 1c98a51..0000000 --- a/deleted_bookmark_response.go +++ /dev/null @@ -1,8 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type DeletedBookmarkResponse struct { - // Bookmark ID - Id string `json:"id"` -} diff --git a/deleted_integration.go b/deleted_integration.go deleted file mode 100644 index 71fa90b..0000000 --- a/deleted_integration.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type DeletedIntegration struct { - Id string `json:"id"` -} diff --git a/deleted_issue_trigger_response.go b/deleted_issue_trigger_response.go deleted file mode 100644 index 939c122..0000000 --- a/deleted_issue_trigger_response.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type DeletedIssueTriggerResponse struct { - Id string `json:"id"` -} diff --git a/delivery_issue.go b/delivery_issue.go deleted file mode 100644 index ec0c470..0000000 --- a/delivery_issue.go +++ /dev/null @@ -1,62 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -// Delivery issue -type DeliveryIssue struct { - // Issue ID - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - Status IssueStatus `json:"status,omitempty"` - // ISO timestamp for when the issue was last opened - OpenedAt string `json:"opened_at"` - // ISO timestamp for when the issue was first opened - FirstSeenAt string `json:"first_seen_at"` - // ISO timestamp for when the issue last occured - LastSeenAt string `json:"last_seen_at"` - // ID of the team member who last updated the issue status - LastUpdatedBy *string `json:"last_updated_by,omitempty"` - // ISO timestamp for when the issue was dismissed - DismissedAt *string `json:"dismissed_at,omitempty"` - AutoResolvedAt *string `json:"auto_resolved_at,omitempty"` - MergedWith *string `json:"merged_with,omitempty"` - // ISO timestamp for when the issue was last updated - UpdatedAt string `json:"updated_at"` - // ISO timestamp for when the issue was created - CreatedAt string `json:"created_at"` - AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty"` - Reference *DeliveryIssueReference `json:"reference,omitempty"` - type_ string -} - -func (d *DeliveryIssue) Type() string { - return d.type_ -} - -func (d *DeliveryIssue) UnmarshalJSON(data []byte) error { - type unmarshaler DeliveryIssue - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DeliveryIssue(value) - d.type_ = "delivery" - return nil -} - -func (d *DeliveryIssue) MarshalJSON() ([]byte, error) { - type embed DeliveryIssue - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*d), - Type: "delivery", - } - return json.Marshal(marshaler) -} diff --git a/delivery_issue_aggregation_keys.go b/delivery_issue_aggregation_keys.go deleted file mode 100644 index c8b5331..0000000 --- a/delivery_issue_aggregation_keys.go +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Keys used as the aggregation keys a 'delivery' type issue -type DeliveryIssueAggregationKeys struct { - WebhookId []string `json:"webhook_id,omitempty"` - ResponseStatus []float64 `json:"response_status,omitempty"` - ErrorCode []AttemptErrorCodes `json:"error_code,omitempty"` -} diff --git a/delivery_issue_data.go b/delivery_issue_data.go deleted file mode 100644 index fed238b..0000000 --- a/delivery_issue_data.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Delivery issue data -type DeliveryIssueData struct { - TriggerEvent *Event `json:"trigger_event,omitempty"` - TriggerAttempt *EventAttempt `json:"trigger_attempt,omitempty"` -} diff --git a/delivery_issue_reference.go b/delivery_issue_reference.go deleted file mode 100644 index f8a0d55..0000000 --- a/delivery_issue_reference.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Reference to the event and attempt an issue is being created for. -type DeliveryIssueReference struct { - EventId string `json:"event_id"` - AttemptId string `json:"attempt_id"` -} diff --git a/delivery_issue_with_data.go b/delivery_issue_with_data.go deleted file mode 100644 index 11f81a1..0000000 --- a/delivery_issue_with_data.go +++ /dev/null @@ -1,63 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -// Delivery issue -type DeliveryIssueWithData struct { - // Issue ID - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - Status IssueStatus `json:"status,omitempty"` - // ISO timestamp for when the issue was last opened - OpenedAt string `json:"opened_at"` - // ISO timestamp for when the issue was first opened - FirstSeenAt string `json:"first_seen_at"` - // ISO timestamp for when the issue last occured - LastSeenAt string `json:"last_seen_at"` - // ID of the team member who last updated the issue status - LastUpdatedBy *string `json:"last_updated_by,omitempty"` - // ISO timestamp for when the issue was dismissed - DismissedAt *string `json:"dismissed_at,omitempty"` - AutoResolvedAt *string `json:"auto_resolved_at,omitempty"` - MergedWith *string `json:"merged_with,omitempty"` - // ISO timestamp for when the issue was last updated - UpdatedAt string `json:"updated_at"` - // ISO timestamp for when the issue was created - CreatedAt string `json:"created_at"` - AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty"` - Reference *DeliveryIssueReference `json:"reference,omitempty"` - Data *DeliveryIssueData `json:"data,omitempty"` - type_ string -} - -func (d *DeliveryIssueWithData) Type() string { - return d.type_ -} - -func (d *DeliveryIssueWithData) UnmarshalJSON(data []byte) error { - type unmarshaler DeliveryIssueWithData - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *d = DeliveryIssueWithData(value) - d.type_ = "delivery" - return nil -} - -func (d *DeliveryIssueWithData) MarshalJSON() ([]byte, error) { - type embed DeliveryIssueWithData - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*d), - Type: "delivery", - } - return json.Marshal(marshaler) -} diff --git a/destination.go b/destination.go deleted file mode 100644 index 4478c9e..0000000 --- a/destination.go +++ /dev/null @@ -1,27 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Associated [Destination](#destination-object) object -type Destination struct { - // ID of the destination - Id string `json:"id"` - // A unique, human-friendly name for the destination - Name string `json:"name"` - // ID of the workspace - TeamId string `json:"team_id"` - PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` - // HTTP endpoint of the destination - Url *string `json:"url,omitempty"` - // Path for the CLI destination - CliPath *string `json:"cli_path,omitempty"` - // Limit event attempts to receive per period. Max value is workspace plan's max attempts thoughput. - RateLimit *int `json:"rate_limit,omitempty"` - RateLimitPeriod *DestinationRateLimitPeriod `json:"rate_limit_period,omitempty"` - // Date the destination was archived - ArchivedAt *string `json:"archived_at,omitempty"` - // Date the destination was last updated - UpdatedAt string `json:"updated_at"` - // Date the destination was created - CreatedAt string `json:"created_at"` -} diff --git a/destination_paginated_result.go b/destination_paginated_result.go deleted file mode 100644 index de7828b..0000000 --- a/destination_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type DestinationPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Destination `json:"models,omitempty"` -} diff --git a/destination_rate_limit_period.go b/destination_rate_limit_period.go deleted file mode 100644 index 91ab267..0000000 --- a/destination_rate_limit_period.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Period to rate limit attempts -type DestinationRateLimitPeriod uint8 - -const ( - DestinationRateLimitPeriodSecond DestinationRateLimitPeriod = iota + 1 - DestinationRateLimitPeriodMinute - DestinationRateLimitPeriodHour -) - -func (d DestinationRateLimitPeriod) String() string { - switch d { - default: - return strconv.Itoa(int(d)) - case DestinationRateLimitPeriodSecond: - return "second" - case DestinationRateLimitPeriodMinute: - return "minute" - case DestinationRateLimitPeriodHour: - return "hour" - } -} - -func (d DestinationRateLimitPeriod) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", d.String())), nil -} - -func (d *DestinationRateLimitPeriod) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "second": - value := DestinationRateLimitPeriodSecond - *d = value - case "minute": - value := DestinationRateLimitPeriodMinute - *d = value - case "hour": - value := DestinationRateLimitPeriodHour - *d = value - } - return nil -} diff --git a/destinations.go b/destinations.go new file mode 100644 index 0000000..38567b4 --- /dev/null +++ b/destinations.go @@ -0,0 +1,75 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateDestinationRequest struct { + // Name for the destination `<= 155 characters` + Name string `json:"name"` + // Description for the destination + Description *string `json:"description,omitempty"` + // Endpoint of the destination + Url *string `json:"url,omitempty"` + // Path for the CLI destination + CliPath *string `json:"cli_path,omitempty"` + // Period to rate limit attempts + RateLimitPeriod *CreateDestinationRequestRateLimitPeriod `json:"rate_limit_period,omitempty"` + // Limit event attempts to receive per period + RateLimit *int `json:"rate_limit,omitempty"` + HttpMethod *DestinationHttpMethod `json:"http_method,omitempty"` + AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` +} + +type GetDestinationsRequest struct { + Id *string `json:"-"` + Name *string `json:"-"` + Archived *bool `json:"-"` + ArchivedAt *time.Time `json:"-"` + Url *string `json:"-"` + CliPath *string `json:"-"` + OrderBy *string `json:"-"` + Dir *GetDestinationsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type UpdateDestinationRequest struct { + // Name for the destination `<= 155 characters` + Name *string `json:"name,omitempty"` + // Description for the destination + Description *string `json:"description,omitempty"` + // Endpoint of the destination + Url *string `json:"url,omitempty"` + // Path for the CLI destination + CliPath *string `json:"cli_path,omitempty"` + // Period to rate limit attempts + RateLimitPeriod *UpdateDestinationRequestRateLimitPeriod `json:"rate_limit_period,omitempty"` + // Limit event attempts to receive per period + RateLimit *int `json:"rate_limit,omitempty"` + HttpMethod *DestinationHttpMethod `json:"http_method,omitempty"` + AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` +} + +type UpsertDestinationRequest struct { + // Name for the destination `<= 155 characters` + Name string `json:"name"` + // Description for the destination + Description *string `json:"description,omitempty"` + // Endpoint of the destination + Url *string `json:"url,omitempty"` + // Path for the CLI destination + CliPath *string `json:"cli_path,omitempty"` + // Period to rate limit attempts + RateLimitPeriod *UpsertDestinationRequestRateLimitPeriod `json:"rate_limit_period,omitempty"` + // Limit event attempts to receive per period + RateLimit *int `json:"rate_limit,omitempty"` + HttpMethod *DestinationHttpMethod `json:"http_method,omitempty"` + AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` +} diff --git a/destinations_client.go b/destinations/client.go similarity index 56% rename from destinations_client.go rename to destinations/client.go index 9ad2713..f3f4f2c 100644 --- a/destinations_client.go +++ b/destinations/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package destinations import ( bytes "bytes" @@ -8,90 +8,82 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type DestinationsClient interface { - GetDestinations(ctx context.Context, request *GetDestinationsRequest) (*DestinationPaginatedResult, error) - CreateDestination(ctx context.Context, request *CreateDestinationRequest) (*Destination, error) - UpsertDestination(ctx context.Context, request *UpsertDestinationRequest) (*Destination, error) - GetDestination(ctx context.Context, id string) (*Destination, error) - UpdateDestination(ctx context.Context, id string, request *UpdateDestinationRequest) (*Destination, error) - ArchiveDestination(ctx context.Context, id string) (*Destination, error) - UnarchiveDestination(ctx context.Context, id string) (*Destination, error) +type Client interface { + GetDestinations(ctx context.Context, request *hookdeckgo.GetDestinationsRequest) (*hookdeckgo.DestinationPaginatedResult, error) + CreateDestination(ctx context.Context, request *hookdeckgo.CreateDestinationRequest) (*hookdeckgo.Destination, error) + UpsertDestination(ctx context.Context, request *hookdeckgo.UpsertDestinationRequest) (*hookdeckgo.Destination, error) + GetDestination(ctx context.Context, id string) (*hookdeckgo.Destination, error) + UpdateDestination(ctx context.Context, id string, request *hookdeckgo.UpdateDestinationRequest) (*hookdeckgo.Destination, error) + DeleteDestination(ctx context.Context, id string) (*hookdeckgo.DeleteDestinationResponse, error) + ArchiveDestination(ctx context.Context, id string) (*hookdeckgo.Destination, error) + UnarchiveDestination(ctx context.Context, id string) (*hookdeckgo.Destination, error) } -func NewDestinationsClient(opts ...core.ClientOption) DestinationsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &destinationsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type destinationsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (d *destinationsClient) GetDestinations(ctx context.Context, request *GetDestinationsRequest) (*DestinationPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if d.baseURL != "" { - baseURL = d.baseURL +func (c *client) GetDestinations(ctx context.Context, request *hookdeckgo.GetDestinationsRequest) (*hookdeckgo.DestinationPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "destinations" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var nameDefaultValue *string - if request.Name != nameDefaultValue { + if request.Name != nil { queryParams.Add("name", fmt.Sprintf("%v", *request.Name)) } - var archivedDefaultValue *bool - if request.Archived != archivedDefaultValue { + if request.Archived != nil { queryParams.Add("archived", fmt.Sprintf("%v", *request.Archived)) } - var archivedAtDefaultValue *string - if request.ArchivedAt != archivedAtDefaultValue { - queryParams.Add("archived_at", fmt.Sprintf("%v", *request.ArchivedAt)) + if request.ArchivedAt != nil { + queryParams.Add("archived_at", fmt.Sprintf("%v", request.ArchivedAt.Format(time.RFC3339))) } - var urlDefaultValue *string - if request.Url != urlDefaultValue { + if request.Url != nil { queryParams.Add("url", fmt.Sprintf("%v", *request.Url)) } - var cliPathDefaultValue *string - if request.CliPath != cliPathDefaultValue { + if request.CliPath != nil { queryParams.Add("cli_path", fmt.Sprintf("%v", *request.CliPath)) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetDestinationsRequestDirGetDestinationsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -107,14 +99,14 @@ func (d *destinationsClient) GetDestinations(ctx context.Context, request *GetDe decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -124,15 +116,16 @@ func (d *destinationsClient) GetDestinations(ctx context.Context, request *GetDe return apiError } - response := new(DestinationPaginatedResult) + var response *hookdeckgo.DestinationPaginatedResult if err := core.DoRequest( ctx, - d.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - d.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -140,10 +133,10 @@ func (d *destinationsClient) GetDestinations(ctx context.Context, request *GetDe return response, nil } -func (d *destinationsClient) CreateDestination(ctx context.Context, request *CreateDestinationRequest) (*Destination, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if d.baseURL != "" { - baseURL = d.baseURL +func (c *client) CreateDestination(ctx context.Context, request *hookdeckgo.CreateDestinationRequest) (*hookdeckgo.Destination, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "destinations" @@ -156,14 +149,14 @@ func (d *destinationsClient) CreateDestination(ctx context.Context, request *Cre decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -173,15 +166,16 @@ func (d *destinationsClient) CreateDestination(ctx context.Context, request *Cre return apiError } - response := new(Destination) + var response *hookdeckgo.Destination if err := core.DoRequest( ctx, - d.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - d.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -189,10 +183,10 @@ func (d *destinationsClient) CreateDestination(ctx context.Context, request *Cre return response, nil } -func (d *destinationsClient) UpsertDestination(ctx context.Context, request *UpsertDestinationRequest) (*Destination, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if d.baseURL != "" { - baseURL = d.baseURL +func (c *client) UpsertDestination(ctx context.Context, request *hookdeckgo.UpsertDestinationRequest) (*hookdeckgo.Destination, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "destinations" @@ -205,14 +199,14 @@ func (d *destinationsClient) UpsertDestination(ctx context.Context, request *Ups decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -222,15 +216,16 @@ func (d *destinationsClient) UpsertDestination(ctx context.Context, request *Ups return apiError } - response := new(Destination) + var response *hookdeckgo.Destination if err := core.DoRequest( ctx, - d.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - d.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -238,10 +233,10 @@ func (d *destinationsClient) UpsertDestination(ctx context.Context, request *Ups return response, nil } -func (d *destinationsClient) GetDestination(ctx context.Context, id string) (*Destination, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if d.baseURL != "" { - baseURL = d.baseURL +func (c *client) GetDestination(ctx context.Context, id string) (*hookdeckgo.Destination, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"destinations/%v", id) @@ -254,7 +249,7 @@ func (d *destinationsClient) GetDestination(ctx context.Context, id string) (*De decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -264,15 +259,16 @@ func (d *destinationsClient) GetDestination(ctx context.Context, id string) (*De return apiError } - response := new(Destination) + var response *hookdeckgo.Destination if err := core.DoRequest( ctx, - d.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - d.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -280,10 +276,10 @@ func (d *destinationsClient) GetDestination(ctx context.Context, id string) (*De return response, nil } -func (d *destinationsClient) UpdateDestination(ctx context.Context, id string, request *UpdateDestinationRequest) (*Destination, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if d.baseURL != "" { - baseURL = d.baseURL +func (c *client) UpdateDestination(ctx context.Context, id string, request *hookdeckgo.UpdateDestinationRequest) (*hookdeckgo.Destination, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"destinations/%v", id) @@ -296,21 +292,21 @@ func (d *destinationsClient) UpdateDestination(ctx context.Context, id string, r decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -320,15 +316,16 @@ func (d *destinationsClient) UpdateDestination(ctx context.Context, id string, r return apiError } - response := new(Destination) + var response *hookdeckgo.Destination if err := core.DoRequest( ctx, - d.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - d.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -336,10 +333,53 @@ func (d *destinationsClient) UpdateDestination(ctx context.Context, id string, r return response, nil } -func (d *destinationsClient) ArchiveDestination(ctx context.Context, id string) (*Destination, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if d.baseURL != "" { - baseURL = d.baseURL +func (c *client) DeleteDestination(ctx context.Context, id string) (*hookdeckgo.DeleteDestinationResponse, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"destinations/%v", id) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 404: + value := new(hookdeckgo.NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *hookdeckgo.DeleteDestinationResponse + if err := core.DoRequest( + ctx, + c.httpClient, + endpointURL, + http.MethodDelete, + nil, + &response, + false, + c.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +func (c *client) ArchiveDestination(ctx context.Context, id string) (*hookdeckgo.Destination, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"destinations/%v/archive", id) @@ -352,7 +392,7 @@ func (d *destinationsClient) ArchiveDestination(ctx context.Context, id string) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -362,15 +402,16 @@ func (d *destinationsClient) ArchiveDestination(ctx context.Context, id string) return apiError } - response := new(Destination) + var response *hookdeckgo.Destination if err := core.DoRequest( ctx, - d.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - d.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -378,10 +419,10 @@ func (d *destinationsClient) ArchiveDestination(ctx context.Context, id string) return response, nil } -func (d *destinationsClient) UnarchiveDestination(ctx context.Context, id string) (*Destination, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if d.baseURL != "" { - baseURL = d.baseURL +func (c *client) UnarchiveDestination(ctx context.Context, id string) (*hookdeckgo.Destination, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"destinations/%v/unarchive", id) @@ -394,7 +435,7 @@ func (d *destinationsClient) UnarchiveDestination(ctx context.Context, id string decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -404,15 +445,16 @@ func (d *destinationsClient) UnarchiveDestination(ctx context.Context, id string return apiError } - response := new(Destination) + var response *hookdeckgo.Destination if err := core.DoRequest( ctx, - d.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - d.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/detached_integration_from_source.go b/detached_integration_from_source.go deleted file mode 100644 index 5a94ffd..0000000 --- a/detached_integration_from_source.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type DetachedIntegrationFromSource struct { -} diff --git a/doc.go b/doc.go new file mode 100644 index 0000000..76ab1b6 --- /dev/null +++ b/doc.go @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +// A connection lets you route webhooks from a source to a destination, using a ruleset. +package api diff --git a/environments.go b/environments.go index e1e319c..ec8de3f 100644 --- a/environments.go +++ b/environments.go @@ -9,5 +9,5 @@ package api var Environments = struct { Default string }{ - Default: "https://api.hookdeck.com/2023-01-01", + Default: "https://api.hookdeck.com/2023-07-01", } diff --git a/errors.go b/errors.go new file mode 100644 index 0000000..8ca8546 --- /dev/null +++ b/errors.go @@ -0,0 +1,65 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + json "encoding/json" + core "github.com/fern-hookdeck/hookdeck-go/core" +) + +type BadRequestError struct { + *core.APIError + Body *ApiErrorResponse +} + +func (b *BadRequestError) UnmarshalJSON(data []byte) error { + var body *ApiErrorResponse + if err := json.Unmarshal(data, &body); err != nil { + return err + } + b.StatusCode = 400 + b.Body = body + return nil +} + +func (b *BadRequestError) MarshalJSON() ([]byte, error) { + return json.Marshal(b.Body) +} + +type NotFoundError struct { + *core.APIError + Body *ApiErrorResponse +} + +func (n *NotFoundError) UnmarshalJSON(data []byte) error { + var body *ApiErrorResponse + if err := json.Unmarshal(data, &body); err != nil { + return err + } + n.StatusCode = 404 + n.Body = body + return nil +} + +func (n *NotFoundError) MarshalJSON() ([]byte, error) { + return json.Marshal(n.Body) +} + +type UnprocessableEntityError struct { + *core.APIError + Body *ApiErrorResponse +} + +func (u *UnprocessableEntityError) UnmarshalJSON(data []byte) error { + var body *ApiErrorResponse + if err := json.Unmarshal(data, &body); err != nil { + return err + } + u.StatusCode = 422 + u.Body = body + return nil +} + +func (u *UnprocessableEntityError) MarshalJSON() ([]byte, error) { + return json.Marshal(u.Body) +} diff --git a/event.go b/event.go deleted file mode 100644 index bf480aa..0000000 --- a/event.go +++ /dev/null @@ -1,40 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type Event struct { - // ID of the event - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - // ID of the associated connection - WebhookId string `json:"webhook_id"` - // ID of the associated source - SourceId string `json:"source_id"` - // ID of the associated destination - DestinationId string `json:"destination_id"` - // ID of the request data - EventDataId string `json:"event_data_id"` - // ID of the request that created the event - RequestId string `json:"request_id"` - // Number of delivery attempts made - Attempts int `json:"attempts"` - Data *EventData `json:"data,omitempty"` - // Date of the most recently attempted retry - LastAttemptAt *string `json:"last_attempt_at,omitempty"` - // Date of the next scheduled retry - NextAttemptAt *string `json:"next_attempt_at,omitempty"` - // Event status - ResponseStatus *int `json:"response_status,omitempty"` - Status EventStatus `json:"status,omitempty"` - // Date of the latest successful attempt - SuccessfulAt *string `json:"successful_at,omitempty"` - // ID of the CLI the event is sent to - CliId *string `json:"cli_id,omitempty"` - // Date the event was last updated - UpdatedAt string `json:"updated_at"` - // Date the event was created - CreatedAt string `json:"created_at"` - CreatedAtId *string `json:"created_at_id,omitempty"` - LastAttemptAtId *string `json:"last_attempt_at_id,omitempty"` -} diff --git a/event_array.go b/event_array.go deleted file mode 100644 index d0412e3..0000000 --- a/event_array.go +++ /dev/null @@ -1,5 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type EventArray = []*Event diff --git a/event_attempt.go b/event_attempt.go deleted file mode 100644 index 3f2788e..0000000 --- a/event_attempt.go +++ /dev/null @@ -1,43 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type EventAttempt struct { - // Attempt ID - Id string `json:"id"` - // Team ID - TeamId string `json:"team_id"` - // Event ID - EventId string `json:"event_id"` - // Attempt's HTTP response code - ResponseStatus *int `json:"response_status,omitempty"` - // Sequential number of attempts (up to and including this one) made for the associated event - AttemptNumber *int `json:"attempt_number,omitempty"` - Trigger *AttemptTrigger `json:"trigger,omitempty"` - ErrorCode *AttemptErrorCodes `json:"error_code,omitempty"` - // Response body from the destination - Body *EventAttemptBody `json:"body,omitempty"` - // URL of the destination where delivery was attempted - RequestedUrl *string `json:"requested_url,omitempty"` - // ID of associated bulk retry - BulkRetryId *string `json:"bulk_retry_id,omitempty"` - Status AttemptStatus `json:"status,omitempty"` - // Date the attempt was successful - SuccessfulAt *string `json:"successful_at,omitempty"` - // Date the attempt was delivered - DeliveredAt *string `json:"delivered_at,omitempty"` - // Date the destination responded to this attempt - RespondedAt *string `json:"responded_at,omitempty"` - // Time elapsed between attempt initiation and final delivery (in ms) - DeliveryLatency *int `json:"delivery_latency,omitempty"` - // Time elapsed between attempt initiation and a response from the destination (in ms) - ResponseLatency *int `json:"response_latency,omitempty"` - // Date the attempt was last updated - UpdatedAt string `json:"updated_at"` - // Date the attempt was created - CreatedAt string `json:"created_at"` - State *AttemptState `json:"state,omitempty"` - // Date the attempt was archived - ArchivedAt *string `json:"archived_at,omitempty"` - DestinationId *string `json:"destination_id,omitempty"` -} diff --git a/event_attempt_body.go b/event_attempt_body.go deleted file mode 100644 index bf40f8b..0000000 --- a/event_attempt_body.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Response body from the destination -type EventAttemptBody struct { -} diff --git a/event_attempt_paginated_result.go b/event_attempt_paginated_result.go deleted file mode 100644 index 797f21d..0000000 --- a/event_attempt_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type EventAttemptPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*EventAttempt `json:"models,omitempty"` -} diff --git a/event_data.go b/event_data.go deleted file mode 100644 index 52b6c73..0000000 --- a/event_data.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type EventData struct { - Path string `json:"path"` - Query *string `json:"query,omitempty"` - ParsedQuery *EventDataParsedQuery `json:"parsed_query,omitempty"` - Headers *EventDataHeaders `json:"headers,omitempty"` - Body *EventDataBody `json:"body,omitempty"` - IsLargePayload *bool `json:"is_large_payload,omitempty"` -} diff --git a/event_data_body.go b/event_data_body.go deleted file mode 100644 index 007928c..0000000 --- a/event_data_body.go +++ /dev/null @@ -1,81 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type EventDataBody struct { - typeName string - String string - EventDataBodyEventDataBody *EventDataBodyEventDataBody - UnknownList []any -} - -func NewEventDataBodyFromString(value string) *EventDataBody { - return &EventDataBody{typeName: "string", String: value} -} - -func NewEventDataBodyFromEventDataBodyEventDataBody(value *EventDataBodyEventDataBody) *EventDataBody { - return &EventDataBody{typeName: "eventDataBodyEventDataBody", EventDataBodyEventDataBody: value} -} - -func NewEventDataBodyFromUnknownList(value []any) *EventDataBody { - return &EventDataBody{typeName: "unknownList", UnknownList: value} -} - -func (e *EventDataBody) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.typeName = "string" - e.String = valueString - return nil - } - valueEventDataBodyEventDataBody := new(EventDataBodyEventDataBody) - if err := json.Unmarshal(data, &valueEventDataBodyEventDataBody); err == nil { - e.typeName = "eventDataBodyEventDataBody" - e.EventDataBodyEventDataBody = valueEventDataBodyEventDataBody - return nil - } - var valueUnknownList []any - if err := json.Unmarshal(data, &valueUnknownList); err == nil { - e.typeName = "unknownList" - e.UnknownList = valueUnknownList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventDataBody) MarshalJSON() ([]byte, error) { - switch e.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", e.typeName, e) - case "string": - return json.Marshal(e.String) - case "eventDataBodyEventDataBody": - return json.Marshal(e.EventDataBodyEventDataBody) - case "unknownList": - return json.Marshal(e.UnknownList) - } -} - -type EventDataBodyVisitor interface { - VisitString(string) error - VisitEventDataBodyEventDataBody(*EventDataBodyEventDataBody) error - VisitUnknownList([]any) error -} - -func (e *EventDataBody) Accept(v EventDataBodyVisitor) error { - switch e.typeName { - default: - return fmt.Errorf("invalid type %s in %T", e.typeName, e) - case "string": - return v.VisitString(e.String) - case "eventDataBodyEventDataBody": - return v.VisitEventDataBodyEventDataBody(e.EventDataBodyEventDataBody) - case "unknownList": - return v.VisitUnknownList(e.UnknownList) - } -} diff --git a/event_data_body_event_data_body.go b/event_data_body_event_data_body.go deleted file mode 100644 index f88b897..0000000 --- a/event_data_body_event_data_body.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type EventDataBodyEventDataBody struct { -} diff --git a/event_data_headers.go b/event_data_headers.go deleted file mode 100644 index c8cc4b0..0000000 --- a/event_data_headers.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type EventDataHeaders struct { - typeName string - String string - StringStringOptionalMap map[string]*string -} - -func NewEventDataHeadersFromString(value string) *EventDataHeaders { - return &EventDataHeaders{typeName: "string", String: value} -} - -func NewEventDataHeadersFromStringStringOptionalMap(value map[string]*string) *EventDataHeaders { - return &EventDataHeaders{typeName: "stringStringOptionalMap", StringStringOptionalMap: value} -} - -func (e *EventDataHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - e.typeName = "string" - e.String = valueString - return nil - } - var valueStringStringOptionalMap map[string]*string - if err := json.Unmarshal(data, &valueStringStringOptionalMap); err == nil { - e.typeName = "stringStringOptionalMap" - e.StringStringOptionalMap = valueStringStringOptionalMap - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventDataHeaders) MarshalJSON() ([]byte, error) { - switch e.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", e.typeName, e) - case "string": - return json.Marshal(e.String) - case "stringStringOptionalMap": - return json.Marshal(e.StringStringOptionalMap) - } -} - -type EventDataHeadersVisitor interface { - VisitString(string) error - VisitStringStringOptionalMap(map[string]*string) error -} - -func (e *EventDataHeaders) Accept(v EventDataHeadersVisitor) error { - switch e.typeName { - default: - return fmt.Errorf("invalid type %s in %T", e.typeName, e) - case "string": - return v.VisitString(e.String) - case "stringStringOptionalMap": - return v.VisitStringStringOptionalMap(e.StringStringOptionalMap) - } -} diff --git a/event_data_parsed_query.go b/event_data_parsed_query.go deleted file mode 100644 index 50a3082..0000000 --- a/event_data_parsed_query.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type EventDataParsedQuery struct { - typeName string - StringOptional *string - EventDataParsedQueryEventDataParsedQuery *EventDataParsedQueryEventDataParsedQuery -} - -func NewEventDataParsedQueryFromStringOptional(value *string) *EventDataParsedQuery { - return &EventDataParsedQuery{typeName: "stringOptional", StringOptional: value} -} - -func NewEventDataParsedQueryFromEventDataParsedQueryEventDataParsedQuery(value *EventDataParsedQueryEventDataParsedQuery) *EventDataParsedQuery { - return &EventDataParsedQuery{typeName: "eventDataParsedQueryEventDataParsedQuery", EventDataParsedQueryEventDataParsedQuery: value} -} - -func (e *EventDataParsedQuery) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - e.typeName = "stringOptional" - e.StringOptional = valueStringOptional - return nil - } - valueEventDataParsedQueryEventDataParsedQuery := new(EventDataParsedQueryEventDataParsedQuery) - if err := json.Unmarshal(data, &valueEventDataParsedQueryEventDataParsedQuery); err == nil { - e.typeName = "eventDataParsedQueryEventDataParsedQuery" - e.EventDataParsedQueryEventDataParsedQuery = valueEventDataParsedQueryEventDataParsedQuery - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, e) -} - -func (e EventDataParsedQuery) MarshalJSON() ([]byte, error) { - switch e.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", e.typeName, e) - case "stringOptional": - return json.Marshal(e.StringOptional) - case "eventDataParsedQueryEventDataParsedQuery": - return json.Marshal(e.EventDataParsedQueryEventDataParsedQuery) - } -} - -type EventDataParsedQueryVisitor interface { - VisitStringOptional(*string) error - VisitEventDataParsedQueryEventDataParsedQuery(*EventDataParsedQueryEventDataParsedQuery) error -} - -func (e *EventDataParsedQuery) Accept(v EventDataParsedQueryVisitor) error { - switch e.typeName { - default: - return fmt.Errorf("invalid type %s in %T", e.typeName, e) - case "stringOptional": - return v.VisitStringOptional(e.StringOptional) - case "eventDataParsedQueryEventDataParsedQuery": - return v.VisitEventDataParsedQueryEventDataParsedQuery(e.EventDataParsedQueryEventDataParsedQuery) - } -} diff --git a/event_data_parsed_query_event_data_parsed_query.go b/event_data_parsed_query_event_data_parsed_query.go deleted file mode 100644 index 8d09167..0000000 --- a/event_data_parsed_query_event_data_parsed_query.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type EventDataParsedQueryEventDataParsedQuery struct { -} diff --git a/event_paginated_result.go b/event_paginated_result.go deleted file mode 100644 index f616dd9..0000000 --- a/event_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type EventPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Event `json:"models,omitempty"` -} diff --git a/event_status.go b/event_status.go deleted file mode 100644 index cfe1f08..0000000 --- a/event_status.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type EventStatus uint8 - -const ( - EventStatusScheduled EventStatus = iota + 1 - EventStatusQueued - EventStatusHold - EventStatusSuccessful - EventStatusFailed -) - -func (e EventStatus) String() string { - switch e { - default: - return strconv.Itoa(int(e)) - case EventStatusScheduled: - return "SCHEDULED" - case EventStatusQueued: - return "QUEUED" - case EventStatusHold: - return "HOLD" - case EventStatusSuccessful: - return "SUCCESSFUL" - case EventStatusFailed: - return "FAILED" - } -} - -func (e EventStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", e.String())), nil -} - -func (e *EventStatus) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "SCHEDULED": - value := EventStatusScheduled - *e = value - case "QUEUED": - value := EventStatusQueued - *e = value - case "HOLD": - value := EventStatusHold - *e = value - case "SUCCESSFUL": - value := EventStatusSuccessful - *e = value - case "FAILED": - value := EventStatusFailed - *e = value - } - return nil -} diff --git a/events.go b/events.go new file mode 100644 index 0000000..167e89f --- /dev/null +++ b/events.go @@ -0,0 +1,37 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type GetEventsRequest struct { + Id *string `json:"-"` + Status *EventStatus `json:"-"` + WebhookId *string `json:"-"` + DestinationId *string `json:"-"` + SourceId *string `json:"-"` + Attempts *int `json:"-"` + ResponseStatus *int `json:"-"` + SuccessfulAt *time.Time `json:"-"` + CreatedAt *time.Time `json:"-"` + ErrorCode *AttemptErrorCodes `json:"-"` + CliId *string `json:"-"` + LastAttemptAt *time.Time `json:"-"` + SearchTerm *string `json:"-"` + Headers *string `json:"-"` + Body *string `json:"-"` + ParsedQuery *string `json:"-"` + Path *string `json:"-"` + CliUserId *string `json:"-"` + IssueId *string `json:"-"` + EventDataId *string `json:"-"` + BulkRetryId *string `json:"-"` + Include *string `json:"-"` + OrderBy *GetEventsRequestOrderBy `json:"-"` + Dir *GetEventsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} diff --git a/events_client.go b/events/client.go similarity index 56% rename from events_client.go rename to events/client.go index 90f5f2c..3cc539a 100644 --- a/events_client.go +++ b/events/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package events import ( bytes "bytes" @@ -8,148 +8,127 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type EventsClient interface { - GetEvents(ctx context.Context, request *GetEventsRequest) (*EventPaginatedResult, error) - GetEvent(ctx context.Context, id string) (*Event, error) - GetRequestRawBody(ctx context.Context, id string) (*RawBody, error) - RetryEvent(ctx context.Context, id string) (*RetriedEvent, error) - MuteEvent(ctx context.Context, id string) (*Event, error) +type Client interface { + GetEvents(ctx context.Context, request *hookdeckgo.GetEventsRequest) (*hookdeckgo.EventPaginatedResult, error) + GetEvent(ctx context.Context, id string) (*hookdeckgo.Event, error) + GetRequestRawBody(ctx context.Context, id string) (*hookdeckgo.RawBody, error) + RetryEvent(ctx context.Context, id string) (*hookdeckgo.RetriedEvent, error) + MuteEvent(ctx context.Context, id string) (*hookdeckgo.Event, error) } -func NewEventsClient(opts ...core.ClientOption) EventsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &eventsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type eventsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (e *eventsClient) GetEvents(ctx context.Context, request *GetEventsRequest) (*EventPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if e.baseURL != "" { - baseURL = e.baseURL +func (c *client) GetEvents(ctx context.Context, request *hookdeckgo.GetEventsRequest) (*hookdeckgo.EventPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "events" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var statusDefaultValue *EventStatus - if request.Status != statusDefaultValue { + if request.Status != nil { queryParams.Add("status", fmt.Sprintf("%v", *request.Status)) } - var issueIdDefaultValue *string - if request.IssueId != issueIdDefaultValue { - queryParams.Add("issue_id", fmt.Sprintf("%v", *request.IssueId)) - } - var webhookIdDefaultValue *string - if request.WebhookId != webhookIdDefaultValue { + if request.WebhookId != nil { queryParams.Add("webhook_id", fmt.Sprintf("%v", *request.WebhookId)) } - var destinationIdDefaultValue *string - if request.DestinationId != destinationIdDefaultValue { + if request.DestinationId != nil { queryParams.Add("destination_id", fmt.Sprintf("%v", *request.DestinationId)) } - var sourceIdDefaultValue *string - if request.SourceId != sourceIdDefaultValue { + if request.SourceId != nil { queryParams.Add("source_id", fmt.Sprintf("%v", *request.SourceId)) } - var attemptsDefaultValue *int - if request.Attempts != attemptsDefaultValue { + if request.Attempts != nil { queryParams.Add("attempts", fmt.Sprintf("%v", *request.Attempts)) } - var responseStatusDefaultValue *int - if request.ResponseStatus != responseStatusDefaultValue { + if request.ResponseStatus != nil { queryParams.Add("response_status", fmt.Sprintf("%v", *request.ResponseStatus)) } - var successfulAtDefaultValue *string - if request.SuccessfulAt != successfulAtDefaultValue { - queryParams.Add("successful_at", fmt.Sprintf("%v", *request.SuccessfulAt)) + if request.SuccessfulAt != nil { + queryParams.Add("successful_at", fmt.Sprintf("%v", request.SuccessfulAt.Format(time.RFC3339))) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.CreatedAt != nil { + queryParams.Add("created_at", fmt.Sprintf("%v", request.CreatedAt.Format(time.RFC3339))) } - var errorCodeDefaultValue *string - if request.ErrorCode != errorCodeDefaultValue { + if request.ErrorCode != nil { queryParams.Add("error_code", fmt.Sprintf("%v", *request.ErrorCode)) } - var cliIdDefaultValue *string - if request.CliId != cliIdDefaultValue { + if request.CliId != nil { queryParams.Add("cli_id", fmt.Sprintf("%v", *request.CliId)) } - var cliUserIdDefaultValue *string - if request.CliUserId != cliUserIdDefaultValue { - queryParams.Add("cli_user_id", fmt.Sprintf("%v", *request.CliUserId)) - } - var lastAttemptAtDefaultValue *string - if request.LastAttemptAt != lastAttemptAtDefaultValue { - queryParams.Add("last_attempt_at", fmt.Sprintf("%v", *request.LastAttemptAt)) + if request.LastAttemptAt != nil { + queryParams.Add("last_attempt_at", fmt.Sprintf("%v", request.LastAttemptAt.Format(time.RFC3339))) } - var eventDataIdDefaultValue *string - if request.EventDataId != eventDataIdDefaultValue { - queryParams.Add("event_data_id", fmt.Sprintf("%v", *request.EventDataId)) + if request.SearchTerm != nil { + queryParams.Add("search_term", fmt.Sprintf("%v", *request.SearchTerm)) } - var headersDefaultValue *string - if request.Headers != headersDefaultValue { + if request.Headers != nil { queryParams.Add("headers", fmt.Sprintf("%v", *request.Headers)) } - var bodyDefaultValue *string - if request.Body != bodyDefaultValue { + if request.Body != nil { queryParams.Add("body", fmt.Sprintf("%v", *request.Body)) } - var parsedQueryDefaultValue *string - if request.ParsedQuery != parsedQueryDefaultValue { + if request.ParsedQuery != nil { queryParams.Add("parsed_query", fmt.Sprintf("%v", *request.ParsedQuery)) } - var bulkRetryIdDefaultValue *string - if request.BulkRetryId != bulkRetryIdDefaultValue { - queryParams.Add("bulk_retry_id", fmt.Sprintf("%v", *request.BulkRetryId)) - } - var pathDefaultValue *string - if request.Path != pathDefaultValue { + if request.Path != nil { queryParams.Add("path", fmt.Sprintf("%v", *request.Path)) } - var includeDefaultValue *string - if request.Include != includeDefaultValue { + if request.CliUserId != nil { + queryParams.Add("cli_user_id", fmt.Sprintf("%v", *request.CliUserId)) + } + if request.IssueId != nil { + queryParams.Add("issue_id", fmt.Sprintf("%v", *request.IssueId)) + } + if request.EventDataId != nil { + queryParams.Add("event_data_id", fmt.Sprintf("%v", *request.EventDataId)) + } + if request.BulkRetryId != nil { + queryParams.Add("bulk_retry_id", fmt.Sprintf("%v", *request.BulkRetryId)) + } + if request.Include != nil { queryParams.Add("include", fmt.Sprintf("%v", *request.Include)) } - var orderByDefaultValue *GetEventsRequestOrderByGetEventsRequestOrderBy - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetEventsRequestDirGetEventsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -165,14 +144,14 @@ func (e *eventsClient) GetEvents(ctx context.Context, request *GetEventsRequest) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -182,15 +161,16 @@ func (e *eventsClient) GetEvents(ctx context.Context, request *GetEventsRequest) return apiError } - response := new(EventPaginatedResult) + var response *hookdeckgo.EventPaginatedResult if err := core.DoRequest( ctx, - e.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - e.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -198,10 +178,10 @@ func (e *eventsClient) GetEvents(ctx context.Context, request *GetEventsRequest) return response, nil } -func (e *eventsClient) GetEvent(ctx context.Context, id string) (*Event, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if e.baseURL != "" { - baseURL = e.baseURL +func (c *client) GetEvent(ctx context.Context, id string) (*hookdeckgo.Event, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"events/%v", id) @@ -214,7 +194,7 @@ func (e *eventsClient) GetEvent(ctx context.Context, id string) (*Event, error) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -224,15 +204,16 @@ func (e *eventsClient) GetEvent(ctx context.Context, id string) (*Event, error) return apiError } - response := new(Event) + var response *hookdeckgo.Event if err := core.DoRequest( ctx, - e.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - e.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -240,10 +221,10 @@ func (e *eventsClient) GetEvent(ctx context.Context, id string) (*Event, error) return response, nil } -func (e *eventsClient) GetRequestRawBody(ctx context.Context, id string) (*RawBody, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if e.baseURL != "" { - baseURL = e.baseURL +func (c *client) GetRequestRawBody(ctx context.Context, id string) (*hookdeckgo.RawBody, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"events/%v/raw_body", id) @@ -256,7 +237,7 @@ func (e *eventsClient) GetRequestRawBody(ctx context.Context, id string) (*RawBo decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -266,15 +247,16 @@ func (e *eventsClient) GetRequestRawBody(ctx context.Context, id string) (*RawBo return apiError } - response := new(RawBody) + var response *hookdeckgo.RawBody if err := core.DoRequest( ctx, - e.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - e.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -282,10 +264,10 @@ func (e *eventsClient) GetRequestRawBody(ctx context.Context, id string) (*RawBo return response, nil } -func (e *eventsClient) RetryEvent(ctx context.Context, id string) (*RetriedEvent, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if e.baseURL != "" { - baseURL = e.baseURL +func (c *client) RetryEvent(ctx context.Context, id string) (*hookdeckgo.RetriedEvent, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"events/%v/retry", id) @@ -298,7 +280,7 @@ func (e *eventsClient) RetryEvent(ctx context.Context, id string) (*RetriedEvent decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -308,15 +290,16 @@ func (e *eventsClient) RetryEvent(ctx context.Context, id string) (*RetriedEvent return apiError } - response := new(RetriedEvent) + var response *hookdeckgo.RetriedEvent if err := core.DoRequest( ctx, - e.httpClient, + c.httpClient, endpointURL, http.MethodPost, nil, &response, - e.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -324,10 +307,10 @@ func (e *eventsClient) RetryEvent(ctx context.Context, id string) (*RetriedEvent return response, nil } -func (e *eventsClient) MuteEvent(ctx context.Context, id string) (*Event, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if e.baseURL != "" { - baseURL = e.baseURL +func (c *client) MuteEvent(ctx context.Context, id string) (*hookdeckgo.Event, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"events/%v/mute", id) @@ -340,7 +323,7 @@ func (e *eventsClient) MuteEvent(ctx context.Context, id string) (*Event, error) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -350,15 +333,16 @@ func (e *eventsClient) MuteEvent(ctx context.Context, id string) (*Event, error) return apiError } - response := new(Event) + var response *hookdeckgo.Event if err := core.DoRequest( ctx, - e.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - e.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/filter_rule.go b/filter_rule.go deleted file mode 100644 index 71dd3ec..0000000 --- a/filter_rule.go +++ /dev/null @@ -1,42 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -type FilterRule struct { - Headers *ConnectionFilterProperty `json:"headers,omitempty"` - Body *ConnectionFilterProperty `json:"body,omitempty"` - Query *ConnectionFilterProperty `json:"query,omitempty"` - Path *ConnectionFilterProperty `json:"path,omitempty"` - type_ string -} - -func (f *FilterRule) Type() string { - return f.type_ -} - -func (f *FilterRule) UnmarshalJSON(data []byte) error { - type unmarshaler FilterRule - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *f = FilterRule(value) - f.type_ = "filter" - return nil -} - -func (f *FilterRule) MarshalJSON() ([]byte, error) { - type embed FilterRule - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*f), - Type: "filter", - } - return json.Marshal(marshaler) -} diff --git a/filtered_meta.go b/filtered_meta.go deleted file mode 100644 index 7a822df..0000000 --- a/filtered_meta.go +++ /dev/null @@ -1,59 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type FilteredMeta uint8 - -const ( - FilteredMetaBody FilteredMeta = iota + 1 - FilteredMetaHeaders - FilteredMetaPath - FilteredMetaQuery -) - -func (f FilteredMeta) String() string { - switch f { - default: - return strconv.Itoa(int(f)) - case FilteredMetaBody: - return "body" - case FilteredMetaHeaders: - return "headers" - case FilteredMetaPath: - return "path" - case FilteredMetaQuery: - return "query" - } -} - -func (f FilteredMeta) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", f.String())), nil -} - -func (f *FilteredMeta) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "body": - value := FilteredMetaBody - *f = value - case "headers": - value := FilteredMetaHeaders - *f = value - case "path": - value := FilteredMetaPath - *f = value - case "query": - value := FilteredMetaQuery - *f = value - } - return nil -} diff --git a/get_attempts_request.go b/get_attempts_request.go deleted file mode 100644 index 28e5ef5..0000000 --- a/get_attempts_request.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetAttemptsRequest is an in-lined request used by the GetAttempts endpoint. -type GetAttemptsRequest struct { - EventId *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetAttemptsRequestDirGetAttemptsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_attempts_request_dir_get_attempts_request_dir.go b/get_attempts_request_dir_get_attempts_request_dir.go deleted file mode 100644 index 90aeb83..0000000 --- a/get_attempts_request_dir_get_attempts_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetAttemptsRequestDirGetAttemptsRequestDir uint8 - -const ( - GetAttemptsRequestDirGetAttemptsRequestDirAsc GetAttemptsRequestDirGetAttemptsRequestDir = iota + 1 - GetAttemptsRequestDirGetAttemptsRequestDirDesc -) - -func (g GetAttemptsRequestDirGetAttemptsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetAttemptsRequestDirGetAttemptsRequestDirAsc: - return "asc" - case GetAttemptsRequestDirGetAttemptsRequestDirDesc: - return "desc" - } -} - -func (g GetAttemptsRequestDirGetAttemptsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetAttemptsRequestDirGetAttemptsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetAttemptsRequestDirGetAttemptsRequestDirAsc - *g = value - case "desc": - value := GetAttemptsRequestDirGetAttemptsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_bookmarks_request.go b/get_bookmarks_request.go deleted file mode 100644 index 2aafb07..0000000 --- a/get_bookmarks_request.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetBookmarksRequest is an in-lined request used by the GetBookmarks endpoint. -type GetBookmarksRequest struct { - Id *string `json:"-"` - Name *string `json:"-"` - WebhookId *string `json:"-"` - EventDataId *string `json:"-"` - Label *string `json:"-"` - LastUsedAt *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetBookmarksRequestDirGetBookmarksRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_bookmarks_request_dir_get_bookmarks_request_dir.go b/get_bookmarks_request_dir_get_bookmarks_request_dir.go deleted file mode 100644 index 04e2d4c..0000000 --- a/get_bookmarks_request_dir_get_bookmarks_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetBookmarksRequestDirGetBookmarksRequestDir uint8 - -const ( - GetBookmarksRequestDirGetBookmarksRequestDirAsc GetBookmarksRequestDirGetBookmarksRequestDir = iota + 1 - GetBookmarksRequestDirGetBookmarksRequestDirDesc -) - -func (g GetBookmarksRequestDirGetBookmarksRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetBookmarksRequestDirGetBookmarksRequestDirAsc: - return "asc" - case GetBookmarksRequestDirGetBookmarksRequestDirDesc: - return "desc" - } -} - -func (g GetBookmarksRequestDirGetBookmarksRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetBookmarksRequestDirGetBookmarksRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetBookmarksRequestDirGetBookmarksRequestDirAsc - *g = value - case "desc": - value := GetBookmarksRequestDirGetBookmarksRequestDirDesc - *g = value - } - return nil -} diff --git a/get_connections_request.go b/get_connections_request.go deleted file mode 100644 index ee12f24..0000000 --- a/get_connections_request.go +++ /dev/null @@ -1,20 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetConnectionsRequest is an in-lined request used by the GetConnections endpoint. -type GetConnectionsRequest struct { - Id *string `json:"-"` - Name *string `json:"-"` - DestinationId *string `json:"-"` - SourceId *string `json:"-"` - Archived *bool `json:"-"` - ArchivedAt *string `json:"-"` - FullName *string `json:"-"` - PausedAt *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetConnectionsRequestDirGetConnectionsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_connections_request_dir_get_connections_request_dir.go b/get_connections_request_dir_get_connections_request_dir.go deleted file mode 100644 index ab03244..0000000 --- a/get_connections_request_dir_get_connections_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetConnectionsRequestDirGetConnectionsRequestDir uint8 - -const ( - GetConnectionsRequestDirGetConnectionsRequestDirAsc GetConnectionsRequestDirGetConnectionsRequestDir = iota + 1 - GetConnectionsRequestDirGetConnectionsRequestDirDesc -) - -func (g GetConnectionsRequestDirGetConnectionsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetConnectionsRequestDirGetConnectionsRequestDirAsc: - return "asc" - case GetConnectionsRequestDirGetConnectionsRequestDirDesc: - return "desc" - } -} - -func (g GetConnectionsRequestDirGetConnectionsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetConnectionsRequestDirGetConnectionsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetConnectionsRequestDirGetConnectionsRequestDirAsc - *g = value - case "desc": - value := GetConnectionsRequestDirGetConnectionsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_destinations_request.go b/get_destinations_request.go deleted file mode 100644 index 15f6ad7..0000000 --- a/get_destinations_request.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetDestinationsRequest is an in-lined request used by the GetDestinations endpoint. -type GetDestinationsRequest struct { - Id *string `json:"-"` - Name *string `json:"-"` - Archived *bool `json:"-"` - ArchivedAt *string `json:"-"` - Url *string `json:"-"` - CliPath *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetDestinationsRequestDirGetDestinationsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_destinations_request_dir_get_destinations_request_dir.go b/get_destinations_request_dir_get_destinations_request_dir.go deleted file mode 100644 index 67d5625..0000000 --- a/get_destinations_request_dir_get_destinations_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetDestinationsRequestDirGetDestinationsRequestDir uint8 - -const ( - GetDestinationsRequestDirGetDestinationsRequestDirAsc GetDestinationsRequestDirGetDestinationsRequestDir = iota + 1 - GetDestinationsRequestDirGetDestinationsRequestDirDesc -) - -func (g GetDestinationsRequestDirGetDestinationsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetDestinationsRequestDirGetDestinationsRequestDirAsc: - return "asc" - case GetDestinationsRequestDirGetDestinationsRequestDirDesc: - return "desc" - } -} - -func (g GetDestinationsRequestDirGetDestinationsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetDestinationsRequestDirGetDestinationsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetDestinationsRequestDirGetDestinationsRequestDirAsc - *g = value - case "desc": - value := GetDestinationsRequestDirGetDestinationsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_event_bulk_retries_request.go b/get_event_bulk_retries_request.go deleted file mode 100644 index 70472d8..0000000 --- a/get_event_bulk_retries_request.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetEventBulkRetriesRequest is an in-lined request used by the GetEventBulkRetries endpoint. -type GetEventBulkRetriesRequest struct { - CancelledAt *string `json:"-"` - CompletedAt *string `json:"-"` - CreatedAt *string `json:"-"` - Id *string `json:"-"` - QueryPartialMatch *bool `json:"-"` - InProgress *bool `json:"-"` - OrderBy *string `json:"-"` - Dir *GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_event_bulk_retries_request_dir_get_event_bulk_retries_request_dir.go b/get_event_bulk_retries_request_dir_get_event_bulk_retries_request_dir.go deleted file mode 100644 index 8b59fff..0000000 --- a/get_event_bulk_retries_request_dir_get_event_bulk_retries_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDir uint8 - -const ( - GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDirAsc GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDir = iota + 1 - GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDirDesc -) - -func (g GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDirAsc: - return "asc" - case GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDirDesc: - return "desc" - } -} - -func (g GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDirAsc - *g = value - case "desc": - value := GetEventBulkRetriesRequestDirGetEventBulkRetriesRequestDirDesc - *g = value - } - return nil -} diff --git a/get_events_request.go b/get_events_request.go deleted file mode 100644 index 0f7ce85..0000000 --- a/get_events_request.go +++ /dev/null @@ -1,33 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetEventsRequest is an in-lined request used by the GetEvents endpoint. -type GetEventsRequest struct { - Id *string `json:"-"` - Status *EventStatus `json:"-"` - IssueId *string `json:"-"` - WebhookId *string `json:"-"` - DestinationId *string `json:"-"` - SourceId *string `json:"-"` - Attempts *int `json:"-"` - ResponseStatus *int `json:"-"` - SuccessfulAt *string `json:"-"` - CreatedAt *string `json:"-"` - ErrorCode *string `json:"-"` - CliId *string `json:"-"` - CliUserId *string `json:"-"` - LastAttemptAt *string `json:"-"` - EventDataId *string `json:"-"` - Headers *string `json:"-"` - Body *string `json:"-"` - ParsedQuery *string `json:"-"` - BulkRetryId *string `json:"-"` - Path *string `json:"-"` - Include *string `json:"-"` - OrderBy *GetEventsRequestOrderByGetEventsRequestOrderBy `json:"-"` - Dir *GetEventsRequestDirGetEventsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_events_request_dir_get_events_request_dir.go b/get_events_request_dir_get_events_request_dir.go deleted file mode 100644 index c58c475..0000000 --- a/get_events_request_dir_get_events_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetEventsRequestDirGetEventsRequestDir uint8 - -const ( - GetEventsRequestDirGetEventsRequestDirAsc GetEventsRequestDirGetEventsRequestDir = iota + 1 - GetEventsRequestDirGetEventsRequestDirDesc -) - -func (g GetEventsRequestDirGetEventsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetEventsRequestDirGetEventsRequestDirAsc: - return "asc" - case GetEventsRequestDirGetEventsRequestDirDesc: - return "desc" - } -} - -func (g GetEventsRequestDirGetEventsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetEventsRequestDirGetEventsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetEventsRequestDirGetEventsRequestDirAsc - *g = value - case "desc": - value := GetEventsRequestDirGetEventsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_events_request_order_by_get_events_request_order_by.go b/get_events_request_order_by_get_events_request_order_by.go deleted file mode 100644 index 6a25e9a..0000000 --- a/get_events_request_order_by_get_events_request_order_by.go +++ /dev/null @@ -1,53 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetEventsRequestOrderByGetEventsRequestOrderBy uint8 - -const ( - GetEventsRequestOrderByGetEventsRequestOrderByLastAttemptAt GetEventsRequestOrderByGetEventsRequestOrderBy = iota + 1 - GetEventsRequestOrderByGetEventsRequestOrderByNextAttemptAt - GetEventsRequestOrderByGetEventsRequestOrderByCreatedAt -) - -func (g GetEventsRequestOrderByGetEventsRequestOrderBy) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetEventsRequestOrderByGetEventsRequestOrderByLastAttemptAt: - return "last_attempt_at" - case GetEventsRequestOrderByGetEventsRequestOrderByNextAttemptAt: - return "next_attempt_at" - case GetEventsRequestOrderByGetEventsRequestOrderByCreatedAt: - return "created_at" - } -} - -func (g GetEventsRequestOrderByGetEventsRequestOrderBy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetEventsRequestOrderByGetEventsRequestOrderBy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "last_attempt_at": - value := GetEventsRequestOrderByGetEventsRequestOrderByLastAttemptAt - *g = value - case "next_attempt_at": - value := GetEventsRequestOrderByGetEventsRequestOrderByNextAttemptAt - *g = value - case "created_at": - value := GetEventsRequestOrderByGetEventsRequestOrderByCreatedAt - *g = value - } - return nil -} diff --git a/get_ignored_event_bulk_retries_request.go b/get_ignored_event_bulk_retries_request.go deleted file mode 100644 index 66a27c8..0000000 --- a/get_ignored_event_bulk_retries_request.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetIgnoredEventBulkRetriesRequest is an in-lined request used by the GetIgnoredEventBulkRetries endpoint. -type GetIgnoredEventBulkRetriesRequest struct { - CancelledAt *string `json:"-"` - CompletedAt *string `json:"-"` - CreatedAt *string `json:"-"` - Id *string `json:"-"` - QueryPartialMatch *bool `json:"-"` - InProgress *bool `json:"-"` - OrderBy *string `json:"-"` - Dir *GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_ignored_event_bulk_retries_request_dir_get_ignored_event_bulk_retries_request_dir.go b/get_ignored_event_bulk_retries_request_dir_get_ignored_event_bulk_retries_request_dir.go deleted file mode 100644 index deb5ec8..0000000 --- a/get_ignored_event_bulk_retries_request_dir_get_ignored_event_bulk_retries_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDir uint8 - -const ( - GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDirAsc GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDir = iota + 1 - GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDirDesc -) - -func (g GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDirAsc: - return "asc" - case GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDirDesc: - return "desc" - } -} - -func (g GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDirAsc - *g = value - case "desc": - value := GetIgnoredEventBulkRetriesRequestDirGetIgnoredEventBulkRetriesRequestDirDesc - *g = value - } - return nil -} diff --git a/get_integrations_request.go b/get_integrations_request.go deleted file mode 100644 index 8a150a7..0000000 --- a/get_integrations_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetIntegrationsRequest is an in-lined request used by the GetIntegrations endpoint. -type GetIntegrationsRequest struct { - Label *string `json:"-"` - Provider *IntegrationProvider `json:"-"` -} diff --git a/get_issue_count_request.go b/get_issue_count_request.go deleted file mode 100644 index e67209d..0000000 --- a/get_issue_count_request.go +++ /dev/null @@ -1,21 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetIssueCountRequest is an in-lined request used by the GetIssueCount endpoint. -type GetIssueCountRequest struct { - Id *string `json:"-"` - IssueTriggerId *string `json:"-"` - Type *GetIssueCountRequestTypeGetIssueCountRequestType `json:"-"` - Status *GetIssueCountRequestStatusGetIssueCountRequestStatus `json:"-"` - MergedWith *string `json:"-"` - CreatedAt *string `json:"-"` - FirstSeenAt *string `json:"-"` - LastSeenAt *string `json:"-"` - DismissedAt *string `json:"-"` - OrderBy *GetIssueCountRequestOrderByGetIssueCountRequestOrderBy `json:"-"` - Dir *GetIssueCountRequestDirGetIssueCountRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_issue_count_request_dir_get_issue_count_request_dir.go b/get_issue_count_request_dir_get_issue_count_request_dir.go deleted file mode 100644 index b00ee40..0000000 --- a/get_issue_count_request_dir_get_issue_count_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetIssueCountRequestDirGetIssueCountRequestDir uint8 - -const ( - GetIssueCountRequestDirGetIssueCountRequestDirAsc GetIssueCountRequestDirGetIssueCountRequestDir = iota + 1 - GetIssueCountRequestDirGetIssueCountRequestDirDesc -) - -func (g GetIssueCountRequestDirGetIssueCountRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssueCountRequestDirGetIssueCountRequestDirAsc: - return "asc" - case GetIssueCountRequestDirGetIssueCountRequestDirDesc: - return "desc" - } -} - -func (g GetIssueCountRequestDirGetIssueCountRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssueCountRequestDirGetIssueCountRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetIssueCountRequestDirGetIssueCountRequestDirAsc - *g = value - case "desc": - value := GetIssueCountRequestDirGetIssueCountRequestDirDesc - *g = value - } - return nil -} diff --git a/get_issue_count_request_order_by_get_issue_count_request_order_by.go b/get_issue_count_request_order_by_get_issue_count_request_order_by.go deleted file mode 100644 index d47bfbc..0000000 --- a/get_issue_count_request_order_by_get_issue_count_request_order_by.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetIssueCountRequestOrderByGetIssueCountRequestOrderBy uint8 - -const ( - GetIssueCountRequestOrderByGetIssueCountRequestOrderByCreatedAt GetIssueCountRequestOrderByGetIssueCountRequestOrderBy = iota + 1 - GetIssueCountRequestOrderByGetIssueCountRequestOrderByFirstSeenAt - GetIssueCountRequestOrderByGetIssueCountRequestOrderByLastSeenAt - GetIssueCountRequestOrderByGetIssueCountRequestOrderByOpenedAt - GetIssueCountRequestOrderByGetIssueCountRequestOrderByStatus -) - -func (g GetIssueCountRequestOrderByGetIssueCountRequestOrderBy) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssueCountRequestOrderByGetIssueCountRequestOrderByCreatedAt: - return "created_at" - case GetIssueCountRequestOrderByGetIssueCountRequestOrderByFirstSeenAt: - return "first_seen_at" - case GetIssueCountRequestOrderByGetIssueCountRequestOrderByLastSeenAt: - return "last_seen_at" - case GetIssueCountRequestOrderByGetIssueCountRequestOrderByOpenedAt: - return "opened_at" - case GetIssueCountRequestOrderByGetIssueCountRequestOrderByStatus: - return "status" - } -} - -func (g GetIssueCountRequestOrderByGetIssueCountRequestOrderBy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssueCountRequestOrderByGetIssueCountRequestOrderBy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "created_at": - value := GetIssueCountRequestOrderByGetIssueCountRequestOrderByCreatedAt - *g = value - case "first_seen_at": - value := GetIssueCountRequestOrderByGetIssueCountRequestOrderByFirstSeenAt - *g = value - case "last_seen_at": - value := GetIssueCountRequestOrderByGetIssueCountRequestOrderByLastSeenAt - *g = value - case "opened_at": - value := GetIssueCountRequestOrderByGetIssueCountRequestOrderByOpenedAt - *g = value - case "status": - value := GetIssueCountRequestOrderByGetIssueCountRequestOrderByStatus - *g = value - } - return nil -} diff --git a/get_issue_count_request_status_get_issue_count_request_status.go b/get_issue_count_request_status_get_issue_count_request_status.go deleted file mode 100644 index a5ba22e..0000000 --- a/get_issue_count_request_status_get_issue_count_request_status.go +++ /dev/null @@ -1,60 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Issue status -type GetIssueCountRequestStatusGetIssueCountRequestStatus uint8 - -const ( - GetIssueCountRequestStatusGetIssueCountRequestStatusOpened GetIssueCountRequestStatusGetIssueCountRequestStatus = iota + 1 - GetIssueCountRequestStatusGetIssueCountRequestStatusIgnored - GetIssueCountRequestStatusGetIssueCountRequestStatusAcknowledged - GetIssueCountRequestStatusGetIssueCountRequestStatusResolved -) - -func (g GetIssueCountRequestStatusGetIssueCountRequestStatus) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssueCountRequestStatusGetIssueCountRequestStatusOpened: - return "OPENED" - case GetIssueCountRequestStatusGetIssueCountRequestStatusIgnored: - return "IGNORED" - case GetIssueCountRequestStatusGetIssueCountRequestStatusAcknowledged: - return "ACKNOWLEDGED" - case GetIssueCountRequestStatusGetIssueCountRequestStatusResolved: - return "RESOLVED" - } -} - -func (g GetIssueCountRequestStatusGetIssueCountRequestStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssueCountRequestStatusGetIssueCountRequestStatus) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "OPENED": - value := GetIssueCountRequestStatusGetIssueCountRequestStatusOpened - *g = value - case "IGNORED": - value := GetIssueCountRequestStatusGetIssueCountRequestStatusIgnored - *g = value - case "ACKNOWLEDGED": - value := GetIssueCountRequestStatusGetIssueCountRequestStatusAcknowledged - *g = value - case "RESOLVED": - value := GetIssueCountRequestStatusGetIssueCountRequestStatusResolved - *g = value - } - return nil -} diff --git a/get_issue_count_request_type_get_issue_count_request_type.go b/get_issue_count_request_type_get_issue_count_request_type.go deleted file mode 100644 index bbda63f..0000000 --- a/get_issue_count_request_type_get_issue_count_request_type.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Issue type -type GetIssueCountRequestTypeGetIssueCountRequestType uint8 - -const ( - GetIssueCountRequestTypeGetIssueCountRequestTypeDelivery GetIssueCountRequestTypeGetIssueCountRequestType = iota + 1 - GetIssueCountRequestTypeGetIssueCountRequestTypeTransformation - GetIssueCountRequestTypeGetIssueCountRequestTypeBackpressure -) - -func (g GetIssueCountRequestTypeGetIssueCountRequestType) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssueCountRequestTypeGetIssueCountRequestTypeDelivery: - return "delivery" - case GetIssueCountRequestTypeGetIssueCountRequestTypeTransformation: - return "transformation" - case GetIssueCountRequestTypeGetIssueCountRequestTypeBackpressure: - return "backpressure" - } -} - -func (g GetIssueCountRequestTypeGetIssueCountRequestType) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssueCountRequestTypeGetIssueCountRequestType) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "delivery": - value := GetIssueCountRequestTypeGetIssueCountRequestTypeDelivery - *g = value - case "transformation": - value := GetIssueCountRequestTypeGetIssueCountRequestTypeTransformation - *g = value - case "backpressure": - value := GetIssueCountRequestTypeGetIssueCountRequestTypeBackpressure - *g = value - } - return nil -} diff --git a/get_issue_triggers_request.go b/get_issue_triggers_request.go deleted file mode 100644 index 1de18d5..0000000 --- a/get_issue_triggers_request.go +++ /dev/null @@ -1,15 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetIssueTriggersRequest is an in-lined request used by the GetIssueTriggers endpoint. -type GetIssueTriggersRequest struct { - Name *string `json:"-"` - Type *IssueType `json:"-"` - DisabledAt *string `json:"-"` - OrderBy *GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderBy `json:"-"` - Dir *GetIssueTriggersRequestDirGetIssueTriggersRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_issue_triggers_request_dir_get_issue_triggers_request_dir.go b/get_issue_triggers_request_dir_get_issue_triggers_request_dir.go deleted file mode 100644 index 97c7c4f..0000000 --- a/get_issue_triggers_request_dir_get_issue_triggers_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetIssueTriggersRequestDirGetIssueTriggersRequestDir uint8 - -const ( - GetIssueTriggersRequestDirGetIssueTriggersRequestDirAsc GetIssueTriggersRequestDirGetIssueTriggersRequestDir = iota + 1 - GetIssueTriggersRequestDirGetIssueTriggersRequestDirDesc -) - -func (g GetIssueTriggersRequestDirGetIssueTriggersRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssueTriggersRequestDirGetIssueTriggersRequestDirAsc: - return "asc" - case GetIssueTriggersRequestDirGetIssueTriggersRequestDirDesc: - return "desc" - } -} - -func (g GetIssueTriggersRequestDirGetIssueTriggersRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssueTriggersRequestDirGetIssueTriggersRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetIssueTriggersRequestDirGetIssueTriggersRequestDirAsc - *g = value - case "desc": - value := GetIssueTriggersRequestDirGetIssueTriggersRequestDirDesc - *g = value - } - return nil -} diff --git a/get_issue_triggers_request_order_by_get_issue_triggers_request_order_by.go b/get_issue_triggers_request_order_by_get_issue_triggers_request_order_by.go deleted file mode 100644 index a0e8009..0000000 --- a/get_issue_triggers_request_order_by_get_issue_triggers_request_order_by.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderBy uint8 - -const ( - GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderByCreatedAt GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderBy = iota + 1 - GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderByType -) - -func (g GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderBy) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderByCreatedAt: - return "created_at" - case GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderByType: - return "type" - } -} - -func (g GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderBy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderBy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "created_at": - value := GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderByCreatedAt - *g = value - case "type": - value := GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderByType - *g = value - } - return nil -} diff --git a/get_issues_request.go b/get_issues_request.go deleted file mode 100644 index 1f09bc8..0000000 --- a/get_issues_request.go +++ /dev/null @@ -1,21 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetIssuesRequest is an in-lined request used by the GetIssues endpoint. -type GetIssuesRequest struct { - Id *string `json:"-"` - IssueTriggerId *string `json:"-"` - Type *GetIssuesRequestTypeGetIssuesRequestType `json:"-"` - Status *GetIssuesRequestStatusGetIssuesRequestStatus `json:"-"` - MergedWith *string `json:"-"` - CreatedAt *string `json:"-"` - FirstSeenAt *string `json:"-"` - LastSeenAt *string `json:"-"` - DismissedAt *string `json:"-"` - OrderBy *GetIssuesRequestOrderByGetIssuesRequestOrderBy `json:"-"` - Dir *GetIssuesRequestDirGetIssuesRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_issues_request_dir_get_issues_request_dir.go b/get_issues_request_dir_get_issues_request_dir.go deleted file mode 100644 index f342049..0000000 --- a/get_issues_request_dir_get_issues_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetIssuesRequestDirGetIssuesRequestDir uint8 - -const ( - GetIssuesRequestDirGetIssuesRequestDirAsc GetIssuesRequestDirGetIssuesRequestDir = iota + 1 - GetIssuesRequestDirGetIssuesRequestDirDesc -) - -func (g GetIssuesRequestDirGetIssuesRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssuesRequestDirGetIssuesRequestDirAsc: - return "asc" - case GetIssuesRequestDirGetIssuesRequestDirDesc: - return "desc" - } -} - -func (g GetIssuesRequestDirGetIssuesRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssuesRequestDirGetIssuesRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetIssuesRequestDirGetIssuesRequestDirAsc - *g = value - case "desc": - value := GetIssuesRequestDirGetIssuesRequestDirDesc - *g = value - } - return nil -} diff --git a/get_issues_request_order_by_get_issues_request_order_by.go b/get_issues_request_order_by_get_issues_request_order_by.go deleted file mode 100644 index 05d9b2d..0000000 --- a/get_issues_request_order_by_get_issues_request_order_by.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetIssuesRequestOrderByGetIssuesRequestOrderBy uint8 - -const ( - GetIssuesRequestOrderByGetIssuesRequestOrderByCreatedAt GetIssuesRequestOrderByGetIssuesRequestOrderBy = iota + 1 - GetIssuesRequestOrderByGetIssuesRequestOrderByFirstSeenAt - GetIssuesRequestOrderByGetIssuesRequestOrderByLastSeenAt - GetIssuesRequestOrderByGetIssuesRequestOrderByOpenedAt - GetIssuesRequestOrderByGetIssuesRequestOrderByStatus -) - -func (g GetIssuesRequestOrderByGetIssuesRequestOrderBy) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssuesRequestOrderByGetIssuesRequestOrderByCreatedAt: - return "created_at" - case GetIssuesRequestOrderByGetIssuesRequestOrderByFirstSeenAt: - return "first_seen_at" - case GetIssuesRequestOrderByGetIssuesRequestOrderByLastSeenAt: - return "last_seen_at" - case GetIssuesRequestOrderByGetIssuesRequestOrderByOpenedAt: - return "opened_at" - case GetIssuesRequestOrderByGetIssuesRequestOrderByStatus: - return "status" - } -} - -func (g GetIssuesRequestOrderByGetIssuesRequestOrderBy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssuesRequestOrderByGetIssuesRequestOrderBy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "created_at": - value := GetIssuesRequestOrderByGetIssuesRequestOrderByCreatedAt - *g = value - case "first_seen_at": - value := GetIssuesRequestOrderByGetIssuesRequestOrderByFirstSeenAt - *g = value - case "last_seen_at": - value := GetIssuesRequestOrderByGetIssuesRequestOrderByLastSeenAt - *g = value - case "opened_at": - value := GetIssuesRequestOrderByGetIssuesRequestOrderByOpenedAt - *g = value - case "status": - value := GetIssuesRequestOrderByGetIssuesRequestOrderByStatus - *g = value - } - return nil -} diff --git a/get_issues_request_status_get_issues_request_status.go b/get_issues_request_status_get_issues_request_status.go deleted file mode 100644 index a18c58c..0000000 --- a/get_issues_request_status_get_issues_request_status.go +++ /dev/null @@ -1,60 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Issue status -type GetIssuesRequestStatusGetIssuesRequestStatus uint8 - -const ( - GetIssuesRequestStatusGetIssuesRequestStatusOpened GetIssuesRequestStatusGetIssuesRequestStatus = iota + 1 - GetIssuesRequestStatusGetIssuesRequestStatusIgnored - GetIssuesRequestStatusGetIssuesRequestStatusAcknowledged - GetIssuesRequestStatusGetIssuesRequestStatusResolved -) - -func (g GetIssuesRequestStatusGetIssuesRequestStatus) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssuesRequestStatusGetIssuesRequestStatusOpened: - return "OPENED" - case GetIssuesRequestStatusGetIssuesRequestStatusIgnored: - return "IGNORED" - case GetIssuesRequestStatusGetIssuesRequestStatusAcknowledged: - return "ACKNOWLEDGED" - case GetIssuesRequestStatusGetIssuesRequestStatusResolved: - return "RESOLVED" - } -} - -func (g GetIssuesRequestStatusGetIssuesRequestStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssuesRequestStatusGetIssuesRequestStatus) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "OPENED": - value := GetIssuesRequestStatusGetIssuesRequestStatusOpened - *g = value - case "IGNORED": - value := GetIssuesRequestStatusGetIssuesRequestStatusIgnored - *g = value - case "ACKNOWLEDGED": - value := GetIssuesRequestStatusGetIssuesRequestStatusAcknowledged - *g = value - case "RESOLVED": - value := GetIssuesRequestStatusGetIssuesRequestStatusResolved - *g = value - } - return nil -} diff --git a/get_issues_request_type_get_issues_request_type.go b/get_issues_request_type_get_issues_request_type.go deleted file mode 100644 index 94eebb0..0000000 --- a/get_issues_request_type_get_issues_request_type.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Issue type -type GetIssuesRequestTypeGetIssuesRequestType uint8 - -const ( - GetIssuesRequestTypeGetIssuesRequestTypeDelivery GetIssuesRequestTypeGetIssuesRequestType = iota + 1 - GetIssuesRequestTypeGetIssuesRequestTypeTransformation - GetIssuesRequestTypeGetIssuesRequestTypeBackpressure -) - -func (g GetIssuesRequestTypeGetIssuesRequestType) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetIssuesRequestTypeGetIssuesRequestTypeDelivery: - return "delivery" - case GetIssuesRequestTypeGetIssuesRequestTypeTransformation: - return "transformation" - case GetIssuesRequestTypeGetIssuesRequestTypeBackpressure: - return "backpressure" - } -} - -func (g GetIssuesRequestTypeGetIssuesRequestType) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetIssuesRequestTypeGetIssuesRequestType) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "delivery": - value := GetIssuesRequestTypeGetIssuesRequestTypeDelivery - *g = value - case "transformation": - value := GetIssuesRequestTypeGetIssuesRequestTypeTransformation - *g = value - case "backpressure": - value := GetIssuesRequestTypeGetIssuesRequestTypeBackpressure - *g = value - } - return nil -} diff --git a/get_request_bulk_retries_request.go b/get_request_bulk_retries_request.go deleted file mode 100644 index 6c20452..0000000 --- a/get_request_bulk_retries_request.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetRequestBulkRetriesRequest is an in-lined request used by the GetRequestBulkRetries endpoint. -type GetRequestBulkRetriesRequest struct { - CancelledAt *string `json:"-"` - CompletedAt *string `json:"-"` - CreatedAt *string `json:"-"` - Id *string `json:"-"` - InProgress *bool `json:"-"` - QueryPartialMatch *bool `json:"-"` - OrderBy *string `json:"-"` - Dir *GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_request_bulk_retries_request_dir_get_request_bulk_retries_request_dir.go b/get_request_bulk_retries_request_dir_get_request_bulk_retries_request_dir.go deleted file mode 100644 index feeae6d..0000000 --- a/get_request_bulk_retries_request_dir_get_request_bulk_retries_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDir uint8 - -const ( - GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDirAsc GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDir = iota + 1 - GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDirDesc -) - -func (g GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDirAsc: - return "asc" - case GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDirDesc: - return "desc" - } -} - -func (g GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDirAsc - *g = value - case "desc": - value := GetRequestBulkRetriesRequestDirGetRequestBulkRetriesRequestDirDesc - *g = value - } - return nil -} diff --git a/get_request_events_request.go b/get_request_events_request.go deleted file mode 100644 index b3fdb0b..0000000 --- a/get_request_events_request.go +++ /dev/null @@ -1,33 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetRequestEventsRequest is an in-lined request used by the GetRequestEvents endpoint. -type GetRequestEventsRequest struct { - Id *string `json:"-"` - Status *EventStatus `json:"-"` - IssueId *string `json:"-"` - WebhookId *string `json:"-"` - DestinationId *string `json:"-"` - SourceId *string `json:"-"` - Attempts *int `json:"-"` - ResponseStatus *int `json:"-"` - SuccessfulAt *string `json:"-"` - CreatedAt *string `json:"-"` - ErrorCode *string `json:"-"` - CliId *string `json:"-"` - CliUserId *string `json:"-"` - LastAttemptAt *string `json:"-"` - EventDataId *string `json:"-"` - Headers *string `json:"-"` - Body *string `json:"-"` - ParsedQuery *string `json:"-"` - BulkRetryId *string `json:"-"` - Path *string `json:"-"` - Include *string `json:"-"` - OrderBy *GetRequestEventsRequestOrderByGetRequestEventsRequestOrderBy `json:"-"` - Dir *GetRequestEventsRequestDirGetRequestEventsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_request_events_request_dir_get_request_events_request_dir.go b/get_request_events_request_dir_get_request_events_request_dir.go deleted file mode 100644 index 69169c2..0000000 --- a/get_request_events_request_dir_get_request_events_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetRequestEventsRequestDirGetRequestEventsRequestDir uint8 - -const ( - GetRequestEventsRequestDirGetRequestEventsRequestDirAsc GetRequestEventsRequestDirGetRequestEventsRequestDir = iota + 1 - GetRequestEventsRequestDirGetRequestEventsRequestDirDesc -) - -func (g GetRequestEventsRequestDirGetRequestEventsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetRequestEventsRequestDirGetRequestEventsRequestDirAsc: - return "asc" - case GetRequestEventsRequestDirGetRequestEventsRequestDirDesc: - return "desc" - } -} - -func (g GetRequestEventsRequestDirGetRequestEventsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetRequestEventsRequestDirGetRequestEventsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetRequestEventsRequestDirGetRequestEventsRequestDirAsc - *g = value - case "desc": - value := GetRequestEventsRequestDirGetRequestEventsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_request_events_request_order_by_get_request_events_request_order_by.go b/get_request_events_request_order_by_get_request_events_request_order_by.go deleted file mode 100644 index 3c354c3..0000000 --- a/get_request_events_request_order_by_get_request_events_request_order_by.go +++ /dev/null @@ -1,53 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetRequestEventsRequestOrderByGetRequestEventsRequestOrderBy uint8 - -const ( - GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByLastAttemptAt GetRequestEventsRequestOrderByGetRequestEventsRequestOrderBy = iota + 1 - GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByNextAttemptAt - GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByCreatedAt -) - -func (g GetRequestEventsRequestOrderByGetRequestEventsRequestOrderBy) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByLastAttemptAt: - return "last_attempt_at" - case GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByNextAttemptAt: - return "next_attempt_at" - case GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByCreatedAt: - return "created_at" - } -} - -func (g GetRequestEventsRequestOrderByGetRequestEventsRequestOrderBy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetRequestEventsRequestOrderByGetRequestEventsRequestOrderBy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "last_attempt_at": - value := GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByLastAttemptAt - *g = value - case "next_attempt_at": - value := GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByNextAttemptAt - *g = value - case "created_at": - value := GetRequestEventsRequestOrderByGetRequestEventsRequestOrderByCreatedAt - *g = value - } - return nil -} diff --git a/get_request_ignored_events_request.go b/get_request_ignored_events_request.go deleted file mode 100644 index f725d4e..0000000 --- a/get_request_ignored_events_request.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetRequestIgnoredEventsRequest is an in-lined request used by the GetRequestIgnoredEvents endpoint. -type GetRequestIgnoredEventsRequest struct { - Id *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_request_ignored_events_request_dir_get_request_ignored_events_request_dir.go b/get_request_ignored_events_request_dir_get_request_ignored_events_request_dir.go deleted file mode 100644 index 2e69381..0000000 --- a/get_request_ignored_events_request_dir_get_request_ignored_events_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDir uint8 - -const ( - GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDirAsc GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDir = iota + 1 - GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDirDesc -) - -func (g GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDirAsc: - return "asc" - case GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDirDesc: - return "desc" - } -} - -func (g GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDirAsc - *g = value - case "desc": - value := GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_requests_request.go b/get_requests_request.go deleted file mode 100644 index b03f8df..0000000 --- a/get_requests_request.go +++ /dev/null @@ -1,27 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetRequestsRequest is an in-lined request used by the GetRequests endpoint. -type GetRequestsRequest struct { - Id *string `json:"-"` - Status *GetRequestsRequestStatus `json:"-"` - RejectionCause *RequestRejectionCause `json:"-"` - IgnoredCount *int `json:"-"` - EventsCount *int `json:"-"` - SourceId *string `json:"-"` - Verified *bool `json:"-"` - Headers *string `json:"-"` - Body *string `json:"-"` - ParsedQuery *string `json:"-"` - Path *string `json:"-"` - CreatedAt *string `json:"-"` - IngestedAt *string `json:"-"` - BulkRetryId *string `json:"-"` - Include *string `json:"-"` - OrderBy *GetRequestsRequestOrderByGetRequestsRequestOrderBy `json:"-"` - Dir *GetRequestsRequestDirGetRequestsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_requests_request_dir_get_requests_request_dir.go b/get_requests_request_dir_get_requests_request_dir.go deleted file mode 100644 index a1dfc15..0000000 --- a/get_requests_request_dir_get_requests_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetRequestsRequestDirGetRequestsRequestDir uint8 - -const ( - GetRequestsRequestDirGetRequestsRequestDirAsc GetRequestsRequestDirGetRequestsRequestDir = iota + 1 - GetRequestsRequestDirGetRequestsRequestDirDesc -) - -func (g GetRequestsRequestDirGetRequestsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetRequestsRequestDirGetRequestsRequestDirAsc: - return "asc" - case GetRequestsRequestDirGetRequestsRequestDirDesc: - return "desc" - } -} - -func (g GetRequestsRequestDirGetRequestsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetRequestsRequestDirGetRequestsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetRequestsRequestDirGetRequestsRequestDirAsc - *g = value - case "desc": - value := GetRequestsRequestDirGetRequestsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_requests_request_order_by_get_requests_request_order_by.go b/get_requests_request_order_by_get_requests_request_order_by.go deleted file mode 100644 index b6a9d73..0000000 --- a/get_requests_request_order_by_get_requests_request_order_by.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetRequestsRequestOrderByGetRequestsRequestOrderBy uint8 - -const ( - GetRequestsRequestOrderByGetRequestsRequestOrderByIngestedAt GetRequestsRequestOrderByGetRequestsRequestOrderBy = iota + 1 - GetRequestsRequestOrderByGetRequestsRequestOrderByCreatedAt -) - -func (g GetRequestsRequestOrderByGetRequestsRequestOrderBy) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetRequestsRequestOrderByGetRequestsRequestOrderByIngestedAt: - return "ingested_at" - case GetRequestsRequestOrderByGetRequestsRequestOrderByCreatedAt: - return "created_at" - } -} - -func (g GetRequestsRequestOrderByGetRequestsRequestOrderBy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetRequestsRequestOrderByGetRequestsRequestOrderBy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "ingested_at": - value := GetRequestsRequestOrderByGetRequestsRequestOrderByIngestedAt - *g = value - case "created_at": - value := GetRequestsRequestOrderByGetRequestsRequestOrderByCreatedAt - *g = value - } - return nil -} diff --git a/get_requests_request_status.go b/get_requests_request_status.go deleted file mode 100644 index 23e5808..0000000 --- a/get_requests_request_status.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetRequestsRequestStatus uint8 - -const ( - GetRequestsRequestStatusAccepted GetRequestsRequestStatus = iota + 1 - GetRequestsRequestStatusRejected -) - -func (g GetRequestsRequestStatus) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetRequestsRequestStatusAccepted: - return "accepted" - case GetRequestsRequestStatusRejected: - return "rejected" - } -} - -func (g GetRequestsRequestStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetRequestsRequestStatus) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "accepted": - value := GetRequestsRequestStatusAccepted - *g = value - case "rejected": - value := GetRequestsRequestStatusRejected - *g = value - } - return nil -} diff --git a/get_rulesets_request.go b/get_rulesets_request.go deleted file mode 100644 index 08a009e..0000000 --- a/get_rulesets_request.go +++ /dev/null @@ -1,16 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetRulesetsRequest is an in-lined request used by the GetRulesets endpoint. -type GetRulesetsRequest struct { - Id *string `json:"-"` - Name *string `json:"-"` - Archived *bool `json:"-"` - ArchivedAt *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetRulesetsRequestDirGetRulesetsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_rulesets_request_dir_get_rulesets_request_dir.go b/get_rulesets_request_dir_get_rulesets_request_dir.go deleted file mode 100644 index 06af78e..0000000 --- a/get_rulesets_request_dir_get_rulesets_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetRulesetsRequestDirGetRulesetsRequestDir uint8 - -const ( - GetRulesetsRequestDirGetRulesetsRequestDirAsc GetRulesetsRequestDirGetRulesetsRequestDir = iota + 1 - GetRulesetsRequestDirGetRulesetsRequestDirDesc -) - -func (g GetRulesetsRequestDirGetRulesetsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetRulesetsRequestDirGetRulesetsRequestDirAsc: - return "asc" - case GetRulesetsRequestDirGetRulesetsRequestDirDesc: - return "desc" - } -} - -func (g GetRulesetsRequestDirGetRulesetsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetRulesetsRequestDirGetRulesetsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetRulesetsRequestDirGetRulesetsRequestDirAsc - *g = value - case "desc": - value := GetRulesetsRequestDirGetRulesetsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_sources_request.go b/get_sources_request.go deleted file mode 100644 index 1116238..0000000 --- a/get_sources_request.go +++ /dev/null @@ -1,17 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetSourcesRequest is an in-lined request used by the GetSources endpoint. -type GetSourcesRequest struct { - Id *string `json:"-"` - Name *string `json:"-"` - Archived *bool `json:"-"` - ArchivedAt *string `json:"-"` - IntegrationId *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetSourcesRequestDirGetSourcesRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_sources_request_dir_get_sources_request_dir.go b/get_sources_request_dir_get_sources_request_dir.go deleted file mode 100644 index 1249b08..0000000 --- a/get_sources_request_dir_get_sources_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetSourcesRequestDirGetSourcesRequestDir uint8 - -const ( - GetSourcesRequestDirGetSourcesRequestDirAsc GetSourcesRequestDirGetSourcesRequestDir = iota + 1 - GetSourcesRequestDirGetSourcesRequestDirDesc -) - -func (g GetSourcesRequestDirGetSourcesRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetSourcesRequestDirGetSourcesRequestDirAsc: - return "asc" - case GetSourcesRequestDirGetSourcesRequestDirDesc: - return "desc" - } -} - -func (g GetSourcesRequestDirGetSourcesRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetSourcesRequestDirGetSourcesRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetSourcesRequestDirGetSourcesRequestDirAsc - *g = value - case "desc": - value := GetSourcesRequestDirGetSourcesRequestDirDesc - *g = value - } - return nil -} diff --git a/get_transformation_executions_request.go b/get_transformation_executions_request.go deleted file mode 100644 index 938af70..0000000 --- a/get_transformation_executions_request.go +++ /dev/null @@ -1,16 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetTransformationExecutionsRequest is an in-lined request used by the GetTransformationExecutions endpoint. -type GetTransformationExecutionsRequest struct { - LogLevel *GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevel `json:"-"` - WebhookId *string `json:"-"` - IssueId *string `json:"-"` - CreatedAt *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_transformation_executions_request_dir_get_transformation_executions_request_dir.go b/get_transformation_executions_request_dir_get_transformation_executions_request_dir.go deleted file mode 100644 index f827218..0000000 --- a/get_transformation_executions_request_dir_get_transformation_executions_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDir uint8 - -const ( - GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDirAsc GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDir = iota + 1 - GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDirDesc -) - -func (g GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDirAsc: - return "asc" - case GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDirDesc: - return "desc" - } -} - -func (g GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDirAsc - *g = value - case "desc": - value := GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDirDesc - *g = value - } - return nil -} diff --git a/get_transformation_executions_request_log_level_get_transformation_executions_request_log_level.go b/get_transformation_executions_request_log_level_get_transformation_executions_request_log_level.go deleted file mode 100644 index 1b0ee8b..0000000 --- a/get_transformation_executions_request_log_level_get_transformation_executions_request_log_level.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevel uint8 - -const ( - GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelDebug GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevel = iota + 1 - GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelInfo - GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelWarn - GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelError - GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelFatal -) - -func (g GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevel) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelDebug: - return "debug" - case GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelInfo: - return "info" - case GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelWarn: - return "warn" - case GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelError: - return "error" - case GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelFatal: - return "fatal" - } -} - -func (g GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevel) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevel) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "debug": - value := GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelDebug - *g = value - case "info": - value := GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelInfo - *g = value - case "warn": - value := GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelWarn - *g = value - case "error": - value := GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelError - *g = value - case "fatal": - value := GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevelFatal - *g = value - } - return nil -} diff --git a/get_transformations_request.go b/get_transformations_request.go deleted file mode 100644 index 9e498f6..0000000 --- a/get_transformations_request.go +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// GetTransformationsRequest is an in-lined request used by the GetTransformations endpoint. -type GetTransformationsRequest struct { - Id *string `json:"-"` - Name *string `json:"-"` - OrderBy *string `json:"-"` - Dir *GetTransformationsRequestDirGetTransformationsRequestDir `json:"-"` - Limit *int `json:"-"` - Next *string `json:"-"` - Prev *string `json:"-"` -} diff --git a/get_transformations_request_dir_get_transformations_request_dir.go b/get_transformations_request_dir_get_transformations_request_dir.go deleted file mode 100644 index e4156b1..0000000 --- a/get_transformations_request_dir_get_transformations_request_dir.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type GetTransformationsRequestDirGetTransformationsRequestDir uint8 - -const ( - GetTransformationsRequestDirGetTransformationsRequestDirAsc GetTransformationsRequestDirGetTransformationsRequestDir = iota + 1 - GetTransformationsRequestDirGetTransformationsRequestDirDesc -) - -func (g GetTransformationsRequestDirGetTransformationsRequestDir) String() string { - switch g { - default: - return strconv.Itoa(int(g)) - case GetTransformationsRequestDirGetTransformationsRequestDirAsc: - return "asc" - case GetTransformationsRequestDirGetTransformationsRequestDirDesc: - return "desc" - } -} - -func (g GetTransformationsRequestDirGetTransformationsRequestDir) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", g.String())), nil -} - -func (g *GetTransformationsRequestDirGetTransformationsRequestDir) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := GetTransformationsRequestDirGetTransformationsRequestDirAsc - *g = value - case "desc": - value := GetTransformationsRequestDirGetTransformationsRequestDirDesc - *g = value - } - return nil -} diff --git a/go.mod b/go.mod index ea77ffb..5d7f8c4 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,11 @@ module github.com/fern-hookdeck/hookdeck-go go 1.19 + +require github.com/stretchr/testify v1.8.4 + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum index e69de29..fa4b6e6 100644 --- a/go.sum +++ b/go.sum @@ -0,0 +1,10 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/handled_hmac_configs.go b/handled_hmac_configs.go deleted file mode 100644 index 51b9419..0000000 --- a/handled_hmac_configs.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type HandledHmacConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key"` -} diff --git a/hmac_algorithms.go b/hmac_algorithms.go deleted file mode 100644 index c7c186f..0000000 --- a/hmac_algorithms.go +++ /dev/null @@ -1,59 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type HmacAlgorithms uint8 - -const ( - HmacAlgorithmsMd5 HmacAlgorithms = iota + 1 - HmacAlgorithmsSha1 - HmacAlgorithmsSha256 - HmacAlgorithmsSha512 -) - -func (h HmacAlgorithms) String() string { - switch h { - default: - return strconv.Itoa(int(h)) - case HmacAlgorithmsMd5: - return "md5" - case HmacAlgorithmsSha1: - return "sha1" - case HmacAlgorithmsSha256: - return "sha256" - case HmacAlgorithmsSha512: - return "sha512" - } -} - -func (h HmacAlgorithms) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", h.String())), nil -} - -func (h *HmacAlgorithms) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "md5": - value := HmacAlgorithmsMd5 - *h = value - case "sha1": - value := HmacAlgorithmsSha1 - *h = value - case "sha256": - value := HmacAlgorithmsSha256 - *h = value - case "sha512": - value := HmacAlgorithmsSha512 - *h = value - } - return nil -} diff --git a/hmac_integration_configs.go b/hmac_integration_configs.go deleted file mode 100644 index a2fcd8b..0000000 --- a/hmac_integration_configs.go +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type HmacIntegrationConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key"` - Algorithm HmacAlgorithms `json:"algorithm,omitempty"` - HeaderKey string `json:"header_key"` - Encoding HmacIntegrationConfigsEncoding `json:"encoding,omitempty"` -} diff --git a/hmac_integration_configs_encoding.go b/hmac_integration_configs_encoding.go deleted file mode 100644 index 9043d90..0000000 --- a/hmac_integration_configs_encoding.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type HmacIntegrationConfigsEncoding uint8 - -const ( - HmacIntegrationConfigsEncodingBase64 HmacIntegrationConfigsEncoding = iota + 1 - HmacIntegrationConfigsEncodingHex -) - -func (h HmacIntegrationConfigsEncoding) String() string { - switch h { - default: - return strconv.Itoa(int(h)) - case HmacIntegrationConfigsEncodingBase64: - return "base64" - case HmacIntegrationConfigsEncodingHex: - return "hex" - } -} - -func (h HmacIntegrationConfigsEncoding) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", h.String())), nil -} - -func (h *HmacIntegrationConfigsEncoding) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "base64": - value := HmacIntegrationConfigsEncodingBase64 - *h = value - case "hex": - value := HmacIntegrationConfigsEncodingHex - *h = value - } - return nil -} diff --git a/ignored_event.go b/ignored_event.go deleted file mode 100644 index feb393f..0000000 --- a/ignored_event.go +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type IgnoredEvent struct { - Id string `json:"id"` - TeamId string `json:"team_id"` - WebhookId string `json:"webhook_id"` - Cause IgnoredEventCause `json:"cause,omitempty"` - RequestId string `json:"request_id"` - Meta *IgnoredEventMeta `json:"meta,omitempty"` - UpdatedAt string `json:"updated_at"` - CreatedAt string `json:"created_at"` -} diff --git a/ignored_event_cause.go b/ignored_event_cause.go deleted file mode 100644 index 6917d0c..0000000 --- a/ignored_event_cause.go +++ /dev/null @@ -1,59 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type IgnoredEventCause uint8 - -const ( - IgnoredEventCauseArchived IgnoredEventCause = iota + 1 - IgnoredEventCauseFiltered - IgnoredEventCauseTransformationFailed - IgnoredEventCauseCliDisconnected -) - -func (i IgnoredEventCause) String() string { - switch i { - default: - return strconv.Itoa(int(i)) - case IgnoredEventCauseArchived: - return "ARCHIVED" - case IgnoredEventCauseFiltered: - return "FILTERED" - case IgnoredEventCauseTransformationFailed: - return "TRANSFORMATION_FAILED" - case IgnoredEventCauseCliDisconnected: - return "CLI_DISCONNECTED" - } -} - -func (i IgnoredEventCause) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", i.String())), nil -} - -func (i *IgnoredEventCause) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "ARCHIVED": - value := IgnoredEventCauseArchived - *i = value - case "FILTERED": - value := IgnoredEventCauseFiltered - *i = value - case "TRANSFORMATION_FAILED": - value := IgnoredEventCauseTransformationFailed - *i = value - case "CLI_DISCONNECTED": - value := IgnoredEventCauseCliDisconnected - *i = value - } - return nil -} diff --git a/ignored_event_meta.go b/ignored_event_meta.go deleted file mode 100644 index 262f394..0000000 --- a/ignored_event_meta.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type IgnoredEventMeta struct { - typeName string - FilteredMeta FilteredMeta - TransformationFailedMeta *TransformationFailedMeta -} - -func NewIgnoredEventMetaFromFilteredMeta(value FilteredMeta) *IgnoredEventMeta { - return &IgnoredEventMeta{typeName: "filteredMeta", FilteredMeta: value} -} - -func NewIgnoredEventMetaFromTransformationFailedMeta(value *TransformationFailedMeta) *IgnoredEventMeta { - return &IgnoredEventMeta{typeName: "transformationFailedMeta", TransformationFailedMeta: value} -} - -func (i *IgnoredEventMeta) UnmarshalJSON(data []byte) error { - var valueFilteredMeta FilteredMeta - if err := json.Unmarshal(data, &valueFilteredMeta); err == nil { - i.typeName = "filteredMeta" - i.FilteredMeta = valueFilteredMeta - return nil - } - valueTransformationFailedMeta := new(TransformationFailedMeta) - if err := json.Unmarshal(data, &valueTransformationFailedMeta); err == nil { - i.typeName = "transformationFailedMeta" - i.TransformationFailedMeta = valueTransformationFailedMeta - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i IgnoredEventMeta) MarshalJSON() ([]byte, error) { - switch i.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "filteredMeta": - return json.Marshal(i.FilteredMeta) - case "transformationFailedMeta": - return json.Marshal(i.TransformationFailedMeta) - } -} - -type IgnoredEventMetaVisitor interface { - VisitFilteredMeta(FilteredMeta) error - VisitTransformationFailedMeta(*TransformationFailedMeta) error -} - -func (i *IgnoredEventMeta) Accept(v IgnoredEventMetaVisitor) error { - switch i.typeName { - default: - return fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "filteredMeta": - return v.VisitFilteredMeta(i.FilteredMeta) - case "transformationFailedMeta": - return v.VisitTransformationFailedMeta(i.TransformationFailedMeta) - } -} diff --git a/ignored_event_paginated_result.go b/ignored_event_paginated_result.go deleted file mode 100644 index 5f0046a..0000000 --- a/ignored_event_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type IgnoredEventPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*IgnoredEvent `json:"models,omitempty"` -} diff --git a/integration.go b/integration.go deleted file mode 100644 index f2172a1..0000000 --- a/integration.go +++ /dev/null @@ -1,23 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type Integration struct { - // ID of the integration - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - // Label of the integration - Label string `json:"label"` - Provider IntegrationProvider `json:"provider,omitempty"` - // List of features to enable (see features list below) - Features []IntegrationFeature `json:"features,omitempty"` - // Decrypted Key/Value object of the associated configuration for that provider - Configs *IntegrationConfigs `json:"configs,omitempty"` - // List of source IDs the integration is attached to - Sources []string `json:"sources,omitempty"` - // Date the integration was last updated - UpdatedAt string `json:"updated_at"` - // Date the integration was created - CreatedAt string `json:"created_at"` -} diff --git a/integration_configs.go b/integration_configs.go deleted file mode 100644 index cb5ca79..0000000 --- a/integration_configs.go +++ /dev/null @@ -1,114 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Decrypted Key/Value object of the associated configuration for that provider -type IntegrationConfigs struct { - typeName string - HmacIntegrationConfigs *HmacIntegrationConfigs - ApiKeyIntegrationConfigs *ApiKeyIntegrationConfigs - HandledHmacConfigs *HandledHmacConfigs - BasicAuthIntegrationConfigs *BasicAuthIntegrationConfigs - ShopifyIntegrationConfigs *ShopifyIntegrationConfigs -} - -func NewIntegrationConfigsFromHmacIntegrationConfigs(value *HmacIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{typeName: "hmacIntegrationConfigs", HmacIntegrationConfigs: value} -} - -func NewIntegrationConfigsFromApiKeyIntegrationConfigs(value *ApiKeyIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{typeName: "apiKeyIntegrationConfigs", ApiKeyIntegrationConfigs: value} -} - -func NewIntegrationConfigsFromHandledHmacConfigs(value *HandledHmacConfigs) *IntegrationConfigs { - return &IntegrationConfigs{typeName: "handledHmacConfigs", HandledHmacConfigs: value} -} - -func NewIntegrationConfigsFromBasicAuthIntegrationConfigs(value *BasicAuthIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{typeName: "basicAuthIntegrationConfigs", BasicAuthIntegrationConfigs: value} -} - -func NewIntegrationConfigsFromShopifyIntegrationConfigs(value *ShopifyIntegrationConfigs) *IntegrationConfigs { - return &IntegrationConfigs{typeName: "shopifyIntegrationConfigs", ShopifyIntegrationConfigs: value} -} - -func (i *IntegrationConfigs) UnmarshalJSON(data []byte) error { - valueHmacIntegrationConfigs := new(HmacIntegrationConfigs) - if err := json.Unmarshal(data, &valueHmacIntegrationConfigs); err == nil { - i.typeName = "hmacIntegrationConfigs" - i.HmacIntegrationConfigs = valueHmacIntegrationConfigs - return nil - } - valueApiKeyIntegrationConfigs := new(ApiKeyIntegrationConfigs) - if err := json.Unmarshal(data, &valueApiKeyIntegrationConfigs); err == nil { - i.typeName = "apiKeyIntegrationConfigs" - i.ApiKeyIntegrationConfigs = valueApiKeyIntegrationConfigs - return nil - } - valueHandledHmacConfigs := new(HandledHmacConfigs) - if err := json.Unmarshal(data, &valueHandledHmacConfigs); err == nil { - i.typeName = "handledHmacConfigs" - i.HandledHmacConfigs = valueHandledHmacConfigs - return nil - } - valueBasicAuthIntegrationConfigs := new(BasicAuthIntegrationConfigs) - if err := json.Unmarshal(data, &valueBasicAuthIntegrationConfigs); err == nil { - i.typeName = "basicAuthIntegrationConfigs" - i.BasicAuthIntegrationConfigs = valueBasicAuthIntegrationConfigs - return nil - } - valueShopifyIntegrationConfigs := new(ShopifyIntegrationConfigs) - if err := json.Unmarshal(data, &valueShopifyIntegrationConfigs); err == nil { - i.typeName = "shopifyIntegrationConfigs" - i.ShopifyIntegrationConfigs = valueShopifyIntegrationConfigs - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i IntegrationConfigs) MarshalJSON() ([]byte, error) { - switch i.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "hmacIntegrationConfigs": - return json.Marshal(i.HmacIntegrationConfigs) - case "apiKeyIntegrationConfigs": - return json.Marshal(i.ApiKeyIntegrationConfigs) - case "handledHmacConfigs": - return json.Marshal(i.HandledHmacConfigs) - case "basicAuthIntegrationConfigs": - return json.Marshal(i.BasicAuthIntegrationConfigs) - case "shopifyIntegrationConfigs": - return json.Marshal(i.ShopifyIntegrationConfigs) - } -} - -type IntegrationConfigsVisitor interface { - VisitHmacIntegrationConfigs(*HmacIntegrationConfigs) error - VisitApiKeyIntegrationConfigs(*ApiKeyIntegrationConfigs) error - VisitHandledHmacConfigs(*HandledHmacConfigs) error - VisitBasicAuthIntegrationConfigs(*BasicAuthIntegrationConfigs) error - VisitShopifyIntegrationConfigs(*ShopifyIntegrationConfigs) error -} - -func (i *IntegrationConfigs) Accept(v IntegrationConfigsVisitor) error { - switch i.typeName { - default: - return fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "hmacIntegrationConfigs": - return v.VisitHmacIntegrationConfigs(i.HmacIntegrationConfigs) - case "apiKeyIntegrationConfigs": - return v.VisitApiKeyIntegrationConfigs(i.ApiKeyIntegrationConfigs) - case "handledHmacConfigs": - return v.VisitHandledHmacConfigs(i.HandledHmacConfigs) - case "basicAuthIntegrationConfigs": - return v.VisitBasicAuthIntegrationConfigs(i.BasicAuthIntegrationConfigs) - case "shopifyIntegrationConfigs": - return v.VisitShopifyIntegrationConfigs(i.ShopifyIntegrationConfigs) - } -} diff --git a/integration_feature.go b/integration_feature.go deleted file mode 100644 index 281d08f..0000000 --- a/integration_feature.go +++ /dev/null @@ -1,53 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type IntegrationFeature uint8 - -const ( - IntegrationFeatureVerification IntegrationFeature = iota + 1 - IntegrationFeatureHandshake - IntegrationFeaturePolling -) - -func (i IntegrationFeature) String() string { - switch i { - default: - return strconv.Itoa(int(i)) - case IntegrationFeatureVerification: - return "VERIFICATION" - case IntegrationFeatureHandshake: - return "HANDSHAKE" - case IntegrationFeaturePolling: - return "POLLING" - } -} - -func (i IntegrationFeature) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", i.String())), nil -} - -func (i *IntegrationFeature) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "VERIFICATION": - value := IntegrationFeatureVerification - *i = value - case "HANDSHAKE": - value := IntegrationFeatureHandshake - *i = value - case "POLLING": - value := IntegrationFeaturePolling - *i = value - } - return nil -} diff --git a/integration_paginated_result.go b/integration_paginated_result.go deleted file mode 100644 index a30b469..0000000 --- a/integration_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type IntegrationPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Integration `json:"models,omitempty"` -} diff --git a/integration_provider.go b/integration_provider.go deleted file mode 100644 index 06955b1..0000000 --- a/integration_provider.go +++ /dev/null @@ -1,174 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// The provider name -type IntegrationProvider uint8 - -const ( - IntegrationProviderTwitter IntegrationProvider = iota + 1 - IntegrationProviderStripe - IntegrationProviderRecharge - IntegrationProviderGithub - IntegrationProviderShopify - IntegrationProviderPostmark - IntegrationProviderTypeform - IntegrationProviderHmac - IntegrationProviderBasicAuth - IntegrationProviderApiKey - IntegrationProviderXero - IntegrationProviderSvix - IntegrationProviderZoom - IntegrationProviderAkeneo - IntegrationProviderAdyen - IntegrationProviderGitlab - IntegrationProviderPropertyFinder - IntegrationProviderWoocommerce - IntegrationProviderOura - IntegrationProviderCommercelayer - IntegrationProviderMailgun - IntegrationProviderPipedrive - IntegrationProviderSendgrid -) - -func (i IntegrationProvider) String() string { - switch i { - default: - return strconv.Itoa(int(i)) - case IntegrationProviderTwitter: - return "twitter" - case IntegrationProviderStripe: - return "stripe" - case IntegrationProviderRecharge: - return "recharge" - case IntegrationProviderGithub: - return "github" - case IntegrationProviderShopify: - return "shopify" - case IntegrationProviderPostmark: - return "postmark" - case IntegrationProviderTypeform: - return "typeform" - case IntegrationProviderHmac: - return "hmac" - case IntegrationProviderBasicAuth: - return "basic_auth" - case IntegrationProviderApiKey: - return "api_key" - case IntegrationProviderXero: - return "xero" - case IntegrationProviderSvix: - return "svix" - case IntegrationProviderZoom: - return "zoom" - case IntegrationProviderAkeneo: - return "akeneo" - case IntegrationProviderAdyen: - return "adyen" - case IntegrationProviderGitlab: - return "gitlab" - case IntegrationProviderPropertyFinder: - return "property-finder" - case IntegrationProviderWoocommerce: - return "woocommerce" - case IntegrationProviderOura: - return "oura" - case IntegrationProviderCommercelayer: - return "commercelayer" - case IntegrationProviderMailgun: - return "mailgun" - case IntegrationProviderPipedrive: - return "pipedrive" - case IntegrationProviderSendgrid: - return "sendgrid" - } -} - -func (i IntegrationProvider) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", i.String())), nil -} - -func (i *IntegrationProvider) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "twitter": - value := IntegrationProviderTwitter - *i = value - case "stripe": - value := IntegrationProviderStripe - *i = value - case "recharge": - value := IntegrationProviderRecharge - *i = value - case "github": - value := IntegrationProviderGithub - *i = value - case "shopify": - value := IntegrationProviderShopify - *i = value - case "postmark": - value := IntegrationProviderPostmark - *i = value - case "typeform": - value := IntegrationProviderTypeform - *i = value - case "hmac": - value := IntegrationProviderHmac - *i = value - case "basic_auth": - value := IntegrationProviderBasicAuth - *i = value - case "api_key": - value := IntegrationProviderApiKey - *i = value - case "xero": - value := IntegrationProviderXero - *i = value - case "svix": - value := IntegrationProviderSvix - *i = value - case "zoom": - value := IntegrationProviderZoom - *i = value - case "akeneo": - value := IntegrationProviderAkeneo - *i = value - case "adyen": - value := IntegrationProviderAdyen - *i = value - case "gitlab": - value := IntegrationProviderGitlab - *i = value - case "property-finder": - value := IntegrationProviderPropertyFinder - *i = value - case "woocommerce": - value := IntegrationProviderWoocommerce - *i = value - case "oura": - value := IntegrationProviderOura - *i = value - case "commercelayer": - value := IntegrationProviderCommercelayer - *i = value - case "mailgun": - value := IntegrationProviderMailgun - *i = value - case "pipedrive": - value := IntegrationProviderPipedrive - *i = value - case "sendgrid": - value := IntegrationProviderSendgrid - *i = value - } - return nil -} diff --git a/integrations.go b/integrations.go new file mode 100644 index 0000000..6b8591d --- /dev/null +++ b/integrations.go @@ -0,0 +1,28 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +type CreateIntegrationRequest struct { + // Label of the integration + Label *string `json:"label,omitempty"` + // Decrypted Key/Value object of the associated configuration for that provider + Configs *CreateIntegrationRequestConfigs `json:"configs,omitempty"` + Provider *IntegrationProvider `json:"provider,omitempty"` + // List of features to enable (see features list above) + Features []IntegrationFeature `json:"features,omitempty"` +} + +type GetIntegrationsRequest struct { + Label *string `json:"-"` + Provider *IntegrationProvider `json:"-"` +} + +type UpdateIntegrationRequest struct { + // Label of the integration + Label *string `json:"label,omitempty"` + // Decrypted Key/Value object of the associated configuration for that provider + Configs *UpdateIntegrationRequestConfigs `json:"configs,omitempty"` + Provider *IntegrationProvider `json:"provider,omitempty"` + // List of features to enable (see features list above) + Features []IntegrationFeature `json:"features,omitempty"` +} diff --git a/integrations_client.go b/integrations/client.go similarity index 63% rename from integrations_client.go rename to integrations/client.go index c733518..a00b90a 100644 --- a/integrations_client.go +++ b/integrations/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package integrations import ( bytes "bytes" @@ -8,54 +8,53 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" ) -type IntegrationsClient interface { - GetIntegrations(ctx context.Context, request *GetIntegrationsRequest) (*IntegrationPaginatedResult, error) - CreateIntegration(ctx context.Context, request *CreateIntegrationRequest) (*Integration, error) - GetIntegration(ctx context.Context, id string) (*Integration, error) - UpdateIntegration(ctx context.Context, id string, request *UpdateIntegrationRequest) (*Integration, error) - DeleteIntegration(ctx context.Context, id string) (*DeletedIntegration, error) - AttachIntegrationToSource(ctx context.Context, id string, sourceId string) (*AttachedIntegrationToSource, error) - DetachIntegrationToSource(ctx context.Context, id string, sourceId string) (*DetachedIntegrationFromSource, error) +type Client interface { + GetIntegrations(ctx context.Context, request *hookdeckgo.GetIntegrationsRequest) (*hookdeckgo.IntegrationPaginatedResult, error) + CreateIntegration(ctx context.Context, request *hookdeckgo.CreateIntegrationRequest) (*hookdeckgo.Integration, error) + GetIntegration(ctx context.Context, id string) (*hookdeckgo.Integration, error) + UpdateIntegration(ctx context.Context, id string, request *hookdeckgo.UpdateIntegrationRequest) (*hookdeckgo.Integration, error) + DeleteIntegration(ctx context.Context, id string) (*hookdeckgo.DeletedIntegration, error) + AttachIntegrationToSource(ctx context.Context, id string, sourceId string) (*hookdeckgo.AttachedIntegrationToSource, error) + DetachIntegrationToSource(ctx context.Context, id string, sourceId string) (*hookdeckgo.DetachedIntegrationFromSource, error) } -func NewIntegrationsClient(opts ...core.ClientOption) IntegrationsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &integrationsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type integrationsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (i *integrationsClient) GetIntegrations(ctx context.Context, request *GetIntegrationsRequest) (*IntegrationPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) GetIntegrations(ctx context.Context, request *hookdeckgo.GetIntegrationsRequest) (*hookdeckgo.IntegrationPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "integrations" queryParams := make(url.Values) - var labelDefaultValue *string - if request.Label != labelDefaultValue { + if request.Label != nil { queryParams.Add("label", fmt.Sprintf("%v", *request.Label)) } - var providerDefaultValue *IntegrationProvider - if request.Provider != providerDefaultValue { + if request.Provider != nil { queryParams.Add("provider", fmt.Sprintf("%v", *request.Provider)) } if len(queryParams) > 0 { @@ -71,14 +70,14 @@ func (i *integrationsClient) GetIntegrations(ctx context.Context, request *GetIn decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -88,15 +87,16 @@ func (i *integrationsClient) GetIntegrations(ctx context.Context, request *GetIn return apiError } - response := new(IntegrationPaginatedResult) + var response *hookdeckgo.IntegrationPaginatedResult if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -104,10 +104,10 @@ func (i *integrationsClient) GetIntegrations(ctx context.Context, request *GetIn return response, nil } -func (i *integrationsClient) CreateIntegration(ctx context.Context, request *CreateIntegrationRequest) (*Integration, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) CreateIntegration(ctx context.Context, request *hookdeckgo.CreateIntegrationRequest) (*hookdeckgo.Integration, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "integrations" @@ -120,14 +120,14 @@ func (i *integrationsClient) CreateIntegration(ctx context.Context, request *Cre decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -137,15 +137,16 @@ func (i *integrationsClient) CreateIntegration(ctx context.Context, request *Cre return apiError } - response := new(Integration) + var response *hookdeckgo.Integration if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -153,10 +154,10 @@ func (i *integrationsClient) CreateIntegration(ctx context.Context, request *Cre return response, nil } -func (i *integrationsClient) GetIntegration(ctx context.Context, id string) (*Integration, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) GetIntegration(ctx context.Context, id string) (*hookdeckgo.Integration, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"integrations/%v", id) @@ -169,7 +170,7 @@ func (i *integrationsClient) GetIntegration(ctx context.Context, id string) (*In decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -179,15 +180,16 @@ func (i *integrationsClient) GetIntegration(ctx context.Context, id string) (*In return apiError } - response := new(Integration) + var response *hookdeckgo.Integration if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -195,10 +197,10 @@ func (i *integrationsClient) GetIntegration(ctx context.Context, id string) (*In return response, nil } -func (i *integrationsClient) UpdateIntegration(ctx context.Context, id string, request *UpdateIntegrationRequest) (*Integration, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) UpdateIntegration(ctx context.Context, id string, request *hookdeckgo.UpdateIntegrationRequest) (*hookdeckgo.Integration, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"integrations/%v", id) @@ -211,21 +213,21 @@ func (i *integrationsClient) UpdateIntegration(ctx context.Context, id string, r decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -235,15 +237,16 @@ func (i *integrationsClient) UpdateIntegration(ctx context.Context, id string, r return apiError } - response := new(Integration) + var response *hookdeckgo.Integration if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -251,10 +254,10 @@ func (i *integrationsClient) UpdateIntegration(ctx context.Context, id string, r return response, nil } -func (i *integrationsClient) DeleteIntegration(ctx context.Context, id string) (*DeletedIntegration, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) DeleteIntegration(ctx context.Context, id string) (*hookdeckgo.DeletedIntegration, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"integrations/%v", id) @@ -267,7 +270,7 @@ func (i *integrationsClient) DeleteIntegration(ctx context.Context, id string) ( decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -277,15 +280,16 @@ func (i *integrationsClient) DeleteIntegration(ctx context.Context, id string) ( return apiError } - response := new(DeletedIntegration) + var response *hookdeckgo.DeletedIntegration if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodDelete, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -293,10 +297,10 @@ func (i *integrationsClient) DeleteIntegration(ctx context.Context, id string) ( return response, nil } -func (i *integrationsClient) AttachIntegrationToSource(ctx context.Context, id string, sourceId string) (*AttachedIntegrationToSource, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) AttachIntegrationToSource(ctx context.Context, id string, sourceId string) (*hookdeckgo.AttachedIntegrationToSource, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"integrations/%v/attach/%v", id, sourceId) @@ -309,14 +313,14 @@ func (i *integrationsClient) AttachIntegrationToSource(ctx context.Context, id s decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -326,15 +330,16 @@ func (i *integrationsClient) AttachIntegrationToSource(ctx context.Context, id s return apiError } - response := new(AttachedIntegrationToSource) + var response *hookdeckgo.AttachedIntegrationToSource if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -342,10 +347,10 @@ func (i *integrationsClient) AttachIntegrationToSource(ctx context.Context, id s return response, nil } -func (i *integrationsClient) DetachIntegrationToSource(ctx context.Context, id string, sourceId string) (*DetachedIntegrationFromSource, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) DetachIntegrationToSource(ctx context.Context, id string, sourceId string) (*hookdeckgo.DetachedIntegrationFromSource, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"integrations/%v/detach/%v", id, sourceId) @@ -358,14 +363,14 @@ func (i *integrationsClient) DetachIntegrationToSource(ctx context.Context, id s decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -375,15 +380,16 @@ func (i *integrationsClient) DetachIntegrationToSource(ctx context.Context, id s return apiError } - response := new(DetachedIntegrationFromSource) + var response *hookdeckgo.DetachedIntegrationFromSource if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/issue.go b/issue.go deleted file mode 100644 index 4f23f67..0000000 --- a/issue.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Issue -type Issue struct { - typeName string - DeliveryIssue *DeliveryIssue - TransformationIssue *TransformationIssue -} - -func NewIssueFromDeliveryIssue(value *DeliveryIssue) *Issue { - return &Issue{typeName: "deliveryIssue", DeliveryIssue: value} -} - -func NewIssueFromTransformationIssue(value *TransformationIssue) *Issue { - return &Issue{typeName: "transformationIssue", TransformationIssue: value} -} - -func (i *Issue) UnmarshalJSON(data []byte) error { - valueDeliveryIssue := new(DeliveryIssue) - if err := json.Unmarshal(data, &valueDeliveryIssue); err == nil { - i.typeName = "deliveryIssue" - i.DeliveryIssue = valueDeliveryIssue - return nil - } - valueTransformationIssue := new(TransformationIssue) - if err := json.Unmarshal(data, &valueTransformationIssue); err == nil { - i.typeName = "transformationIssue" - i.TransformationIssue = valueTransformationIssue - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i Issue) MarshalJSON() ([]byte, error) { - switch i.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "deliveryIssue": - return json.Marshal(i.DeliveryIssue) - case "transformationIssue": - return json.Marshal(i.TransformationIssue) - } -} - -type IssueVisitor interface { - VisitDeliveryIssue(*DeliveryIssue) error - VisitTransformationIssue(*TransformationIssue) error -} - -func (i *Issue) Accept(v IssueVisitor) error { - switch i.typeName { - default: - return fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "deliveryIssue": - return v.VisitDeliveryIssue(i.DeliveryIssue) - case "transformationIssue": - return v.VisitTransformationIssue(i.TransformationIssue) - } -} diff --git a/issue_count.go b/issue_count.go deleted file mode 100644 index bd47335..0000000 --- a/issue_count.go +++ /dev/null @@ -1,8 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type IssueCount struct { - // Number of issues - Count int `json:"count"` -} diff --git a/issue_status.go b/issue_status.go deleted file mode 100644 index 60df395..0000000 --- a/issue_status.go +++ /dev/null @@ -1,60 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Issue status -type IssueStatus uint8 - -const ( - IssueStatusOpened IssueStatus = iota + 1 - IssueStatusIgnored - IssueStatusAcknowledged - IssueStatusResolved -) - -func (i IssueStatus) String() string { - switch i { - default: - return strconv.Itoa(int(i)) - case IssueStatusOpened: - return "OPENED" - case IssueStatusIgnored: - return "IGNORED" - case IssueStatusAcknowledged: - return "ACKNOWLEDGED" - case IssueStatusResolved: - return "RESOLVED" - } -} - -func (i IssueStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", i.String())), nil -} - -func (i *IssueStatus) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "OPENED": - value := IssueStatusOpened - *i = value - case "IGNORED": - value := IssueStatusIgnored - *i = value - case "ACKNOWLEDGED": - value := IssueStatusAcknowledged - *i = value - case "RESOLVED": - value := IssueStatusResolved - *i = value - } - return nil -} diff --git a/issue_trigger.go b/issue_trigger.go deleted file mode 100644 index 14a272d..0000000 --- a/issue_trigger.go +++ /dev/null @@ -1,23 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type IssueTrigger struct { - // ID of the issue trigger - Id string `json:"id"` - // ID of the workspace - TeamId *string `json:"team_id,omitempty"` - // Optional unique name to use as reference when using the API - Name *string `json:"name,omitempty"` - Type IssueType `json:"type,omitempty"` - Configs *IssueTriggerReference `json:"configs,omitempty"` - Channels *IssueTriggerChannels `json:"channels,omitempty"` - // ISO timestamp for when the issue trigger was disabled - DisabledAt *string `json:"disabled_at,omitempty"` - // ISO timestamp for when the issue trigger was last updated - UpdatedAt string `json:"updated_at"` - // ISO timestamp for when the issue trigger was created - CreatedAt string `json:"created_at"` - // ISO timestamp for when the issue trigger was deleted - DeletedAt *string `json:"deleted_at,omitempty"` -} diff --git a/issue_trigger_backpressure_configs.go b/issue_trigger_backpressure_configs.go deleted file mode 100644 index d51348e..0000000 --- a/issue_trigger_backpressure_configs.go +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Configurations for a 'Backpressure' issue trigger -type IssueTriggerBackpressureConfigs struct { - Delay IssueTriggerBackpressureDelay `json:"delay"` - // A pattern to match on the destination name or array of destination IDs. Use `*` as wildcard. - Destinations *IssueTriggerBackpressureConfigsDestinations `json:"destinations,omitempty"` -} diff --git a/issue_trigger_backpressure_configs_destinations.go b/issue_trigger_backpressure_configs_destinations.go deleted file mode 100644 index e390f05..0000000 --- a/issue_trigger_backpressure_configs_destinations.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// A pattern to match on the destination name or array of destination IDs. Use `*` as wildcard. -type IssueTriggerBackpressureConfigsDestinations struct { - typeName string - String string - StringList []string -} - -func NewIssueTriggerBackpressureConfigsDestinationsFromString(value string) *IssueTriggerBackpressureConfigsDestinations { - return &IssueTriggerBackpressureConfigsDestinations{typeName: "string", String: value} -} - -func NewIssueTriggerBackpressureConfigsDestinationsFromStringList(value []string) *IssueTriggerBackpressureConfigsDestinations { - return &IssueTriggerBackpressureConfigsDestinations{typeName: "stringList", StringList: value} -} - -func (i *IssueTriggerBackpressureConfigsDestinations) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - i.typeName = "string" - i.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - i.typeName = "stringList" - i.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i IssueTriggerBackpressureConfigsDestinations) MarshalJSON() ([]byte, error) { - switch i.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "string": - return json.Marshal(i.String) - case "stringList": - return json.Marshal(i.StringList) - } -} - -type IssueTriggerBackpressureConfigsDestinationsVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (i *IssueTriggerBackpressureConfigsDestinations) Accept(v IssueTriggerBackpressureConfigsDestinationsVisitor) error { - switch i.typeName { - default: - return fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "string": - return v.VisitString(i.String) - case "stringList": - return v.VisitStringList(i.StringList) - } -} diff --git a/issue_trigger_backpressure_delay.go b/issue_trigger_backpressure_delay.go deleted file mode 100644 index 53b6b3a..0000000 --- a/issue_trigger_backpressure_delay.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// The minimum delay (backpressure) to open the issue for min of 1 minute (60000) and max of 1 day (86400000) -type IssueTriggerBackpressureDelay = int diff --git a/issue_trigger_channels.go b/issue_trigger_channels.go deleted file mode 100644 index 51fa078..0000000 --- a/issue_trigger_channels.go +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Notification channels object for the specific channel type -type IssueTriggerChannels struct { - Slack *IssueTriggerSlackChannel `json:"slack,omitempty"` - Opsgenie *IssueTriggerIntegrationChannel `json:"opsgenie,omitempty"` - Email *IssueTriggerEmailChannel `json:"email,omitempty"` -} diff --git a/issue_trigger_delivery_configs.go b/issue_trigger_delivery_configs.go deleted file mode 100644 index 6d4da2d..0000000 --- a/issue_trigger_delivery_configs.go +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Configurations for a 'delivery' issue trigger -type IssueTriggerDeliveryConfigs struct { - Strategy IssueTriggerStrategy `json:"strategy,omitempty"` - // A pattern to match on the connection name or array of connection IDs. Use `*` as wildcard. - Connections *IssueTriggerDeliveryConfigsConnections `json:"connections,omitempty"` -} diff --git a/issue_trigger_delivery_configs_connections.go b/issue_trigger_delivery_configs_connections.go deleted file mode 100644 index 7d8d2eb..0000000 --- a/issue_trigger_delivery_configs_connections.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// A pattern to match on the connection name or array of connection IDs. Use `*` as wildcard. -type IssueTriggerDeliveryConfigsConnections struct { - typeName string - String string - StringList []string -} - -func NewIssueTriggerDeliveryConfigsConnectionsFromString(value string) *IssueTriggerDeliveryConfigsConnections { - return &IssueTriggerDeliveryConfigsConnections{typeName: "string", String: value} -} - -func NewIssueTriggerDeliveryConfigsConnectionsFromStringList(value []string) *IssueTriggerDeliveryConfigsConnections { - return &IssueTriggerDeliveryConfigsConnections{typeName: "stringList", StringList: value} -} - -func (i *IssueTriggerDeliveryConfigsConnections) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - i.typeName = "string" - i.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - i.typeName = "stringList" - i.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i IssueTriggerDeliveryConfigsConnections) MarshalJSON() ([]byte, error) { - switch i.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "string": - return json.Marshal(i.String) - case "stringList": - return json.Marshal(i.StringList) - } -} - -type IssueTriggerDeliveryConfigsConnectionsVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (i *IssueTriggerDeliveryConfigsConnections) Accept(v IssueTriggerDeliveryConfigsConnectionsVisitor) error { - switch i.typeName { - default: - return fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "string": - return v.VisitString(i.String) - case "stringList": - return v.VisitStringList(i.StringList) - } -} diff --git a/issue_trigger_email_channel.go b/issue_trigger_email_channel.go deleted file mode 100644 index 954533d..0000000 --- a/issue_trigger_email_channel.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Email channel for an issue trigger -type IssueTriggerEmailChannel struct { -} diff --git a/issue_trigger_integration_channel.go b/issue_trigger_integration_channel.go deleted file mode 100644 index 3045a70..0000000 --- a/issue_trigger_integration_channel.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Integration channel for an issue trigger -type IssueTriggerIntegrationChannel struct { -} diff --git a/issue_trigger_paginated_result.go b/issue_trigger_paginated_result.go deleted file mode 100644 index 1d41e89..0000000 --- a/issue_trigger_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type IssueTriggerPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*IssueTrigger `json:"models,omitempty"` -} diff --git a/issue_trigger_reference.go b/issue_trigger_reference.go deleted file mode 100644 index 2049769..0000000 --- a/issue_trigger_reference.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Configuration object for the specific issue type selected -type IssueTriggerReference struct { - typeName string - IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs - IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs - IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs -} - -func NewIssueTriggerReferenceFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *IssueTriggerReference { - return &IssueTriggerReference{typeName: "issueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} -} - -func NewIssueTriggerReferenceFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *IssueTriggerReference { - return &IssueTriggerReference{typeName: "issueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} -} - -func NewIssueTriggerReferenceFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *IssueTriggerReference { - return &IssueTriggerReference{typeName: "issueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} -} - -func (i *IssueTriggerReference) UnmarshalJSON(data []byte) error { - valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { - i.typeName = "issueTriggerDeliveryConfigs" - i.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs - return nil - } - valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { - i.typeName = "issueTriggerTransformationConfigs" - i.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs - return nil - } - valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { - i.typeName = "issueTriggerBackpressureConfigs" - i.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i IssueTriggerReference) MarshalJSON() ([]byte, error) { - switch i.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "issueTriggerDeliveryConfigs": - return json.Marshal(i.IssueTriggerDeliveryConfigs) - case "issueTriggerTransformationConfigs": - return json.Marshal(i.IssueTriggerTransformationConfigs) - case "issueTriggerBackpressureConfigs": - return json.Marshal(i.IssueTriggerBackpressureConfigs) - } -} - -type IssueTriggerReferenceVisitor interface { - VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error - VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error - VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error -} - -func (i *IssueTriggerReference) Accept(v IssueTriggerReferenceVisitor) error { - switch i.typeName { - default: - return fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "issueTriggerDeliveryConfigs": - return v.VisitIssueTriggerDeliveryConfigs(i.IssueTriggerDeliveryConfigs) - case "issueTriggerTransformationConfigs": - return v.VisitIssueTriggerTransformationConfigs(i.IssueTriggerTransformationConfigs) - case "issueTriggerBackpressureConfigs": - return v.VisitIssueTriggerBackpressureConfigs(i.IssueTriggerBackpressureConfigs) - } -} diff --git a/issue_trigger_slack_channel.go b/issue_trigger_slack_channel.go deleted file mode 100644 index 290161b..0000000 --- a/issue_trigger_slack_channel.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Slack channel for an issue trigger -type IssueTriggerSlackChannel struct { - // Channel name - ChannelName string `json:"channel_name"` -} diff --git a/issue_trigger_strategy.go b/issue_trigger_strategy.go deleted file mode 100644 index a32cca6..0000000 --- a/issue_trigger_strategy.go +++ /dev/null @@ -1,48 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// The strategy uses to open the issue -type IssueTriggerStrategy uint8 - -const ( - IssueTriggerStrategyFirstAttempt IssueTriggerStrategy = iota + 1 - IssueTriggerStrategyFinalAttempt -) - -func (i IssueTriggerStrategy) String() string { - switch i { - default: - return strconv.Itoa(int(i)) - case IssueTriggerStrategyFirstAttempt: - return "first_attempt" - case IssueTriggerStrategyFinalAttempt: - return "final_attempt" - } -} - -func (i IssueTriggerStrategy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", i.String())), nil -} - -func (i *IssueTriggerStrategy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "first_attempt": - value := IssueTriggerStrategyFirstAttempt - *i = value - case "final_attempt": - value := IssueTriggerStrategyFinalAttempt - *i = value - } - return nil -} diff --git a/issue_trigger_transformation_configs.go b/issue_trigger_transformation_configs.go deleted file mode 100644 index ce718c5..0000000 --- a/issue_trigger_transformation_configs.go +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Configurations for a 'Transformation' issue trigger -type IssueTriggerTransformationConfigs struct { - LogLevel TransformationExecutionLogLevel `json:"log_level,omitempty"` - // A pattern to match on the transformation name or array of transformation IDs. Use `*` as wildcard. - Transformations *IssueTriggerTransformationConfigsTransformations `json:"transformations,omitempty"` -} diff --git a/issue_trigger_transformation_configs_transformations.go b/issue_trigger_transformation_configs_transformations.go deleted file mode 100644 index 4328a39..0000000 --- a/issue_trigger_transformation_configs_transformations.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// A pattern to match on the transformation name or array of transformation IDs. Use `*` as wildcard. -type IssueTriggerTransformationConfigsTransformations struct { - typeName string - String string - StringList []string -} - -func NewIssueTriggerTransformationConfigsTransformationsFromString(value string) *IssueTriggerTransformationConfigsTransformations { - return &IssueTriggerTransformationConfigsTransformations{typeName: "string", String: value} -} - -func NewIssueTriggerTransformationConfigsTransformationsFromStringList(value []string) *IssueTriggerTransformationConfigsTransformations { - return &IssueTriggerTransformationConfigsTransformations{typeName: "stringList", StringList: value} -} - -func (i *IssueTriggerTransformationConfigsTransformations) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - i.typeName = "string" - i.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - i.typeName = "stringList" - i.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i IssueTriggerTransformationConfigsTransformations) MarshalJSON() ([]byte, error) { - switch i.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "string": - return json.Marshal(i.String) - case "stringList": - return json.Marshal(i.StringList) - } -} - -type IssueTriggerTransformationConfigsTransformationsVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (i *IssueTriggerTransformationConfigsTransformations) Accept(v IssueTriggerTransformationConfigsTransformationsVisitor) error { - switch i.typeName { - default: - return fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "string": - return v.VisitString(i.String) - case "stringList": - return v.VisitStringList(i.StringList) - } -} diff --git a/issue_triggers.go b/issue_triggers.go new file mode 100644 index 0000000..307eded --- /dev/null +++ b/issue_triggers.go @@ -0,0 +1,46 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateIssueTriggerRequest struct { + Type IssueType `json:"type,omitempty"` + // Configuration object for the specific issue type selected + Configs *CreateIssueTriggerRequestConfigs `json:"configs,omitempty"` + Channels *IssueTriggerChannels `json:"channels,omitempty"` + // Optional unique name to use as reference when using the API + Name *string `json:"name,omitempty"` +} + +type GetIssueTriggersRequest struct { + Name *string `json:"-"` + Type *IssueType `json:"-"` + DisabledAt *time.Time `json:"-"` + OrderBy *GetIssueTriggersRequestOrderBy `json:"-"` + Dir *GetIssueTriggersRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type UpdateIssueTriggerRequest struct { + // Configuration object for the specific issue type selected + Configs *UpdateIssueTriggerRequestConfigs `json:"configs,omitempty"` + Channels *IssueTriggerChannels `json:"channels,omitempty"` + // Date when the issue trigger was disabled + DisabledAt *time.Time `json:"disabled_at,omitempty"` + // Optional unique name to use as reference when using the API + Name *string `json:"name,omitempty"` +} + +type UpsertIssueTriggerRequest struct { + Type IssueType `json:"type,omitempty"` + // Configuration object for the specific issue type selected + Configs *UpsertIssueTriggerRequestConfigs `json:"configs,omitempty"` + Channels *IssueTriggerChannels `json:"channels,omitempty"` + // Required unique name to use as reference when using the API `<= 255 characters` + Name string `json:"name"` +} diff --git a/issue_type.go b/issue_type.go deleted file mode 100644 index 12f3a4d..0000000 --- a/issue_type.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Issue type -type IssueType uint8 - -const ( - IssueTypeDelivery IssueType = iota + 1 - IssueTypeTransformation - IssueTypeBackpressure -) - -func (i IssueType) String() string { - switch i { - default: - return strconv.Itoa(int(i)) - case IssueTypeDelivery: - return "delivery" - case IssueTypeTransformation: - return "transformation" - case IssueTypeBackpressure: - return "backpressure" - } -} - -func (i IssueType) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", i.String())), nil -} - -func (i *IssueType) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "delivery": - value := IssueTypeDelivery - *i = value - case "transformation": - value := IssueTypeTransformation - *i = value - case "backpressure": - value := IssueTypeBackpressure - *i = value - } - return nil -} diff --git a/issue_with_data.go b/issue_with_data.go deleted file mode 100644 index 08195c1..0000000 --- a/issue_with_data.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type IssueWithData struct { - typeName string - DeliveryIssueWithData *DeliveryIssueWithData - TransformationIssueWithData *TransformationIssueWithData -} - -func NewIssueWithDataFromDeliveryIssueWithData(value *DeliveryIssueWithData) *IssueWithData { - return &IssueWithData{typeName: "deliveryIssueWithData", DeliveryIssueWithData: value} -} - -func NewIssueWithDataFromTransformationIssueWithData(value *TransformationIssueWithData) *IssueWithData { - return &IssueWithData{typeName: "transformationIssueWithData", TransformationIssueWithData: value} -} - -func (i *IssueWithData) UnmarshalJSON(data []byte) error { - valueDeliveryIssueWithData := new(DeliveryIssueWithData) - if err := json.Unmarshal(data, &valueDeliveryIssueWithData); err == nil { - i.typeName = "deliveryIssueWithData" - i.DeliveryIssueWithData = valueDeliveryIssueWithData - return nil - } - valueTransformationIssueWithData := new(TransformationIssueWithData) - if err := json.Unmarshal(data, &valueTransformationIssueWithData); err == nil { - i.typeName = "transformationIssueWithData" - i.TransformationIssueWithData = valueTransformationIssueWithData - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -} - -func (i IssueWithData) MarshalJSON() ([]byte, error) { - switch i.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "deliveryIssueWithData": - return json.Marshal(i.DeliveryIssueWithData) - case "transformationIssueWithData": - return json.Marshal(i.TransformationIssueWithData) - } -} - -type IssueWithDataVisitor interface { - VisitDeliveryIssueWithData(*DeliveryIssueWithData) error - VisitTransformationIssueWithData(*TransformationIssueWithData) error -} - -func (i *IssueWithData) Accept(v IssueWithDataVisitor) error { - switch i.typeName { - default: - return fmt.Errorf("invalid type %s in %T", i.typeName, i) - case "deliveryIssueWithData": - return v.VisitDeliveryIssueWithData(i.DeliveryIssueWithData) - case "transformationIssueWithData": - return v.VisitTransformationIssueWithData(i.TransformationIssueWithData) - } -} diff --git a/issue_with_data_paginated_result.go b/issue_with_data_paginated_result.go deleted file mode 100644 index 0883536..0000000 --- a/issue_with_data_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type IssueWithDataPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*IssueWithData `json:"models,omitempty"` -} diff --git a/issues.go b/issues.go new file mode 100644 index 0000000..9519539 --- /dev/null +++ b/issues.go @@ -0,0 +1,46 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type GetIssueCountRequest struct { + Id *string `json:"-"` + IssueTriggerId *string `json:"-"` + Type *GetIssueCountRequestType `json:"-"` + Status *GetIssueCountRequestStatus `json:"-"` + MergedWith *string `json:"-"` + CreatedAt *time.Time `json:"-"` + FirstSeenAt *time.Time `json:"-"` + LastSeenAt *time.Time `json:"-"` + DismissedAt *time.Time `json:"-"` + OrderBy *GetIssueCountRequestOrderBy `json:"-"` + Dir *GetIssueCountRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type GetIssuesRequest struct { + Id *string `json:"-"` + IssueTriggerId *string `json:"-"` + Type *GetIssuesRequestType `json:"-"` + Status *GetIssuesRequestStatus `json:"-"` + MergedWith *string `json:"-"` + CreatedAt *time.Time `json:"-"` + FirstSeenAt *time.Time `json:"-"` + LastSeenAt *time.Time `json:"-"` + DismissedAt *time.Time `json:"-"` + OrderBy *GetIssuesRequestOrderBy `json:"-"` + Dir *GetIssuesRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type UpdateIssueRequest struct { + // New status + Status UpdateIssueRequestStatus `json:"status,omitempty"` +} diff --git a/issues_client.go b/issues/client.go similarity index 51% rename from issues_client.go rename to issues/client.go index c2f7110..c452f85 100644 --- a/issues_client.go +++ b/issues/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package issues import ( bytes "bytes" @@ -8,100 +8,88 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type IssuesClient interface { - GetIssues(ctx context.Context, request *GetIssuesRequest) (*IssueWithDataPaginatedResult, error) - GetIssueCount(ctx context.Context, request *GetIssueCountRequest) (*IssueCount, error) - GetIssue(ctx context.Context, id string) (*IssueWithData, error) - UpdateIssue(ctx context.Context, id string, request *UpdateIssueRequest) (*Issue, error) - DismissIssue(ctx context.Context, id string) (*Issue, error) +type Client interface { + GetIssues(ctx context.Context, request *hookdeckgo.GetIssuesRequest) (*hookdeckgo.IssueWithDataPaginatedResult, error) + GetIssueCount(ctx context.Context, request *hookdeckgo.GetIssueCountRequest) (*hookdeckgo.IssueCount, error) + GetIssue(ctx context.Context, id string) (*hookdeckgo.IssueWithData, error) + UpdateIssue(ctx context.Context, id string, request *hookdeckgo.UpdateIssueRequest) (*hookdeckgo.Issue, error) + DismissIssue(ctx context.Context, id string) (*hookdeckgo.Issue, error) } -func NewIssuesClient(opts ...core.ClientOption) IssuesClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &issuesClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type issuesClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (i *issuesClient) GetIssues(ctx context.Context, request *GetIssuesRequest) (*IssueWithDataPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) GetIssues(ctx context.Context, request *hookdeckgo.GetIssuesRequest) (*hookdeckgo.IssueWithDataPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "issues" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var issueTriggerIdDefaultValue *string - if request.IssueTriggerId != issueTriggerIdDefaultValue { + if request.IssueTriggerId != nil { queryParams.Add("issue_trigger_id", fmt.Sprintf("%v", *request.IssueTriggerId)) } - var type_DefaultValue *GetIssuesRequestTypeGetIssuesRequestType - if request.Type != type_DefaultValue { + if request.Type != nil { queryParams.Add("type", fmt.Sprintf("%v", *request.Type)) } - var statusDefaultValue *GetIssuesRequestStatusGetIssuesRequestStatus - if request.Status != statusDefaultValue { + if request.Status != nil { queryParams.Add("status", fmt.Sprintf("%v", *request.Status)) } - var mergedWithDefaultValue *string - if request.MergedWith != mergedWithDefaultValue { + if request.MergedWith != nil { queryParams.Add("merged_with", fmt.Sprintf("%v", *request.MergedWith)) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.CreatedAt != nil { + queryParams.Add("created_at", fmt.Sprintf("%v", request.CreatedAt.Format(time.RFC3339))) } - var firstSeenAtDefaultValue *string - if request.FirstSeenAt != firstSeenAtDefaultValue { - queryParams.Add("first_seen_at", fmt.Sprintf("%v", *request.FirstSeenAt)) + if request.FirstSeenAt != nil { + queryParams.Add("first_seen_at", fmt.Sprintf("%v", request.FirstSeenAt.Format(time.RFC3339))) } - var lastSeenAtDefaultValue *string - if request.LastSeenAt != lastSeenAtDefaultValue { - queryParams.Add("last_seen_at", fmt.Sprintf("%v", *request.LastSeenAt)) + if request.LastSeenAt != nil { + queryParams.Add("last_seen_at", fmt.Sprintf("%v", request.LastSeenAt.Format(time.RFC3339))) } - var dismissedAtDefaultValue *string - if request.DismissedAt != dismissedAtDefaultValue { - queryParams.Add("dismissed_at", fmt.Sprintf("%v", *request.DismissedAt)) + if request.DismissedAt != nil { + queryParams.Add("dismissed_at", fmt.Sprintf("%v", request.DismissedAt.Format(time.RFC3339))) } - var orderByDefaultValue *GetIssuesRequestOrderByGetIssuesRequestOrderBy - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetIssuesRequestDirGetIssuesRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -117,14 +105,14 @@ func (i *issuesClient) GetIssues(ctx context.Context, request *GetIssuesRequest) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -134,15 +122,16 @@ func (i *issuesClient) GetIssues(ctx context.Context, request *GetIssuesRequest) return apiError } - response := new(IssueWithDataPaginatedResult) + var response *hookdeckgo.IssueWithDataPaginatedResult if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -150,68 +139,54 @@ func (i *issuesClient) GetIssues(ctx context.Context, request *GetIssuesRequest) return response, nil } -func (i *issuesClient) GetIssueCount(ctx context.Context, request *GetIssueCountRequest) (*IssueCount, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) GetIssueCount(ctx context.Context, request *hookdeckgo.GetIssueCountRequest) (*hookdeckgo.IssueCount, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "issues/count" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var issueTriggerIdDefaultValue *string - if request.IssueTriggerId != issueTriggerIdDefaultValue { + if request.IssueTriggerId != nil { queryParams.Add("issue_trigger_id", fmt.Sprintf("%v", *request.IssueTriggerId)) } - var type_DefaultValue *GetIssueCountRequestTypeGetIssueCountRequestType - if request.Type != type_DefaultValue { + if request.Type != nil { queryParams.Add("type", fmt.Sprintf("%v", *request.Type)) } - var statusDefaultValue *GetIssueCountRequestStatusGetIssueCountRequestStatus - if request.Status != statusDefaultValue { + if request.Status != nil { queryParams.Add("status", fmt.Sprintf("%v", *request.Status)) } - var mergedWithDefaultValue *string - if request.MergedWith != mergedWithDefaultValue { + if request.MergedWith != nil { queryParams.Add("merged_with", fmt.Sprintf("%v", *request.MergedWith)) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.CreatedAt != nil { + queryParams.Add("created_at", fmt.Sprintf("%v", request.CreatedAt.Format(time.RFC3339))) } - var firstSeenAtDefaultValue *string - if request.FirstSeenAt != firstSeenAtDefaultValue { - queryParams.Add("first_seen_at", fmt.Sprintf("%v", *request.FirstSeenAt)) + if request.FirstSeenAt != nil { + queryParams.Add("first_seen_at", fmt.Sprintf("%v", request.FirstSeenAt.Format(time.RFC3339))) } - var lastSeenAtDefaultValue *string - if request.LastSeenAt != lastSeenAtDefaultValue { - queryParams.Add("last_seen_at", fmt.Sprintf("%v", *request.LastSeenAt)) + if request.LastSeenAt != nil { + queryParams.Add("last_seen_at", fmt.Sprintf("%v", request.LastSeenAt.Format(time.RFC3339))) } - var dismissedAtDefaultValue *string - if request.DismissedAt != dismissedAtDefaultValue { - queryParams.Add("dismissed_at", fmt.Sprintf("%v", *request.DismissedAt)) + if request.DismissedAt != nil { + queryParams.Add("dismissed_at", fmt.Sprintf("%v", request.DismissedAt.Format(time.RFC3339))) } - var orderByDefaultValue *GetIssueCountRequestOrderByGetIssueCountRequestOrderBy - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetIssueCountRequestDirGetIssueCountRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -227,7 +202,7 @@ func (i *issuesClient) GetIssueCount(ctx context.Context, request *GetIssueCount decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -237,15 +212,16 @@ func (i *issuesClient) GetIssueCount(ctx context.Context, request *GetIssueCount return apiError } - response := new(IssueCount) + var response *hookdeckgo.IssueCount if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -253,10 +229,10 @@ func (i *issuesClient) GetIssueCount(ctx context.Context, request *GetIssueCount return response, nil } -func (i *issuesClient) GetIssue(ctx context.Context, id string) (*IssueWithData, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) GetIssue(ctx context.Context, id string) (*hookdeckgo.IssueWithData, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"issues/%v", id) @@ -269,7 +245,7 @@ func (i *issuesClient) GetIssue(ctx context.Context, id string) (*IssueWithData, decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -279,15 +255,16 @@ func (i *issuesClient) GetIssue(ctx context.Context, id string) (*IssueWithData, return apiError } - response := new(IssueWithData) + var response *hookdeckgo.IssueWithData if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -295,10 +272,10 @@ func (i *issuesClient) GetIssue(ctx context.Context, id string) (*IssueWithData, return response, nil } -func (i *issuesClient) UpdateIssue(ctx context.Context, id string, request *UpdateIssueRequest) (*Issue, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) UpdateIssue(ctx context.Context, id string, request *hookdeckgo.UpdateIssueRequest) (*hookdeckgo.Issue, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"issues/%v", id) @@ -311,14 +288,14 @@ func (i *issuesClient) UpdateIssue(ctx context.Context, id string, request *Upda decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -328,15 +305,16 @@ func (i *issuesClient) UpdateIssue(ctx context.Context, id string, request *Upda return apiError } - response := new(Issue) + var response *hookdeckgo.Issue if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -344,10 +322,10 @@ func (i *issuesClient) UpdateIssue(ctx context.Context, id string, request *Upda return response, nil } -func (i *issuesClient) DismissIssue(ctx context.Context, id string) (*Issue, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) DismissIssue(ctx context.Context, id string) (*hookdeckgo.Issue, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"issues/%v", id) @@ -360,7 +338,7 @@ func (i *issuesClient) DismissIssue(ctx context.Context, id string) (*Issue, err decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -370,15 +348,16 @@ func (i *issuesClient) DismissIssue(ctx context.Context, id string) (*Issue, err return apiError } - response := new(Issue) + var response *hookdeckgo.Issue if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodDelete, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/issue_triggers_client.go b/issuetriggers/client.go similarity index 61% rename from issue_triggers_client.go rename to issuetriggers/client.go index 00466eb..a3fe453 100644 --- a/issue_triggers_client.go +++ b/issuetriggers/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package issuetriggers import ( bytes "bytes" @@ -8,79 +8,73 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type IssueTriggersClient interface { - GetIssueTriggers(ctx context.Context, request *GetIssueTriggersRequest) (*IssueTriggerPaginatedResult, error) - CreateIssueTrigger(ctx context.Context, request *CreateIssueTriggerRequest) (*IssueTrigger, error) - UpsertIssueTrigger(ctx context.Context, request *UpsertIssueTriggerRequest) (*IssueTrigger, error) - GetIssueTrigger(ctx context.Context, id string) (*IssueTrigger, error) - UpdateIssueTrigger(ctx context.Context, id string, request *UpdateIssueTriggerRequest) (*IssueTrigger, error) - DeleteIssueTrigger(ctx context.Context, id string) (*DeletedIssueTriggerResponse, error) - DisableIssueTrigger(ctx context.Context, id string) (*IssueTrigger, error) - EnableIssueTrigger(ctx context.Context, id string) (*IssueTrigger, error) +type Client interface { + GetIssueTriggers(ctx context.Context, request *hookdeckgo.GetIssueTriggersRequest) (*hookdeckgo.IssueTriggerPaginatedResult, error) + CreateIssueTrigger(ctx context.Context, request *hookdeckgo.CreateIssueTriggerRequest) (*hookdeckgo.IssueTrigger, error) + UpsertIssueTrigger(ctx context.Context, request *hookdeckgo.UpsertIssueTriggerRequest) (*hookdeckgo.IssueTrigger, error) + GetIssueTrigger(ctx context.Context, id string) (*hookdeckgo.IssueTrigger, error) + UpdateIssueTrigger(ctx context.Context, id string, request *hookdeckgo.UpdateIssueTriggerRequest) (*hookdeckgo.IssueTrigger, error) + DeleteIssueTrigger(ctx context.Context, id string) (*hookdeckgo.DeletedIssueTriggerResponse, error) + DisableIssueTrigger(ctx context.Context, id string) (*hookdeckgo.IssueTrigger, error) + EnableIssueTrigger(ctx context.Context, id string) (*hookdeckgo.IssueTrigger, error) } -func NewIssueTriggersClient(opts ...core.ClientOption) IssueTriggersClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &issueTriggersClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type issueTriggersClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (i *issueTriggersClient) GetIssueTriggers(ctx context.Context, request *GetIssueTriggersRequest) (*IssueTriggerPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) GetIssueTriggers(ctx context.Context, request *hookdeckgo.GetIssueTriggersRequest) (*hookdeckgo.IssueTriggerPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "issue-triggers" queryParams := make(url.Values) - var nameDefaultValue *string - if request.Name != nameDefaultValue { + if request.Name != nil { queryParams.Add("name", fmt.Sprintf("%v", *request.Name)) } - var type_DefaultValue *IssueType - if request.Type != type_DefaultValue { + if request.Type != nil { queryParams.Add("type", fmt.Sprintf("%v", *request.Type)) } - var disabledAtDefaultValue *string - if request.DisabledAt != disabledAtDefaultValue { - queryParams.Add("disabled_at", fmt.Sprintf("%v", *request.DisabledAt)) + if request.DisabledAt != nil { + queryParams.Add("disabled_at", fmt.Sprintf("%v", request.DisabledAt.Format(time.RFC3339))) } - var orderByDefaultValue *GetIssueTriggersRequestOrderByGetIssueTriggersRequestOrderBy - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetIssueTriggersRequestDirGetIssueTriggersRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -96,14 +90,14 @@ func (i *issueTriggersClient) GetIssueTriggers(ctx context.Context, request *Get decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -113,15 +107,16 @@ func (i *issueTriggersClient) GetIssueTriggers(ctx context.Context, request *Get return apiError } - response := new(IssueTriggerPaginatedResult) + var response *hookdeckgo.IssueTriggerPaginatedResult if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -129,10 +124,10 @@ func (i *issueTriggersClient) GetIssueTriggers(ctx context.Context, request *Get return response, nil } -func (i *issueTriggersClient) CreateIssueTrigger(ctx context.Context, request *CreateIssueTriggerRequest) (*IssueTrigger, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) CreateIssueTrigger(ctx context.Context, request *hookdeckgo.CreateIssueTriggerRequest) (*hookdeckgo.IssueTrigger, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "issue-triggers" @@ -145,14 +140,14 @@ func (i *issueTriggersClient) CreateIssueTrigger(ctx context.Context, request *C decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -162,15 +157,16 @@ func (i *issueTriggersClient) CreateIssueTrigger(ctx context.Context, request *C return apiError } - response := new(IssueTrigger) + var response *hookdeckgo.IssueTrigger if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -178,10 +174,10 @@ func (i *issueTriggersClient) CreateIssueTrigger(ctx context.Context, request *C return response, nil } -func (i *issueTriggersClient) UpsertIssueTrigger(ctx context.Context, request *UpsertIssueTriggerRequest) (*IssueTrigger, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) UpsertIssueTrigger(ctx context.Context, request *hookdeckgo.UpsertIssueTriggerRequest) (*hookdeckgo.IssueTrigger, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "issue-triggers" @@ -194,14 +190,14 @@ func (i *issueTriggersClient) UpsertIssueTrigger(ctx context.Context, request *U decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -211,15 +207,16 @@ func (i *issueTriggersClient) UpsertIssueTrigger(ctx context.Context, request *U return apiError } - response := new(IssueTrigger) + var response *hookdeckgo.IssueTrigger if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -227,10 +224,10 @@ func (i *issueTriggersClient) UpsertIssueTrigger(ctx context.Context, request *U return response, nil } -func (i *issueTriggersClient) GetIssueTrigger(ctx context.Context, id string) (*IssueTrigger, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) GetIssueTrigger(ctx context.Context, id string) (*hookdeckgo.IssueTrigger, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"issue-triggers/%v", id) @@ -243,7 +240,7 @@ func (i *issueTriggersClient) GetIssueTrigger(ctx context.Context, id string) (* decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -253,15 +250,16 @@ func (i *issueTriggersClient) GetIssueTrigger(ctx context.Context, id string) (* return apiError } - response := new(IssueTrigger) + var response *hookdeckgo.IssueTrigger if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -269,10 +267,10 @@ func (i *issueTriggersClient) GetIssueTrigger(ctx context.Context, id string) (* return response, nil } -func (i *issueTriggersClient) UpdateIssueTrigger(ctx context.Context, id string, request *UpdateIssueTriggerRequest) (*IssueTrigger, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) UpdateIssueTrigger(ctx context.Context, id string, request *hookdeckgo.UpdateIssueTriggerRequest) (*hookdeckgo.IssueTrigger, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"issue-triggers/%v", id) @@ -285,14 +283,14 @@ func (i *issueTriggersClient) UpdateIssueTrigger(ctx context.Context, id string, decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -302,15 +300,16 @@ func (i *issueTriggersClient) UpdateIssueTrigger(ctx context.Context, id string, return apiError } - response := new(IssueTrigger) + var response *hookdeckgo.IssueTrigger if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -318,10 +317,10 @@ func (i *issueTriggersClient) UpdateIssueTrigger(ctx context.Context, id string, return response, nil } -func (i *issueTriggersClient) DeleteIssueTrigger(ctx context.Context, id string) (*DeletedIssueTriggerResponse, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) DeleteIssueTrigger(ctx context.Context, id string) (*hookdeckgo.DeletedIssueTriggerResponse, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"issue-triggers/%v", id) @@ -334,7 +333,7 @@ func (i *issueTriggersClient) DeleteIssueTrigger(ctx context.Context, id string) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -344,15 +343,16 @@ func (i *issueTriggersClient) DeleteIssueTrigger(ctx context.Context, id string) return apiError } - response := new(DeletedIssueTriggerResponse) + var response *hookdeckgo.DeletedIssueTriggerResponse if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodDelete, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -360,10 +360,10 @@ func (i *issueTriggersClient) DeleteIssueTrigger(ctx context.Context, id string) return response, nil } -func (i *issueTriggersClient) DisableIssueTrigger(ctx context.Context, id string) (*IssueTrigger, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) DisableIssueTrigger(ctx context.Context, id string) (*hookdeckgo.IssueTrigger, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"issue-triggers/%v/disable", id) @@ -376,7 +376,7 @@ func (i *issueTriggersClient) DisableIssueTrigger(ctx context.Context, id string decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -386,15 +386,16 @@ func (i *issueTriggersClient) DisableIssueTrigger(ctx context.Context, id string return apiError } - response := new(IssueTrigger) + var response *hookdeckgo.IssueTrigger if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -402,10 +403,10 @@ func (i *issueTriggersClient) DisableIssueTrigger(ctx context.Context, id string return response, nil } -func (i *issueTriggersClient) EnableIssueTrigger(ctx context.Context, id string) (*IssueTrigger, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if i.baseURL != "" { - baseURL = i.baseURL +func (c *client) EnableIssueTrigger(ctx context.Context, id string) (*hookdeckgo.IssueTrigger, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"issue-triggers/%v/enable", id) @@ -418,7 +419,7 @@ func (i *issueTriggersClient) EnableIssueTrigger(ctx context.Context, id string) decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -428,15 +429,16 @@ func (i *issueTriggersClient) EnableIssueTrigger(ctx context.Context, id string) return apiError } - response := new(IssueTrigger) + var response *hookdeckgo.IssueTrigger if err := core.DoRequest( ctx, - i.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - i.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/not_found_error.go b/not_found_error.go deleted file mode 100644 index 2fff6b8..0000000 --- a/not_found_error.go +++ /dev/null @@ -1,27 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - core "github.com/fern-hookdeck/hookdeck-go/core" -) - -type NotFoundError struct { - *core.APIError - Body *ApiErrorResponse -} - -func (n *NotFoundError) UnmarshalJSON(data []byte) error { - body := new(ApiErrorResponse) - if err := json.Unmarshal(data, &body); err != nil { - return err - } - n.StatusCode = 404 - n.Body = body - return nil -} - -func (n *NotFoundError) MarshalJSON() ([]byte, error) { - return json.Marshal(n.Body) -} diff --git a/notifications/client.go b/notifications/client.go new file mode 100644 index 0000000..cf98b9b --- /dev/null +++ b/notifications/client.go @@ -0,0 +1,107 @@ +// This file was auto-generated by Fern from our API Definition. + +package notifications + +import ( + context "context" + fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" + core "github.com/fern-hookdeck/hookdeck-go/core" + http "net/http" +) + +type Client interface { + ListCustomDomains(ctx context.Context, teamId string) (hookdeckgo.ListCustomDomainSchema, error) + AddCustomDomain(ctx context.Context, teamId string, request *hookdeckgo.AddCustomHostname) (*hookdeckgo.AddCustomHostname, error) + DeleteCustomDomain(ctx context.Context, teamId string, domainId string) (*hookdeckgo.DeleteCustomDomainSchema, error) +} + +func NewClient(opts ...core.ClientOption) Client { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &client{ + baseURL: options.BaseURL, + httpClient: options.HTTPClient, + header: options.ToHeader(), + } +} + +type client struct { + baseURL string + httpClient core.HTTPClient + header http.Header +} + +func (c *client) ListCustomDomains(ctx context.Context, teamId string) (hookdeckgo.ListCustomDomainSchema, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"teams/%v/custom_domains", teamId) + + var response hookdeckgo.ListCustomDomainSchema + if err := core.DoRequest( + ctx, + c.httpClient, + endpointURL, + http.MethodGet, + nil, + &response, + false, + c.header, + nil, + ); err != nil { + return response, err + } + return response, nil +} + +func (c *client) AddCustomDomain(ctx context.Context, teamId string, request *hookdeckgo.AddCustomHostname) (*hookdeckgo.AddCustomHostname, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"teams/%v/custom_domains", teamId) + + var response *hookdeckgo.AddCustomHostname + if err := core.DoRequest( + ctx, + c.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + c.header, + nil, + ); err != nil { + return response, err + } + return response, nil +} + +func (c *client) DeleteCustomDomain(ctx context.Context, teamId string, domainId string) (*hookdeckgo.DeleteCustomDomainSchema, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"teams/%v/custom_domains/%v", teamId, domainId) + + var response *hookdeckgo.DeleteCustomDomainSchema + if err := core.DoRequest( + ctx, + c.httpClient, + endpointURL, + http.MethodDelete, + nil, + &response, + false, + c.header, + nil, + ); err != nil { + return response, err + } + return response, nil +} diff --git a/notifications_client.go b/notifications_client.go deleted file mode 100644 index 7c20ec6..0000000 --- a/notifications_client.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - context "context" - core "github.com/fern-hookdeck/hookdeck-go/core" - http "net/http" -) - -type NotificationsClient interface { - ToggleWebhookNotifications(ctx context.Context, request *ToggleWebhookNotificationsRequest) (*ToggleWebhookNotifications, error) -} - -func NewNotificationsClient(opts ...core.ClientOption) NotificationsClient { - options := core.NewClientOptions() - for _, opt := range opts { - opt(options) - } - return ¬ificationsClient{ - baseURL: options.BaseURL, - httpClient: options.HTTPClient, - header: options.ToHeader(), - } -} - -type notificationsClient struct { - baseURL string - httpClient core.HTTPClient - header http.Header -} - -func (n *notificationsClient) ToggleWebhookNotifications(ctx context.Context, request *ToggleWebhookNotificationsRequest) (*ToggleWebhookNotifications, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if n.baseURL != "" { - baseURL = n.baseURL - } - endpointURL := baseURL + "/" + "notifications/webhooks" - - response := new(ToggleWebhookNotifications) - if err := core.DoRequest( - ctx, - n.httpClient, - endpointURL, - http.MethodPut, - request, - &response, - n.header, - nil, - ); err != nil { - return response, err - } - return response, nil -} diff --git a/order_by_direction.go b/order_by_direction.go deleted file mode 100644 index 7a94b1d..0000000 --- a/order_by_direction.go +++ /dev/null @@ -1,59 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type OrderByDirection uint8 - -const ( - OrderByDirectionasc OrderByDirection = iota + 1 - OrderByDirectiondesc - OrderByDirectionASC - OrderByDirectionDESC -) - -func (o OrderByDirection) String() string { - switch o { - default: - return strconv.Itoa(int(o)) - case OrderByDirectionasc: - return "asc" - case OrderByDirectiondesc: - return "desc" - case OrderByDirectionASC: - return "ASC" - case OrderByDirectionDESC: - return "DESC" - } -} - -func (o OrderByDirection) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", o.String())), nil -} - -func (o *OrderByDirection) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "asc": - value := OrderByDirectionasc - *o = value - case "desc": - value := OrderByDirectiondesc - *o = value - case "ASC": - value := OrderByDirectionASC - *o = value - case "DESC": - value := OrderByDirectionDESC - *o = value - } - return nil -} diff --git a/raw_body.go b/raw_body.go deleted file mode 100644 index 76514fe..0000000 --- a/raw_body.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type RawBody struct { - Body string `json:"body"` -} diff --git a/request.go b/request.go deleted file mode 100644 index 3b09856..0000000 --- a/request.go +++ /dev/null @@ -1,36 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type Request struct { - // ID of the request - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - // Whether or not the request was verified when received - Verified *bool `json:"verified,omitempty"` - // ID of the request data - OriginalEventDataId *string `json:"original_event_data_id,omitempty"` - // Hash of the request data payload used to check for duplicates - DuplicateHash *string `json:"duplicate_hash,omitempty"` - // Count of duplicate hits found - DuplicateHits *int `json:"duplicate_hits,omitempty"` - RejectionCause *RequestRejectionCause `json:"rejection_cause,omitempty"` - // The priority attributed to the request when received - IngestPriority *RequestIngestPriority `json:"ingest_priority,omitempty"` - // The time the request was originally received - IngestedAt *string `json:"ingested_at,omitempty"` - IngestedAtId *string `json:"ingested_at_id,omitempty"` - // ID of the associated source - SourceId string `json:"source_id"` - // The count of events created from this request (CLI events not included) - EventsCount *int `json:"events_count,omitempty"` - // The count of CLI events created from this request - CliEventsCount *int `json:"cli_events_count,omitempty"` - IgnoredCount *int `json:"ignored_count,omitempty"` - Data *RequestData `json:"data,omitempty"` - // Date the event was last updated - UpdatedAt string `json:"updated_at"` - // Date the event was created - CreatedAt string `json:"created_at"` -} diff --git a/request_data.go b/request_data.go deleted file mode 100644 index 121f348..0000000 --- a/request_data.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type RequestData struct { - Path string `json:"path"` - Query *string `json:"query,omitempty"` - ParsedQuery *RequestDataParsedQuery `json:"parsed_query,omitempty"` - Headers *RequestDataHeaders `json:"headers,omitempty"` - Body *RequestDataBody `json:"body,omitempty"` - IsLargePayload *bool `json:"is_large_payload,omitempty"` -} diff --git a/request_data_body.go b/request_data_body.go deleted file mode 100644 index 041aac1..0000000 --- a/request_data_body.go +++ /dev/null @@ -1,81 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type RequestDataBody struct { - typeName string - String string - RequestDataBodyRequestDataBody *RequestDataBodyRequestDataBody - UnknownList []any -} - -func NewRequestDataBodyFromString(value string) *RequestDataBody { - return &RequestDataBody{typeName: "string", String: value} -} - -func NewRequestDataBodyFromRequestDataBodyRequestDataBody(value *RequestDataBodyRequestDataBody) *RequestDataBody { - return &RequestDataBody{typeName: "requestDataBodyRequestDataBody", RequestDataBodyRequestDataBody: value} -} - -func NewRequestDataBodyFromUnknownList(value []any) *RequestDataBody { - return &RequestDataBody{typeName: "unknownList", UnknownList: value} -} - -func (r *RequestDataBody) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - r.typeName = "string" - r.String = valueString - return nil - } - valueRequestDataBodyRequestDataBody := new(RequestDataBodyRequestDataBody) - if err := json.Unmarshal(data, &valueRequestDataBodyRequestDataBody); err == nil { - r.typeName = "requestDataBodyRequestDataBody" - r.RequestDataBodyRequestDataBody = valueRequestDataBodyRequestDataBody - return nil - } - var valueUnknownList []any - if err := json.Unmarshal(data, &valueUnknownList); err == nil { - r.typeName = "unknownList" - r.UnknownList = valueUnknownList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) -} - -func (r RequestDataBody) MarshalJSON() ([]byte, error) { - switch r.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", r.typeName, r) - case "string": - return json.Marshal(r.String) - case "requestDataBodyRequestDataBody": - return json.Marshal(r.RequestDataBodyRequestDataBody) - case "unknownList": - return json.Marshal(r.UnknownList) - } -} - -type RequestDataBodyVisitor interface { - VisitString(string) error - VisitRequestDataBodyRequestDataBody(*RequestDataBodyRequestDataBody) error - VisitUnknownList([]any) error -} - -func (r *RequestDataBody) Accept(v RequestDataBodyVisitor) error { - switch r.typeName { - default: - return fmt.Errorf("invalid type %s in %T", r.typeName, r) - case "string": - return v.VisitString(r.String) - case "requestDataBodyRequestDataBody": - return v.VisitRequestDataBodyRequestDataBody(r.RequestDataBodyRequestDataBody) - case "unknownList": - return v.VisitUnknownList(r.UnknownList) - } -} diff --git a/request_data_body_request_data_body.go b/request_data_body_request_data_body.go deleted file mode 100644 index 19f0041..0000000 --- a/request_data_body_request_data_body.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type RequestDataBodyRequestDataBody struct { -} diff --git a/request_data_headers.go b/request_data_headers.go deleted file mode 100644 index 59ede34..0000000 --- a/request_data_headers.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type RequestDataHeaders struct { - typeName string - String string - StringStringOptionalMap map[string]*string -} - -func NewRequestDataHeadersFromString(value string) *RequestDataHeaders { - return &RequestDataHeaders{typeName: "string", String: value} -} - -func NewRequestDataHeadersFromStringStringOptionalMap(value map[string]*string) *RequestDataHeaders { - return &RequestDataHeaders{typeName: "stringStringOptionalMap", StringStringOptionalMap: value} -} - -func (r *RequestDataHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - r.typeName = "string" - r.String = valueString - return nil - } - var valueStringStringOptionalMap map[string]*string - if err := json.Unmarshal(data, &valueStringStringOptionalMap); err == nil { - r.typeName = "stringStringOptionalMap" - r.StringStringOptionalMap = valueStringStringOptionalMap - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) -} - -func (r RequestDataHeaders) MarshalJSON() ([]byte, error) { - switch r.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", r.typeName, r) - case "string": - return json.Marshal(r.String) - case "stringStringOptionalMap": - return json.Marshal(r.StringStringOptionalMap) - } -} - -type RequestDataHeadersVisitor interface { - VisitString(string) error - VisitStringStringOptionalMap(map[string]*string) error -} - -func (r *RequestDataHeaders) Accept(v RequestDataHeadersVisitor) error { - switch r.typeName { - default: - return fmt.Errorf("invalid type %s in %T", r.typeName, r) - case "string": - return v.VisitString(r.String) - case "stringStringOptionalMap": - return v.VisitStringStringOptionalMap(r.StringStringOptionalMap) - } -} diff --git a/request_data_parsed_query.go b/request_data_parsed_query.go deleted file mode 100644 index 2c73530..0000000 --- a/request_data_parsed_query.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type RequestDataParsedQuery struct { - typeName string - StringOptional *string - RequestDataParsedQueryRequestDataParsedQuery *RequestDataParsedQueryRequestDataParsedQuery -} - -func NewRequestDataParsedQueryFromStringOptional(value *string) *RequestDataParsedQuery { - return &RequestDataParsedQuery{typeName: "stringOptional", StringOptional: value} -} - -func NewRequestDataParsedQueryFromRequestDataParsedQueryRequestDataParsedQuery(value *RequestDataParsedQueryRequestDataParsedQuery) *RequestDataParsedQuery { - return &RequestDataParsedQuery{typeName: "requestDataParsedQueryRequestDataParsedQuery", RequestDataParsedQueryRequestDataParsedQuery: value} -} - -func (r *RequestDataParsedQuery) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - r.typeName = "stringOptional" - r.StringOptional = valueStringOptional - return nil - } - valueRequestDataParsedQueryRequestDataParsedQuery := new(RequestDataParsedQueryRequestDataParsedQuery) - if err := json.Unmarshal(data, &valueRequestDataParsedQueryRequestDataParsedQuery); err == nil { - r.typeName = "requestDataParsedQueryRequestDataParsedQuery" - r.RequestDataParsedQueryRequestDataParsedQuery = valueRequestDataParsedQueryRequestDataParsedQuery - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) -} - -func (r RequestDataParsedQuery) MarshalJSON() ([]byte, error) { - switch r.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", r.typeName, r) - case "stringOptional": - return json.Marshal(r.StringOptional) - case "requestDataParsedQueryRequestDataParsedQuery": - return json.Marshal(r.RequestDataParsedQueryRequestDataParsedQuery) - } -} - -type RequestDataParsedQueryVisitor interface { - VisitStringOptional(*string) error - VisitRequestDataParsedQueryRequestDataParsedQuery(*RequestDataParsedQueryRequestDataParsedQuery) error -} - -func (r *RequestDataParsedQuery) Accept(v RequestDataParsedQueryVisitor) error { - switch r.typeName { - default: - return fmt.Errorf("invalid type %s in %T", r.typeName, r) - case "stringOptional": - return v.VisitStringOptional(r.StringOptional) - case "requestDataParsedQueryRequestDataParsedQuery": - return v.VisitRequestDataParsedQueryRequestDataParsedQuery(r.RequestDataParsedQueryRequestDataParsedQuery) - } -} diff --git a/request_data_parsed_query_request_data_parsed_query.go b/request_data_parsed_query_request_data_parsed_query.go deleted file mode 100644 index 5bd03d1..0000000 --- a/request_data_parsed_query_request_data_parsed_query.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type RequestDataParsedQueryRequestDataParsedQuery struct { -} diff --git a/request_ingest_priority.go b/request_ingest_priority.go deleted file mode 100644 index cbfcdf2..0000000 --- a/request_ingest_priority.go +++ /dev/null @@ -1,48 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// The priority attributed to the request when received -type RequestIngestPriority uint8 - -const ( - RequestIngestPriorityNormal RequestIngestPriority = iota + 1 - RequestIngestPriorityLow -) - -func (r RequestIngestPriority) String() string { - switch r { - default: - return strconv.Itoa(int(r)) - case RequestIngestPriorityNormal: - return "NORMAL" - case RequestIngestPriorityLow: - return "LOW" - } -} - -func (r RequestIngestPriority) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", r.String())), nil -} - -func (r *RequestIngestPriority) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "NORMAL": - value := RequestIngestPriorityNormal - *r = value - case "LOW": - value := RequestIngestPriorityLow - *r = value - } - return nil -} diff --git a/request_paginated_result.go b/request_paginated_result.go deleted file mode 100644 index d1a982b..0000000 --- a/request_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type RequestPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Request `json:"models,omitempty"` -} diff --git a/request_rejection_cause.go b/request_rejection_cause.go deleted file mode 100644 index 0100f85..0000000 --- a/request_rejection_cause.go +++ /dev/null @@ -1,89 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type RequestRejectionCause uint8 - -const ( - RequestRejectionCauseSourceArchived RequestRejectionCause = iota + 1 - RequestRejectionCauseNoWebhook - RequestRejectionCauseVerificationFailed - RequestRejectionCauseUnsupportedHttpMethod - RequestRejectionCauseUnsupportedContentType - RequestRejectionCauseUnparsableJson - RequestRejectionCausePayloadTooLarge - RequestRejectionCauseIngestionFatal - RequestRejectionCauseUnknown -) - -func (r RequestRejectionCause) String() string { - switch r { - default: - return strconv.Itoa(int(r)) - case RequestRejectionCauseSourceArchived: - return "SOURCE_ARCHIVED" - case RequestRejectionCauseNoWebhook: - return "NO_WEBHOOK" - case RequestRejectionCauseVerificationFailed: - return "VERIFICATION_FAILED" - case RequestRejectionCauseUnsupportedHttpMethod: - return "UNSUPPORTED_HTTP_METHOD" - case RequestRejectionCauseUnsupportedContentType: - return "UNSUPPORTED_CONTENT_TYPE" - case RequestRejectionCauseUnparsableJson: - return "UNPARSABLE_JSON" - case RequestRejectionCausePayloadTooLarge: - return "PAYLOAD_TOO_LARGE" - case RequestRejectionCauseIngestionFatal: - return "INGESTION_FATAL" - case RequestRejectionCauseUnknown: - return "UNKNOWN" - } -} - -func (r RequestRejectionCause) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", r.String())), nil -} - -func (r *RequestRejectionCause) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "SOURCE_ARCHIVED": - value := RequestRejectionCauseSourceArchived - *r = value - case "NO_WEBHOOK": - value := RequestRejectionCauseNoWebhook - *r = value - case "VERIFICATION_FAILED": - value := RequestRejectionCauseVerificationFailed - *r = value - case "UNSUPPORTED_HTTP_METHOD": - value := RequestRejectionCauseUnsupportedHttpMethod - *r = value - case "UNSUPPORTED_CONTENT_TYPE": - value := RequestRejectionCauseUnsupportedContentType - *r = value - case "UNPARSABLE_JSON": - value := RequestRejectionCauseUnparsableJson - *r = value - case "PAYLOAD_TOO_LARGE": - value := RequestRejectionCausePayloadTooLarge - *r = value - case "INGESTION_FATAL": - value := RequestRejectionCauseIngestionFatal - *r = value - case "UNKNOWN": - value := RequestRejectionCauseUnknown - *r = value - } - return nil -} diff --git a/requests.go b/requests.go new file mode 100644 index 0000000..abe336e --- /dev/null +++ b/requests.go @@ -0,0 +1,74 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type GetRequestEventsRequest struct { + Id *string `json:"-"` + Status *EventStatus `json:"-"` + WebhookId *string `json:"-"` + DestinationId *string `json:"-"` + SourceId *string `json:"-"` + Attempts *int `json:"-"` + ResponseStatus *int `json:"-"` + SuccessfulAt *time.Time `json:"-"` + CreatedAt *time.Time `json:"-"` + ErrorCode *AttemptErrorCodes `json:"-"` + CliId *string `json:"-"` + LastAttemptAt *time.Time `json:"-"` + SearchTerm *string `json:"-"` + Headers *string `json:"-"` + Body *string `json:"-"` + ParsedQuery *string `json:"-"` + Path *string `json:"-"` + CliUserId *string `json:"-"` + IssueId *string `json:"-"` + EventDataId *string `json:"-"` + BulkRetryId *string `json:"-"` + Include *string `json:"-"` + OrderBy *GetRequestEventsRequestOrderBy `json:"-"` + Dir *GetRequestEventsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type GetRequestIgnoredEventsRequest struct { + Id *string `json:"-"` + OrderBy *string `json:"-"` + Dir *GetRequestIgnoredEventsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type GetRequestsRequest struct { + Id *string `json:"-"` + Status *GetRequestsRequestStatus `json:"-"` + RejectionCause *RequestRejectionCause `json:"-"` + SourceId *string `json:"-"` + Verified *bool `json:"-"` + SearchTerm *string `json:"-"` + Headers *string `json:"-"` + Body *string `json:"-"` + ParsedQuery *string `json:"-"` + Path *string `json:"-"` + IgnoredCount *int `json:"-"` + EventsCount *int `json:"-"` + IngestedAt *time.Time `json:"-"` + BulkRetryId *string `json:"-"` + Include *string `json:"-"` + OrderBy *GetRequestsRequestOrderBy `json:"-"` + Dir *GetRequestsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type RetryRequestRequest struct { + // Subset of webhook_ids to re-run the event logic on. Useful to retry only specific ignored_events + WebhookIds []string `json:"webhook_ids,omitempty"` +} diff --git a/requests_client.go b/requests/client.go similarity index 54% rename from requests_client.go rename to requests/client.go index 499cbb8..a503b03 100644 --- a/requests_client.go +++ b/requests/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package requests import ( bytes "bytes" @@ -8,125 +8,107 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type RequestsClient interface { - GetRequests(ctx context.Context, request *GetRequestsRequest) (*RequestPaginatedResult, error) - GetRequest(ctx context.Context, id string) (*Request, error) - GetRequestRawBody(ctx context.Context, id string) (*RawBody, error) - RetryRequest(ctx context.Context, id string, request *RetryRequestRequest) (*RetryRequest, error) - GetRequestEvents(ctx context.Context, id string, request *GetRequestEventsRequest) (*EventPaginatedResult, error) - GetRequestIgnoredEvents(ctx context.Context, id string, request *GetRequestIgnoredEventsRequest) (*IgnoredEventPaginatedResult, error) +type Client interface { + GetRequests(ctx context.Context, request *hookdeckgo.GetRequestsRequest) (*hookdeckgo.RequestPaginatedResult, error) + GetRequest(ctx context.Context, id string) (*hookdeckgo.Request, error) + GetRequestRawBody(ctx context.Context, id string) (*hookdeckgo.RawBody, error) + RetryRequest(ctx context.Context, id string, request *hookdeckgo.RetryRequestRequest) (*hookdeckgo.RetryRequest, error) + GetRequestEvents(ctx context.Context, id string, request *hookdeckgo.GetRequestEventsRequest) (*hookdeckgo.EventPaginatedResult, error) + GetRequestIgnoredEvents(ctx context.Context, id string, request *hookdeckgo.GetRequestIgnoredEventsRequest) (*hookdeckgo.IgnoredEventPaginatedResult, error) } -func NewRequestsClient(opts ...core.ClientOption) RequestsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &requestsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type requestsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (r *requestsClient) GetRequests(ctx context.Context, request *GetRequestsRequest) (*RequestPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) GetRequests(ctx context.Context, request *hookdeckgo.GetRequestsRequest) (*hookdeckgo.RequestPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "requests" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var statusDefaultValue *GetRequestsRequestStatus - if request.Status != statusDefaultValue { + if request.Status != nil { queryParams.Add("status", fmt.Sprintf("%v", *request.Status)) } - var rejectionCauseDefaultValue *RequestRejectionCause - if request.RejectionCause != rejectionCauseDefaultValue { + if request.RejectionCause != nil { queryParams.Add("rejection_cause", fmt.Sprintf("%v", *request.RejectionCause)) } - var ignoredCountDefaultValue *int - if request.IgnoredCount != ignoredCountDefaultValue { - queryParams.Add("ignored_count", fmt.Sprintf("%v", *request.IgnoredCount)) - } - var eventsCountDefaultValue *int - if request.EventsCount != eventsCountDefaultValue { - queryParams.Add("events_count", fmt.Sprintf("%v", *request.EventsCount)) - } - var sourceIdDefaultValue *string - if request.SourceId != sourceIdDefaultValue { + if request.SourceId != nil { queryParams.Add("source_id", fmt.Sprintf("%v", *request.SourceId)) } - var verifiedDefaultValue *bool - if request.Verified != verifiedDefaultValue { + if request.Verified != nil { queryParams.Add("verified", fmt.Sprintf("%v", *request.Verified)) } - var headersDefaultValue *string - if request.Headers != headersDefaultValue { + if request.SearchTerm != nil { + queryParams.Add("search_term", fmt.Sprintf("%v", *request.SearchTerm)) + } + if request.Headers != nil { queryParams.Add("headers", fmt.Sprintf("%v", *request.Headers)) } - var bodyDefaultValue *string - if request.Body != bodyDefaultValue { + if request.Body != nil { queryParams.Add("body", fmt.Sprintf("%v", *request.Body)) } - var parsedQueryDefaultValue *string - if request.ParsedQuery != parsedQueryDefaultValue { + if request.ParsedQuery != nil { queryParams.Add("parsed_query", fmt.Sprintf("%v", *request.ParsedQuery)) } - var pathDefaultValue *string - if request.Path != pathDefaultValue { + if request.Path != nil { queryParams.Add("path", fmt.Sprintf("%v", *request.Path)) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.IgnoredCount != nil { + queryParams.Add("ignored_count", fmt.Sprintf("%v", *request.IgnoredCount)) + } + if request.EventsCount != nil { + queryParams.Add("events_count", fmt.Sprintf("%v", *request.EventsCount)) } - var ingestedAtDefaultValue *string - if request.IngestedAt != ingestedAtDefaultValue { - queryParams.Add("ingested_at", fmt.Sprintf("%v", *request.IngestedAt)) + if request.IngestedAt != nil { + queryParams.Add("ingested_at", fmt.Sprintf("%v", request.IngestedAt.Format(time.RFC3339))) } - var bulkRetryIdDefaultValue *string - if request.BulkRetryId != bulkRetryIdDefaultValue { + if request.BulkRetryId != nil { queryParams.Add("bulk_retry_id", fmt.Sprintf("%v", *request.BulkRetryId)) } - var includeDefaultValue *string - if request.Include != includeDefaultValue { + if request.Include != nil { queryParams.Add("include", fmt.Sprintf("%v", *request.Include)) } - var orderByDefaultValue *GetRequestsRequestOrderByGetRequestsRequestOrderBy - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetRequestsRequestDirGetRequestsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -142,14 +124,14 @@ func (r *requestsClient) GetRequests(ctx context.Context, request *GetRequestsRe decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -159,15 +141,16 @@ func (r *requestsClient) GetRequests(ctx context.Context, request *GetRequestsRe return apiError } - response := new(RequestPaginatedResult) + var response *hookdeckgo.RequestPaginatedResult if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -175,10 +158,10 @@ func (r *requestsClient) GetRequests(ctx context.Context, request *GetRequestsRe return response, nil } -func (r *requestsClient) GetRequest(ctx context.Context, id string) (*Request, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) GetRequest(ctx context.Context, id string) (*hookdeckgo.Request, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"requests/%v", id) @@ -191,7 +174,7 @@ func (r *requestsClient) GetRequest(ctx context.Context, id string) (*Request, e decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -201,15 +184,16 @@ func (r *requestsClient) GetRequest(ctx context.Context, id string) (*Request, e return apiError } - response := new(Request) + var response *hookdeckgo.Request if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -217,10 +201,10 @@ func (r *requestsClient) GetRequest(ctx context.Context, id string) (*Request, e return response, nil } -func (r *requestsClient) GetRequestRawBody(ctx context.Context, id string) (*RawBody, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) GetRequestRawBody(ctx context.Context, id string) (*hookdeckgo.RawBody, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"requests/%v/raw_body", id) @@ -233,7 +217,7 @@ func (r *requestsClient) GetRequestRawBody(ctx context.Context, id string) (*Raw decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -243,15 +227,16 @@ func (r *requestsClient) GetRequestRawBody(ctx context.Context, id string) (*Raw return apiError } - response := new(RawBody) + var response *hookdeckgo.RawBody if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -259,10 +244,10 @@ func (r *requestsClient) GetRequestRawBody(ctx context.Context, id string) (*Raw return response, nil } -func (r *requestsClient) RetryRequest(ctx context.Context, id string, request *RetryRequestRequest) (*RetryRequest, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) RetryRequest(ctx context.Context, id string, request *hookdeckgo.RetryRequestRequest) (*hookdeckgo.RetryRequest, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"requests/%v/retry", id) @@ -275,21 +260,21 @@ func (r *requestsClient) RetryRequest(ctx context.Context, id string, request *R decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -299,15 +284,16 @@ func (r *requestsClient) RetryRequest(ctx context.Context, id string, request *R return apiError } - response := new(RetryRequest) + var response *hookdeckgo.RetryRequest if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -315,116 +301,93 @@ func (r *requestsClient) RetryRequest(ctx context.Context, id string, request *R return response, nil } -func (r *requestsClient) GetRequestEvents(ctx context.Context, id string, request *GetRequestEventsRequest) (*EventPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) GetRequestEvents(ctx context.Context, id string, request *hookdeckgo.GetRequestEventsRequest) (*hookdeckgo.EventPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"requests/%v/events", id) queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var statusDefaultValue *EventStatus - if request.Status != statusDefaultValue { + if request.Status != nil { queryParams.Add("status", fmt.Sprintf("%v", *request.Status)) } - var issueIdDefaultValue *string - if request.IssueId != issueIdDefaultValue { - queryParams.Add("issue_id", fmt.Sprintf("%v", *request.IssueId)) - } - var webhookIdDefaultValue *string - if request.WebhookId != webhookIdDefaultValue { + if request.WebhookId != nil { queryParams.Add("webhook_id", fmt.Sprintf("%v", *request.WebhookId)) } - var destinationIdDefaultValue *string - if request.DestinationId != destinationIdDefaultValue { + if request.DestinationId != nil { queryParams.Add("destination_id", fmt.Sprintf("%v", *request.DestinationId)) } - var sourceIdDefaultValue *string - if request.SourceId != sourceIdDefaultValue { + if request.SourceId != nil { queryParams.Add("source_id", fmt.Sprintf("%v", *request.SourceId)) } - var attemptsDefaultValue *int - if request.Attempts != attemptsDefaultValue { + if request.Attempts != nil { queryParams.Add("attempts", fmt.Sprintf("%v", *request.Attempts)) } - var responseStatusDefaultValue *int - if request.ResponseStatus != responseStatusDefaultValue { + if request.ResponseStatus != nil { queryParams.Add("response_status", fmt.Sprintf("%v", *request.ResponseStatus)) } - var successfulAtDefaultValue *string - if request.SuccessfulAt != successfulAtDefaultValue { - queryParams.Add("successful_at", fmt.Sprintf("%v", *request.SuccessfulAt)) + if request.SuccessfulAt != nil { + queryParams.Add("successful_at", fmt.Sprintf("%v", request.SuccessfulAt.Format(time.RFC3339))) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.CreatedAt != nil { + queryParams.Add("created_at", fmt.Sprintf("%v", request.CreatedAt.Format(time.RFC3339))) } - var errorCodeDefaultValue *string - if request.ErrorCode != errorCodeDefaultValue { + if request.ErrorCode != nil { queryParams.Add("error_code", fmt.Sprintf("%v", *request.ErrorCode)) } - var cliIdDefaultValue *string - if request.CliId != cliIdDefaultValue { + if request.CliId != nil { queryParams.Add("cli_id", fmt.Sprintf("%v", *request.CliId)) } - var cliUserIdDefaultValue *string - if request.CliUserId != cliUserIdDefaultValue { - queryParams.Add("cli_user_id", fmt.Sprintf("%v", *request.CliUserId)) + if request.LastAttemptAt != nil { + queryParams.Add("last_attempt_at", fmt.Sprintf("%v", request.LastAttemptAt.Format(time.RFC3339))) } - var lastAttemptAtDefaultValue *string - if request.LastAttemptAt != lastAttemptAtDefaultValue { - queryParams.Add("last_attempt_at", fmt.Sprintf("%v", *request.LastAttemptAt)) + if request.SearchTerm != nil { + queryParams.Add("search_term", fmt.Sprintf("%v", *request.SearchTerm)) } - var eventDataIdDefaultValue *string - if request.EventDataId != eventDataIdDefaultValue { - queryParams.Add("event_data_id", fmt.Sprintf("%v", *request.EventDataId)) - } - var headersDefaultValue *string - if request.Headers != headersDefaultValue { + if request.Headers != nil { queryParams.Add("headers", fmt.Sprintf("%v", *request.Headers)) } - var bodyDefaultValue *string - if request.Body != bodyDefaultValue { + if request.Body != nil { queryParams.Add("body", fmt.Sprintf("%v", *request.Body)) } - var parsedQueryDefaultValue *string - if request.ParsedQuery != parsedQueryDefaultValue { + if request.ParsedQuery != nil { queryParams.Add("parsed_query", fmt.Sprintf("%v", *request.ParsedQuery)) } - var bulkRetryIdDefaultValue *string - if request.BulkRetryId != bulkRetryIdDefaultValue { - queryParams.Add("bulk_retry_id", fmt.Sprintf("%v", *request.BulkRetryId)) - } - var pathDefaultValue *string - if request.Path != pathDefaultValue { + if request.Path != nil { queryParams.Add("path", fmt.Sprintf("%v", *request.Path)) } - var includeDefaultValue *string - if request.Include != includeDefaultValue { + if request.CliUserId != nil { + queryParams.Add("cli_user_id", fmt.Sprintf("%v", *request.CliUserId)) + } + if request.IssueId != nil { + queryParams.Add("issue_id", fmt.Sprintf("%v", *request.IssueId)) + } + if request.EventDataId != nil { + queryParams.Add("event_data_id", fmt.Sprintf("%v", *request.EventDataId)) + } + if request.BulkRetryId != nil { + queryParams.Add("bulk_retry_id", fmt.Sprintf("%v", *request.BulkRetryId)) + } + if request.Include != nil { queryParams.Add("include", fmt.Sprintf("%v", *request.Include)) } - var orderByDefaultValue *GetRequestEventsRequestOrderByGetRequestEventsRequestOrderBy - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetRequestEventsRequestDirGetRequestEventsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -440,21 +403,21 @@ func (r *requestsClient) GetRequestEvents(ctx context.Context, id string, reques decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -464,15 +427,16 @@ func (r *requestsClient) GetRequestEvents(ctx context.Context, id string, reques return apiError } - response := new(EventPaginatedResult) + var response *hookdeckgo.EventPaginatedResult if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -480,36 +444,30 @@ func (r *requestsClient) GetRequestEvents(ctx context.Context, id string, reques return response, nil } -func (r *requestsClient) GetRequestIgnoredEvents(ctx context.Context, id string, request *GetRequestIgnoredEventsRequest) (*IgnoredEventPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if r.baseURL != "" { - baseURL = r.baseURL +func (c *client) GetRequestIgnoredEvents(ctx context.Context, id string, request *hookdeckgo.GetRequestIgnoredEventsRequest) (*hookdeckgo.IgnoredEventPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"requests/%v/ignored_events", id) queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetRequestIgnoredEventsRequestDirGetRequestIgnoredEventsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -525,21 +483,21 @@ func (r *requestsClient) GetRequestIgnoredEvents(ctx context.Context, id string, decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -549,15 +507,16 @@ func (r *requestsClient) GetRequestIgnoredEvents(ctx context.Context, id string, return apiError } - response := new(IgnoredEventPaginatedResult) + var response *hookdeckgo.IgnoredEventPaginatedResult if err := core.DoRequest( ctx, - r.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - r.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/retried_event.go b/retried_event.go deleted file mode 100644 index 06ad48b..0000000 --- a/retried_event.go +++ /dev/null @@ -1,8 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type RetriedEvent struct { - Event *Event `json:"event,omitempty"` - Attempt *EventAttempt `json:"attempt,omitempty"` -} diff --git a/retry_request.go b/retry_request.go deleted file mode 100644 index 1848d9b..0000000 --- a/retry_request.go +++ /dev/null @@ -1,8 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type RetryRequest struct { - Request *Request `json:"request,omitempty"` - Events *[]*Event `json:"events,omitempty"` -} diff --git a/retry_request_request.go b/retry_request_request.go deleted file mode 100644 index f682cfe..0000000 --- a/retry_request_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// RetryRequestRequest is an in-lined request used by the RetryRequest endpoint. -type RetryRequestRequest struct { - // Subset of webhook_ids to re-run the event logic on. Useful to retry only specific ignored_events - WebhookIds []string `json:"webhook_ids,omitempty"` -} diff --git a/retry_rule.go b/retry_rule.go deleted file mode 100644 index effb0d4..0000000 --- a/retry_rule.go +++ /dev/null @@ -1,43 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -type RetryRule struct { - Strategy RetryStrategy `json:"strategy,omitempty"` - // Time in MS between each retry - Interval *int `json:"interval,omitempty"` - // Maximum number of retries to attempt - Count *int `json:"count,omitempty"` - type_ string -} - -func (r *RetryRule) Type() string { - return r.type_ -} - -func (r *RetryRule) UnmarshalJSON(data []byte) error { - type unmarshaler RetryRule - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *r = RetryRule(value) - r.type_ = "retry" - return nil -} - -func (r *RetryRule) MarshalJSON() ([]byte, error) { - type embed RetryRule - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*r), - Type: "retry", - } - return json.Marshal(marshaler) -} diff --git a/retry_strategy.go b/retry_strategy.go deleted file mode 100644 index 2f32947..0000000 --- a/retry_strategy.go +++ /dev/null @@ -1,48 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Algorithm to use when calculating delay between retries -type RetryStrategy uint8 - -const ( - RetryStrategyLinear RetryStrategy = iota + 1 - RetryStrategyExponential -) - -func (r RetryStrategy) String() string { - switch r { - default: - return strconv.Itoa(int(r)) - case RetryStrategyLinear: - return "linear" - case RetryStrategyExponential: - return "exponential" - } -} - -func (r RetryStrategy) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", r.String())), nil -} - -func (r *RetryStrategy) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "linear": - value := RetryStrategyLinear - *r = value - case "exponential": - value := RetryStrategyExponential - *r = value - } - return nil -} diff --git a/rule.go b/rule.go deleted file mode 100644 index e4753d7..0000000 --- a/rule.go +++ /dev/null @@ -1,113 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type Rule struct { - typeName string - RetryRule *RetryRule - AlertRule *AlertRule - FilterRule *FilterRule - TransformRule *TransformRule - DelayRule *DelayRule -} - -func NewRuleFromRetryRule(value *RetryRule) *Rule { - return &Rule{typeName: "retryRule", RetryRule: value} -} - -func NewRuleFromAlertRule(value *AlertRule) *Rule { - return &Rule{typeName: "alertRule", AlertRule: value} -} - -func NewRuleFromFilterRule(value *FilterRule) *Rule { - return &Rule{typeName: "filterRule", FilterRule: value} -} - -func NewRuleFromTransformRule(value *TransformRule) *Rule { - return &Rule{typeName: "transformRule", TransformRule: value} -} - -func NewRuleFromDelayRule(value *DelayRule) *Rule { - return &Rule{typeName: "delayRule", DelayRule: value} -} - -func (r *Rule) UnmarshalJSON(data []byte) error { - valueRetryRule := new(RetryRule) - if err := json.Unmarshal(data, &valueRetryRule); err == nil { - r.typeName = "retryRule" - r.RetryRule = valueRetryRule - return nil - } - valueAlertRule := new(AlertRule) - if err := json.Unmarshal(data, &valueAlertRule); err == nil { - r.typeName = "alertRule" - r.AlertRule = valueAlertRule - return nil - } - valueFilterRule := new(FilterRule) - if err := json.Unmarshal(data, &valueFilterRule); err == nil { - r.typeName = "filterRule" - r.FilterRule = valueFilterRule - return nil - } - valueTransformRule := new(TransformRule) - if err := json.Unmarshal(data, &valueTransformRule); err == nil { - r.typeName = "transformRule" - r.TransformRule = valueTransformRule - return nil - } - valueDelayRule := new(DelayRule) - if err := json.Unmarshal(data, &valueDelayRule); err == nil { - r.typeName = "delayRule" - r.DelayRule = valueDelayRule - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, r) -} - -func (r Rule) MarshalJSON() ([]byte, error) { - switch r.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", r.typeName, r) - case "retryRule": - return json.Marshal(r.RetryRule) - case "alertRule": - return json.Marshal(r.AlertRule) - case "filterRule": - return json.Marshal(r.FilterRule) - case "transformRule": - return json.Marshal(r.TransformRule) - case "delayRule": - return json.Marshal(r.DelayRule) - } -} - -type RuleVisitor interface { - VisitRetryRule(*RetryRule) error - VisitAlertRule(*AlertRule) error - VisitFilterRule(*FilterRule) error - VisitTransformRule(*TransformRule) error - VisitDelayRule(*DelayRule) error -} - -func (r *Rule) Accept(v RuleVisitor) error { - switch r.typeName { - default: - return fmt.Errorf("invalid type %s in %T", r.typeName, r) - case "retryRule": - return v.VisitRetryRule(r.RetryRule) - case "alertRule": - return v.VisitAlertRule(r.AlertRule) - case "filterRule": - return v.VisitFilterRule(r.FilterRule) - case "transformRule": - return v.VisitTransformRule(r.TransformRule) - case "delayRule": - return v.VisitDelayRule(r.DelayRule) - } -} diff --git a/ruleset.go b/ruleset.go deleted file mode 100644 index 6badb05..0000000 --- a/ruleset.go +++ /dev/null @@ -1,23 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Associated [Ruleset](#ruleset-object) object -type Ruleset struct { - // ID of the ruleset - Id string `json:"id"` - // A unique name for the ruleset - Name string `json:"name"` - // ID of the workspace - TeamId string `json:"team_id"` - // Array of rules to apply - Rules []*Rule `json:"rules,omitempty"` - // Default ruleset of Workspace - IsTeamDefault bool `json:"is_team_default"` - // Date the ruleset was archived - ArchivedAt *string `json:"archived_at,omitempty"` - // Date the ruleset was last updated - UpdatedAt string `json:"updated_at"` - // Date the ruleset was created - CreatedAt string `json:"created_at"` -} diff --git a/ruleset_paginated_result.go b/ruleset_paginated_result.go deleted file mode 100644 index 5373f7f..0000000 --- a/ruleset_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type RulesetPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Ruleset `json:"models,omitempty"` -} diff --git a/seek_pagination.go b/seek_pagination.go deleted file mode 100644 index c7dc3bc..0000000 --- a/seek_pagination.go +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type SeekPagination struct { - OrderBy *SeekPaginationOrderBy `json:"order_by,omitempty"` - Dir *SeekPaginationDir `json:"dir,omitempty"` - Limit *int `json:"limit,omitempty"` - Prev *string `json:"prev,omitempty"` - Next *string `json:"next,omitempty"` -} diff --git a/seek_pagination_dir.go b/seek_pagination_dir.go deleted file mode 100644 index 2833e52..0000000 --- a/seek_pagination_dir.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type SeekPaginationDir struct { - typeName string - OrderByDirection OrderByDirection - OrderByDirectionList []OrderByDirection -} - -func NewSeekPaginationDirFromOrderByDirection(value OrderByDirection) *SeekPaginationDir { - return &SeekPaginationDir{typeName: "orderByDirection", OrderByDirection: value} -} - -func NewSeekPaginationDirFromOrderByDirectionList(value []OrderByDirection) *SeekPaginationDir { - return &SeekPaginationDir{typeName: "orderByDirectionList", OrderByDirectionList: value} -} - -func (s *SeekPaginationDir) UnmarshalJSON(data []byte) error { - var valueOrderByDirection OrderByDirection - if err := json.Unmarshal(data, &valueOrderByDirection); err == nil { - s.typeName = "orderByDirection" - s.OrderByDirection = valueOrderByDirection - return nil - } - var valueOrderByDirectionList []OrderByDirection - if err := json.Unmarshal(data, &valueOrderByDirectionList); err == nil { - s.typeName = "orderByDirectionList" - s.OrderByDirectionList = valueOrderByDirectionList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) -} - -func (s SeekPaginationDir) MarshalJSON() ([]byte, error) { - switch s.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "orderByDirection": - return json.Marshal(s.OrderByDirection) - case "orderByDirectionList": - return json.Marshal(s.OrderByDirectionList) - } -} - -type SeekPaginationDirVisitor interface { - VisitOrderByDirection(OrderByDirection) error - VisitOrderByDirectionList([]OrderByDirection) error -} - -func (s *SeekPaginationDir) Accept(v SeekPaginationDirVisitor) error { - switch s.typeName { - default: - return fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "orderByDirection": - return v.VisitOrderByDirection(s.OrderByDirection) - case "orderByDirectionList": - return v.VisitOrderByDirectionList(s.OrderByDirectionList) - } -} diff --git a/seek_pagination_order_by.go b/seek_pagination_order_by.go deleted file mode 100644 index 81a2d07..0000000 --- a/seek_pagination_order_by.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type SeekPaginationOrderBy struct { - typeName string - String string - StringList []string -} - -func NewSeekPaginationOrderByFromString(value string) *SeekPaginationOrderBy { - return &SeekPaginationOrderBy{typeName: "string", String: value} -} - -func NewSeekPaginationOrderByFromStringList(value []string) *SeekPaginationOrderBy { - return &SeekPaginationOrderBy{typeName: "stringList", StringList: value} -} - -func (s *SeekPaginationOrderBy) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.typeName = "string" - s.String = valueString - return nil - } - var valueStringList []string - if err := json.Unmarshal(data, &valueStringList); err == nil { - s.typeName = "stringList" - s.StringList = valueStringList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) -} - -func (s SeekPaginationOrderBy) MarshalJSON() ([]byte, error) { - switch s.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "string": - return json.Marshal(s.String) - case "stringList": - return json.Marshal(s.StringList) - } -} - -type SeekPaginationOrderByVisitor interface { - VisitString(string) error - VisitStringList([]string) error -} - -func (s *SeekPaginationOrderBy) Accept(v SeekPaginationOrderByVisitor) error { - switch s.typeName { - default: - return fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "string": - return v.VisitString(s.String) - case "stringList": - return v.VisitStringList(s.StringList) - } -} diff --git a/shopify_integration_configs.go b/shopify_integration_configs.go deleted file mode 100644 index 7174277..0000000 --- a/shopify_integration_configs.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ShopifyIntegrationConfigs struct { - WebhookSecretKey string `json:"webhook_secret_key"` - RateLimitPeriod *ShopifyIntegrationConfigsRateLimitPeriod `json:"rate_limit_period,omitempty"` - RateLimit *float64 `json:"rate_limit,omitempty"` - ApiKey *string `json:"api_key,omitempty"` - ApiSecret *string `json:"api_secret,omitempty"` - Shop *string `json:"shop,omitempty"` -} diff --git a/shopify_integration_configs_rate_limit_period.go b/shopify_integration_configs_rate_limit_period.go deleted file mode 100644 index cf8ed92..0000000 --- a/shopify_integration_configs_rate_limit_period.go +++ /dev/null @@ -1,47 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -type ShopifyIntegrationConfigsRateLimitPeriod uint8 - -const ( - ShopifyIntegrationConfigsRateLimitPeriodMinute ShopifyIntegrationConfigsRateLimitPeriod = iota + 1 - ShopifyIntegrationConfigsRateLimitPeriodSecond -) - -func (s ShopifyIntegrationConfigsRateLimitPeriod) String() string { - switch s { - default: - return strconv.Itoa(int(s)) - case ShopifyIntegrationConfigsRateLimitPeriodMinute: - return "minute" - case ShopifyIntegrationConfigsRateLimitPeriodSecond: - return "second" - } -} - -func (s ShopifyIntegrationConfigsRateLimitPeriod) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", s.String())), nil -} - -func (s *ShopifyIntegrationConfigsRateLimitPeriod) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "minute": - value := ShopifyIntegrationConfigsRateLimitPeriodMinute - *s = value - case "second": - value := ShopifyIntegrationConfigsRateLimitPeriodSecond - *s = value - } - return nil -} diff --git a/short_event_data.go b/short_event_data.go deleted file mode 100644 index 0d1002b..0000000 --- a/short_event_data.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ShortEventData struct { - Path string `json:"path"` - Query *string `json:"query,omitempty"` - ParsedQuery *ShortEventDataParsedQuery `json:"parsed_query,omitempty"` - Headers *ShortEventDataHeaders `json:"headers,omitempty"` - Body *ShortEventDataBody `json:"body,omitempty"` - IsLargePayload *bool `json:"is_large_payload,omitempty"` -} diff --git a/short_event_data_body.go b/short_event_data_body.go deleted file mode 100644 index 40d2d35..0000000 --- a/short_event_data_body.go +++ /dev/null @@ -1,81 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type ShortEventDataBody struct { - typeName string - String string - ShortEventDataBodyShortEventDataBody *ShortEventDataBodyShortEventDataBody - UnknownList []any -} - -func NewShortEventDataBodyFromString(value string) *ShortEventDataBody { - return &ShortEventDataBody{typeName: "string", String: value} -} - -func NewShortEventDataBodyFromShortEventDataBodyShortEventDataBody(value *ShortEventDataBodyShortEventDataBody) *ShortEventDataBody { - return &ShortEventDataBody{typeName: "shortEventDataBodyShortEventDataBody", ShortEventDataBodyShortEventDataBody: value} -} - -func NewShortEventDataBodyFromUnknownList(value []any) *ShortEventDataBody { - return &ShortEventDataBody{typeName: "unknownList", UnknownList: value} -} - -func (s *ShortEventDataBody) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.typeName = "string" - s.String = valueString - return nil - } - valueShortEventDataBodyShortEventDataBody := new(ShortEventDataBodyShortEventDataBody) - if err := json.Unmarshal(data, &valueShortEventDataBodyShortEventDataBody); err == nil { - s.typeName = "shortEventDataBodyShortEventDataBody" - s.ShortEventDataBodyShortEventDataBody = valueShortEventDataBodyShortEventDataBody - return nil - } - var valueUnknownList []any - if err := json.Unmarshal(data, &valueUnknownList); err == nil { - s.typeName = "unknownList" - s.UnknownList = valueUnknownList - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) -} - -func (s ShortEventDataBody) MarshalJSON() ([]byte, error) { - switch s.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "string": - return json.Marshal(s.String) - case "shortEventDataBodyShortEventDataBody": - return json.Marshal(s.ShortEventDataBodyShortEventDataBody) - case "unknownList": - return json.Marshal(s.UnknownList) - } -} - -type ShortEventDataBodyVisitor interface { - VisitString(string) error - VisitShortEventDataBodyShortEventDataBody(*ShortEventDataBodyShortEventDataBody) error - VisitUnknownList([]any) error -} - -func (s *ShortEventDataBody) Accept(v ShortEventDataBodyVisitor) error { - switch s.typeName { - default: - return fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "string": - return v.VisitString(s.String) - case "shortEventDataBodyShortEventDataBody": - return v.VisitShortEventDataBodyShortEventDataBody(s.ShortEventDataBodyShortEventDataBody) - case "unknownList": - return v.VisitUnknownList(s.UnknownList) - } -} diff --git a/short_event_data_body_short_event_data_body.go b/short_event_data_body_short_event_data_body.go deleted file mode 100644 index 8d7f00a..0000000 --- a/short_event_data_body_short_event_data_body.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ShortEventDataBodyShortEventDataBody struct { -} diff --git a/short_event_data_headers.go b/short_event_data_headers.go deleted file mode 100644 index 8c816bd..0000000 --- a/short_event_data_headers.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type ShortEventDataHeaders struct { - typeName string - String string - StringStringOptionalMap map[string]*string -} - -func NewShortEventDataHeadersFromString(value string) *ShortEventDataHeaders { - return &ShortEventDataHeaders{typeName: "string", String: value} -} - -func NewShortEventDataHeadersFromStringStringOptionalMap(value map[string]*string) *ShortEventDataHeaders { - return &ShortEventDataHeaders{typeName: "stringStringOptionalMap", StringStringOptionalMap: value} -} - -func (s *ShortEventDataHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - s.typeName = "string" - s.String = valueString - return nil - } - var valueStringStringOptionalMap map[string]*string - if err := json.Unmarshal(data, &valueStringStringOptionalMap); err == nil { - s.typeName = "stringStringOptionalMap" - s.StringStringOptionalMap = valueStringStringOptionalMap - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) -} - -func (s ShortEventDataHeaders) MarshalJSON() ([]byte, error) { - switch s.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "string": - return json.Marshal(s.String) - case "stringStringOptionalMap": - return json.Marshal(s.StringStringOptionalMap) - } -} - -type ShortEventDataHeadersVisitor interface { - VisitString(string) error - VisitStringStringOptionalMap(map[string]*string) error -} - -func (s *ShortEventDataHeaders) Accept(v ShortEventDataHeadersVisitor) error { - switch s.typeName { - default: - return fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "string": - return v.VisitString(s.String) - case "stringStringOptionalMap": - return v.VisitStringStringOptionalMap(s.StringStringOptionalMap) - } -} diff --git a/short_event_data_parsed_query.go b/short_event_data_parsed_query.go deleted file mode 100644 index 61642a6..0000000 --- a/short_event_data_parsed_query.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type ShortEventDataParsedQuery struct { - typeName string - StringOptional *string - ShortEventDataParsedQueryShortEventDataParsedQuery *ShortEventDataParsedQueryShortEventDataParsedQuery -} - -func NewShortEventDataParsedQueryFromStringOptional(value *string) *ShortEventDataParsedQuery { - return &ShortEventDataParsedQuery{typeName: "stringOptional", StringOptional: value} -} - -func NewShortEventDataParsedQueryFromShortEventDataParsedQueryShortEventDataParsedQuery(value *ShortEventDataParsedQueryShortEventDataParsedQuery) *ShortEventDataParsedQuery { - return &ShortEventDataParsedQuery{typeName: "shortEventDataParsedQueryShortEventDataParsedQuery", ShortEventDataParsedQueryShortEventDataParsedQuery: value} -} - -func (s *ShortEventDataParsedQuery) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - s.typeName = "stringOptional" - s.StringOptional = valueStringOptional - return nil - } - valueShortEventDataParsedQueryShortEventDataParsedQuery := new(ShortEventDataParsedQueryShortEventDataParsedQuery) - if err := json.Unmarshal(data, &valueShortEventDataParsedQueryShortEventDataParsedQuery); err == nil { - s.typeName = "shortEventDataParsedQueryShortEventDataParsedQuery" - s.ShortEventDataParsedQueryShortEventDataParsedQuery = valueShortEventDataParsedQueryShortEventDataParsedQuery - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, s) -} - -func (s ShortEventDataParsedQuery) MarshalJSON() ([]byte, error) { - switch s.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "stringOptional": - return json.Marshal(s.StringOptional) - case "shortEventDataParsedQueryShortEventDataParsedQuery": - return json.Marshal(s.ShortEventDataParsedQueryShortEventDataParsedQuery) - } -} - -type ShortEventDataParsedQueryVisitor interface { - VisitStringOptional(*string) error - VisitShortEventDataParsedQueryShortEventDataParsedQuery(*ShortEventDataParsedQueryShortEventDataParsedQuery) error -} - -func (s *ShortEventDataParsedQuery) Accept(v ShortEventDataParsedQueryVisitor) error { - switch s.typeName { - default: - return fmt.Errorf("invalid type %s in %T", s.typeName, s) - case "stringOptional": - return v.VisitStringOptional(s.StringOptional) - case "shortEventDataParsedQueryShortEventDataParsedQuery": - return v.VisitShortEventDataParsedQueryShortEventDataParsedQuery(s.ShortEventDataParsedQueryShortEventDataParsedQuery) - } -} diff --git a/short_event_data_parsed_query_short_event_data_parsed_query.go b/short_event_data_parsed_query_short_event_data_parsed_query.go deleted file mode 100644 index 79b1127..0000000 --- a/short_event_data_parsed_query_short_event_data_parsed_query.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ShortEventDataParsedQueryShortEventDataParsedQuery struct { -} diff --git a/source.go b/source.go deleted file mode 100644 index 0515084..0000000 --- a/source.go +++ /dev/null @@ -1,25 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Associated [Source](#source-object) object -type Source struct { - // ID of the source - Id string `json:"id"` - // Name for the source - Name string `json:"name"` - // ID of the workspace - TeamId string `json:"team_id"` - // A unique URL that must be supplied to your webhook's provider - Url string `json:"url"` - // ID of the integration - IntegrationId *string `json:"integration_id,omitempty"` - // Integration object - Integration *SourceIntegration `json:"integration,omitempty"` - // Date the source was archived - ArchivedAt *string `json:"archived_at,omitempty"` - // Date the source was last updated - UpdatedAt string `json:"updated_at"` - // Date the source was created - CreatedAt string `json:"created_at"` -} diff --git a/source_integration.go b/source_integration.go deleted file mode 100644 index f125d47..0000000 --- a/source_integration.go +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Integration object -type SourceIntegration struct { - // ID of the integration - Id string `json:"id"` - // Label of the integration - Label string `json:"label"` - Provider IntegrationProvider `json:"provider,omitempty"` - // List of enabled features - Features []IntegrationFeature `json:"features,omitempty"` -} diff --git a/source_paginated_result.go b/source_paginated_result.go deleted file mode 100644 index 80b2a14..0000000 --- a/source_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type SourcePaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Source `json:"models,omitempty"` -} diff --git a/sources.go b/sources.go new file mode 100644 index 0000000..051c655 --- /dev/null +++ b/sources.go @@ -0,0 +1,53 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateSourceRequest struct { + // A unique name for the source `<= 155 characters` + Name string `json:"name"` + // Description for the source + Description *string `json:"description,omitempty"` + AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty"` + CustomResponse *SourceCustomResponse `json:"custom_response,omitempty"` + Verification *VerificationConfig `json:"verification,omitempty"` +} + +type GetSourceRequest struct { + Include *string `json:"-"` +} + +type GetSourcesRequest struct { + Id *string `json:"-"` + Name *string `json:"-"` + Archived *bool `json:"-"` + ArchivedAt *time.Time `json:"-"` + OrderBy *string `json:"-"` + Dir *GetSourcesRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type UpdateSourceRequest struct { + // A unique name for the source `<= 155 characters` + Name *string `json:"name,omitempty"` + // Description for the source + Description *string `json:"description,omitempty"` + AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty"` + CustomResponse *SourceCustomResponse `json:"custom_response,omitempty"` + Verification *VerificationConfig `json:"verification,omitempty"` +} + +type UpsertSourceRequest struct { + // A unique name for the source `<= 155 characters` + Name string `json:"name"` + // Description for the source + Description *string `json:"description,omitempty"` + AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty"` + CustomResponse *SourceCustomResponse `json:"custom_response,omitempty"` + Verification *VerificationConfig `json:"verification,omitempty"` +} diff --git a/sources_client.go b/sources/client.go similarity index 55% rename from sources_client.go rename to sources/client.go index ef7eb57..64ab9fe 100644 --- a/sources_client.go +++ b/sources/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package sources import ( bytes "bytes" @@ -8,86 +8,76 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type SourcesClient interface { - GetSources(ctx context.Context, request *GetSourcesRequest) (*SourcePaginatedResult, error) - CreateSource(ctx context.Context, request *CreateSourceRequest) (*Source, error) - UpsertSource(ctx context.Context, request *UpsertSourceRequest) (*Source, error) - GetSource(ctx context.Context, id string) (*Source, error) - UpdateSource(ctx context.Context, id string, request *UpdateSourceRequest) (*Source, error) - ArchiveSource(ctx context.Context, id string) (*Source, error) - UnarchiveSource(ctx context.Context, id string) (*Source, error) +type Client interface { + GetSources(ctx context.Context, request *hookdeckgo.GetSourcesRequest) (*hookdeckgo.SourcePaginatedResult, error) + CreateSource(ctx context.Context, request *hookdeckgo.CreateSourceRequest) (*hookdeckgo.Source, error) + UpsertSource(ctx context.Context, request *hookdeckgo.UpsertSourceRequest) (*hookdeckgo.Source, error) + GetSource(ctx context.Context, id string, request *hookdeckgo.GetSourceRequest) (*hookdeckgo.Source, error) + UpdateSource(ctx context.Context, id string, request *hookdeckgo.UpdateSourceRequest) (*hookdeckgo.Source, error) + DeleteSource(ctx context.Context, id string) (*hookdeckgo.DeleteSourceResponse, error) + ArchiveSource(ctx context.Context, id string) (*hookdeckgo.Source, error) + UnarchiveSource(ctx context.Context, id string) (*hookdeckgo.Source, error) } -func NewSourcesClient(opts ...core.ClientOption) SourcesClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &sourcesClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type sourcesClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (s *sourcesClient) GetSources(ctx context.Context, request *GetSourcesRequest) (*SourcePaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if s.baseURL != "" { - baseURL = s.baseURL +func (c *client) GetSources(ctx context.Context, request *hookdeckgo.GetSourcesRequest) (*hookdeckgo.SourcePaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "sources" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var nameDefaultValue *string - if request.Name != nameDefaultValue { + if request.Name != nil { queryParams.Add("name", fmt.Sprintf("%v", *request.Name)) } - var archivedDefaultValue *bool - if request.Archived != archivedDefaultValue { + if request.Archived != nil { queryParams.Add("archived", fmt.Sprintf("%v", *request.Archived)) } - var archivedAtDefaultValue *string - if request.ArchivedAt != archivedAtDefaultValue { - queryParams.Add("archived_at", fmt.Sprintf("%v", *request.ArchivedAt)) + if request.ArchivedAt != nil { + queryParams.Add("archived_at", fmt.Sprintf("%v", request.ArchivedAt.Format(time.RFC3339))) } - var integrationIdDefaultValue *string - if request.IntegrationId != integrationIdDefaultValue { - queryParams.Add("integration_id", fmt.Sprintf("%v", *request.IntegrationId)) - } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetSourcesRequestDirGetSourcesRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -103,14 +93,14 @@ func (s *sourcesClient) GetSources(ctx context.Context, request *GetSourcesReque decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -120,15 +110,16 @@ func (s *sourcesClient) GetSources(ctx context.Context, request *GetSourcesReque return apiError } - response := new(SourcePaginatedResult) + var response *hookdeckgo.SourcePaginatedResult if err := core.DoRequest( ctx, - s.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - s.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -136,10 +127,10 @@ func (s *sourcesClient) GetSources(ctx context.Context, request *GetSourcesReque return response, nil } -func (s *sourcesClient) CreateSource(ctx context.Context, request *CreateSourceRequest) (*Source, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if s.baseURL != "" { - baseURL = s.baseURL +func (c *client) CreateSource(ctx context.Context, request *hookdeckgo.CreateSourceRequest) (*hookdeckgo.Source, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "sources" @@ -152,14 +143,14 @@ func (s *sourcesClient) CreateSource(ctx context.Context, request *CreateSourceR decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -169,15 +160,16 @@ func (s *sourcesClient) CreateSource(ctx context.Context, request *CreateSourceR return apiError } - response := new(Source) + var response *hookdeckgo.Source if err := core.DoRequest( ctx, - s.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - s.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -185,10 +177,10 @@ func (s *sourcesClient) CreateSource(ctx context.Context, request *CreateSourceR return response, nil } -func (s *sourcesClient) UpsertSource(ctx context.Context, request *UpsertSourceRequest) (*Source, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if s.baseURL != "" { - baseURL = s.baseURL +func (c *client) UpsertSource(ctx context.Context, request *hookdeckgo.UpsertSourceRequest) (*hookdeckgo.Source, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "sources" @@ -201,14 +193,14 @@ func (s *sourcesClient) UpsertSource(ctx context.Context, request *UpsertSourceR decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -218,15 +210,16 @@ func (s *sourcesClient) UpsertSource(ctx context.Context, request *UpsertSourceR return apiError } - response := new(Source) + var response *hookdeckgo.Source if err := core.DoRequest( ctx, - s.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - s.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -234,13 +227,21 @@ func (s *sourcesClient) UpsertSource(ctx context.Context, request *UpsertSourceR return response, nil } -func (s *sourcesClient) GetSource(ctx context.Context, id string) (*Source, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if s.baseURL != "" { - baseURL = s.baseURL +func (c *client) GetSource(ctx context.Context, id string, request *hookdeckgo.GetSourceRequest) (*hookdeckgo.Source, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"sources/%v", id) + queryParams := make(url.Values) + if request.Include != nil { + queryParams.Add("include", fmt.Sprintf("%v", *request.Include)) + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) if err != nil { @@ -250,7 +251,7 @@ func (s *sourcesClient) GetSource(ctx context.Context, id string) (*Source, erro decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -260,15 +261,16 @@ func (s *sourcesClient) GetSource(ctx context.Context, id string) (*Source, erro return apiError } - response := new(Source) + var response *hookdeckgo.Source if err := core.DoRequest( ctx, - s.httpClient, + c.httpClient, endpointURL, http.MethodGet, - nil, + request, &response, - s.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -276,10 +278,10 @@ func (s *sourcesClient) GetSource(ctx context.Context, id string) (*Source, erro return response, nil } -func (s *sourcesClient) UpdateSource(ctx context.Context, id string, request *UpdateSourceRequest) (*Source, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if s.baseURL != "" { - baseURL = s.baseURL +func (c *client) UpdateSource(ctx context.Context, id string, request *hookdeckgo.UpdateSourceRequest) (*hookdeckgo.Source, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"sources/%v", id) @@ -292,21 +294,21 @@ func (s *sourcesClient) UpdateSource(ctx context.Context, id string, request *Up decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -316,15 +318,59 @@ func (s *sourcesClient) UpdateSource(ctx context.Context, id string, request *Up return apiError } - response := new(Source) + var response *hookdeckgo.Source if err := core.DoRequest( ctx, - s.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - s.header, + false, + c.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +func (c *client) DeleteSource(ctx context.Context, id string) (*hookdeckgo.DeleteSourceResponse, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"sources/%v", id) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 404: + value := new(hookdeckgo.NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *hookdeckgo.DeleteSourceResponse + if err := core.DoRequest( + ctx, + c.httpClient, + endpointURL, + http.MethodDelete, + nil, + &response, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -332,10 +378,10 @@ func (s *sourcesClient) UpdateSource(ctx context.Context, id string, request *Up return response, nil } -func (s *sourcesClient) ArchiveSource(ctx context.Context, id string) (*Source, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if s.baseURL != "" { - baseURL = s.baseURL +func (c *client) ArchiveSource(ctx context.Context, id string) (*hookdeckgo.Source, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"sources/%v/archive", id) @@ -348,7 +394,7 @@ func (s *sourcesClient) ArchiveSource(ctx context.Context, id string) (*Source, decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -358,15 +404,16 @@ func (s *sourcesClient) ArchiveSource(ctx context.Context, id string) (*Source, return apiError } - response := new(Source) + var response *hookdeckgo.Source if err := core.DoRequest( ctx, - s.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - s.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -374,10 +421,10 @@ func (s *sourcesClient) ArchiveSource(ctx context.Context, id string) (*Source, return response, nil } -func (s *sourcesClient) UnarchiveSource(ctx context.Context, id string) (*Source, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if s.baseURL != "" { - baseURL = s.baseURL +func (c *client) UnarchiveSource(ctx context.Context, id string) (*hookdeckgo.Source, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"sources/%v/unarchive", id) @@ -390,7 +437,7 @@ func (s *sourcesClient) UnarchiveSource(ctx context.Context, id string) (*Source decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -400,15 +447,16 @@ func (s *sourcesClient) UnarchiveSource(ctx context.Context, id string) (*Source return apiError } - response := new(Source) + var response *hookdeckgo.Source if err := core.DoRequest( ctx, - s.httpClient, + c.httpClient, endpointURL, http.MethodPut, nil, &response, - s.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/test_transformation_request.go b/test_transformation_request.go deleted file mode 100644 index 8395d63..0000000 --- a/test_transformation_request.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// TestTransformationRequest is an in-lined request used by the TestTransformation endpoint. -type TestTransformationRequest struct { - // Key-value environment variables to be passed to the transformation - Env *TestTransformationRequestEnv `json:"env,omitempty"` - // ID of the connection to use for the execution `context` - WebhookId *string `json:"webhook_id,omitempty"` - // JavaScript code to be executed - Code *string `json:"code,omitempty"` - // Transformation ID - TransformationId *string `json:"transformation_id,omitempty"` - // Request input to use for the transformation execution - Request *TestTransformationRequestRequest `json:"request,omitempty"` - EventId *string `json:"event_id,omitempty"` -} diff --git a/test_transformation_request_env.go b/test_transformation_request_env.go deleted file mode 100644 index f162df6..0000000 --- a/test_transformation_request_env.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Key-value environment variables to be passed to the transformation -type TestTransformationRequestEnv struct { -} diff --git a/test_transformation_request_request.go b/test_transformation_request_request.go deleted file mode 100644 index 06fd51f..0000000 --- a/test_transformation_request_request.go +++ /dev/null @@ -1,17 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Request input to use for the transformation execution -type TestTransformationRequestRequest struct { - // Headers of the request - Headers map[string]string `json:"headers,omitempty"` - // Body of the request - Body *TestTransformationRequestRequestBody `json:"body,omitempty"` - // Path of the request - Path *string `json:"path,omitempty"` - // String representation of the query params of the request - Query *string `json:"query,omitempty"` - // JSON representation of the query params - ParsedQuery *TestTransformationRequestRequestParsedQuery `json:"parsed_query,omitempty"` -} diff --git a/test_transformation_request_request_body.go b/test_transformation_request_request_body.go deleted file mode 100644 index f86c3e1..0000000 --- a/test_transformation_request_request_body.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Body of the request -type TestTransformationRequestRequestBody struct { - typeName string - TestTransformationRequestRequestBodyTestTransformationRequestRequestBody *TestTransformationRequestRequestBodyTestTransformationRequestRequestBody - String string -} - -func NewTestTransformationRequestRequestBodyFromTestTransformationRequestRequestBodyTestTransformationRequestRequestBody(value *TestTransformationRequestRequestBodyTestTransformationRequestRequestBody) *TestTransformationRequestRequestBody { - return &TestTransformationRequestRequestBody{typeName: "testTransformationRequestRequestBodyTestTransformationRequestRequestBody", TestTransformationRequestRequestBodyTestTransformationRequestRequestBody: value} -} - -func NewTestTransformationRequestRequestBodyFromString(value string) *TestTransformationRequestRequestBody { - return &TestTransformationRequestRequestBody{typeName: "string", String: value} -} - -func (t *TestTransformationRequestRequestBody) UnmarshalJSON(data []byte) error { - valueTestTransformationRequestRequestBodyTestTransformationRequestRequestBody := new(TestTransformationRequestRequestBodyTestTransformationRequestRequestBody) - if err := json.Unmarshal(data, &valueTestTransformationRequestRequestBodyTestTransformationRequestRequestBody); err == nil { - t.typeName = "testTransformationRequestRequestBodyTestTransformationRequestRequestBody" - t.TestTransformationRequestRequestBodyTestTransformationRequestRequestBody = valueTestTransformationRequestRequestBodyTestTransformationRequestRequestBody - return nil - } - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - t.typeName = "string" - t.String = valueString - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) -} - -func (t TestTransformationRequestRequestBody) MarshalJSON() ([]byte, error) { - switch t.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "testTransformationRequestRequestBodyTestTransformationRequestRequestBody": - return json.Marshal(t.TestTransformationRequestRequestBodyTestTransformationRequestRequestBody) - case "string": - return json.Marshal(t.String) - } -} - -type TestTransformationRequestRequestBodyVisitor interface { - VisitTestTransformationRequestRequestBodyTestTransformationRequestRequestBody(*TestTransformationRequestRequestBodyTestTransformationRequestRequestBody) error - VisitString(string) error -} - -func (t *TestTransformationRequestRequestBody) Accept(v TestTransformationRequestRequestBodyVisitor) error { - switch t.typeName { - default: - return fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "testTransformationRequestRequestBodyTestTransformationRequestRequestBody": - return v.VisitTestTransformationRequestRequestBodyTestTransformationRequestRequestBody(t.TestTransformationRequestRequestBodyTestTransformationRequestRequestBody) - case "string": - return v.VisitString(t.String) - } -} diff --git a/test_transformation_request_request_body_test_transformation_request_request_body.go b/test_transformation_request_request_body_test_transformation_request_request_body.go deleted file mode 100644 index f2357f4..0000000 --- a/test_transformation_request_request_body_test_transformation_request_request_body.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TestTransformationRequestRequestBodyTestTransformationRequestRequestBody struct { -} diff --git a/test_transformation_request_request_parsed_query.go b/test_transformation_request_request_parsed_query.go deleted file mode 100644 index 4903590..0000000 --- a/test_transformation_request_request_parsed_query.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// JSON representation of the query params -type TestTransformationRequestRequestParsedQuery struct { -} diff --git a/toggle_webhook_notifications.go b/toggle_webhook_notifications.go deleted file mode 100644 index 82daf4d..0000000 --- a/toggle_webhook_notifications.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type ToggleWebhookNotifications struct { - Enabled bool `json:"enabled"` - Topics *[]TopicsValue `json:"topics,omitempty"` - SourceId string `json:"source_id"` -} diff --git a/toggle_webhook_notifications_request.go b/toggle_webhook_notifications_request.go deleted file mode 100644 index b50142b..0000000 --- a/toggle_webhook_notifications_request.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// ToggleWebhookNotificationsRequest is an in-lined request used by the ToggleWebhookNotifications endpoint. -type ToggleWebhookNotificationsRequest struct { - // Enable or disable webhook notifications on the workspace - Enabled *bool `json:"enabled,omitempty"` - // List of topics to send notifications for - Topics *[]TopicsValue `json:"topics,omitempty"` - // The Hookdeck Source to send the webhook to - SourceId *string `json:"source_id,omitempty"` -} diff --git a/topics_value.go b/topics_value.go deleted file mode 100644 index 0fb6925..0000000 --- a/topics_value.go +++ /dev/null @@ -1,60 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Supported topics -type TopicsValue uint8 - -const ( - TopicsValueIssueOpened TopicsValue = iota + 1 - TopicsValueIssueUpdated - TopicsValueDeprecatedAttemptFailed - TopicsValueEventSuccessful -) - -func (t TopicsValue) String() string { - switch t { - default: - return strconv.Itoa(int(t)) - case TopicsValueIssueOpened: - return "issue.opened" - case TopicsValueIssueUpdated: - return "issue.updated" - case TopicsValueDeprecatedAttemptFailed: - return "deprecated.attempt-failed" - case TopicsValueEventSuccessful: - return "event.successful" - } -} - -func (t TopicsValue) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", t.String())), nil -} - -func (t *TopicsValue) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "issue.opened": - value := TopicsValueIssueOpened - *t = value - case "issue.updated": - value := TopicsValueIssueUpdated - *t = value - case "deprecated.attempt-failed": - value := TopicsValueDeprecatedAttemptFailed - *t = value - case "event.successful": - value := TopicsValueEventSuccessful - *t = value - } - return nil -} diff --git a/transform_full.go b/transform_full.go deleted file mode 100644 index 783d041..0000000 --- a/transform_full.go +++ /dev/null @@ -1,42 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -type TransformFull struct { - // ID of the attached transformation object. Optional input, always set once the rule is defined - TransformationId *string `json:"transformation_id,omitempty"` - // You can optionally define a new transformation while creating a transform rule - Transformation *TransformFullTransformation `json:"transformation,omitempty"` - type_ string -} - -func (t *TransformFull) Type() string { - return t.type_ -} - -func (t *TransformFull) UnmarshalJSON(data []byte) error { - type unmarshaler TransformFull - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformFull(value) - t.type_ = "transform" - return nil -} - -func (t *TransformFull) MarshalJSON() ([]byte, error) { - type embed TransformFull - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*t), - Type: "transform", - } - return json.Marshal(marshaler) -} diff --git a/transform_full_transformation.go b/transform_full_transformation.go deleted file mode 100644 index b20c639..0000000 --- a/transform_full_transformation.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// You can optionally define a new transformation while creating a transform rule -type TransformFullTransformation struct { - // The unique name of the transformation - Name string `json:"name"` - // A string representation of your JavaScript (ES6) code to run - Code string `json:"code"` - // A key-value object of environment variables to encrypt and expose to your transformation code - Env *map[string]*string `json:"env,omitempty"` -} diff --git a/transform_reference.go b/transform_reference.go deleted file mode 100644 index 402cfb8..0000000 --- a/transform_reference.go +++ /dev/null @@ -1,40 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -type TransformReference struct { - // ID of the attached transformation object. Optional input, always set once the rule is defined - TransformationId string `json:"transformation_id"` - type_ string -} - -func (t *TransformReference) Type() string { - return t.type_ -} - -func (t *TransformReference) UnmarshalJSON(data []byte) error { - type unmarshaler TransformReference - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformReference(value) - t.type_ = "transform" - return nil -} - -func (t *TransformReference) MarshalJSON() ([]byte, error) { - type embed TransformReference - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*t), - Type: "transform", - } - return json.Marshal(marshaler) -} diff --git a/transform_rule.go b/transform_rule.go deleted file mode 100644 index 9658571..0000000 --- a/transform_rule.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type TransformRule struct { - typeName string - TransformReference *TransformReference - TransformFull *TransformFull -} - -func NewTransformRuleFromTransformReference(value *TransformReference) *TransformRule { - return &TransformRule{typeName: "transformReference", TransformReference: value} -} - -func NewTransformRuleFromTransformFull(value *TransformFull) *TransformRule { - return &TransformRule{typeName: "transformFull", TransformFull: value} -} - -func (t *TransformRule) UnmarshalJSON(data []byte) error { - valueTransformReference := new(TransformReference) - if err := json.Unmarshal(data, &valueTransformReference); err == nil { - t.typeName = "transformReference" - t.TransformReference = valueTransformReference - return nil - } - valueTransformFull := new(TransformFull) - if err := json.Unmarshal(data, &valueTransformFull); err == nil { - t.typeName = "transformFull" - t.TransformFull = valueTransformFull - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) -} - -func (t TransformRule) MarshalJSON() ([]byte, error) { - switch t.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "transformReference": - return json.Marshal(t.TransformReference) - case "transformFull": - return json.Marshal(t.TransformFull) - } -} - -type TransformRuleVisitor interface { - VisitTransformReference(*TransformReference) error - VisitTransformFull(*TransformFull) error -} - -func (t *TransformRule) Accept(v TransformRuleVisitor) error { - switch t.typeName { - default: - return fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "transformReference": - return v.VisitTransformReference(t.TransformReference) - case "transformFull": - return v.VisitTransformFull(t.TransformFull) - } -} diff --git a/transformation.go b/transformation.go deleted file mode 100644 index 19c4e1a..0000000 --- a/transformation.go +++ /dev/null @@ -1,22 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type Transformation struct { - // ID of the transformation - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - // A unique, human-friendly name for the transformation - Name string `json:"name"` - // JavaScript code to be executed - Code string `json:"code"` - EncryptedEnv *string `json:"encrypted_env,omitempty"` - Iv *string `json:"iv,omitempty"` - // Key-value environment variables to be passed to the transformation - Env *map[string]*string `json:"env,omitempty"` - // Date the transformation was last updated - UpdatedAt string `json:"updated_at"` - // Date the transformation was created - CreatedAt string `json:"created_at"` -} diff --git a/transformation_execution.go b/transformation_execution.go deleted file mode 100644 index d186e05..0000000 --- a/transformation_execution.go +++ /dev/null @@ -1,19 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationExecution struct { - Id string `json:"id"` - TransformedEventDataId string `json:"transformed_event_data_id"` - OriginalEventDataId string `json:"original_event_data_id"` - TransformationId string `json:"transformation_id"` - TeamId string `json:"team_id"` - WebhookId string `json:"webhook_id"` - LogLevel TransformationExecutionLogLevel `json:"log_level,omitempty"` - Logs []*ConsoleLine `json:"logs,omitempty"` - UpdatedAt string `json:"updated_at"` - CreatedAt string `json:"created_at"` - OriginalEventData *ShortEventData `json:"original_event_data,omitempty"` - TransformedEventData *ShortEventData `json:"transformed_event_data,omitempty"` - IssueId *string `json:"issue_id,omitempty"` -} diff --git a/transformation_execution_log_level.go b/transformation_execution_log_level.go deleted file mode 100644 index 116b7e0..0000000 --- a/transformation_execution_log_level.go +++ /dev/null @@ -1,66 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// The minimum log level to open the issue on -type TransformationExecutionLogLevel uint8 - -const ( - TransformationExecutionLogLevelDebug TransformationExecutionLogLevel = iota + 1 - TransformationExecutionLogLevelInfo - TransformationExecutionLogLevelWarn - TransformationExecutionLogLevelError - TransformationExecutionLogLevelFatal -) - -func (t TransformationExecutionLogLevel) String() string { - switch t { - default: - return strconv.Itoa(int(t)) - case TransformationExecutionLogLevelDebug: - return "debug" - case TransformationExecutionLogLevelInfo: - return "info" - case TransformationExecutionLogLevelWarn: - return "warn" - case TransformationExecutionLogLevelError: - return "error" - case TransformationExecutionLogLevelFatal: - return "fatal" - } -} - -func (t TransformationExecutionLogLevel) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", t.String())), nil -} - -func (t *TransformationExecutionLogLevel) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "debug": - value := TransformationExecutionLogLevelDebug - *t = value - case "info": - value := TransformationExecutionLogLevelInfo - *t = value - case "warn": - value := TransformationExecutionLogLevelWarn - *t = value - case "error": - value := TransformationExecutionLogLevelError - *t = value - case "fatal": - value := TransformationExecutionLogLevelFatal - *t = value - } - return nil -} diff --git a/transformation_execution_paginated_result.go b/transformation_execution_paginated_result.go deleted file mode 100644 index 485122c..0000000 --- a/transformation_execution_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationExecutionPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*TransformationExecution `json:"models,omitempty"` -} diff --git a/transformation_executor_output.go b/transformation_executor_output.go deleted file mode 100644 index 30a1d68..0000000 --- a/transformation_executor_output.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationExecutorOutput struct { - RequestId *string `json:"request_id,omitempty"` - TransformationId *string `json:"transformation_id,omitempty"` - ExecutionId *string `json:"execution_id,omitempty"` - LogLevel TransformationExecutionLogLevel `json:"log_level,omitempty"` - Request *TransformationExecutorOutputRequest `json:"request,omitempty"` - Console *[]*ConsoleLine `json:"console,omitempty"` -} diff --git a/transformation_executor_output_request.go b/transformation_executor_output_request.go deleted file mode 100644 index bdb3b20..0000000 --- a/transformation_executor_output_request.go +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationExecutorOutputRequest struct { - Headers *TransformationExecutorOutputRequestHeaders `json:"headers,omitempty"` - Path string `json:"path"` - Query *TransformationExecutorOutputRequestQuery `json:"query,omitempty"` - ParsedQuery *TransformationExecutorOutputRequestParsedQuery `json:"parsed_query,omitempty"` - Body *TransformationExecutorOutputRequestBody `json:"body,omitempty"` -} diff --git a/transformation_executor_output_request_body.go b/transformation_executor_output_request_body.go deleted file mode 100644 index c3be851..0000000 --- a/transformation_executor_output_request_body.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type TransformationExecutorOutputRequestBody struct { - typeName string - StringOptional *string - TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody *TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody -} - -func NewTransformationExecutorOutputRequestBodyFromStringOptional(value *string) *TransformationExecutorOutputRequestBody { - return &TransformationExecutorOutputRequestBody{typeName: "stringOptional", StringOptional: value} -} - -func NewTransformationExecutorOutputRequestBodyFromTransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody(value *TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody) *TransformationExecutorOutputRequestBody { - return &TransformationExecutorOutputRequestBody{typeName: "transformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody", TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody: value} -} - -func (t *TransformationExecutorOutputRequestBody) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - t.typeName = "stringOptional" - t.StringOptional = valueStringOptional - return nil - } - valueTransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody := new(TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody) - if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody); err == nil { - t.typeName = "transformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody" - t.TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody = valueTransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) -} - -func (t TransformationExecutorOutputRequestBody) MarshalJSON() ([]byte, error) { - switch t.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "stringOptional": - return json.Marshal(t.StringOptional) - case "transformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody": - return json.Marshal(t.TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody) - } -} - -type TransformationExecutorOutputRequestBodyVisitor interface { - VisitStringOptional(*string) error - VisitTransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody(*TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody) error -} - -func (t *TransformationExecutorOutputRequestBody) Accept(v TransformationExecutorOutputRequestBodyVisitor) error { - switch t.typeName { - default: - return fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "stringOptional": - return v.VisitStringOptional(t.StringOptional) - case "transformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody": - return v.VisitTransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody(t.TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody) - } -} diff --git a/transformation_executor_output_request_body_transformation_executor_output_request_body.go b/transformation_executor_output_request_body_transformation_executor_output_request_body.go deleted file mode 100644 index f3a9b0a..0000000 --- a/transformation_executor_output_request_body_transformation_executor_output_request_body.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationExecutorOutputRequestBodyTransformationExecutorOutputRequestBody struct { -} diff --git a/transformation_executor_output_request_headers.go b/transformation_executor_output_request_headers.go deleted file mode 100644 index 789e03c..0000000 --- a/transformation_executor_output_request_headers.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type TransformationExecutorOutputRequestHeaders struct { - typeName string - String string - StringUnknownMap map[string]any -} - -func NewTransformationExecutorOutputRequestHeadersFromString(value string) *TransformationExecutorOutputRequestHeaders { - return &TransformationExecutorOutputRequestHeaders{typeName: "string", String: value} -} - -func NewTransformationExecutorOutputRequestHeadersFromStringUnknownMap(value map[string]any) *TransformationExecutorOutputRequestHeaders { - return &TransformationExecutorOutputRequestHeaders{typeName: "stringUnknownMap", StringUnknownMap: value} -} - -func (t *TransformationExecutorOutputRequestHeaders) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - t.typeName = "string" - t.String = valueString - return nil - } - var valueStringUnknownMap map[string]any - if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { - t.typeName = "stringUnknownMap" - t.StringUnknownMap = valueStringUnknownMap - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) -} - -func (t TransformationExecutorOutputRequestHeaders) MarshalJSON() ([]byte, error) { - switch t.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "string": - return json.Marshal(t.String) - case "stringUnknownMap": - return json.Marshal(t.StringUnknownMap) - } -} - -type TransformationExecutorOutputRequestHeadersVisitor interface { - VisitString(string) error - VisitStringUnknownMap(map[string]any) error -} - -func (t *TransformationExecutorOutputRequestHeaders) Accept(v TransformationExecutorOutputRequestHeadersVisitor) error { - switch t.typeName { - default: - return fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "string": - return v.VisitString(t.String) - case "stringUnknownMap": - return v.VisitStringUnknownMap(t.StringUnknownMap) - } -} diff --git a/transformation_executor_output_request_parsed_query.go b/transformation_executor_output_request_parsed_query.go deleted file mode 100644 index ffc8994..0000000 --- a/transformation_executor_output_request_parsed_query.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type TransformationExecutorOutputRequestParsedQuery struct { - typeName string - StringOptional *string - TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery *TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery -} - -func NewTransformationExecutorOutputRequestParsedQueryFromStringOptional(value *string) *TransformationExecutorOutputRequestParsedQuery { - return &TransformationExecutorOutputRequestParsedQuery{typeName: "stringOptional", StringOptional: value} -} - -func NewTransformationExecutorOutputRequestParsedQueryFromTransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery(value *TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery) *TransformationExecutorOutputRequestParsedQuery { - return &TransformationExecutorOutputRequestParsedQuery{typeName: "transformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery", TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery: value} -} - -func (t *TransformationExecutorOutputRequestParsedQuery) UnmarshalJSON(data []byte) error { - var valueStringOptional *string - if err := json.Unmarshal(data, &valueStringOptional); err == nil { - t.typeName = "stringOptional" - t.StringOptional = valueStringOptional - return nil - } - valueTransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery := new(TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery) - if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery); err == nil { - t.typeName = "transformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery" - t.TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery = valueTransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) -} - -func (t TransformationExecutorOutputRequestParsedQuery) MarshalJSON() ([]byte, error) { - switch t.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "stringOptional": - return json.Marshal(t.StringOptional) - case "transformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery": - return json.Marshal(t.TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery) - } -} - -type TransformationExecutorOutputRequestParsedQueryVisitor interface { - VisitStringOptional(*string) error - VisitTransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery(*TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery) error -} - -func (t *TransformationExecutorOutputRequestParsedQuery) Accept(v TransformationExecutorOutputRequestParsedQueryVisitor) error { - switch t.typeName { - default: - return fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "stringOptional": - return v.VisitStringOptional(t.StringOptional) - case "transformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery": - return v.VisitTransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery(t.TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery) - } -} diff --git a/transformation_executor_output_request_parsed_query_transformation_executor_output_request_parsed_query.go b/transformation_executor_output_request_parsed_query_transformation_executor_output_request_parsed_query.go deleted file mode 100644 index eef5327..0000000 --- a/transformation_executor_output_request_parsed_query_transformation_executor_output_request_parsed_query.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationExecutorOutputRequestParsedQueryTransformationExecutorOutputRequestParsedQuery struct { -} diff --git a/transformation_executor_output_request_query.go b/transformation_executor_output_request_query.go deleted file mode 100644 index 9422c83..0000000 --- a/transformation_executor_output_request_query.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type TransformationExecutorOutputRequestQuery struct { - typeName string - TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional *TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQuery - String string -} - -func NewTransformationExecutorOutputRequestQueryFromTransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional(value *TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQuery) *TransformationExecutorOutputRequestQuery { - return &TransformationExecutorOutputRequestQuery{typeName: "transformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional", TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional: value} -} - -func NewTransformationExecutorOutputRequestQueryFromString(value string) *TransformationExecutorOutputRequestQuery { - return &TransformationExecutorOutputRequestQuery{typeName: "string", String: value} -} - -func (t *TransformationExecutorOutputRequestQuery) UnmarshalJSON(data []byte) error { - var valueTransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional *TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQuery - if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional); err == nil { - t.typeName = "transformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional" - t.TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional = valueTransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional - return nil - } - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - t.typeName = "string" - t.String = valueString - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, t) -} - -func (t TransformationExecutorOutputRequestQuery) MarshalJSON() ([]byte, error) { - switch t.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "transformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional": - return json.Marshal(t.TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional) - case "string": - return json.Marshal(t.String) - } -} - -type TransformationExecutorOutputRequestQueryVisitor interface { - VisitTransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional(*TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQuery) error - VisitString(string) error -} - -func (t *TransformationExecutorOutputRequestQuery) Accept(v TransformationExecutorOutputRequestQueryVisitor) error { - switch t.typeName { - default: - return fmt.Errorf("invalid type %s in %T", t.typeName, t) - case "transformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional": - return v.VisitTransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional(t.TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQueryOptional) - case "string": - return v.VisitString(t.String) - } -} diff --git a/transformation_executor_output_request_query_transformation_executor_output_request_query.go b/transformation_executor_output_request_query_transformation_executor_output_request_query.go deleted file mode 100644 index e3dd43f..0000000 --- a/transformation_executor_output_request_query_transformation_executor_output_request_query.go +++ /dev/null @@ -1,6 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationExecutorOutputRequestQueryTransformationExecutorOutputRequestQuery struct { -} diff --git a/transformation_failed_meta.go b/transformation_failed_meta.go deleted file mode 100644 index 2cf89d0..0000000 --- a/transformation_failed_meta.go +++ /dev/null @@ -1,7 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationFailedMeta struct { - TransformationId string `json:"transformation_id"` -} diff --git a/transformation_issue.go b/transformation_issue.go deleted file mode 100644 index 6d96f7a..0000000 --- a/transformation_issue.go +++ /dev/null @@ -1,62 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -// Transformation issue -type TransformationIssue struct { - // Issue ID - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - Status IssueStatus `json:"status,omitempty"` - // ISO timestamp for when the issue was last opened - OpenedAt string `json:"opened_at"` - // ISO timestamp for when the issue was first opened - FirstSeenAt string `json:"first_seen_at"` - // ISO timestamp for when the issue last occured - LastSeenAt string `json:"last_seen_at"` - // ID of the team member who last updated the issue status - LastUpdatedBy *string `json:"last_updated_by,omitempty"` - // ISO timestamp for when the issue was dismissed - DismissedAt *string `json:"dismissed_at,omitempty"` - AutoResolvedAt *string `json:"auto_resolved_at,omitempty"` - MergedWith *string `json:"merged_with,omitempty"` - // ISO timestamp for when the issue was last updated - UpdatedAt string `json:"updated_at"` - // ISO timestamp for when the issue was created - CreatedAt string `json:"created_at"` - AggregationKeys *TransformationIssueAggregationKeys `json:"aggregation_keys,omitempty"` - Reference *TransformationIssueReference `json:"reference,omitempty"` - type_ string -} - -func (t *TransformationIssue) Type() string { - return t.type_ -} - -func (t *TransformationIssue) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationIssue - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformationIssue(value) - t.type_ = "transformation" - return nil -} - -func (t *TransformationIssue) MarshalJSON() ([]byte, error) { - type embed TransformationIssue - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*t), - Type: "transformation", - } - return json.Marshal(marshaler) -} diff --git a/transformation_issue_aggregation_keys.go b/transformation_issue_aggregation_keys.go deleted file mode 100644 index e41e8b9..0000000 --- a/transformation_issue_aggregation_keys.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Keys used as the aggregation keys a 'transformation' type issue -type TransformationIssueAggregationKeys struct { - TransformationId []string `json:"transformation_id,omitempty"` - LogLevel TransformationExecutionLogLevel `json:"log_level,omitempty"` -} diff --git a/transformation_issue_data.go b/transformation_issue_data.go deleted file mode 100644 index dc61a77..0000000 --- a/transformation_issue_data.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Transformation issue data -type TransformationIssueData struct { - TransformationExecution *TransformationExecution `json:"transformation_execution,omitempty"` - TriggerAttempt *EventAttempt `json:"trigger_attempt,omitempty"` -} diff --git a/transformation_issue_reference.go b/transformation_issue_reference.go deleted file mode 100644 index 872d7e4..0000000 --- a/transformation_issue_reference.go +++ /dev/null @@ -1,10 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Reference to the event request transformation an issue is being created for. -type TransformationIssueReference struct { - TransformationExecutionId string `json:"transformation_execution_id"` - // Deprecated but still found on historical issues - TriggerEventRequestTransformationId *string `json:"trigger_event_request_transformation_id,omitempty"` -} diff --git a/transformation_issue_with_data.go b/transformation_issue_with_data.go deleted file mode 100644 index e3cb4f7..0000000 --- a/transformation_issue_with_data.go +++ /dev/null @@ -1,63 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" -) - -// Transformation issue -type TransformationIssueWithData struct { - // Issue ID - Id string `json:"id"` - // ID of the workspace - TeamId string `json:"team_id"` - Status IssueStatus `json:"status,omitempty"` - // ISO timestamp for when the issue was last opened - OpenedAt string `json:"opened_at"` - // ISO timestamp for when the issue was first opened - FirstSeenAt string `json:"first_seen_at"` - // ISO timestamp for when the issue last occured - LastSeenAt string `json:"last_seen_at"` - // ID of the team member who last updated the issue status - LastUpdatedBy *string `json:"last_updated_by,omitempty"` - // ISO timestamp for when the issue was dismissed - DismissedAt *string `json:"dismissed_at,omitempty"` - AutoResolvedAt *string `json:"auto_resolved_at,omitempty"` - MergedWith *string `json:"merged_with,omitempty"` - // ISO timestamp for when the issue was last updated - UpdatedAt string `json:"updated_at"` - // ISO timestamp for when the issue was created - CreatedAt string `json:"created_at"` - AggregationKeys *TransformationIssueAggregationKeys `json:"aggregation_keys,omitempty"` - Reference *TransformationIssueReference `json:"reference,omitempty"` - Data *TransformationIssueData `json:"data,omitempty"` - type_ string -} - -func (t *TransformationIssueWithData) Type() string { - return t.type_ -} - -func (t *TransformationIssueWithData) UnmarshalJSON(data []byte) error { - type unmarshaler TransformationIssueWithData - var value unmarshaler - if err := json.Unmarshal(data, &value); err != nil { - return err - } - *t = TransformationIssueWithData(value) - t.type_ = "transformation" - return nil -} - -func (t *TransformationIssueWithData) MarshalJSON() ([]byte, error) { - type embed TransformationIssueWithData - var marshaler = struct { - embed - Type string `json:"type"` - }{ - embed: embed(*t), - Type: "transformation", - } - return json.Marshal(marshaler) -} diff --git a/transformation_paginated_result.go b/transformation_paginated_result.go deleted file mode 100644 index 18485dc..0000000 --- a/transformation_paginated_result.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -type TransformationPaginatedResult struct { - Pagination *SeekPagination `json:"pagination,omitempty"` - Count *int `json:"count,omitempty"` - Models *[]*Transformation `json:"models,omitempty"` -} diff --git a/transformations.go b/transformations.go new file mode 100644 index 0000000..da89a51 --- /dev/null +++ b/transformations.go @@ -0,0 +1,70 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + time "time" +) + +type CreateTransformationRequest struct { + // A unique, human-friendly name for the transformation `<= 155 characters` + Name string `json:"name"` + // JavaScript code to be executed as string + Code string `json:"code"` + // Key-value environment variables to be passed to the transformation + Env map[string]*CreateTransformationRequestEnvValue `json:"env,omitempty"` +} + +type GetTransformationExecutionsRequest struct { + LogLevel *GetTransformationExecutionsRequestLogLevel `json:"-"` + WebhookId *string `json:"-"` + IssueId *string `json:"-"` + CreatedAt *time.Time `json:"-"` + OrderBy *string `json:"-"` + Dir *GetTransformationExecutionsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type GetTransformationsRequest struct { + Id *string `json:"-"` + Name *string `json:"-"` + OrderBy *string `json:"-"` + Dir *GetTransformationsRequestDir `json:"-"` + Limit *int `json:"-"` + Next *string `json:"-"` + Prev *string `json:"-"` +} + +type TestTransformationRequest struct { + // Key-value environment variables to be passed to the transformation + Env *TestTransformationRequestEnv `json:"env,omitempty"` + // ID of the connection to use for the execution `context` + WebhookId *string `json:"webhook_id,omitempty"` + // JavaScript code to be executed + Code *string `json:"code,omitempty"` + // Transformation ID + TransformationId *string `json:"transformation_id,omitempty"` + // Request input to use for the transformation execution + Request *TestTransformationRequestRequest `json:"request,omitempty"` + EventId *string `json:"event_id,omitempty"` +} + +type UpdateTransformationRequest struct { + // A unique, human-friendly name for the transformation `<= 155 characters` + Name *string `json:"name,omitempty"` + // JavaScript code to be executed + Code *string `json:"code,omitempty"` + // Key-value environment variables to be passed to the transformation + Env map[string]*UpdateTransformationRequestEnvValue `json:"env,omitempty"` +} + +type UpsertTransformationRequest struct { + // A unique, human-friendly name for the transformation `<= 155 characters` + Name string `json:"name"` + // JavaScript code to be executed as string + Code string `json:"code"` + // Key-value environment variables to be passed to the transformation + Env map[string]*UpsertTransformationRequestEnvValue `json:"env,omitempty"` +} diff --git a/transformations_client.go b/transformations/client.go similarity index 59% rename from transformations_client.go rename to transformations/client.go index dbbc592..593f8db 100644 --- a/transformations_client.go +++ b/transformations/client.go @@ -1,6 +1,6 @@ // This file was auto-generated by Fern from our API Definition. -package api +package transformations import ( bytes "bytes" @@ -8,75 +8,70 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + hookdeckgo "github.com/fern-hookdeck/hookdeck-go" core "github.com/fern-hookdeck/hookdeck-go/core" io "io" http "net/http" url "net/url" + time "time" ) -type TransformationsClient interface { - GetTransformations(ctx context.Context, request *GetTransformationsRequest) (*TransformationPaginatedResult, error) - CreateTransformation(ctx context.Context, request *CreateTransformationRequest) (*Transformation, error) - UpsertTransformation(ctx context.Context, request *UpsertTransformationRequest) (*Transformation, error) - GetTransformation(ctx context.Context, id string) (*Transformation, error) - UpdateTransformation(ctx context.Context, id string, request *UpdateTransformationRequest) (*Transformation, error) - TestTransformation(ctx context.Context, request *TestTransformationRequest) (*TransformationExecutorOutput, error) - GetTransformationExecutions(ctx context.Context, id string, request *GetTransformationExecutionsRequest) (*TransformationExecutionPaginatedResult, error) - GetTransformationExecution(ctx context.Context, id string, executionId string) (*TransformationExecution, error) +type Client interface { + GetTransformations(ctx context.Context, request *hookdeckgo.GetTransformationsRequest) (*hookdeckgo.TransformationPaginatedResult, error) + CreateTransformation(ctx context.Context, request *hookdeckgo.CreateTransformationRequest) (*hookdeckgo.Transformation, error) + UpsertTransformation(ctx context.Context, request *hookdeckgo.UpsertTransformationRequest) (*hookdeckgo.Transformation, error) + GetTransformation(ctx context.Context, id string) (*hookdeckgo.Transformation, error) + UpdateTransformation(ctx context.Context, id string, request *hookdeckgo.UpdateTransformationRequest) (*hookdeckgo.Transformation, error) + TestTransformation(ctx context.Context, request *hookdeckgo.TestTransformationRequest) (*hookdeckgo.TransformationExecutorOutput, error) + GetTransformationExecutions(ctx context.Context, id string, request *hookdeckgo.GetTransformationExecutionsRequest) (*hookdeckgo.TransformationExecutionPaginatedResult, error) + GetTransformationExecution(ctx context.Context, id string, executionId string) (*hookdeckgo.TransformationExecution, error) } -func NewTransformationsClient(opts ...core.ClientOption) TransformationsClient { +func NewClient(opts ...core.ClientOption) Client { options := core.NewClientOptions() for _, opt := range opts { opt(options) } - return &transformationsClient{ + return &client{ baseURL: options.BaseURL, httpClient: options.HTTPClient, header: options.ToHeader(), } } -type transformationsClient struct { +type client struct { baseURL string httpClient core.HTTPClient header http.Header } -func (t *transformationsClient) GetTransformations(ctx context.Context, request *GetTransformationsRequest) (*TransformationPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if t.baseURL != "" { - baseURL = t.baseURL +func (c *client) GetTransformations(ctx context.Context, request *hookdeckgo.GetTransformationsRequest) (*hookdeckgo.TransformationPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "transformations" queryParams := make(url.Values) - var idDefaultValue *string - if request.Id != idDefaultValue { + if request.Id != nil { queryParams.Add("id", fmt.Sprintf("%v", *request.Id)) } - var nameDefaultValue *string - if request.Name != nameDefaultValue { + if request.Name != nil { queryParams.Add("name", fmt.Sprintf("%v", *request.Name)) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetTransformationsRequestDirGetTransformationsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -92,14 +87,14 @@ func (t *transformationsClient) GetTransformations(ctx context.Context, request decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -109,15 +104,16 @@ func (t *transformationsClient) GetTransformations(ctx context.Context, request return apiError } - response := new(TransformationPaginatedResult) + var response *hookdeckgo.TransformationPaginatedResult if err := core.DoRequest( ctx, - t.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - t.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -125,10 +121,10 @@ func (t *transformationsClient) GetTransformations(ctx context.Context, request return response, nil } -func (t *transformationsClient) CreateTransformation(ctx context.Context, request *CreateTransformationRequest) (*Transformation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if t.baseURL != "" { - baseURL = t.baseURL +func (c *client) CreateTransformation(ctx context.Context, request *hookdeckgo.CreateTransformationRequest) (*hookdeckgo.Transformation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "transformations" @@ -141,14 +137,14 @@ func (t *transformationsClient) CreateTransformation(ctx context.Context, reques decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -158,15 +154,16 @@ func (t *transformationsClient) CreateTransformation(ctx context.Context, reques return apiError } - response := new(Transformation) + var response *hookdeckgo.Transformation if err := core.DoRequest( ctx, - t.httpClient, + c.httpClient, endpointURL, http.MethodPost, request, &response, - t.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -174,10 +171,10 @@ func (t *transformationsClient) CreateTransformation(ctx context.Context, reques return response, nil } -func (t *transformationsClient) UpsertTransformation(ctx context.Context, request *UpsertTransformationRequest) (*Transformation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if t.baseURL != "" { - baseURL = t.baseURL +func (c *client) UpsertTransformation(ctx context.Context, request *hookdeckgo.UpsertTransformationRequest) (*hookdeckgo.Transformation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "transformations" @@ -190,14 +187,14 @@ func (t *transformationsClient) UpsertTransformation(ctx context.Context, reques decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -207,15 +204,16 @@ func (t *transformationsClient) UpsertTransformation(ctx context.Context, reques return apiError } - response := new(Transformation) + var response *hookdeckgo.Transformation if err := core.DoRequest( ctx, - t.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - t.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -223,10 +221,10 @@ func (t *transformationsClient) UpsertTransformation(ctx context.Context, reques return response, nil } -func (t *transformationsClient) GetTransformation(ctx context.Context, id string) (*Transformation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if t.baseURL != "" { - baseURL = t.baseURL +func (c *client) GetTransformation(ctx context.Context, id string) (*hookdeckgo.Transformation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"transformations/%v", id) @@ -239,7 +237,7 @@ func (t *transformationsClient) GetTransformation(ctx context.Context, id string decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -249,15 +247,16 @@ func (t *transformationsClient) GetTransformation(ctx context.Context, id string return apiError } - response := new(Transformation) + var response *hookdeckgo.Transformation if err := core.DoRequest( ctx, - t.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - t.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -265,10 +264,10 @@ func (t *transformationsClient) GetTransformation(ctx context.Context, id string return response, nil } -func (t *transformationsClient) UpdateTransformation(ctx context.Context, id string, request *UpdateTransformationRequest) (*Transformation, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if t.baseURL != "" { - baseURL = t.baseURL +func (c *client) UpdateTransformation(ctx context.Context, id string, request *hookdeckgo.UpdateTransformationRequest) (*hookdeckgo.Transformation, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"transformations/%v", id) @@ -281,21 +280,21 @@ func (t *transformationsClient) UpdateTransformation(ctx context.Context, id str decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -305,15 +304,16 @@ func (t *transformationsClient) UpdateTransformation(ctx context.Context, id str return apiError } - response := new(Transformation) + var response *hookdeckgo.Transformation if err := core.DoRequest( ctx, - t.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - t.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -321,10 +321,10 @@ func (t *transformationsClient) UpdateTransformation(ctx context.Context, id str return response, nil } -func (t *transformationsClient) TestTransformation(ctx context.Context, request *TestTransformationRequest) (*TransformationExecutorOutput, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if t.baseURL != "" { - baseURL = t.baseURL +func (c *client) TestTransformation(ctx context.Context, request *hookdeckgo.TestTransformationRequest) (*hookdeckgo.TransformationExecutorOutput, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := baseURL + "/" + "transformations/run" @@ -337,14 +337,14 @@ func (t *transformationsClient) TestTransformation(ctx context.Context, request decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -354,15 +354,16 @@ func (t *transformationsClient) TestTransformation(ctx context.Context, request return apiError } - response := new(TransformationExecutorOutput) + var response *hookdeckgo.TransformationExecutorOutput if err := core.DoRequest( ctx, - t.httpClient, + c.httpClient, endpointURL, http.MethodPut, request, &response, - t.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -370,48 +371,39 @@ func (t *transformationsClient) TestTransformation(ctx context.Context, request return response, nil } -func (t *transformationsClient) GetTransformationExecutions(ctx context.Context, id string, request *GetTransformationExecutionsRequest) (*TransformationExecutionPaginatedResult, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if t.baseURL != "" { - baseURL = t.baseURL +func (c *client) GetTransformationExecutions(ctx context.Context, id string, request *hookdeckgo.GetTransformationExecutionsRequest) (*hookdeckgo.TransformationExecutionPaginatedResult, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"transformations/%v/executions", id) queryParams := make(url.Values) - var logLevelDefaultValue *GetTransformationExecutionsRequestLogLevelGetTransformationExecutionsRequestLogLevel - if request.LogLevel != logLevelDefaultValue { + if request.LogLevel != nil { queryParams.Add("log_level", fmt.Sprintf("%v", *request.LogLevel)) } - var webhookIdDefaultValue *string - if request.WebhookId != webhookIdDefaultValue { + if request.WebhookId != nil { queryParams.Add("webhook_id", fmt.Sprintf("%v", *request.WebhookId)) } - var issueIdDefaultValue *string - if request.IssueId != issueIdDefaultValue { + if request.IssueId != nil { queryParams.Add("issue_id", fmt.Sprintf("%v", *request.IssueId)) } - var createdAtDefaultValue *string - if request.CreatedAt != createdAtDefaultValue { - queryParams.Add("created_at", fmt.Sprintf("%v", *request.CreatedAt)) + if request.CreatedAt != nil { + queryParams.Add("created_at", fmt.Sprintf("%v", request.CreatedAt.Format(time.RFC3339))) } - var orderByDefaultValue *string - if request.OrderBy != orderByDefaultValue { + if request.OrderBy != nil { queryParams.Add("order_by", fmt.Sprintf("%v", *request.OrderBy)) } - var dirDefaultValue *GetTransformationExecutionsRequestDirGetTransformationExecutionsRequestDir - if request.Dir != dirDefaultValue { + if request.Dir != nil { queryParams.Add("dir", fmt.Sprintf("%v", *request.Dir)) } - var limitDefaultValue *int - if request.Limit != limitDefaultValue { + if request.Limit != nil { queryParams.Add("limit", fmt.Sprintf("%v", *request.Limit)) } - var nextDefaultValue *string - if request.Next != nextDefaultValue { + if request.Next != nil { queryParams.Add("next", fmt.Sprintf("%v", *request.Next)) } - var prevDefaultValue *string - if request.Prev != prevDefaultValue { + if request.Prev != nil { queryParams.Add("prev", fmt.Sprintf("%v", *request.Prev)) } if len(queryParams) > 0 { @@ -427,14 +419,14 @@ func (t *transformationsClient) GetTransformationExecutions(ctx context.Context, decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 400: - value := new(BadRequestError) + value := new(hookdeckgo.BadRequestError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err } return value case 422: - value := new(UnprocessableEntityError) + value := new(hookdeckgo.UnprocessableEntityError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -444,15 +436,16 @@ func (t *transformationsClient) GetTransformationExecutions(ctx context.Context, return apiError } - response := new(TransformationExecutionPaginatedResult) + var response *hookdeckgo.TransformationExecutionPaginatedResult if err := core.DoRequest( ctx, - t.httpClient, + c.httpClient, endpointURL, http.MethodGet, request, &response, - t.header, + false, + c.header, errorDecoder, ); err != nil { return response, err @@ -460,10 +453,10 @@ func (t *transformationsClient) GetTransformationExecutions(ctx context.Context, return response, nil } -func (t *transformationsClient) GetTransformationExecution(ctx context.Context, id string, executionId string) (*TransformationExecution, error) { - baseURL := "https://api.hookdeck.com/2023-01-01" - if t.baseURL != "" { - baseURL = t.baseURL +func (c *client) GetTransformationExecution(ctx context.Context, id string, executionId string) (*hookdeckgo.TransformationExecution, error) { + baseURL := "https://api.hookdeck.com/2023-07-01" + if c.baseURL != "" { + baseURL = c.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"transformations/%v/executions/%v", id, executionId) @@ -476,7 +469,7 @@ func (t *transformationsClient) GetTransformationExecution(ctx context.Context, decoder := json.NewDecoder(bytes.NewReader(raw)) switch statusCode { case 404: - value := new(NotFoundError) + value := new(hookdeckgo.NotFoundError) value.APIError = apiError if err := decoder.Decode(value); err != nil { return err @@ -486,15 +479,16 @@ func (t *transformationsClient) GetTransformationExecution(ctx context.Context, return apiError } - response := new(TransformationExecution) + var response *hookdeckgo.TransformationExecution if err := core.DoRequest( ctx, - t.httpClient, + c.httpClient, endpointURL, http.MethodGet, nil, &response, - t.header, + false, + c.header, errorDecoder, ); err != nil { return response, err diff --git a/trigger_bookmark_request.go b/trigger_bookmark_request.go deleted file mode 100644 index 7605747..0000000 --- a/trigger_bookmark_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// TriggerBookmarkRequest is an in-lined request used by the TriggerBookmark endpoint. -type TriggerBookmarkRequest struct { - // Bookmark target - Target *TriggerBookmarkRequestTarget `json:"target,omitempty"` -} diff --git a/trigger_bookmark_request_target.go b/trigger_bookmark_request_target.go deleted file mode 100644 index 24c942e..0000000 --- a/trigger_bookmark_request_target.go +++ /dev/null @@ -1,48 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Bookmark target -type TriggerBookmarkRequestTarget uint8 - -const ( - TriggerBookmarkRequestTargetHttp TriggerBookmarkRequestTarget = iota + 1 - TriggerBookmarkRequestTargetCli -) - -func (t TriggerBookmarkRequestTarget) String() string { - switch t { - default: - return strconv.Itoa(int(t)) - case TriggerBookmarkRequestTargetHttp: - return "http" - case TriggerBookmarkRequestTargetCli: - return "cli" - } -} - -func (t TriggerBookmarkRequestTarget) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", t.String())), nil -} - -func (t *TriggerBookmarkRequestTarget) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "http": - value := TriggerBookmarkRequestTargetHttp - *t = value - case "cli": - value := TriggerBookmarkRequestTargetCli - *t = value - } - return nil -} diff --git a/types.go b/types.go new file mode 100644 index 0000000..90690e1 --- /dev/null +++ b/types.go @@ -0,0 +1,10555 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + json "encoding/json" + fmt "fmt" + strconv "strconv" + time "time" +) + +type AddCustomHostname struct { + // The custom hostname to attach to the workspace + Hostname string `json:"hostname"` +} + +type Adyen struct { + Configs *AdyenConfigs `json:"configs,omitempty"` + type_ string +} + +func (a *Adyen) Type() string { + return a.type_ +} + +func (a *Adyen) UnmarshalJSON(data []byte) error { + type unmarshaler Adyen + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = Adyen(value) + a.type_ = "adyen" + return nil +} + +func (a *Adyen) MarshalJSON() ([]byte, error) { + type embed Adyen + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*a), + Type: "adyen", + } + return json.Marshal(marshaler) +} + +// The verification configs for Adyen. Only included if the ?include=verification.configs query param is present +type AdyenConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Akeneo struct { + Configs *AkeneoConfigs `json:"configs,omitempty"` + type_ string +} + +func (a *Akeneo) Type() string { + return a.type_ +} + +func (a *Akeneo) UnmarshalJSON(data []byte) error { + type unmarshaler Akeneo + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = Akeneo(value) + a.type_ = "akeneo" + return nil +} + +func (a *Akeneo) MarshalJSON() ([]byte, error) { + type embed Akeneo + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*a), + Type: "akeneo", + } + return json.Marshal(marshaler) +} + +// The verification configs for Akeneo. Only included if the ?include=verification.configs query param is present +type AkeneoConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +// Error response model +type ApiErrorResponse struct { + // Error code + Code string `json:"code"` + // Status code + Status float64 `json:"status"` + // Error description + Message string `json:"message"` + Data *ApiErrorResponseData `json:"data,omitempty"` +} + +type ApiErrorResponseData struct { +} + +type ApiKey struct { + Configs *ApiKeyConfigs `json:"configs,omitempty"` + type_ string +} + +func (a *ApiKey) Type() string { + return a.type_ +} + +func (a *ApiKey) UnmarshalJSON(data []byte) error { + type unmarshaler ApiKey + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = ApiKey(value) + a.type_ = "api_key" + return nil +} + +func (a *ApiKey) MarshalJSON() ([]byte, error) { + type embed ApiKey + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*a), + Type: "api_key", + } + return json.Marshal(marshaler) +} + +// The verification configs for API Key. Only included if the ?include=verification.configs query param is present +type ApiKeyConfigs struct { + HeaderKey string `json:"header_key"` + ApiKey string `json:"api_key"` +} + +type ApiKeyIntegrationConfigs struct { + HeaderKey string `json:"header_key"` + ApiKey string `json:"api_key"` +} + +type AttachedIntegrationToSource struct { + Success bool `json:"success"` +} + +// Error code of the delivery attempt +type AttemptErrorCodes uint + +const ( + AttemptErrorCodesCancelled AttemptErrorCodes = iota + 1 + AttemptErrorCodesTimeout + AttemptErrorCodesNotFound + AttemptErrorCodesConnectionRefused + AttemptErrorCodesConnectionReset + AttemptErrorCodesMissingUrl + AttemptErrorCodesCli + AttemptErrorCodesCliUnavailable + AttemptErrorCodesSelfSignedCert + AttemptErrorCodesErrTlsCertAltnameInvalid + AttemptErrorCodesSslErrorCaUnknown + AttemptErrorCodesTtlExpired + AttemptErrorCodesDataArchived + AttemptErrorCodesSslCertExpired + AttemptErrorCodesBulkRetryCancelled + AttemptErrorCodesDnsLookupFailed + AttemptErrorCodesHostUnreachable + AttemptErrorCodesProtocolError + AttemptErrorCodesSocketClosed + AttemptErrorCodesUnknown +) + +func (a AttemptErrorCodes) String() string { + switch a { + default: + return strconv.Itoa(int(a)) + case AttemptErrorCodesCancelled: + return "CANCELLED" + case AttemptErrorCodesTimeout: + return "TIMEOUT" + case AttemptErrorCodesNotFound: + return "NOT_FOUND" + case AttemptErrorCodesConnectionRefused: + return "CONNECTION_REFUSED" + case AttemptErrorCodesConnectionReset: + return "CONNECTION_RESET" + case AttemptErrorCodesMissingUrl: + return "MISSING_URL" + case AttemptErrorCodesCli: + return "CLI" + case AttemptErrorCodesCliUnavailable: + return "CLI_UNAVAILABLE" + case AttemptErrorCodesSelfSignedCert: + return "SELF_SIGNED_CERT" + case AttemptErrorCodesErrTlsCertAltnameInvalid: + return "ERR_TLS_CERT_ALTNAME_INVALID" + case AttemptErrorCodesSslErrorCaUnknown: + return "SSL_ERROR_CA_UNKNOWN" + case AttemptErrorCodesTtlExpired: + return "TTL_EXPIRED" + case AttemptErrorCodesDataArchived: + return "DATA_ARCHIVED" + case AttemptErrorCodesSslCertExpired: + return "SSL_CERT_EXPIRED" + case AttemptErrorCodesBulkRetryCancelled: + return "BULK_RETRY_CANCELLED" + case AttemptErrorCodesDnsLookupFailed: + return "DNS_LOOKUP_FAILED" + case AttemptErrorCodesHostUnreachable: + return "HOST_UNREACHABLE" + case AttemptErrorCodesProtocolError: + return "PROTOCOL_ERROR" + case AttemptErrorCodesSocketClosed: + return "SOCKET_CLOSED" + case AttemptErrorCodesUnknown: + return "UNKNOWN" + } +} + +func (a AttemptErrorCodes) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", a.String())), nil +} + +func (a *AttemptErrorCodes) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "CANCELLED": + value := AttemptErrorCodesCancelled + *a = value + case "TIMEOUT": + value := AttemptErrorCodesTimeout + *a = value + case "NOT_FOUND": + value := AttemptErrorCodesNotFound + *a = value + case "CONNECTION_REFUSED": + value := AttemptErrorCodesConnectionRefused + *a = value + case "CONNECTION_RESET": + value := AttemptErrorCodesConnectionReset + *a = value + case "MISSING_URL": + value := AttemptErrorCodesMissingUrl + *a = value + case "CLI": + value := AttemptErrorCodesCli + *a = value + case "CLI_UNAVAILABLE": + value := AttemptErrorCodesCliUnavailable + *a = value + case "SELF_SIGNED_CERT": + value := AttemptErrorCodesSelfSignedCert + *a = value + case "ERR_TLS_CERT_ALTNAME_INVALID": + value := AttemptErrorCodesErrTlsCertAltnameInvalid + *a = value + case "SSL_ERROR_CA_UNKNOWN": + value := AttemptErrorCodesSslErrorCaUnknown + *a = value + case "TTL_EXPIRED": + value := AttemptErrorCodesTtlExpired + *a = value + case "DATA_ARCHIVED": + value := AttemptErrorCodesDataArchived + *a = value + case "SSL_CERT_EXPIRED": + value := AttemptErrorCodesSslCertExpired + *a = value + case "BULK_RETRY_CANCELLED": + value := AttemptErrorCodesBulkRetryCancelled + *a = value + case "DNS_LOOKUP_FAILED": + value := AttemptErrorCodesDnsLookupFailed + *a = value + case "HOST_UNREACHABLE": + value := AttemptErrorCodesHostUnreachable + *a = value + case "PROTOCOL_ERROR": + value := AttemptErrorCodesProtocolError + *a = value + case "SOCKET_CLOSED": + value := AttemptErrorCodesSocketClosed + *a = value + case "UNKNOWN": + value := AttemptErrorCodesUnknown + *a = value + } + return nil +} + +type AttemptState uint + +const ( + AttemptStateDelivering AttemptState = iota + 1 + AttemptStateQueued + AttemptStatePending + AttemptStateCompleted + AttemptStateHold +) + +func (a AttemptState) String() string { + switch a { + default: + return strconv.Itoa(int(a)) + case AttemptStateDelivering: + return "DELIVERING" + case AttemptStateQueued: + return "QUEUED" + case AttemptStatePending: + return "PENDING" + case AttemptStateCompleted: + return "COMPLETED" + case AttemptStateHold: + return "HOLD" + } +} + +func (a AttemptState) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", a.String())), nil +} + +func (a *AttemptState) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "DELIVERING": + value := AttemptStateDelivering + *a = value + case "QUEUED": + value := AttemptStateQueued + *a = value + case "PENDING": + value := AttemptStatePending + *a = value + case "COMPLETED": + value := AttemptStateCompleted + *a = value + case "HOLD": + value := AttemptStateHold + *a = value + } + return nil +} + +// Attempt status +type AttemptStatus uint + +const ( + AttemptStatusQueued AttemptStatus = iota + 1 + AttemptStatusFailed + AttemptStatusSuccessful + AttemptStatusHold +) + +func (a AttemptStatus) String() string { + switch a { + default: + return strconv.Itoa(int(a)) + case AttemptStatusQueued: + return "QUEUED" + case AttemptStatusFailed: + return "FAILED" + case AttemptStatusSuccessful: + return "SUCCESSFUL" + case AttemptStatusHold: + return "HOLD" + } +} + +func (a AttemptStatus) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", a.String())), nil +} + +func (a *AttemptStatus) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "QUEUED": + value := AttemptStatusQueued + *a = value + case "FAILED": + value := AttemptStatusFailed + *a = value + case "SUCCESSFUL": + value := AttemptStatusSuccessful + *a = value + case "HOLD": + value := AttemptStatusHold + *a = value + } + return nil +} + +// How the attempt was triggered +type AttemptTrigger uint + +const ( + AttemptTriggerInitial AttemptTrigger = iota + 1 + AttemptTriggerManual + AttemptTriggerBulkRetry + AttemptTriggerUnpause + AttemptTriggerAutomatic +) + +func (a AttemptTrigger) String() string { + switch a { + default: + return strconv.Itoa(int(a)) + case AttemptTriggerInitial: + return "INITIAL" + case AttemptTriggerManual: + return "MANUAL" + case AttemptTriggerBulkRetry: + return "BULK_RETRY" + case AttemptTriggerUnpause: + return "UNPAUSE" + case AttemptTriggerAutomatic: + return "AUTOMATIC" + } +} + +func (a AttemptTrigger) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", a.String())), nil +} + +func (a *AttemptTrigger) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "INITIAL": + value := AttemptTriggerInitial + *a = value + case "MANUAL": + value := AttemptTriggerManual + *a = value + case "BULK_RETRY": + value := AttemptTriggerBulkRetry + *a = value + case "UNPAUSE": + value := AttemptTriggerUnpause + *a = value + case "AUTOMATIC": + value := AttemptTriggerAutomatic + *a = value + } + return nil +} + +type AwsSns struct { + Configs *AwsSnsConfigs `json:"configs,omitempty"` + type_ string +} + +func (a *AwsSns) Type() string { + return a.type_ +} + +func (a *AwsSns) UnmarshalJSON(data []byte) error { + type unmarshaler AwsSns + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *a = AwsSns(value) + a.type_ = "aws_sns" + return nil +} + +func (a *AwsSns) MarshalJSON() ([]byte, error) { + type embed AwsSns + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*a), + Type: "aws_sns", + } + return json.Marshal(marshaler) +} + +// The verification configs for AWS SNS. Only included if the ?include=verification.configs query param is present +type AwsSnsConfigs struct { +} + +type BasicAuth struct { + Configs *BasicAuthConfigs `json:"configs,omitempty"` + type_ string +} + +func (b *BasicAuth) Type() string { + return b.type_ +} + +func (b *BasicAuth) UnmarshalJSON(data []byte) error { + type unmarshaler BasicAuth + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BasicAuth(value) + b.type_ = "basic_auth" + return nil +} + +func (b *BasicAuth) MarshalJSON() ([]byte, error) { + type embed BasicAuth + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*b), + Type: "basic_auth", + } + return json.Marshal(marshaler) +} + +// The verification configs for Basic Auth. Only included if the ?include=verification.configs query param is present +type BasicAuthConfigs struct { + Name string `json:"name"` + Password string `json:"password"` +} + +type BasicAuthIntegrationConfigs struct { + Name string `json:"name"` + Password string `json:"password"` +} + +type BatchOperation struct { + // ID of the bulk retry + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + // Query object to filter records + Query *BatchOperationQuery `json:"query,omitempty"` + // Date the bulk retry was created + CreatedAt time.Time `json:"created_at"` + // Last time the bulk retry was updated + UpdatedAt time.Time `json:"updated_at"` + // Date the bulk retry was cancelled + CancelledAt *time.Time `json:"cancelled_at,omitempty"` + // Date the bulk retry was completed + CompletedAt *time.Time `json:"completed_at,omitempty"` + // Number of batches required to complete the bulk retry + EstimatedBatch *int `json:"estimated_batch,omitempty"` + // Number of estimated events to be retried + EstimatedCount *int `json:"estimated_count,omitempty"` + // Number of batches currently processed + ProcessedBatch *int `json:"processed_batch,omitempty"` + // Number of events that were successfully delivered + CompletedCount *int `json:"completed_count,omitempty"` + // Indicates if the bulk retry is currently in progress + InProgress bool `json:"in_progress"` + // Progression of the batch operations, values 0 - 1 + Progress *float64 `json:"progress,omitempty"` + // Number of events that failed to be delivered + FailedCount *int `json:"failed_count,omitempty"` + Number *float64 `json:"number,omitempty"` +} + +type BatchOperationPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*BatchOperation `json:"models,omitempty"` +} + +// Query object to filter records +type BatchOperationQuery struct { + typeName string + StringUnknownMap map[string]any + StringOptional *string +} + +func NewBatchOperationQueryFromStringUnknownMap(value map[string]any) *BatchOperationQuery { + return &BatchOperationQuery{typeName: "stringUnknownMap", StringUnknownMap: value} +} + +func NewBatchOperationQueryFromStringOptional(value *string) *BatchOperationQuery { + return &BatchOperationQuery{typeName: "stringOptional", StringOptional: value} +} + +func (b *BatchOperationQuery) UnmarshalJSON(data []byte) error { + var valueStringUnknownMap map[string]any + if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { + b.typeName = "stringUnknownMap" + b.StringUnknownMap = valueStringUnknownMap + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + b.typeName = "stringOptional" + b.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, b) +} + +func (b BatchOperationQuery) MarshalJSON() ([]byte, error) { + switch b.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", b.typeName, b) + case "stringUnknownMap": + return json.Marshal(b.StringUnknownMap) + case "stringOptional": + return json.Marshal(b.StringOptional) + } +} + +type BatchOperationQueryVisitor interface { + VisitStringUnknownMap(map[string]any) error + VisitStringOptional(*string) error +} + +func (b *BatchOperationQuery) Accept(visitor BatchOperationQueryVisitor) error { + switch b.typeName { + default: + return fmt.Errorf("invalid type %s in %T", b.typeName, b) + case "stringUnknownMap": + return visitor.VisitStringUnknownMap(b.StringUnknownMap) + case "stringOptional": + return visitor.VisitStringOptional(b.StringOptional) + } +} + +// Bearer Token +type BearerToken struct { + Config *DestinationAuthMethodBearerTokenConfig `json:"config,omitempty"` + type_ string +} + +func (b *BearerToken) Type() string { + return b.type_ +} + +func (b *BearerToken) UnmarshalJSON(data []byte) error { + type unmarshaler BearerToken + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *b = BearerToken(value) + b.type_ = "BEARER_TOKEN" + return nil +} + +func (b *BearerToken) MarshalJSON() ([]byte, error) { + type embed BearerToken + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*b), + Type: "BEARER_TOKEN", + } + return json.Marshal(marshaler) +} + +type Bookmark struct { + // ID of the bookmark + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + // ID of the associated connection + WebhookId string `json:"webhook_id"` + // ID of the bookmarked event data + EventDataId string `json:"event_data_id"` + // Descriptive name of the bookmark + Label string `json:"label"` + // Alternate alias for the bookmark + Alias *string `json:"alias,omitempty"` + Data *ShortEventData `json:"data,omitempty"` + // Date the bookmark was last manually triggered + LastUsedAt *time.Time `json:"last_used_at,omitempty"` + // Date the bookmark was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the bookmark was created + CreatedAt time.Time `json:"created_at"` +} + +type BookmarkPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*Bookmark `json:"models,omitempty"` +} + +type Commercelayer struct { + Configs *CommercelayerConfigs `json:"configs,omitempty"` + type_ string +} + +func (c *Commercelayer) Type() string { + return c.type_ +} + +func (c *Commercelayer) UnmarshalJSON(data []byte) error { + type unmarshaler Commercelayer + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = Commercelayer(value) + c.type_ = "commercelayer" + return nil +} + +func (c *Commercelayer) MarshalJSON() ([]byte, error) { + type embed Commercelayer + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*c), + Type: "commercelayer", + } + return json.Marshal(marshaler) +} + +// The verification configs for Commercelayer. Only included if the ?include=verification.configs query param is present +type CommercelayerConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Connection struct { + // ID of the connection + Id string `json:"id"` + // Unique name of the connection for this source + Name *string `json:"name,omitempty"` + // Full name of the connection concatenated from source, connection and desitnation name + FullName *string `json:"full_name,omitempty"` + // Description of the connection + Description *string `json:"description,omitempty"` + // ID of the workspace + TeamId string `json:"team_id"` + Destination *Destination `json:"destination,omitempty"` + Source *Source `json:"source,omitempty"` + // Array of rules configured on the connection + Rules []*Rule `json:"rules,omitempty"` + // Date the connection was archived + ArchivedAt *time.Time `json:"archived_at,omitempty"` + // Date the connection was paused + PausedAt *time.Time `json:"paused_at,omitempty"` + // Date the connection was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the connection was created + CreatedAt time.Time `json:"created_at"` +} + +// JSON using our filter syntax to filter on request headers +type ConnectionFilterProperty struct { + typeName string + StringOptional *string + Double float64 + Boolean bool + ConnectionFilterPropertyThree *ConnectionFilterPropertyThree +} + +func NewConnectionFilterPropertyFromStringOptional(value *string) *ConnectionFilterProperty { + return &ConnectionFilterProperty{typeName: "stringOptional", StringOptional: value} +} + +func NewConnectionFilterPropertyFromDouble(value float64) *ConnectionFilterProperty { + return &ConnectionFilterProperty{typeName: "double", Double: value} +} + +func NewConnectionFilterPropertyFromBoolean(value bool) *ConnectionFilterProperty { + return &ConnectionFilterProperty{typeName: "boolean", Boolean: value} +} + +func NewConnectionFilterPropertyFromConnectionFilterPropertyThree(value *ConnectionFilterPropertyThree) *ConnectionFilterProperty { + return &ConnectionFilterProperty{typeName: "connectionFilterPropertyThree", ConnectionFilterPropertyThree: value} +} + +func (c *ConnectionFilterProperty) UnmarshalJSON(data []byte) error { + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + c.typeName = "stringOptional" + c.StringOptional = valueStringOptional + return nil + } + var valueDouble float64 + if err := json.Unmarshal(data, &valueDouble); err == nil { + c.typeName = "double" + c.Double = valueDouble + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + c.typeName = "boolean" + c.Boolean = valueBoolean + return nil + } + valueConnectionFilterPropertyThree := new(ConnectionFilterPropertyThree) + if err := json.Unmarshal(data, &valueConnectionFilterPropertyThree); err == nil { + c.typeName = "connectionFilterPropertyThree" + c.ConnectionFilterPropertyThree = valueConnectionFilterPropertyThree + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c ConnectionFilterProperty) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "stringOptional": + return json.Marshal(c.StringOptional) + case "double": + return json.Marshal(c.Double) + case "boolean": + return json.Marshal(c.Boolean) + case "connectionFilterPropertyThree": + return json.Marshal(c.ConnectionFilterPropertyThree) + } +} + +type ConnectionFilterPropertyVisitor interface { + VisitStringOptional(*string) error + VisitDouble(float64) error + VisitBoolean(bool) error + VisitConnectionFilterPropertyThree(*ConnectionFilterPropertyThree) error +} + +func (c *ConnectionFilterProperty) Accept(visitor ConnectionFilterPropertyVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "stringOptional": + return visitor.VisitStringOptional(c.StringOptional) + case "double": + return visitor.VisitDouble(c.Double) + case "boolean": + return visitor.VisitBoolean(c.Boolean) + case "connectionFilterPropertyThree": + return visitor.VisitConnectionFilterPropertyThree(c.ConnectionFilterPropertyThree) + } +} + +type ConnectionFilterPropertyThree struct { +} + +type ConnectionPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*Connection `json:"models,omitempty"` +} + +type ConsoleLine struct { + Type ConsoleLineType `json:"type,omitempty"` + Message string `json:"message"` +} + +type ConsoleLineType uint + +const ( + ConsoleLineTypeError ConsoleLineType = iota + 1 + ConsoleLineTypeLog + ConsoleLineTypeWarn + ConsoleLineTypeInfo + ConsoleLineTypeDebug +) + +func (c ConsoleLineType) String() string { + switch c { + default: + return strconv.Itoa(int(c)) + case ConsoleLineTypeError: + return "error" + case ConsoleLineTypeLog: + return "log" + case ConsoleLineTypeWarn: + return "warn" + case ConsoleLineTypeInfo: + return "info" + case ConsoleLineTypeDebug: + return "debug" + } +} + +func (c ConsoleLineType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", c.String())), nil +} + +func (c *ConsoleLineType) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "error": + value := ConsoleLineTypeError + *c = value + case "log": + value := ConsoleLineTypeLog + *c = value + case "warn": + value := ConsoleLineTypeWarn + *c = value + case "info": + value := ConsoleLineTypeInfo + *c = value + case "debug": + value := ConsoleLineTypeDebug + *c = value + } + return nil +} + +// Destination input object +type CreateConnectionRequestDestination struct { + // Name for the destination `<= 155 characters` + Name string `json:"name"` + // Description for the destination + Description *string `json:"description,omitempty"` + // Endpoint of the destination + Url *string `json:"url,omitempty"` + // Path for the CLI destination + CliPath *string `json:"cli_path,omitempty"` + // Period to rate limit attempts + RateLimitPeriod *CreateConnectionRequestDestinationRateLimitPeriod `json:"rate_limit_period,omitempty"` + // Limit event attempts to receive per period + RateLimit *int `json:"rate_limit,omitempty"` + HttpMethod *DestinationHttpMethod `json:"http_method,omitempty"` + AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` +} + +// Period to rate limit attempts +type CreateConnectionRequestDestinationRateLimitPeriod uint + +const ( + CreateConnectionRequestDestinationRateLimitPeriodSecond CreateConnectionRequestDestinationRateLimitPeriod = iota + 1 + CreateConnectionRequestDestinationRateLimitPeriodMinute + CreateConnectionRequestDestinationRateLimitPeriodHour +) + +func (c CreateConnectionRequestDestinationRateLimitPeriod) String() string { + switch c { + default: + return strconv.Itoa(int(c)) + case CreateConnectionRequestDestinationRateLimitPeriodSecond: + return "second" + case CreateConnectionRequestDestinationRateLimitPeriodMinute: + return "minute" + case CreateConnectionRequestDestinationRateLimitPeriodHour: + return "hour" + } +} + +func (c CreateConnectionRequestDestinationRateLimitPeriod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", c.String())), nil +} + +func (c *CreateConnectionRequestDestinationRateLimitPeriod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "second": + value := CreateConnectionRequestDestinationRateLimitPeriodSecond + *c = value + case "minute": + value := CreateConnectionRequestDestinationRateLimitPeriodMinute + *c = value + case "hour": + value := CreateConnectionRequestDestinationRateLimitPeriodHour + *c = value + } + return nil +} + +// Source input object +type CreateConnectionRequestSource struct { + // A unique name for the source `<= 155 characters` + Name string `json:"name"` + // Description for the source + Description *string `json:"description,omitempty"` + AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty"` + CustomResponse *SourceCustomResponse `json:"custom_response,omitempty"` + Verification *VerificationConfig `json:"verification,omitempty"` +} + +// Period to rate limit attempts +type CreateDestinationRequestRateLimitPeriod uint + +const ( + CreateDestinationRequestRateLimitPeriodSecond CreateDestinationRequestRateLimitPeriod = iota + 1 + CreateDestinationRequestRateLimitPeriodMinute + CreateDestinationRequestRateLimitPeriodHour +) + +func (c CreateDestinationRequestRateLimitPeriod) String() string { + switch c { + default: + return strconv.Itoa(int(c)) + case CreateDestinationRequestRateLimitPeriodSecond: + return "second" + case CreateDestinationRequestRateLimitPeriodMinute: + return "minute" + case CreateDestinationRequestRateLimitPeriodHour: + return "hour" + } +} + +func (c CreateDestinationRequestRateLimitPeriod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", c.String())), nil +} + +func (c *CreateDestinationRequestRateLimitPeriod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "second": + value := CreateDestinationRequestRateLimitPeriodSecond + *c = value + case "minute": + value := CreateDestinationRequestRateLimitPeriodMinute + *c = value + case "hour": + value := CreateDestinationRequestRateLimitPeriodHour + *c = value + } + return nil +} + +// Filter properties for the events to be included in the bulk retry +type CreateEventBulkRetryRequestQuery struct { + // Filter by event IDs + Id *CreateEventBulkRetryRequestQueryId `json:"id,omitempty"` + // Lifecyle status of the event + Status *CreateEventBulkRetryRequestQueryStatus `json:"status,omitempty"` + // Filter by webhook connection IDs + WebhookId *CreateEventBulkRetryRequestQueryWebhookId `json:"webhook_id,omitempty"` + // Filter by destination IDs + DestinationId *CreateEventBulkRetryRequestQueryDestinationId `json:"destination_id,omitempty"` + // Filter by source IDs + SourceId *CreateEventBulkRetryRequestQuerySourceId `json:"source_id,omitempty"` + // Filter by number of attempts + Attempts *CreateEventBulkRetryRequestQueryAttempts `json:"attempts,omitempty"` + // Filter by HTTP response status code + ResponseStatus *CreateEventBulkRetryRequestQueryResponseStatus `json:"response_status,omitempty"` + // Filter by `successful_at` date using a date operator + SuccessfulAt *CreateEventBulkRetryRequestQuerySuccessfulAt `json:"successful_at,omitempty"` + // Filter by `created_at` date using a date operator + CreatedAt *CreateEventBulkRetryRequestQueryCreatedAt `json:"created_at,omitempty"` + // Filter by error code code + ErrorCode *CreateEventBulkRetryRequestQueryErrorCode `json:"error_code,omitempty"` + // Filter by CLI IDs. `?[any]=true` operator for any CLI. + CliId *CreateEventBulkRetryRequestQueryCliId `json:"cli_id,omitempty"` + // Filter by `last_attempt_at` date using a date operator + LastAttemptAt *CreateEventBulkRetryRequestQueryLastAttemptAt `json:"last_attempt_at,omitempty"` + // URL Encoded string of the value to match partially to the body, headers, parsed_query or path + SearchTerm *string `json:"search_term,omitempty"` + // URL Encoded string of the JSON to match to the data headers + Headers *CreateEventBulkRetryRequestQueryHeaders `json:"headers,omitempty"` + // URL Encoded string of the JSON to match to the data body + Body *CreateEventBulkRetryRequestQueryBody `json:"body,omitempty"` + // URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) + ParsedQuery *CreateEventBulkRetryRequestQueryParsedQuery `json:"parsed_query,omitempty"` + // URL Encoded string of the value to match partially to the path + Path *string `json:"path,omitempty"` + CliUserId *CreateEventBulkRetryRequestQueryCliUserId `json:"cli_user_id,omitempty"` + IssueId *CreateEventBulkRetryRequestQueryIssueId `json:"issue_id,omitempty"` + EventDataId *CreateEventBulkRetryRequestQueryEventDataId `json:"event_data_id,omitempty"` + BulkRetryId *CreateEventBulkRetryRequestQueryBulkRetryId `json:"bulk_retry_id,omitempty"` +} + +// Filter by number of attempts +type CreateEventBulkRetryRequestQueryAttempts struct { + typeName string + Integer int + CreateEventBulkRetryRequestQueryAttemptsAny *CreateEventBulkRetryRequestQueryAttemptsAny +} + +func NewCreateEventBulkRetryRequestQueryAttemptsFromInteger(value int) *CreateEventBulkRetryRequestQueryAttempts { + return &CreateEventBulkRetryRequestQueryAttempts{typeName: "integer", Integer: value} +} + +func NewCreateEventBulkRetryRequestQueryAttemptsFromCreateEventBulkRetryRequestQueryAttemptsAny(value *CreateEventBulkRetryRequestQueryAttemptsAny) *CreateEventBulkRetryRequestQueryAttempts { + return &CreateEventBulkRetryRequestQueryAttempts{typeName: "createEventBulkRetryRequestQueryAttemptsAny", CreateEventBulkRetryRequestQueryAttemptsAny: value} +} + +func (c *CreateEventBulkRetryRequestQueryAttempts) UnmarshalJSON(data []byte) error { + var valueInteger int + if err := json.Unmarshal(data, &valueInteger); err == nil { + c.typeName = "integer" + c.Integer = valueInteger + return nil + } + valueCreateEventBulkRetryRequestQueryAttemptsAny := new(CreateEventBulkRetryRequestQueryAttemptsAny) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryAttemptsAny); err == nil { + c.typeName = "createEventBulkRetryRequestQueryAttemptsAny" + c.CreateEventBulkRetryRequestQueryAttemptsAny = valueCreateEventBulkRetryRequestQueryAttemptsAny + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryAttempts) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "integer": + return json.Marshal(c.Integer) + case "createEventBulkRetryRequestQueryAttemptsAny": + return json.Marshal(c.CreateEventBulkRetryRequestQueryAttemptsAny) + } +} + +type CreateEventBulkRetryRequestQueryAttemptsVisitor interface { + VisitInteger(int) error + VisitCreateEventBulkRetryRequestQueryAttemptsAny(*CreateEventBulkRetryRequestQueryAttemptsAny) error +} + +func (c *CreateEventBulkRetryRequestQueryAttempts) Accept(visitor CreateEventBulkRetryRequestQueryAttemptsVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "integer": + return visitor.VisitInteger(c.Integer) + case "createEventBulkRetryRequestQueryAttemptsAny": + return visitor.VisitCreateEventBulkRetryRequestQueryAttemptsAny(c.CreateEventBulkRetryRequestQueryAttemptsAny) + } +} + +type CreateEventBulkRetryRequestQueryAttemptsAny struct { + Gt *int `json:"gt,omitempty"` + Gte *int `json:"gte,omitempty"` + Le *int `json:"le,omitempty"` + Lte *int `json:"lte,omitempty"` + Any *bool `json:"any,omitempty"` + Contains *int `json:"contains,omitempty"` +} + +// URL Encoded string of the JSON to match to the data body +type CreateEventBulkRetryRequestQueryBody struct { + typeName string + String string + CreateEventBulkRetryRequestQueryBodyOne *CreateEventBulkRetryRequestQueryBodyOne +} + +func NewCreateEventBulkRetryRequestQueryBodyFromString(value string) *CreateEventBulkRetryRequestQueryBody { + return &CreateEventBulkRetryRequestQueryBody{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryBodyFromCreateEventBulkRetryRequestQueryBodyOne(value *CreateEventBulkRetryRequestQueryBodyOne) *CreateEventBulkRetryRequestQueryBody { + return &CreateEventBulkRetryRequestQueryBody{typeName: "createEventBulkRetryRequestQueryBodyOne", CreateEventBulkRetryRequestQueryBodyOne: value} +} + +func (c *CreateEventBulkRetryRequestQueryBody) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + valueCreateEventBulkRetryRequestQueryBodyOne := new(CreateEventBulkRetryRequestQueryBodyOne) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryBodyOne); err == nil { + c.typeName = "createEventBulkRetryRequestQueryBodyOne" + c.CreateEventBulkRetryRequestQueryBodyOne = valueCreateEventBulkRetryRequestQueryBodyOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryBody) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "createEventBulkRetryRequestQueryBodyOne": + return json.Marshal(c.CreateEventBulkRetryRequestQueryBodyOne) + } +} + +type CreateEventBulkRetryRequestQueryBodyVisitor interface { + VisitString(string) error + VisitCreateEventBulkRetryRequestQueryBodyOne(*CreateEventBulkRetryRequestQueryBodyOne) error +} + +func (c *CreateEventBulkRetryRequestQueryBody) Accept(visitor CreateEventBulkRetryRequestQueryBodyVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "createEventBulkRetryRequestQueryBodyOne": + return visitor.VisitCreateEventBulkRetryRequestQueryBodyOne(c.CreateEventBulkRetryRequestQueryBodyOne) + } +} + +type CreateEventBulkRetryRequestQueryBodyOne struct { +} + +type CreateEventBulkRetryRequestQueryBulkRetryId struct { + typeName string + // `<= 255 characters` + String string + StringList []string +} + +func NewCreateEventBulkRetryRequestQueryBulkRetryIdFromString(value string) *CreateEventBulkRetryRequestQueryBulkRetryId { + return &CreateEventBulkRetryRequestQueryBulkRetryId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryBulkRetryIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryBulkRetryId { + return &CreateEventBulkRetryRequestQueryBulkRetryId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQueryBulkRetryId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryBulkRetryId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryBulkRetryIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQueryBulkRetryId) Accept(visitor CreateEventBulkRetryRequestQueryBulkRetryIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Filter by CLI IDs. `?[any]=true` operator for any CLI. +type CreateEventBulkRetryRequestQueryCliId struct { + typeName string + String string + CreateEventBulkRetryRequestQueryCliIdAny *CreateEventBulkRetryRequestQueryCliIdAny + StringList []string +} + +func NewCreateEventBulkRetryRequestQueryCliIdFromString(value string) *CreateEventBulkRetryRequestQueryCliId { + return &CreateEventBulkRetryRequestQueryCliId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryCliIdFromCreateEventBulkRetryRequestQueryCliIdAny(value *CreateEventBulkRetryRequestQueryCliIdAny) *CreateEventBulkRetryRequestQueryCliId { + return &CreateEventBulkRetryRequestQueryCliId{typeName: "createEventBulkRetryRequestQueryCliIdAny", CreateEventBulkRetryRequestQueryCliIdAny: value} +} + +func NewCreateEventBulkRetryRequestQueryCliIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryCliId { + return &CreateEventBulkRetryRequestQueryCliId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQueryCliId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + valueCreateEventBulkRetryRequestQueryCliIdAny := new(CreateEventBulkRetryRequestQueryCliIdAny) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryCliIdAny); err == nil { + c.typeName = "createEventBulkRetryRequestQueryCliIdAny" + c.CreateEventBulkRetryRequestQueryCliIdAny = valueCreateEventBulkRetryRequestQueryCliIdAny + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryCliId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "createEventBulkRetryRequestQueryCliIdAny": + return json.Marshal(c.CreateEventBulkRetryRequestQueryCliIdAny) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryCliIdVisitor interface { + VisitString(string) error + VisitCreateEventBulkRetryRequestQueryCliIdAny(*CreateEventBulkRetryRequestQueryCliIdAny) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQueryCliId) Accept(visitor CreateEventBulkRetryRequestQueryCliIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "createEventBulkRetryRequestQueryCliIdAny": + return visitor.VisitCreateEventBulkRetryRequestQueryCliIdAny(c.CreateEventBulkRetryRequestQueryCliIdAny) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryCliIdAny struct { + Any *bool `json:"any,omitempty"` +} + +type CreateEventBulkRetryRequestQueryCliUserId struct { + typeName string + String string + StringList []string +} + +func NewCreateEventBulkRetryRequestQueryCliUserIdFromString(value string) *CreateEventBulkRetryRequestQueryCliUserId { + return &CreateEventBulkRetryRequestQueryCliUserId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryCliUserIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryCliUserId { + return &CreateEventBulkRetryRequestQueryCliUserId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQueryCliUserId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryCliUserId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryCliUserIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQueryCliUserId) Accept(visitor CreateEventBulkRetryRequestQueryCliUserIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Filter by `created_at` date using a date operator +type CreateEventBulkRetryRequestQueryCreatedAt struct { + typeName string + DateTime time.Time + CreateEventBulkRetryRequestQueryCreatedAtAny *CreateEventBulkRetryRequestQueryCreatedAtAny +} + +func NewCreateEventBulkRetryRequestQueryCreatedAtFromDateTime(value time.Time) *CreateEventBulkRetryRequestQueryCreatedAt { + return &CreateEventBulkRetryRequestQueryCreatedAt{typeName: "dateTime", DateTime: value} +} + +func NewCreateEventBulkRetryRequestQueryCreatedAtFromCreateEventBulkRetryRequestQueryCreatedAtAny(value *CreateEventBulkRetryRequestQueryCreatedAtAny) *CreateEventBulkRetryRequestQueryCreatedAt { + return &CreateEventBulkRetryRequestQueryCreatedAt{typeName: "createEventBulkRetryRequestQueryCreatedAtAny", CreateEventBulkRetryRequestQueryCreatedAtAny: value} +} + +func (c *CreateEventBulkRetryRequestQueryCreatedAt) UnmarshalJSON(data []byte) error { + var valueDateTime time.Time + if err := json.Unmarshal(data, &valueDateTime); err == nil { + c.typeName = "dateTime" + c.DateTime = valueDateTime + return nil + } + valueCreateEventBulkRetryRequestQueryCreatedAtAny := new(CreateEventBulkRetryRequestQueryCreatedAtAny) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryCreatedAtAny); err == nil { + c.typeName = "createEventBulkRetryRequestQueryCreatedAtAny" + c.CreateEventBulkRetryRequestQueryCreatedAtAny = valueCreateEventBulkRetryRequestQueryCreatedAtAny + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryCreatedAt) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "dateTime": + return json.Marshal(c.DateTime) + case "createEventBulkRetryRequestQueryCreatedAtAny": + return json.Marshal(c.CreateEventBulkRetryRequestQueryCreatedAtAny) + } +} + +type CreateEventBulkRetryRequestQueryCreatedAtVisitor interface { + VisitDateTime(time.Time) error + VisitCreateEventBulkRetryRequestQueryCreatedAtAny(*CreateEventBulkRetryRequestQueryCreatedAtAny) error +} + +func (c *CreateEventBulkRetryRequestQueryCreatedAt) Accept(visitor CreateEventBulkRetryRequestQueryCreatedAtVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "dateTime": + return visitor.VisitDateTime(c.DateTime) + case "createEventBulkRetryRequestQueryCreatedAtAny": + return visitor.VisitCreateEventBulkRetryRequestQueryCreatedAtAny(c.CreateEventBulkRetryRequestQueryCreatedAtAny) + } +} + +type CreateEventBulkRetryRequestQueryCreatedAtAny struct { + Gt *time.Time `json:"gt,omitempty"` + Gte *time.Time `json:"gte,omitempty"` + Le *time.Time `json:"le,omitempty"` + Lte *time.Time `json:"lte,omitempty"` + Any *bool `json:"any,omitempty"` +} + +// Filter by destination IDs +type CreateEventBulkRetryRequestQueryDestinationId struct { + typeName string + // Destination ID `<= 255 characters` + String string + StringList []string +} + +func NewCreateEventBulkRetryRequestQueryDestinationIdFromString(value string) *CreateEventBulkRetryRequestQueryDestinationId { + return &CreateEventBulkRetryRequestQueryDestinationId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryDestinationIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryDestinationId { + return &CreateEventBulkRetryRequestQueryDestinationId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQueryDestinationId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryDestinationId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryDestinationIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQueryDestinationId) Accept(visitor CreateEventBulkRetryRequestQueryDestinationIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Filter by error code code +type CreateEventBulkRetryRequestQueryErrorCode struct { + typeName string + AttemptErrorCodes AttemptErrorCodes + AttemptErrorCodesList []AttemptErrorCodes +} + +func NewCreateEventBulkRetryRequestQueryErrorCodeFromAttemptErrorCodes(value AttemptErrorCodes) *CreateEventBulkRetryRequestQueryErrorCode { + return &CreateEventBulkRetryRequestQueryErrorCode{typeName: "attemptErrorCodes", AttemptErrorCodes: value} +} + +func NewCreateEventBulkRetryRequestQueryErrorCodeFromAttemptErrorCodesList(value []AttemptErrorCodes) *CreateEventBulkRetryRequestQueryErrorCode { + return &CreateEventBulkRetryRequestQueryErrorCode{typeName: "attemptErrorCodesList", AttemptErrorCodesList: value} +} + +func (c *CreateEventBulkRetryRequestQueryErrorCode) UnmarshalJSON(data []byte) error { + var valueAttemptErrorCodes AttemptErrorCodes + if err := json.Unmarshal(data, &valueAttemptErrorCodes); err == nil { + c.typeName = "attemptErrorCodes" + c.AttemptErrorCodes = valueAttemptErrorCodes + return nil + } + var valueAttemptErrorCodesList []AttemptErrorCodes + if err := json.Unmarshal(data, &valueAttemptErrorCodesList); err == nil { + c.typeName = "attemptErrorCodesList" + c.AttemptErrorCodesList = valueAttemptErrorCodesList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryErrorCode) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "attemptErrorCodes": + return json.Marshal(c.AttemptErrorCodes) + case "attemptErrorCodesList": + return json.Marshal(c.AttemptErrorCodesList) + } +} + +type CreateEventBulkRetryRequestQueryErrorCodeVisitor interface { + VisitAttemptErrorCodes(AttemptErrorCodes) error + VisitAttemptErrorCodesList([]AttemptErrorCodes) error +} + +func (c *CreateEventBulkRetryRequestQueryErrorCode) Accept(visitor CreateEventBulkRetryRequestQueryErrorCodeVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "attemptErrorCodes": + return visitor.VisitAttemptErrorCodes(c.AttemptErrorCodes) + case "attemptErrorCodesList": + return visitor.VisitAttemptErrorCodesList(c.AttemptErrorCodesList) + } +} + +type CreateEventBulkRetryRequestQueryEventDataId struct { + typeName string + // `<= 255 characters` + String string + StringList []string +} + +func NewCreateEventBulkRetryRequestQueryEventDataIdFromString(value string) *CreateEventBulkRetryRequestQueryEventDataId { + return &CreateEventBulkRetryRequestQueryEventDataId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryEventDataIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryEventDataId { + return &CreateEventBulkRetryRequestQueryEventDataId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQueryEventDataId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryEventDataId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryEventDataIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQueryEventDataId) Accept(visitor CreateEventBulkRetryRequestQueryEventDataIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// URL Encoded string of the JSON to match to the data headers +type CreateEventBulkRetryRequestQueryHeaders struct { + typeName string + String string + CreateEventBulkRetryRequestQueryHeadersOne *CreateEventBulkRetryRequestQueryHeadersOne +} + +func NewCreateEventBulkRetryRequestQueryHeadersFromString(value string) *CreateEventBulkRetryRequestQueryHeaders { + return &CreateEventBulkRetryRequestQueryHeaders{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryHeadersFromCreateEventBulkRetryRequestQueryHeadersOne(value *CreateEventBulkRetryRequestQueryHeadersOne) *CreateEventBulkRetryRequestQueryHeaders { + return &CreateEventBulkRetryRequestQueryHeaders{typeName: "createEventBulkRetryRequestQueryHeadersOne", CreateEventBulkRetryRequestQueryHeadersOne: value} +} + +func (c *CreateEventBulkRetryRequestQueryHeaders) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + valueCreateEventBulkRetryRequestQueryHeadersOne := new(CreateEventBulkRetryRequestQueryHeadersOne) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryHeadersOne); err == nil { + c.typeName = "createEventBulkRetryRequestQueryHeadersOne" + c.CreateEventBulkRetryRequestQueryHeadersOne = valueCreateEventBulkRetryRequestQueryHeadersOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryHeaders) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "createEventBulkRetryRequestQueryHeadersOne": + return json.Marshal(c.CreateEventBulkRetryRequestQueryHeadersOne) + } +} + +type CreateEventBulkRetryRequestQueryHeadersVisitor interface { + VisitString(string) error + VisitCreateEventBulkRetryRequestQueryHeadersOne(*CreateEventBulkRetryRequestQueryHeadersOne) error +} + +func (c *CreateEventBulkRetryRequestQueryHeaders) Accept(visitor CreateEventBulkRetryRequestQueryHeadersVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "createEventBulkRetryRequestQueryHeadersOne": + return visitor.VisitCreateEventBulkRetryRequestQueryHeadersOne(c.CreateEventBulkRetryRequestQueryHeadersOne) + } +} + +type CreateEventBulkRetryRequestQueryHeadersOne struct { +} + +// Filter by event IDs +type CreateEventBulkRetryRequestQueryId struct { + typeName string + // Event ID `<= 255 characters` + String string + StringList []string +} + +func NewCreateEventBulkRetryRequestQueryIdFromString(value string) *CreateEventBulkRetryRequestQueryId { + return &CreateEventBulkRetryRequestQueryId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryId { + return &CreateEventBulkRetryRequestQueryId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQueryId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQueryId) Accept(visitor CreateEventBulkRetryRequestQueryIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryIssueId struct { + typeName string + // `<= 255 characters` + String string + StringList []string +} + +func NewCreateEventBulkRetryRequestQueryIssueIdFromString(value string) *CreateEventBulkRetryRequestQueryIssueId { + return &CreateEventBulkRetryRequestQueryIssueId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryIssueIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryIssueId { + return &CreateEventBulkRetryRequestQueryIssueId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQueryIssueId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryIssueId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryIssueIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQueryIssueId) Accept(visitor CreateEventBulkRetryRequestQueryIssueIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Filter by `last_attempt_at` date using a date operator +type CreateEventBulkRetryRequestQueryLastAttemptAt struct { + typeName string + DateTime time.Time + CreateEventBulkRetryRequestQueryLastAttemptAtAny *CreateEventBulkRetryRequestQueryLastAttemptAtAny +} + +func NewCreateEventBulkRetryRequestQueryLastAttemptAtFromDateTime(value time.Time) *CreateEventBulkRetryRequestQueryLastAttemptAt { + return &CreateEventBulkRetryRequestQueryLastAttemptAt{typeName: "dateTime", DateTime: value} +} + +func NewCreateEventBulkRetryRequestQueryLastAttemptAtFromCreateEventBulkRetryRequestQueryLastAttemptAtAny(value *CreateEventBulkRetryRequestQueryLastAttemptAtAny) *CreateEventBulkRetryRequestQueryLastAttemptAt { + return &CreateEventBulkRetryRequestQueryLastAttemptAt{typeName: "createEventBulkRetryRequestQueryLastAttemptAtAny", CreateEventBulkRetryRequestQueryLastAttemptAtAny: value} +} + +func (c *CreateEventBulkRetryRequestQueryLastAttemptAt) UnmarshalJSON(data []byte) error { + var valueDateTime time.Time + if err := json.Unmarshal(data, &valueDateTime); err == nil { + c.typeName = "dateTime" + c.DateTime = valueDateTime + return nil + } + valueCreateEventBulkRetryRequestQueryLastAttemptAtAny := new(CreateEventBulkRetryRequestQueryLastAttemptAtAny) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryLastAttemptAtAny); err == nil { + c.typeName = "createEventBulkRetryRequestQueryLastAttemptAtAny" + c.CreateEventBulkRetryRequestQueryLastAttemptAtAny = valueCreateEventBulkRetryRequestQueryLastAttemptAtAny + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryLastAttemptAt) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "dateTime": + return json.Marshal(c.DateTime) + case "createEventBulkRetryRequestQueryLastAttemptAtAny": + return json.Marshal(c.CreateEventBulkRetryRequestQueryLastAttemptAtAny) + } +} + +type CreateEventBulkRetryRequestQueryLastAttemptAtVisitor interface { + VisitDateTime(time.Time) error + VisitCreateEventBulkRetryRequestQueryLastAttemptAtAny(*CreateEventBulkRetryRequestQueryLastAttemptAtAny) error +} + +func (c *CreateEventBulkRetryRequestQueryLastAttemptAt) Accept(visitor CreateEventBulkRetryRequestQueryLastAttemptAtVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "dateTime": + return visitor.VisitDateTime(c.DateTime) + case "createEventBulkRetryRequestQueryLastAttemptAtAny": + return visitor.VisitCreateEventBulkRetryRequestQueryLastAttemptAtAny(c.CreateEventBulkRetryRequestQueryLastAttemptAtAny) + } +} + +type CreateEventBulkRetryRequestQueryLastAttemptAtAny struct { + Gt *time.Time `json:"gt,omitempty"` + Gte *time.Time `json:"gte,omitempty"` + Le *time.Time `json:"le,omitempty"` + Lte *time.Time `json:"lte,omitempty"` + Any *bool `json:"any,omitempty"` +} + +// URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) +type CreateEventBulkRetryRequestQueryParsedQuery struct { + typeName string + String string + CreateEventBulkRetryRequestQueryParsedQueryOne *CreateEventBulkRetryRequestQueryParsedQueryOne +} + +func NewCreateEventBulkRetryRequestQueryParsedQueryFromString(value string) *CreateEventBulkRetryRequestQueryParsedQuery { + return &CreateEventBulkRetryRequestQueryParsedQuery{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryParsedQueryFromCreateEventBulkRetryRequestQueryParsedQueryOne(value *CreateEventBulkRetryRequestQueryParsedQueryOne) *CreateEventBulkRetryRequestQueryParsedQuery { + return &CreateEventBulkRetryRequestQueryParsedQuery{typeName: "createEventBulkRetryRequestQueryParsedQueryOne", CreateEventBulkRetryRequestQueryParsedQueryOne: value} +} + +func (c *CreateEventBulkRetryRequestQueryParsedQuery) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + valueCreateEventBulkRetryRequestQueryParsedQueryOne := new(CreateEventBulkRetryRequestQueryParsedQueryOne) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryParsedQueryOne); err == nil { + c.typeName = "createEventBulkRetryRequestQueryParsedQueryOne" + c.CreateEventBulkRetryRequestQueryParsedQueryOne = valueCreateEventBulkRetryRequestQueryParsedQueryOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryParsedQuery) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "createEventBulkRetryRequestQueryParsedQueryOne": + return json.Marshal(c.CreateEventBulkRetryRequestQueryParsedQueryOne) + } +} + +type CreateEventBulkRetryRequestQueryParsedQueryVisitor interface { + VisitString(string) error + VisitCreateEventBulkRetryRequestQueryParsedQueryOne(*CreateEventBulkRetryRequestQueryParsedQueryOne) error +} + +func (c *CreateEventBulkRetryRequestQueryParsedQuery) Accept(visitor CreateEventBulkRetryRequestQueryParsedQueryVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "createEventBulkRetryRequestQueryParsedQueryOne": + return visitor.VisitCreateEventBulkRetryRequestQueryParsedQueryOne(c.CreateEventBulkRetryRequestQueryParsedQueryOne) + } +} + +type CreateEventBulkRetryRequestQueryParsedQueryOne struct { +} + +// Filter by HTTP response status code +type CreateEventBulkRetryRequestQueryResponseStatus struct { + typeName string + Integer int + CreateEventBulkRetryRequestQueryResponseStatusAny *CreateEventBulkRetryRequestQueryResponseStatusAny + IntegerList []int +} + +func NewCreateEventBulkRetryRequestQueryResponseStatusFromInteger(value int) *CreateEventBulkRetryRequestQueryResponseStatus { + return &CreateEventBulkRetryRequestQueryResponseStatus{typeName: "integer", Integer: value} +} + +func NewCreateEventBulkRetryRequestQueryResponseStatusFromCreateEventBulkRetryRequestQueryResponseStatusAny(value *CreateEventBulkRetryRequestQueryResponseStatusAny) *CreateEventBulkRetryRequestQueryResponseStatus { + return &CreateEventBulkRetryRequestQueryResponseStatus{typeName: "createEventBulkRetryRequestQueryResponseStatusAny", CreateEventBulkRetryRequestQueryResponseStatusAny: value} +} + +func NewCreateEventBulkRetryRequestQueryResponseStatusFromIntegerList(value []int) *CreateEventBulkRetryRequestQueryResponseStatus { + return &CreateEventBulkRetryRequestQueryResponseStatus{typeName: "integerList", IntegerList: value} +} + +func (c *CreateEventBulkRetryRequestQueryResponseStatus) UnmarshalJSON(data []byte) error { + var valueInteger int + if err := json.Unmarshal(data, &valueInteger); err == nil { + c.typeName = "integer" + c.Integer = valueInteger + return nil + } + valueCreateEventBulkRetryRequestQueryResponseStatusAny := new(CreateEventBulkRetryRequestQueryResponseStatusAny) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQueryResponseStatusAny); err == nil { + c.typeName = "createEventBulkRetryRequestQueryResponseStatusAny" + c.CreateEventBulkRetryRequestQueryResponseStatusAny = valueCreateEventBulkRetryRequestQueryResponseStatusAny + return nil + } + var valueIntegerList []int + if err := json.Unmarshal(data, &valueIntegerList); err == nil { + c.typeName = "integerList" + c.IntegerList = valueIntegerList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryResponseStatus) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "integer": + return json.Marshal(c.Integer) + case "createEventBulkRetryRequestQueryResponseStatusAny": + return json.Marshal(c.CreateEventBulkRetryRequestQueryResponseStatusAny) + case "integerList": + return json.Marshal(c.IntegerList) + } +} + +type CreateEventBulkRetryRequestQueryResponseStatusVisitor interface { + VisitInteger(int) error + VisitCreateEventBulkRetryRequestQueryResponseStatusAny(*CreateEventBulkRetryRequestQueryResponseStatusAny) error + VisitIntegerList([]int) error +} + +func (c *CreateEventBulkRetryRequestQueryResponseStatus) Accept(visitor CreateEventBulkRetryRequestQueryResponseStatusVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "integer": + return visitor.VisitInteger(c.Integer) + case "createEventBulkRetryRequestQueryResponseStatusAny": + return visitor.VisitCreateEventBulkRetryRequestQueryResponseStatusAny(c.CreateEventBulkRetryRequestQueryResponseStatusAny) + case "integerList": + return visitor.VisitIntegerList(c.IntegerList) + } +} + +type CreateEventBulkRetryRequestQueryResponseStatusAny struct { + Gt *int `json:"gt,omitempty"` + Gte *int `json:"gte,omitempty"` + Le *int `json:"le,omitempty"` + Lte *int `json:"lte,omitempty"` + Any *bool `json:"any,omitempty"` + Contains *int `json:"contains,omitempty"` +} + +// Filter by source IDs +type CreateEventBulkRetryRequestQuerySourceId struct { + typeName string + // Source ID `<= 255 characters` + String string + StringList []string +} + +func NewCreateEventBulkRetryRequestQuerySourceIdFromString(value string) *CreateEventBulkRetryRequestQuerySourceId { + return &CreateEventBulkRetryRequestQuerySourceId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQuerySourceIdFromStringList(value []string) *CreateEventBulkRetryRequestQuerySourceId { + return &CreateEventBulkRetryRequestQuerySourceId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQuerySourceId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQuerySourceId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQuerySourceIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQuerySourceId) Accept(visitor CreateEventBulkRetryRequestQuerySourceIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Lifecyle status of the event +type CreateEventBulkRetryRequestQueryStatus struct { + typeName string + EventStatus EventStatus + EventStatusList []EventStatus +} + +func NewCreateEventBulkRetryRequestQueryStatusFromEventStatus(value EventStatus) *CreateEventBulkRetryRequestQueryStatus { + return &CreateEventBulkRetryRequestQueryStatus{typeName: "eventStatus", EventStatus: value} +} + +func NewCreateEventBulkRetryRequestQueryStatusFromEventStatusList(value []EventStatus) *CreateEventBulkRetryRequestQueryStatus { + return &CreateEventBulkRetryRequestQueryStatus{typeName: "eventStatusList", EventStatusList: value} +} + +func (c *CreateEventBulkRetryRequestQueryStatus) UnmarshalJSON(data []byte) error { + var valueEventStatus EventStatus + if err := json.Unmarshal(data, &valueEventStatus); err == nil { + c.typeName = "eventStatus" + c.EventStatus = valueEventStatus + return nil + } + var valueEventStatusList []EventStatus + if err := json.Unmarshal(data, &valueEventStatusList); err == nil { + c.typeName = "eventStatusList" + c.EventStatusList = valueEventStatusList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryStatus) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "eventStatus": + return json.Marshal(c.EventStatus) + case "eventStatusList": + return json.Marshal(c.EventStatusList) + } +} + +type CreateEventBulkRetryRequestQueryStatusVisitor interface { + VisitEventStatus(EventStatus) error + VisitEventStatusList([]EventStatus) error +} + +func (c *CreateEventBulkRetryRequestQueryStatus) Accept(visitor CreateEventBulkRetryRequestQueryStatusVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "eventStatus": + return visitor.VisitEventStatus(c.EventStatus) + case "eventStatusList": + return visitor.VisitEventStatusList(c.EventStatusList) + } +} + +// Filter by `successful_at` date using a date operator +type CreateEventBulkRetryRequestQuerySuccessfulAt struct { + typeName string + DateTime time.Time + CreateEventBulkRetryRequestQuerySuccessfulAtAny *CreateEventBulkRetryRequestQuerySuccessfulAtAny +} + +func NewCreateEventBulkRetryRequestQuerySuccessfulAtFromDateTime(value time.Time) *CreateEventBulkRetryRequestQuerySuccessfulAt { + return &CreateEventBulkRetryRequestQuerySuccessfulAt{typeName: "dateTime", DateTime: value} +} + +func NewCreateEventBulkRetryRequestQuerySuccessfulAtFromCreateEventBulkRetryRequestQuerySuccessfulAtAny(value *CreateEventBulkRetryRequestQuerySuccessfulAtAny) *CreateEventBulkRetryRequestQuerySuccessfulAt { + return &CreateEventBulkRetryRequestQuerySuccessfulAt{typeName: "createEventBulkRetryRequestQuerySuccessfulAtAny", CreateEventBulkRetryRequestQuerySuccessfulAtAny: value} +} + +func (c *CreateEventBulkRetryRequestQuerySuccessfulAt) UnmarshalJSON(data []byte) error { + var valueDateTime time.Time + if err := json.Unmarshal(data, &valueDateTime); err == nil { + c.typeName = "dateTime" + c.DateTime = valueDateTime + return nil + } + valueCreateEventBulkRetryRequestQuerySuccessfulAtAny := new(CreateEventBulkRetryRequestQuerySuccessfulAtAny) + if err := json.Unmarshal(data, &valueCreateEventBulkRetryRequestQuerySuccessfulAtAny); err == nil { + c.typeName = "createEventBulkRetryRequestQuerySuccessfulAtAny" + c.CreateEventBulkRetryRequestQuerySuccessfulAtAny = valueCreateEventBulkRetryRequestQuerySuccessfulAtAny + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQuerySuccessfulAt) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "dateTime": + return json.Marshal(c.DateTime) + case "createEventBulkRetryRequestQuerySuccessfulAtAny": + return json.Marshal(c.CreateEventBulkRetryRequestQuerySuccessfulAtAny) + } +} + +type CreateEventBulkRetryRequestQuerySuccessfulAtVisitor interface { + VisitDateTime(time.Time) error + VisitCreateEventBulkRetryRequestQuerySuccessfulAtAny(*CreateEventBulkRetryRequestQuerySuccessfulAtAny) error +} + +func (c *CreateEventBulkRetryRequestQuerySuccessfulAt) Accept(visitor CreateEventBulkRetryRequestQuerySuccessfulAtVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "dateTime": + return visitor.VisitDateTime(c.DateTime) + case "createEventBulkRetryRequestQuerySuccessfulAtAny": + return visitor.VisitCreateEventBulkRetryRequestQuerySuccessfulAtAny(c.CreateEventBulkRetryRequestQuerySuccessfulAtAny) + } +} + +type CreateEventBulkRetryRequestQuerySuccessfulAtAny struct { + Gt *time.Time `json:"gt,omitempty"` + Gte *time.Time `json:"gte,omitempty"` + Le *time.Time `json:"le,omitempty"` + Lte *time.Time `json:"lte,omitempty"` + Any *bool `json:"any,omitempty"` +} + +// Filter by webhook connection IDs +type CreateEventBulkRetryRequestQueryWebhookId struct { + typeName string + // Webhook ID `<= 255 characters` + String string + StringList []string +} + +func NewCreateEventBulkRetryRequestQueryWebhookIdFromString(value string) *CreateEventBulkRetryRequestQueryWebhookId { + return &CreateEventBulkRetryRequestQueryWebhookId{typeName: "string", String: value} +} + +func NewCreateEventBulkRetryRequestQueryWebhookIdFromStringList(value []string) *CreateEventBulkRetryRequestQueryWebhookId { + return &CreateEventBulkRetryRequestQueryWebhookId{typeName: "stringList", StringList: value} +} + +func (c *CreateEventBulkRetryRequestQueryWebhookId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateEventBulkRetryRequestQueryWebhookId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateEventBulkRetryRequestQueryWebhookIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateEventBulkRetryRequestQueryWebhookId) Accept(visitor CreateEventBulkRetryRequestQueryWebhookIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Filter by the bulk retry ignored event query object +type CreateIgnoredEventBulkRetryRequestQuery struct { + // The cause of the ignored event + Cause *CreateIgnoredEventBulkRetryRequestQueryCause `json:"cause,omitempty"` + // Connection ID of the ignored event + WebhookId *CreateIgnoredEventBulkRetryRequestQueryWebhookId `json:"webhook_id,omitempty"` + // The associated transformation ID (only applicable to the cause `TRANSFORMATION_FAILED`) `<= 255 characters` + TransformationId *string `json:"transformation_id,omitempty"` +} + +// The cause of the ignored event +type CreateIgnoredEventBulkRetryRequestQueryCause struct { + typeName string + // `<= 255 characters` + String string + StringList []string +} + +func NewCreateIgnoredEventBulkRetryRequestQueryCauseFromString(value string) *CreateIgnoredEventBulkRetryRequestQueryCause { + return &CreateIgnoredEventBulkRetryRequestQueryCause{typeName: "string", String: value} +} + +func NewCreateIgnoredEventBulkRetryRequestQueryCauseFromStringList(value []string) *CreateIgnoredEventBulkRetryRequestQueryCause { + return &CreateIgnoredEventBulkRetryRequestQueryCause{typeName: "stringList", StringList: value} +} + +func (c *CreateIgnoredEventBulkRetryRequestQueryCause) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateIgnoredEventBulkRetryRequestQueryCause) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateIgnoredEventBulkRetryRequestQueryCauseVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateIgnoredEventBulkRetryRequestQueryCause) Accept(visitor CreateIgnoredEventBulkRetryRequestQueryCauseVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Connection ID of the ignored event +type CreateIgnoredEventBulkRetryRequestQueryWebhookId struct { + typeName string + // `<= 255 characters` + String string + StringList []string +} + +func NewCreateIgnoredEventBulkRetryRequestQueryWebhookIdFromString(value string) *CreateIgnoredEventBulkRetryRequestQueryWebhookId { + return &CreateIgnoredEventBulkRetryRequestQueryWebhookId{typeName: "string", String: value} +} + +func NewCreateIgnoredEventBulkRetryRequestQueryWebhookIdFromStringList(value []string) *CreateIgnoredEventBulkRetryRequestQueryWebhookId { + return &CreateIgnoredEventBulkRetryRequestQueryWebhookId{typeName: "stringList", StringList: value} +} + +func (c *CreateIgnoredEventBulkRetryRequestQueryWebhookId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateIgnoredEventBulkRetryRequestQueryWebhookId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateIgnoredEventBulkRetryRequestQueryWebhookIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateIgnoredEventBulkRetryRequestQueryWebhookId) Accept(visitor CreateIgnoredEventBulkRetryRequestQueryWebhookIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Decrypted Key/Value object of the associated configuration for that provider +type CreateIntegrationRequestConfigs struct { + typeName string + HmacIntegrationConfigs *HmacIntegrationConfigs + ApiKeyIntegrationConfigs *ApiKeyIntegrationConfigs + HandledApiKeyIntegrationConfigs *HandledApiKeyIntegrationConfigs + HandledHmacConfigs *HandledHmacConfigs + BasicAuthIntegrationConfigs *BasicAuthIntegrationConfigs + ShopifyIntegrationConfigs *ShopifyIntegrationConfigs + CreateIntegrationRequestConfigsSix *CreateIntegrationRequestConfigsSix +} + +func NewCreateIntegrationRequestConfigsFromHmacIntegrationConfigs(value *HmacIntegrationConfigs) *CreateIntegrationRequestConfigs { + return &CreateIntegrationRequestConfigs{typeName: "hmacIntegrationConfigs", HmacIntegrationConfigs: value} +} + +func NewCreateIntegrationRequestConfigsFromApiKeyIntegrationConfigs(value *ApiKeyIntegrationConfigs) *CreateIntegrationRequestConfigs { + return &CreateIntegrationRequestConfigs{typeName: "apiKeyIntegrationConfigs", ApiKeyIntegrationConfigs: value} +} + +func NewCreateIntegrationRequestConfigsFromHandledApiKeyIntegrationConfigs(value *HandledApiKeyIntegrationConfigs) *CreateIntegrationRequestConfigs { + return &CreateIntegrationRequestConfigs{typeName: "handledApiKeyIntegrationConfigs", HandledApiKeyIntegrationConfigs: value} +} + +func NewCreateIntegrationRequestConfigsFromHandledHmacConfigs(value *HandledHmacConfigs) *CreateIntegrationRequestConfigs { + return &CreateIntegrationRequestConfigs{typeName: "handledHmacConfigs", HandledHmacConfigs: value} +} + +func NewCreateIntegrationRequestConfigsFromBasicAuthIntegrationConfigs(value *BasicAuthIntegrationConfigs) *CreateIntegrationRequestConfigs { + return &CreateIntegrationRequestConfigs{typeName: "basicAuthIntegrationConfigs", BasicAuthIntegrationConfigs: value} +} + +func NewCreateIntegrationRequestConfigsFromShopifyIntegrationConfigs(value *ShopifyIntegrationConfigs) *CreateIntegrationRequestConfigs { + return &CreateIntegrationRequestConfigs{typeName: "shopifyIntegrationConfigs", ShopifyIntegrationConfigs: value} +} + +func NewCreateIntegrationRequestConfigsFromCreateIntegrationRequestConfigsSix(value *CreateIntegrationRequestConfigsSix) *CreateIntegrationRequestConfigs { + return &CreateIntegrationRequestConfigs{typeName: "createIntegrationRequestConfigsSix", CreateIntegrationRequestConfigsSix: value} +} + +func (c *CreateIntegrationRequestConfigs) UnmarshalJSON(data []byte) error { + valueHmacIntegrationConfigs := new(HmacIntegrationConfigs) + if err := json.Unmarshal(data, &valueHmacIntegrationConfigs); err == nil { + c.typeName = "hmacIntegrationConfigs" + c.HmacIntegrationConfigs = valueHmacIntegrationConfigs + return nil + } + valueApiKeyIntegrationConfigs := new(ApiKeyIntegrationConfigs) + if err := json.Unmarshal(data, &valueApiKeyIntegrationConfigs); err == nil { + c.typeName = "apiKeyIntegrationConfigs" + c.ApiKeyIntegrationConfigs = valueApiKeyIntegrationConfigs + return nil + } + valueHandledApiKeyIntegrationConfigs := new(HandledApiKeyIntegrationConfigs) + if err := json.Unmarshal(data, &valueHandledApiKeyIntegrationConfigs); err == nil { + c.typeName = "handledApiKeyIntegrationConfigs" + c.HandledApiKeyIntegrationConfigs = valueHandledApiKeyIntegrationConfigs + return nil + } + valueHandledHmacConfigs := new(HandledHmacConfigs) + if err := json.Unmarshal(data, &valueHandledHmacConfigs); err == nil { + c.typeName = "handledHmacConfigs" + c.HandledHmacConfigs = valueHandledHmacConfigs + return nil + } + valueBasicAuthIntegrationConfigs := new(BasicAuthIntegrationConfigs) + if err := json.Unmarshal(data, &valueBasicAuthIntegrationConfigs); err == nil { + c.typeName = "basicAuthIntegrationConfigs" + c.BasicAuthIntegrationConfigs = valueBasicAuthIntegrationConfigs + return nil + } + valueShopifyIntegrationConfigs := new(ShopifyIntegrationConfigs) + if err := json.Unmarshal(data, &valueShopifyIntegrationConfigs); err == nil { + c.typeName = "shopifyIntegrationConfigs" + c.ShopifyIntegrationConfigs = valueShopifyIntegrationConfigs + return nil + } + valueCreateIntegrationRequestConfigsSix := new(CreateIntegrationRequestConfigsSix) + if err := json.Unmarshal(data, &valueCreateIntegrationRequestConfigsSix); err == nil { + c.typeName = "createIntegrationRequestConfigsSix" + c.CreateIntegrationRequestConfigsSix = valueCreateIntegrationRequestConfigsSix + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateIntegrationRequestConfigs) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "hmacIntegrationConfigs": + return json.Marshal(c.HmacIntegrationConfigs) + case "apiKeyIntegrationConfigs": + return json.Marshal(c.ApiKeyIntegrationConfigs) + case "handledApiKeyIntegrationConfigs": + return json.Marshal(c.HandledApiKeyIntegrationConfigs) + case "handledHmacConfigs": + return json.Marshal(c.HandledHmacConfigs) + case "basicAuthIntegrationConfigs": + return json.Marshal(c.BasicAuthIntegrationConfigs) + case "shopifyIntegrationConfigs": + return json.Marshal(c.ShopifyIntegrationConfigs) + case "createIntegrationRequestConfigsSix": + return json.Marshal(c.CreateIntegrationRequestConfigsSix) + } +} + +type CreateIntegrationRequestConfigsVisitor interface { + VisitHmacIntegrationConfigs(*HmacIntegrationConfigs) error + VisitApiKeyIntegrationConfigs(*ApiKeyIntegrationConfigs) error + VisitHandledApiKeyIntegrationConfigs(*HandledApiKeyIntegrationConfigs) error + VisitHandledHmacConfigs(*HandledHmacConfigs) error + VisitBasicAuthIntegrationConfigs(*BasicAuthIntegrationConfigs) error + VisitShopifyIntegrationConfigs(*ShopifyIntegrationConfigs) error + VisitCreateIntegrationRequestConfigsSix(*CreateIntegrationRequestConfigsSix) error +} + +func (c *CreateIntegrationRequestConfigs) Accept(visitor CreateIntegrationRequestConfigsVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "hmacIntegrationConfigs": + return visitor.VisitHmacIntegrationConfigs(c.HmacIntegrationConfigs) + case "apiKeyIntegrationConfigs": + return visitor.VisitApiKeyIntegrationConfigs(c.ApiKeyIntegrationConfigs) + case "handledApiKeyIntegrationConfigs": + return visitor.VisitHandledApiKeyIntegrationConfigs(c.HandledApiKeyIntegrationConfigs) + case "handledHmacConfigs": + return visitor.VisitHandledHmacConfigs(c.HandledHmacConfigs) + case "basicAuthIntegrationConfigs": + return visitor.VisitBasicAuthIntegrationConfigs(c.BasicAuthIntegrationConfigs) + case "shopifyIntegrationConfigs": + return visitor.VisitShopifyIntegrationConfigs(c.ShopifyIntegrationConfigs) + case "createIntegrationRequestConfigsSix": + return visitor.VisitCreateIntegrationRequestConfigsSix(c.CreateIntegrationRequestConfigsSix) + } +} + +type CreateIntegrationRequestConfigsSix struct { +} + +// Configuration object for the specific issue type selected +type CreateIssueTriggerRequestConfigs struct { + typeName string + IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs + IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs + IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs +} + +func NewCreateIssueTriggerRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *CreateIssueTriggerRequestConfigs { + return &CreateIssueTriggerRequestConfigs{typeName: "issueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} +} + +func NewCreateIssueTriggerRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *CreateIssueTriggerRequestConfigs { + return &CreateIssueTriggerRequestConfigs{typeName: "issueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} +} + +func NewCreateIssueTriggerRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *CreateIssueTriggerRequestConfigs { + return &CreateIssueTriggerRequestConfigs{typeName: "issueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} +} + +func (c *CreateIssueTriggerRequestConfigs) UnmarshalJSON(data []byte) error { + valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { + c.typeName = "issueTriggerDeliveryConfigs" + c.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs + return nil + } + valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { + c.typeName = "issueTriggerTransformationConfigs" + c.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs + return nil + } + valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { + c.typeName = "issueTriggerBackpressureConfigs" + c.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateIssueTriggerRequestConfigs) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "issueTriggerDeliveryConfigs": + return json.Marshal(c.IssueTriggerDeliveryConfigs) + case "issueTriggerTransformationConfigs": + return json.Marshal(c.IssueTriggerTransformationConfigs) + case "issueTriggerBackpressureConfigs": + return json.Marshal(c.IssueTriggerBackpressureConfigs) + } +} + +type CreateIssueTriggerRequestConfigsVisitor interface { + VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error + VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error + VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error +} + +func (c *CreateIssueTriggerRequestConfigs) Accept(visitor CreateIssueTriggerRequestConfigsVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "issueTriggerDeliveryConfigs": + return visitor.VisitIssueTriggerDeliveryConfigs(c.IssueTriggerDeliveryConfigs) + case "issueTriggerTransformationConfigs": + return visitor.VisitIssueTriggerTransformationConfigs(c.IssueTriggerTransformationConfigs) + case "issueTriggerBackpressureConfigs": + return visitor.VisitIssueTriggerBackpressureConfigs(c.IssueTriggerBackpressureConfigs) + } +} + +// Filter properties for the events to be included in the bulk retry, use query parameters of [Requests](#requests) +type CreateRequestBulkRetryRequestQuery struct { + // Filter by requests IDs + Id *CreateRequestBulkRetryRequestQueryId `json:"id,omitempty"` + // Filter by status + Status *CreateRequestBulkRetryRequestQueryStatus `json:"status,omitempty"` + // Filter by rejection cause + RejectionCause *CreateRequestBulkRetryRequestQueryRejectionCause `json:"rejection_cause,omitempty"` + // Filter by source IDs + SourceId *CreateRequestBulkRetryRequestQuerySourceId `json:"source_id,omitempty"` + // Filter by verification status + Verified *bool `json:"verified,omitempty"` + // URL Encoded string of the value to match partially to the body, headers, parsed_query or path + SearchTerm *string `json:"search_term,omitempty"` + // URL Encoded string of the JSON to match to the data headers + Headers *CreateRequestBulkRetryRequestQueryHeaders `json:"headers,omitempty"` + // URL Encoded string of the JSON to match to the data body + Body *CreateRequestBulkRetryRequestQueryBody `json:"body,omitempty"` + // URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) + ParsedQuery *CreateRequestBulkRetryRequestQueryParsedQuery `json:"parsed_query,omitempty"` + // URL Encoded string of the value to match partially to the path + Path *string `json:"path,omitempty"` + // Filter by count of ignored events + IgnoredCount *CreateRequestBulkRetryRequestQueryIgnoredCount `json:"ignored_count,omitempty"` + // Filter by count of events + EventsCount *CreateRequestBulkRetryRequestQueryEventsCount `json:"events_count,omitempty"` + // Filter by event ingested date + IngestedAt *CreateRequestBulkRetryRequestQueryIngestedAt `json:"ingested_at,omitempty"` + BulkRetryId *CreateRequestBulkRetryRequestQueryBulkRetryId `json:"bulk_retry_id,omitempty"` +} + +// URL Encoded string of the JSON to match to the data body +type CreateRequestBulkRetryRequestQueryBody struct { + typeName string + String string + CreateRequestBulkRetryRequestQueryBodyOne *CreateRequestBulkRetryRequestQueryBodyOne +} + +func NewCreateRequestBulkRetryRequestQueryBodyFromString(value string) *CreateRequestBulkRetryRequestQueryBody { + return &CreateRequestBulkRetryRequestQueryBody{typeName: "string", String: value} +} + +func NewCreateRequestBulkRetryRequestQueryBodyFromCreateRequestBulkRetryRequestQueryBodyOne(value *CreateRequestBulkRetryRequestQueryBodyOne) *CreateRequestBulkRetryRequestQueryBody { + return &CreateRequestBulkRetryRequestQueryBody{typeName: "createRequestBulkRetryRequestQueryBodyOne", CreateRequestBulkRetryRequestQueryBodyOne: value} +} + +func (c *CreateRequestBulkRetryRequestQueryBody) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + valueCreateRequestBulkRetryRequestQueryBodyOne := new(CreateRequestBulkRetryRequestQueryBodyOne) + if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryBodyOne); err == nil { + c.typeName = "createRequestBulkRetryRequestQueryBodyOne" + c.CreateRequestBulkRetryRequestQueryBodyOne = valueCreateRequestBulkRetryRequestQueryBodyOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryBody) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "createRequestBulkRetryRequestQueryBodyOne": + return json.Marshal(c.CreateRequestBulkRetryRequestQueryBodyOne) + } +} + +type CreateRequestBulkRetryRequestQueryBodyVisitor interface { + VisitString(string) error + VisitCreateRequestBulkRetryRequestQueryBodyOne(*CreateRequestBulkRetryRequestQueryBodyOne) error +} + +func (c *CreateRequestBulkRetryRequestQueryBody) Accept(visitor CreateRequestBulkRetryRequestQueryBodyVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "createRequestBulkRetryRequestQueryBodyOne": + return visitor.VisitCreateRequestBulkRetryRequestQueryBodyOne(c.CreateRequestBulkRetryRequestQueryBodyOne) + } +} + +type CreateRequestBulkRetryRequestQueryBodyOne struct { +} + +type CreateRequestBulkRetryRequestQueryBulkRetryId struct { + typeName string + // `<= 255 characters` + String string + StringList []string +} + +func NewCreateRequestBulkRetryRequestQueryBulkRetryIdFromString(value string) *CreateRequestBulkRetryRequestQueryBulkRetryId { + return &CreateRequestBulkRetryRequestQueryBulkRetryId{typeName: "string", String: value} +} + +func NewCreateRequestBulkRetryRequestQueryBulkRetryIdFromStringList(value []string) *CreateRequestBulkRetryRequestQueryBulkRetryId { + return &CreateRequestBulkRetryRequestQueryBulkRetryId{typeName: "stringList", StringList: value} +} + +func (c *CreateRequestBulkRetryRequestQueryBulkRetryId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryBulkRetryId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateRequestBulkRetryRequestQueryBulkRetryIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateRequestBulkRetryRequestQueryBulkRetryId) Accept(visitor CreateRequestBulkRetryRequestQueryBulkRetryIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Filter by count of events +type CreateRequestBulkRetryRequestQueryEventsCount struct { + typeName string + Integer int + CreateRequestBulkRetryRequestQueryEventsCountAny *CreateRequestBulkRetryRequestQueryEventsCountAny + IntegerList []int +} + +func NewCreateRequestBulkRetryRequestQueryEventsCountFromInteger(value int) *CreateRequestBulkRetryRequestQueryEventsCount { + return &CreateRequestBulkRetryRequestQueryEventsCount{typeName: "integer", Integer: value} +} + +func NewCreateRequestBulkRetryRequestQueryEventsCountFromCreateRequestBulkRetryRequestQueryEventsCountAny(value *CreateRequestBulkRetryRequestQueryEventsCountAny) *CreateRequestBulkRetryRequestQueryEventsCount { + return &CreateRequestBulkRetryRequestQueryEventsCount{typeName: "createRequestBulkRetryRequestQueryEventsCountAny", CreateRequestBulkRetryRequestQueryEventsCountAny: value} +} + +func NewCreateRequestBulkRetryRequestQueryEventsCountFromIntegerList(value []int) *CreateRequestBulkRetryRequestQueryEventsCount { + return &CreateRequestBulkRetryRequestQueryEventsCount{typeName: "integerList", IntegerList: value} +} + +func (c *CreateRequestBulkRetryRequestQueryEventsCount) UnmarshalJSON(data []byte) error { + var valueInteger int + if err := json.Unmarshal(data, &valueInteger); err == nil { + c.typeName = "integer" + c.Integer = valueInteger + return nil + } + valueCreateRequestBulkRetryRequestQueryEventsCountAny := new(CreateRequestBulkRetryRequestQueryEventsCountAny) + if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryEventsCountAny); err == nil { + c.typeName = "createRequestBulkRetryRequestQueryEventsCountAny" + c.CreateRequestBulkRetryRequestQueryEventsCountAny = valueCreateRequestBulkRetryRequestQueryEventsCountAny + return nil + } + var valueIntegerList []int + if err := json.Unmarshal(data, &valueIntegerList); err == nil { + c.typeName = "integerList" + c.IntegerList = valueIntegerList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryEventsCount) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "integer": + return json.Marshal(c.Integer) + case "createRequestBulkRetryRequestQueryEventsCountAny": + return json.Marshal(c.CreateRequestBulkRetryRequestQueryEventsCountAny) + case "integerList": + return json.Marshal(c.IntegerList) + } +} + +type CreateRequestBulkRetryRequestQueryEventsCountVisitor interface { + VisitInteger(int) error + VisitCreateRequestBulkRetryRequestQueryEventsCountAny(*CreateRequestBulkRetryRequestQueryEventsCountAny) error + VisitIntegerList([]int) error +} + +func (c *CreateRequestBulkRetryRequestQueryEventsCount) Accept(visitor CreateRequestBulkRetryRequestQueryEventsCountVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "integer": + return visitor.VisitInteger(c.Integer) + case "createRequestBulkRetryRequestQueryEventsCountAny": + return visitor.VisitCreateRequestBulkRetryRequestQueryEventsCountAny(c.CreateRequestBulkRetryRequestQueryEventsCountAny) + case "integerList": + return visitor.VisitIntegerList(c.IntegerList) + } +} + +type CreateRequestBulkRetryRequestQueryEventsCountAny struct { + Gt *int `json:"gt,omitempty"` + Gte *int `json:"gte,omitempty"` + Le *int `json:"le,omitempty"` + Lte *int `json:"lte,omitempty"` + Any *bool `json:"any,omitempty"` + Contains *int `json:"contains,omitempty"` +} + +// URL Encoded string of the JSON to match to the data headers +type CreateRequestBulkRetryRequestQueryHeaders struct { + typeName string + String string + CreateRequestBulkRetryRequestQueryHeadersOne *CreateRequestBulkRetryRequestQueryHeadersOne +} + +func NewCreateRequestBulkRetryRequestQueryHeadersFromString(value string) *CreateRequestBulkRetryRequestQueryHeaders { + return &CreateRequestBulkRetryRequestQueryHeaders{typeName: "string", String: value} +} + +func NewCreateRequestBulkRetryRequestQueryHeadersFromCreateRequestBulkRetryRequestQueryHeadersOne(value *CreateRequestBulkRetryRequestQueryHeadersOne) *CreateRequestBulkRetryRequestQueryHeaders { + return &CreateRequestBulkRetryRequestQueryHeaders{typeName: "createRequestBulkRetryRequestQueryHeadersOne", CreateRequestBulkRetryRequestQueryHeadersOne: value} +} + +func (c *CreateRequestBulkRetryRequestQueryHeaders) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + valueCreateRequestBulkRetryRequestQueryHeadersOne := new(CreateRequestBulkRetryRequestQueryHeadersOne) + if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryHeadersOne); err == nil { + c.typeName = "createRequestBulkRetryRequestQueryHeadersOne" + c.CreateRequestBulkRetryRequestQueryHeadersOne = valueCreateRequestBulkRetryRequestQueryHeadersOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryHeaders) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "createRequestBulkRetryRequestQueryHeadersOne": + return json.Marshal(c.CreateRequestBulkRetryRequestQueryHeadersOne) + } +} + +type CreateRequestBulkRetryRequestQueryHeadersVisitor interface { + VisitString(string) error + VisitCreateRequestBulkRetryRequestQueryHeadersOne(*CreateRequestBulkRetryRequestQueryHeadersOne) error +} + +func (c *CreateRequestBulkRetryRequestQueryHeaders) Accept(visitor CreateRequestBulkRetryRequestQueryHeadersVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "createRequestBulkRetryRequestQueryHeadersOne": + return visitor.VisitCreateRequestBulkRetryRequestQueryHeadersOne(c.CreateRequestBulkRetryRequestQueryHeadersOne) + } +} + +type CreateRequestBulkRetryRequestQueryHeadersOne struct { +} + +// Filter by requests IDs +type CreateRequestBulkRetryRequestQueryId struct { + typeName string + // Request ID `<= 255 characters` + String string + StringList []string +} + +func NewCreateRequestBulkRetryRequestQueryIdFromString(value string) *CreateRequestBulkRetryRequestQueryId { + return &CreateRequestBulkRetryRequestQueryId{typeName: "string", String: value} +} + +func NewCreateRequestBulkRetryRequestQueryIdFromStringList(value []string) *CreateRequestBulkRetryRequestQueryId { + return &CreateRequestBulkRetryRequestQueryId{typeName: "stringList", StringList: value} +} + +func (c *CreateRequestBulkRetryRequestQueryId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateRequestBulkRetryRequestQueryIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateRequestBulkRetryRequestQueryId) Accept(visitor CreateRequestBulkRetryRequestQueryIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Filter by count of ignored events +type CreateRequestBulkRetryRequestQueryIgnoredCount struct { + typeName string + Integer int + CreateRequestBulkRetryRequestQueryIgnoredCountAny *CreateRequestBulkRetryRequestQueryIgnoredCountAny + IntegerList []int +} + +func NewCreateRequestBulkRetryRequestQueryIgnoredCountFromInteger(value int) *CreateRequestBulkRetryRequestQueryIgnoredCount { + return &CreateRequestBulkRetryRequestQueryIgnoredCount{typeName: "integer", Integer: value} +} + +func NewCreateRequestBulkRetryRequestQueryIgnoredCountFromCreateRequestBulkRetryRequestQueryIgnoredCountAny(value *CreateRequestBulkRetryRequestQueryIgnoredCountAny) *CreateRequestBulkRetryRequestQueryIgnoredCount { + return &CreateRequestBulkRetryRequestQueryIgnoredCount{typeName: "createRequestBulkRetryRequestQueryIgnoredCountAny", CreateRequestBulkRetryRequestQueryIgnoredCountAny: value} +} + +func NewCreateRequestBulkRetryRequestQueryIgnoredCountFromIntegerList(value []int) *CreateRequestBulkRetryRequestQueryIgnoredCount { + return &CreateRequestBulkRetryRequestQueryIgnoredCount{typeName: "integerList", IntegerList: value} +} + +func (c *CreateRequestBulkRetryRequestQueryIgnoredCount) UnmarshalJSON(data []byte) error { + var valueInteger int + if err := json.Unmarshal(data, &valueInteger); err == nil { + c.typeName = "integer" + c.Integer = valueInteger + return nil + } + valueCreateRequestBulkRetryRequestQueryIgnoredCountAny := new(CreateRequestBulkRetryRequestQueryIgnoredCountAny) + if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryIgnoredCountAny); err == nil { + c.typeName = "createRequestBulkRetryRequestQueryIgnoredCountAny" + c.CreateRequestBulkRetryRequestQueryIgnoredCountAny = valueCreateRequestBulkRetryRequestQueryIgnoredCountAny + return nil + } + var valueIntegerList []int + if err := json.Unmarshal(data, &valueIntegerList); err == nil { + c.typeName = "integerList" + c.IntegerList = valueIntegerList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryIgnoredCount) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "integer": + return json.Marshal(c.Integer) + case "createRequestBulkRetryRequestQueryIgnoredCountAny": + return json.Marshal(c.CreateRequestBulkRetryRequestQueryIgnoredCountAny) + case "integerList": + return json.Marshal(c.IntegerList) + } +} + +type CreateRequestBulkRetryRequestQueryIgnoredCountVisitor interface { + VisitInteger(int) error + VisitCreateRequestBulkRetryRequestQueryIgnoredCountAny(*CreateRequestBulkRetryRequestQueryIgnoredCountAny) error + VisitIntegerList([]int) error +} + +func (c *CreateRequestBulkRetryRequestQueryIgnoredCount) Accept(visitor CreateRequestBulkRetryRequestQueryIgnoredCountVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "integer": + return visitor.VisitInteger(c.Integer) + case "createRequestBulkRetryRequestQueryIgnoredCountAny": + return visitor.VisitCreateRequestBulkRetryRequestQueryIgnoredCountAny(c.CreateRequestBulkRetryRequestQueryIgnoredCountAny) + case "integerList": + return visitor.VisitIntegerList(c.IntegerList) + } +} + +type CreateRequestBulkRetryRequestQueryIgnoredCountAny struct { + Gt *int `json:"gt,omitempty"` + Gte *int `json:"gte,omitempty"` + Le *int `json:"le,omitempty"` + Lte *int `json:"lte,omitempty"` + Any *bool `json:"any,omitempty"` + Contains *int `json:"contains,omitempty"` +} + +// Filter by event ingested date +type CreateRequestBulkRetryRequestQueryIngestedAt struct { + typeName string + DateTime time.Time + CreateRequestBulkRetryRequestQueryIngestedAtAny *CreateRequestBulkRetryRequestQueryIngestedAtAny +} + +func NewCreateRequestBulkRetryRequestQueryIngestedAtFromDateTime(value time.Time) *CreateRequestBulkRetryRequestQueryIngestedAt { + return &CreateRequestBulkRetryRequestQueryIngestedAt{typeName: "dateTime", DateTime: value} +} + +func NewCreateRequestBulkRetryRequestQueryIngestedAtFromCreateRequestBulkRetryRequestQueryIngestedAtAny(value *CreateRequestBulkRetryRequestQueryIngestedAtAny) *CreateRequestBulkRetryRequestQueryIngestedAt { + return &CreateRequestBulkRetryRequestQueryIngestedAt{typeName: "createRequestBulkRetryRequestQueryIngestedAtAny", CreateRequestBulkRetryRequestQueryIngestedAtAny: value} +} + +func (c *CreateRequestBulkRetryRequestQueryIngestedAt) UnmarshalJSON(data []byte) error { + var valueDateTime time.Time + if err := json.Unmarshal(data, &valueDateTime); err == nil { + c.typeName = "dateTime" + c.DateTime = valueDateTime + return nil + } + valueCreateRequestBulkRetryRequestQueryIngestedAtAny := new(CreateRequestBulkRetryRequestQueryIngestedAtAny) + if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryIngestedAtAny); err == nil { + c.typeName = "createRequestBulkRetryRequestQueryIngestedAtAny" + c.CreateRequestBulkRetryRequestQueryIngestedAtAny = valueCreateRequestBulkRetryRequestQueryIngestedAtAny + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryIngestedAt) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "dateTime": + return json.Marshal(c.DateTime) + case "createRequestBulkRetryRequestQueryIngestedAtAny": + return json.Marshal(c.CreateRequestBulkRetryRequestQueryIngestedAtAny) + } +} + +type CreateRequestBulkRetryRequestQueryIngestedAtVisitor interface { + VisitDateTime(time.Time) error + VisitCreateRequestBulkRetryRequestQueryIngestedAtAny(*CreateRequestBulkRetryRequestQueryIngestedAtAny) error +} + +func (c *CreateRequestBulkRetryRequestQueryIngestedAt) Accept(visitor CreateRequestBulkRetryRequestQueryIngestedAtVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "dateTime": + return visitor.VisitDateTime(c.DateTime) + case "createRequestBulkRetryRequestQueryIngestedAtAny": + return visitor.VisitCreateRequestBulkRetryRequestQueryIngestedAtAny(c.CreateRequestBulkRetryRequestQueryIngestedAtAny) + } +} + +type CreateRequestBulkRetryRequestQueryIngestedAtAny struct { + Gt *time.Time `json:"gt,omitempty"` + Gte *time.Time `json:"gte,omitempty"` + Le *time.Time `json:"le,omitempty"` + Lte *time.Time `json:"lte,omitempty"` + Any *bool `json:"any,omitempty"` +} + +// URL Encoded string of the JSON to match to the parsed query (JSON representation of the query) +type CreateRequestBulkRetryRequestQueryParsedQuery struct { + typeName string + String string + CreateRequestBulkRetryRequestQueryParsedQueryOne *CreateRequestBulkRetryRequestQueryParsedQueryOne +} + +func NewCreateRequestBulkRetryRequestQueryParsedQueryFromString(value string) *CreateRequestBulkRetryRequestQueryParsedQuery { + return &CreateRequestBulkRetryRequestQueryParsedQuery{typeName: "string", String: value} +} + +func NewCreateRequestBulkRetryRequestQueryParsedQueryFromCreateRequestBulkRetryRequestQueryParsedQueryOne(value *CreateRequestBulkRetryRequestQueryParsedQueryOne) *CreateRequestBulkRetryRequestQueryParsedQuery { + return &CreateRequestBulkRetryRequestQueryParsedQuery{typeName: "createRequestBulkRetryRequestQueryParsedQueryOne", CreateRequestBulkRetryRequestQueryParsedQueryOne: value} +} + +func (c *CreateRequestBulkRetryRequestQueryParsedQuery) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + valueCreateRequestBulkRetryRequestQueryParsedQueryOne := new(CreateRequestBulkRetryRequestQueryParsedQueryOne) + if err := json.Unmarshal(data, &valueCreateRequestBulkRetryRequestQueryParsedQueryOne); err == nil { + c.typeName = "createRequestBulkRetryRequestQueryParsedQueryOne" + c.CreateRequestBulkRetryRequestQueryParsedQueryOne = valueCreateRequestBulkRetryRequestQueryParsedQueryOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryParsedQuery) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "createRequestBulkRetryRequestQueryParsedQueryOne": + return json.Marshal(c.CreateRequestBulkRetryRequestQueryParsedQueryOne) + } +} + +type CreateRequestBulkRetryRequestQueryParsedQueryVisitor interface { + VisitString(string) error + VisitCreateRequestBulkRetryRequestQueryParsedQueryOne(*CreateRequestBulkRetryRequestQueryParsedQueryOne) error +} + +func (c *CreateRequestBulkRetryRequestQueryParsedQuery) Accept(visitor CreateRequestBulkRetryRequestQueryParsedQueryVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "createRequestBulkRetryRequestQueryParsedQueryOne": + return visitor.VisitCreateRequestBulkRetryRequestQueryParsedQueryOne(c.CreateRequestBulkRetryRequestQueryParsedQueryOne) + } +} + +type CreateRequestBulkRetryRequestQueryParsedQueryOne struct { +} + +// Filter by rejection cause +type CreateRequestBulkRetryRequestQueryRejectionCause struct { + typeName string + RequestRejectionCause RequestRejectionCause + RequestRejectionCauseList []RequestRejectionCause +} + +func NewCreateRequestBulkRetryRequestQueryRejectionCauseFromRequestRejectionCause(value RequestRejectionCause) *CreateRequestBulkRetryRequestQueryRejectionCause { + return &CreateRequestBulkRetryRequestQueryRejectionCause{typeName: "requestRejectionCause", RequestRejectionCause: value} +} + +func NewCreateRequestBulkRetryRequestQueryRejectionCauseFromRequestRejectionCauseList(value []RequestRejectionCause) *CreateRequestBulkRetryRequestQueryRejectionCause { + return &CreateRequestBulkRetryRequestQueryRejectionCause{typeName: "requestRejectionCauseList", RequestRejectionCauseList: value} +} + +func (c *CreateRequestBulkRetryRequestQueryRejectionCause) UnmarshalJSON(data []byte) error { + var valueRequestRejectionCause RequestRejectionCause + if err := json.Unmarshal(data, &valueRequestRejectionCause); err == nil { + c.typeName = "requestRejectionCause" + c.RequestRejectionCause = valueRequestRejectionCause + return nil + } + var valueRequestRejectionCauseList []RequestRejectionCause + if err := json.Unmarshal(data, &valueRequestRejectionCauseList); err == nil { + c.typeName = "requestRejectionCauseList" + c.RequestRejectionCauseList = valueRequestRejectionCauseList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQueryRejectionCause) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "requestRejectionCause": + return json.Marshal(c.RequestRejectionCause) + case "requestRejectionCauseList": + return json.Marshal(c.RequestRejectionCauseList) + } +} + +type CreateRequestBulkRetryRequestQueryRejectionCauseVisitor interface { + VisitRequestRejectionCause(RequestRejectionCause) error + VisitRequestRejectionCauseList([]RequestRejectionCause) error +} + +func (c *CreateRequestBulkRetryRequestQueryRejectionCause) Accept(visitor CreateRequestBulkRetryRequestQueryRejectionCauseVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "requestRejectionCause": + return visitor.VisitRequestRejectionCause(c.RequestRejectionCause) + case "requestRejectionCauseList": + return visitor.VisitRequestRejectionCauseList(c.RequestRejectionCauseList) + } +} + +// Filter by source IDs +type CreateRequestBulkRetryRequestQuerySourceId struct { + typeName string + // Source ID `<= 255 characters` + String string + StringList []string +} + +func NewCreateRequestBulkRetryRequestQuerySourceIdFromString(value string) *CreateRequestBulkRetryRequestQuerySourceId { + return &CreateRequestBulkRetryRequestQuerySourceId{typeName: "string", String: value} +} + +func NewCreateRequestBulkRetryRequestQuerySourceIdFromStringList(value []string) *CreateRequestBulkRetryRequestQuerySourceId { + return &CreateRequestBulkRetryRequestQuerySourceId{typeName: "stringList", StringList: value} +} + +func (c *CreateRequestBulkRetryRequestQuerySourceId) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + c.typeName = "stringList" + c.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateRequestBulkRetryRequestQuerySourceId) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "stringList": + return json.Marshal(c.StringList) + } +} + +type CreateRequestBulkRetryRequestQuerySourceIdVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (c *CreateRequestBulkRetryRequestQuerySourceId) Accept(visitor CreateRequestBulkRetryRequestQuerySourceIdVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "stringList": + return visitor.VisitStringList(c.StringList) + } +} + +// Filter by status +type CreateRequestBulkRetryRequestQueryStatus uint + +const ( + CreateRequestBulkRetryRequestQueryStatusAccepted CreateRequestBulkRetryRequestQueryStatus = iota + 1 + CreateRequestBulkRetryRequestQueryStatusRejected +) + +func (c CreateRequestBulkRetryRequestQueryStatus) String() string { + switch c { + default: + return strconv.Itoa(int(c)) + case CreateRequestBulkRetryRequestQueryStatusAccepted: + return "accepted" + case CreateRequestBulkRetryRequestQueryStatusRejected: + return "rejected" + } +} + +func (c CreateRequestBulkRetryRequestQueryStatus) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", c.String())), nil +} + +func (c *CreateRequestBulkRetryRequestQueryStatus) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "accepted": + value := CreateRequestBulkRetryRequestQueryStatusAccepted + *c = value + case "rejected": + value := CreateRequestBulkRetryRequestQueryStatusRejected + *c = value + } + return nil +} + +type CreateTransformationRequestEnvValue struct { + typeName string + String string + Double float64 +} + +func NewCreateTransformationRequestEnvValueFromString(value string) *CreateTransformationRequestEnvValue { + return &CreateTransformationRequestEnvValue{typeName: "string", String: value} +} + +func NewCreateTransformationRequestEnvValueFromDouble(value float64) *CreateTransformationRequestEnvValue { + return &CreateTransformationRequestEnvValue{typeName: "double", Double: value} +} + +func (c *CreateTransformationRequestEnvValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + c.typeName = "string" + c.String = valueString + return nil + } + var valueDouble float64 + if err := json.Unmarshal(data, &valueDouble); err == nil { + c.typeName = "double" + c.Double = valueDouble + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateTransformationRequestEnvValue) MarshalJSON() ([]byte, error) { + switch c.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return json.Marshal(c.String) + case "double": + return json.Marshal(c.Double) + } +} + +type CreateTransformationRequestEnvValueVisitor interface { + VisitString(string) error + VisitDouble(float64) error +} + +func (c *CreateTransformationRequestEnvValue) Accept(visitor CreateTransformationRequestEnvValueVisitor) error { + switch c.typeName { + default: + return fmt.Errorf("invalid type %s in %T", c.typeName, c) + case "string": + return visitor.VisitString(c.String) + case "double": + return visitor.VisitDouble(c.Double) + } +} + +// Custom Signature +type CustomSignature struct { + Config *DestinationAuthMethodCustomSignatureConfig `json:"config,omitempty"` + type_ string +} + +func (c *CustomSignature) Type() string { + return c.type_ +} + +func (c *CustomSignature) UnmarshalJSON(data []byte) error { + type unmarshaler CustomSignature + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *c = CustomSignature(value) + c.type_ = "CUSTOM_SIGNATURE" + return nil +} + +func (c *CustomSignature) MarshalJSON() ([]byte, error) { + type embed CustomSignature + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*c), + Type: "CUSTOM_SIGNATURE", + } + return json.Marshal(marshaler) +} + +type DelayRule struct { + // Delay to introduce in MS + Delay int `json:"delay"` + type_ string +} + +func (d *DelayRule) Type() string { + return d.type_ +} + +func (d *DelayRule) UnmarshalJSON(data []byte) error { + type unmarshaler DelayRule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DelayRule(value) + d.type_ = "delay" + return nil +} + +func (d *DelayRule) MarshalJSON() ([]byte, error) { + type embed DelayRule + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*d), + Type: "delay", + } + return json.Marshal(marshaler) +} + +type DeleteCustomDomainSchema struct { + // The custom hostname ID + Id string `json:"id"` +} + +type DeleteDestinationResponse struct { + // ID of the destination + Id string `json:"id"` +} + +type DeleteSourceResponse struct { + // ID of the source + Id string `json:"id"` +} + +type DeletedBookmarkResponse struct { + // Bookmark ID + Id string `json:"id"` +} + +type DeletedIntegration struct { + Id string `json:"id"` +} + +type DeletedIssueTriggerResponse struct { + Id string `json:"id"` +} + +// Delivery issue +type DeliveryIssue struct { + // Issue ID + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + Status IssueStatus `json:"status,omitempty"` + // ISO timestamp for when the issue was last opened + OpenedAt time.Time `json:"opened_at"` + // ISO timestamp for when the issue was first opened + FirstSeenAt time.Time `json:"first_seen_at"` + // ISO timestamp for when the issue last occured + LastSeenAt time.Time `json:"last_seen_at"` + // ID of the team member who last updated the issue status + LastUpdatedBy *string `json:"last_updated_by,omitempty"` + // ISO timestamp for when the issue was dismissed + DismissedAt *time.Time `json:"dismissed_at,omitempty"` + AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty"` + MergedWith *string `json:"merged_with,omitempty"` + // ISO timestamp for when the issue was last updated + UpdatedAt string `json:"updated_at"` + // ISO timestamp for when the issue was created + CreatedAt string `json:"created_at"` + AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty"` + Reference *DeliveryIssueReference `json:"reference,omitempty"` + type_ string +} + +func (d *DeliveryIssue) Type() string { + return d.type_ +} + +func (d *DeliveryIssue) UnmarshalJSON(data []byte) error { + type unmarshaler DeliveryIssue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeliveryIssue(value) + d.type_ = "delivery" + return nil +} + +func (d *DeliveryIssue) MarshalJSON() ([]byte, error) { + type embed DeliveryIssue + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*d), + Type: "delivery", + } + return json.Marshal(marshaler) +} + +// Keys used as the aggregation keys a 'delivery' type issue +type DeliveryIssueAggregationKeys struct { + WebhookId []string `json:"webhook_id,omitempty"` + ResponseStatus []float64 `json:"response_status,omitempty"` + ErrorCode []AttemptErrorCodes `json:"error_code,omitempty"` +} + +// Delivery issue data +type DeliveryIssueData struct { + TriggerEvent *Event `json:"trigger_event,omitempty"` + TriggerAttempt *EventAttempt `json:"trigger_attempt,omitempty"` +} + +// Reference to the event and attempt an issue is being created for. +type DeliveryIssueReference struct { + EventId string `json:"event_id"` + AttemptId string `json:"attempt_id"` +} + +// Delivery issue +type DeliveryIssueWithData struct { + // Issue ID + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + Status IssueStatus `json:"status,omitempty"` + // ISO timestamp for when the issue was last opened + OpenedAt time.Time `json:"opened_at"` + // ISO timestamp for when the issue was first opened + FirstSeenAt time.Time `json:"first_seen_at"` + // ISO timestamp for when the issue last occured + LastSeenAt time.Time `json:"last_seen_at"` + // ID of the team member who last updated the issue status + LastUpdatedBy *string `json:"last_updated_by,omitempty"` + // ISO timestamp for when the issue was dismissed + DismissedAt *time.Time `json:"dismissed_at,omitempty"` + AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty"` + MergedWith *string `json:"merged_with,omitempty"` + // ISO timestamp for when the issue was last updated + UpdatedAt string `json:"updated_at"` + // ISO timestamp for when the issue was created + CreatedAt string `json:"created_at"` + AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty"` + Reference *DeliveryIssueReference `json:"reference,omitempty"` + Data *DeliveryIssueData `json:"data,omitempty"` + type_ string +} + +func (d *DeliveryIssueWithData) Type() string { + return d.type_ +} + +func (d *DeliveryIssueWithData) UnmarshalJSON(data []byte) error { + type unmarshaler DeliveryIssueWithData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *d = DeliveryIssueWithData(value) + d.type_ = "delivery" + return nil +} + +func (d *DeliveryIssueWithData) MarshalJSON() ([]byte, error) { + type embed DeliveryIssueWithData + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*d), + Type: "delivery", + } + return json.Marshal(marshaler) +} + +// Associated [Destination](#destination-object) object +type Destination struct { + // ID of the destination + Id string `json:"id"` + // A unique, human-friendly name for the destination + Name string `json:"name"` + // Description of the destination + Description *string `json:"description,omitempty"` + // ID of the workspace + TeamId string `json:"team_id"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` + // HTTP endpoint of the destination + Url *string `json:"url,omitempty"` + // Path for the CLI destination + CliPath *string `json:"cli_path,omitempty"` + // Limit event attempts to receive per period. Max value is workspace plan's max attempts thoughput. + RateLimit *int `json:"rate_limit,omitempty"` + RateLimitPeriod *DestinationRateLimitPeriod `json:"rate_limit_period,omitempty"` + HttpMethod *DestinationHttpMethod `json:"http_method,omitempty"` + AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty"` + // Date the destination was archived + ArchivedAt *time.Time `json:"archived_at,omitempty"` + // Date the destination was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the destination was created + CreatedAt time.Time `json:"created_at"` +} + +// API key config for the destination's auth method +type DestinationAuthMethodApiKeyConfig struct { + // Key for the API key auth + Key string `json:"key"` + // API key for the API key auth + ApiKey string `json:"api_key"` + // Whether the API key should be sent as a header or a query parameter + To *DestinationAuthMethodApiKeyConfigTo `json:"to,omitempty"` +} + +// Whether the API key should be sent as a header or a query parameter +type DestinationAuthMethodApiKeyConfigTo uint + +const ( + DestinationAuthMethodApiKeyConfigToHeader DestinationAuthMethodApiKeyConfigTo = iota + 1 + DestinationAuthMethodApiKeyConfigToQuery +) + +func (d DestinationAuthMethodApiKeyConfigTo) String() string { + switch d { + default: + return strconv.Itoa(int(d)) + case DestinationAuthMethodApiKeyConfigToHeader: + return "header" + case DestinationAuthMethodApiKeyConfigToQuery: + return "query" + } +} + +func (d DestinationAuthMethodApiKeyConfigTo) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", d.String())), nil +} + +func (d *DestinationAuthMethodApiKeyConfigTo) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "header": + value := DestinationAuthMethodApiKeyConfigToHeader + *d = value + case "query": + value := DestinationAuthMethodApiKeyConfigToQuery + *d = value + } + return nil +} + +// Basic auth config for the destination's auth method +type DestinationAuthMethodBasicAuthConfig struct { + // Username for basic auth + Username string `json:"username"` + // Password for basic auth + Password string `json:"password"` +} + +// Bearer token config for the destination's auth method +type DestinationAuthMethodBearerTokenConfig struct { + // Token for the bearer token auth + Token string `json:"token"` +} + +// Config for the destination's auth method +type DestinationAuthMethodConfig struct { + typeName string + HookdeckSignature *HookdeckSignature + BasicAuth *BasicAuth + ApiKey *ApiKey + BearerToken *BearerToken + CustomSignature *CustomSignature +} + +func NewDestinationAuthMethodConfigFromHookdeckSignature(value *HookdeckSignature) *DestinationAuthMethodConfig { + return &DestinationAuthMethodConfig{typeName: "hookdeckSignature", HookdeckSignature: value} +} + +func NewDestinationAuthMethodConfigFromBasicAuth(value *BasicAuth) *DestinationAuthMethodConfig { + return &DestinationAuthMethodConfig{typeName: "basicAuth", BasicAuth: value} +} + +func NewDestinationAuthMethodConfigFromApiKey(value *ApiKey) *DestinationAuthMethodConfig { + return &DestinationAuthMethodConfig{typeName: "apiKey", ApiKey: value} +} + +func NewDestinationAuthMethodConfigFromBearerToken(value *BearerToken) *DestinationAuthMethodConfig { + return &DestinationAuthMethodConfig{typeName: "bearerToken", BearerToken: value} +} + +func NewDestinationAuthMethodConfigFromCustomSignature(value *CustomSignature) *DestinationAuthMethodConfig { + return &DestinationAuthMethodConfig{typeName: "customSignature", CustomSignature: value} +} + +func (d *DestinationAuthMethodConfig) UnmarshalJSON(data []byte) error { + valueHookdeckSignature := new(HookdeckSignature) + if err := json.Unmarshal(data, &valueHookdeckSignature); err == nil { + d.typeName = "hookdeckSignature" + d.HookdeckSignature = valueHookdeckSignature + return nil + } + valueBasicAuth := new(BasicAuth) + if err := json.Unmarshal(data, &valueBasicAuth); err == nil { + d.typeName = "basicAuth" + d.BasicAuth = valueBasicAuth + return nil + } + valueApiKey := new(ApiKey) + if err := json.Unmarshal(data, &valueApiKey); err == nil { + d.typeName = "apiKey" + d.ApiKey = valueApiKey + return nil + } + valueBearerToken := new(BearerToken) + if err := json.Unmarshal(data, &valueBearerToken); err == nil { + d.typeName = "bearerToken" + d.BearerToken = valueBearerToken + return nil + } + valueCustomSignature := new(CustomSignature) + if err := json.Unmarshal(data, &valueCustomSignature); err == nil { + d.typeName = "customSignature" + d.CustomSignature = valueCustomSignature + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, d) +} + +func (d DestinationAuthMethodConfig) MarshalJSON() ([]byte, error) { + switch d.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", d.typeName, d) + case "hookdeckSignature": + return json.Marshal(d.HookdeckSignature) + case "basicAuth": + return json.Marshal(d.BasicAuth) + case "apiKey": + return json.Marshal(d.ApiKey) + case "bearerToken": + return json.Marshal(d.BearerToken) + case "customSignature": + return json.Marshal(d.CustomSignature) + } +} + +type DestinationAuthMethodConfigVisitor interface { + VisitHookdeckSignature(*HookdeckSignature) error + VisitBasicAuth(*BasicAuth) error + VisitApiKey(*ApiKey) error + VisitBearerToken(*BearerToken) error + VisitCustomSignature(*CustomSignature) error +} + +func (d *DestinationAuthMethodConfig) Accept(visitor DestinationAuthMethodConfigVisitor) error { + switch d.typeName { + default: + return fmt.Errorf("invalid type %s in %T", d.typeName, d) + case "hookdeckSignature": + return visitor.VisitHookdeckSignature(d.HookdeckSignature) + case "basicAuth": + return visitor.VisitBasicAuth(d.BasicAuth) + case "apiKey": + return visitor.VisitApiKey(d.ApiKey) + case "bearerToken": + return visitor.VisitBearerToken(d.BearerToken) + case "customSignature": + return visitor.VisitCustomSignature(d.CustomSignature) + } +} + +// Custom signature config for the destination's auth method +type DestinationAuthMethodCustomSignatureConfig struct { + // Key for the custom signature auth + Key string `json:"key"` + // Signing secret for the custom signature auth. If left empty a secret will be generated for you. + SigningSecret *string `json:"signing_secret,omitempty"` +} + +// Empty config for the destination's auth method +type DestinationAuthMethodSignatureConfig struct { +} + +// HTTP method used on requests sent to the destination, overrides the method used on requests sent to the source. +type DestinationHttpMethod uint + +const ( + DestinationHttpMethodGet DestinationHttpMethod = iota + 1 + DestinationHttpMethodPost + DestinationHttpMethodPut + DestinationHttpMethodPatch + DestinationHttpMethodDelete +) + +func (d DestinationHttpMethod) String() string { + switch d { + default: + return strconv.Itoa(int(d)) + case DestinationHttpMethodGet: + return "GET" + case DestinationHttpMethodPost: + return "POST" + case DestinationHttpMethodPut: + return "PUT" + case DestinationHttpMethodPatch: + return "PATCH" + case DestinationHttpMethodDelete: + return "DELETE" + } +} + +func (d DestinationHttpMethod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", d.String())), nil +} + +func (d *DestinationHttpMethod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "GET": + value := DestinationHttpMethodGet + *d = value + case "POST": + value := DestinationHttpMethodPost + *d = value + case "PUT": + value := DestinationHttpMethodPut + *d = value + case "PATCH": + value := DestinationHttpMethodPatch + *d = value + case "DELETE": + value := DestinationHttpMethodDelete + *d = value + } + return nil +} + +type DestinationPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*Destination `json:"models,omitempty"` +} + +// Period to rate limit attempts +type DestinationRateLimitPeriod uint + +const ( + DestinationRateLimitPeriodSecond DestinationRateLimitPeriod = iota + 1 + DestinationRateLimitPeriodMinute + DestinationRateLimitPeriodHour +) + +func (d DestinationRateLimitPeriod) String() string { + switch d { + default: + return strconv.Itoa(int(d)) + case DestinationRateLimitPeriodSecond: + return "second" + case DestinationRateLimitPeriodMinute: + return "minute" + case DestinationRateLimitPeriodHour: + return "hour" + } +} + +func (d DestinationRateLimitPeriod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", d.String())), nil +} + +func (d *DestinationRateLimitPeriod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "second": + value := DestinationRateLimitPeriodSecond + *d = value + case "minute": + value := DestinationRateLimitPeriodMinute + *d = value + case "hour": + value := DestinationRateLimitPeriodHour + *d = value + } + return nil +} + +type DetachedIntegrationFromSource struct { +} + +type Event struct { + // ID of the event + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + // ID of the associated connection + WebhookId string `json:"webhook_id"` + // ID of the associated source + SourceId string `json:"source_id"` + // ID of the associated destination + DestinationId string `json:"destination_id"` + // ID of the event data + EventDataId string `json:"event_data_id"` + // ID of the request that created the event + RequestId string `json:"request_id"` + // Number of delivery attempts made + Attempts int `json:"attempts"` + // Date of the most recently attempted retry + LastAttemptAt *time.Time `json:"last_attempt_at,omitempty"` + // Date of the next scheduled retry + NextAttemptAt *time.Time `json:"next_attempt_at,omitempty"` + // Event status + ResponseStatus *int `json:"response_status,omitempty"` + ErrorCode *AttemptErrorCodes `json:"error_code,omitempty"` + Status EventStatus `json:"status,omitempty"` + // Date of the latest successful attempt + SuccessfulAt *time.Time `json:"successful_at,omitempty"` + // ID of the CLI the event is sent to + CliId *string `json:"cli_id,omitempty"` + // Date the event was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the event was created + CreatedAt time.Time `json:"created_at"` + Data *ShortEventData `json:"data,omitempty"` +} + +type EventArray = []*Event + +type EventAttempt struct { + // Attempt ID + Id string `json:"id"` + // Team ID + TeamId string `json:"team_id"` + // Event ID + EventId string `json:"event_id"` + // Attempt's HTTP response code + ResponseStatus *int `json:"response_status,omitempty"` + // Sequential number of attempts (up to and including this one) made for the associated event + AttemptNumber *int `json:"attempt_number,omitempty"` + Trigger *AttemptTrigger `json:"trigger,omitempty"` + ErrorCode *AttemptErrorCodes `json:"error_code,omitempty"` + Body *EventAttemptBody `json:"body,omitempty"` + // URL of the destination where delivery was attempted + RequestedUrl *string `json:"requested_url,omitempty"` + // HTTP method used to deliver the attempt + HttpMethod *EventAttemptHttpMethod `json:"http_method,omitempty"` + // ID of associated bulk retry + BulkRetryId *string `json:"bulk_retry_id,omitempty"` + Status AttemptStatus `json:"status,omitempty"` + // Date the attempt was successful + SuccessfulAt *time.Time `json:"successful_at,omitempty"` + // Date the attempt was delivered + DeliveredAt *time.Time `json:"delivered_at,omitempty"` + // Date the destination responded to this attempt + RespondedAt *time.Time `json:"responded_at,omitempty"` + // Time elapsed between attempt initiation and final delivery (in ms) + DeliveryLatency *int `json:"delivery_latency,omitempty"` + // Time elapsed between attempt initiation and a response from the destination (in ms) + ResponseLatency *int `json:"response_latency,omitempty"` + // Date the attempt was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the attempt was created + CreatedAt time.Time `json:"created_at"` + State *AttemptState `json:"state,omitempty"` + // Date the attempt was archived + ArchivedAt *string `json:"archived_at,omitempty"` + DestinationId *string `json:"destination_id,omitempty"` +} + +type EventAttemptBody struct { + typeName string + // Response body from the destination + EventAttemptBodyZeroOptional *EventAttemptBodyZero + // Response body from the destination + StringOptional *string +} + +func NewEventAttemptBodyFromEventAttemptBodyZeroOptional(value *EventAttemptBodyZero) *EventAttemptBody { + return &EventAttemptBody{typeName: "eventAttemptBodyZeroOptional", EventAttemptBodyZeroOptional: value} +} + +func NewEventAttemptBodyFromStringOptional(value *string) *EventAttemptBody { + return &EventAttemptBody{typeName: "stringOptional", StringOptional: value} +} + +func (e *EventAttemptBody) UnmarshalJSON(data []byte) error { + var valueEventAttemptBodyZeroOptional *EventAttemptBodyZero + if err := json.Unmarshal(data, &valueEventAttemptBodyZeroOptional); err == nil { + e.typeName = "eventAttemptBodyZeroOptional" + e.EventAttemptBodyZeroOptional = valueEventAttemptBodyZeroOptional + return nil + } + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + e.typeName = "stringOptional" + e.StringOptional = valueStringOptional + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EventAttemptBody) MarshalJSON() ([]byte, error) { + switch e.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", e.typeName, e) + case "eventAttemptBodyZeroOptional": + return json.Marshal(e.EventAttemptBodyZeroOptional) + case "stringOptional": + return json.Marshal(e.StringOptional) + } +} + +type EventAttemptBodyVisitor interface { + VisitEventAttemptBodyZeroOptional(*EventAttemptBodyZero) error + VisitStringOptional(*string) error +} + +func (e *EventAttemptBody) Accept(visitor EventAttemptBodyVisitor) error { + switch e.typeName { + default: + return fmt.Errorf("invalid type %s in %T", e.typeName, e) + case "eventAttemptBodyZeroOptional": + return visitor.VisitEventAttemptBodyZeroOptional(e.EventAttemptBodyZeroOptional) + case "stringOptional": + return visitor.VisitStringOptional(e.StringOptional) + } +} + +// Response body from the destination +type EventAttemptBodyZero struct { +} + +// HTTP method used to deliver the attempt +type EventAttemptHttpMethod uint + +const ( + EventAttemptHttpMethodGet EventAttemptHttpMethod = iota + 1 + EventAttemptHttpMethodPost + EventAttemptHttpMethodPut + EventAttemptHttpMethodPatch + EventAttemptHttpMethodDelete +) + +func (e EventAttemptHttpMethod) String() string { + switch e { + default: + return strconv.Itoa(int(e)) + case EventAttemptHttpMethodGet: + return "GET" + case EventAttemptHttpMethodPost: + return "POST" + case EventAttemptHttpMethodPut: + return "PUT" + case EventAttemptHttpMethodPatch: + return "PATCH" + case EventAttemptHttpMethodDelete: + return "DELETE" + } +} + +func (e EventAttemptHttpMethod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", e.String())), nil +} + +func (e *EventAttemptHttpMethod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "GET": + value := EventAttemptHttpMethodGet + *e = value + case "POST": + value := EventAttemptHttpMethodPost + *e = value + case "PUT": + value := EventAttemptHttpMethodPut + *e = value + case "PATCH": + value := EventAttemptHttpMethodPatch + *e = value + case "DELETE": + value := EventAttemptHttpMethodDelete + *e = value + } + return nil +} + +type EventAttemptPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*EventAttempt `json:"models,omitempty"` +} + +type EventPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*Event `json:"models,omitempty"` +} + +type EventStatus uint + +const ( + EventStatusScheduled EventStatus = iota + 1 + EventStatusQueued + EventStatusHold + EventStatusSuccessful + EventStatusFailed +) + +func (e EventStatus) String() string { + switch e { + default: + return strconv.Itoa(int(e)) + case EventStatusScheduled: + return "SCHEDULED" + case EventStatusQueued: + return "QUEUED" + case EventStatusHold: + return "HOLD" + case EventStatusSuccessful: + return "SUCCESSFUL" + case EventStatusFailed: + return "FAILED" + } +} + +func (e EventStatus) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", e.String())), nil +} + +func (e *EventStatus) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "SCHEDULED": + value := EventStatusScheduled + *e = value + case "QUEUED": + value := EventStatusQueued + *e = value + case "HOLD": + value := EventStatusHold + *e = value + case "SUCCESSFUL": + value := EventStatusSuccessful + *e = value + case "FAILED": + value := EventStatusFailed + *e = value + } + return nil +} + +type FilterRule struct { + Headers *ConnectionFilterProperty `json:"headers,omitempty"` + Body *ConnectionFilterProperty `json:"body,omitempty"` + Query *ConnectionFilterProperty `json:"query,omitempty"` + Path *ConnectionFilterProperty `json:"path,omitempty"` + type_ string +} + +func (f *FilterRule) Type() string { + return f.type_ +} + +func (f *FilterRule) UnmarshalJSON(data []byte) error { + type unmarshaler FilterRule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *f = FilterRule(value) + f.type_ = "filter" + return nil +} + +func (f *FilterRule) MarshalJSON() ([]byte, error) { + type embed FilterRule + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*f), + Type: "filter", + } + return json.Marshal(marshaler) +} + +type FilteredMeta uint + +const ( + FilteredMetaBody FilteredMeta = iota + 1 + FilteredMetaHeaders + FilteredMetaPath + FilteredMetaQuery +) + +func (f FilteredMeta) String() string { + switch f { + default: + return strconv.Itoa(int(f)) + case FilteredMetaBody: + return "body" + case FilteredMetaHeaders: + return "headers" + case FilteredMetaPath: + return "path" + case FilteredMetaQuery: + return "query" + } +} + +func (f FilteredMeta) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", f.String())), nil +} + +func (f *FilteredMeta) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "body": + value := FilteredMetaBody + *f = value + case "headers": + value := FilteredMetaHeaders + *f = value + case "path": + value := FilteredMetaPath + *f = value + case "query": + value := FilteredMetaQuery + *f = value + } + return nil +} + +type GenerateEventBulkRetryPlanResponse struct { + // Number of batches required to complete the bulk retry + EstimatedBatch *int `json:"estimated_batch,omitempty"` + // Number of estimated events to be retried + EstimatedCount *int `json:"estimated_count,omitempty"` + // Progression of the batch operations, values 0 - 1 + Progress *float64 `json:"progress,omitempty"` +} + +type GenerateIgnoredEventBulkRetryPlanResponse struct { + // Number of batches required to complete the bulk retry + EstimatedBatch *int `json:"estimated_batch,omitempty"` + // Number of estimated events to be retried + EstimatedCount *int `json:"estimated_count,omitempty"` + // Progression of the batch operations, values 0 - 1 + Progress *float64 `json:"progress,omitempty"` +} + +type GenerateRequestBulkRetryPlanResponse struct { + // Number of batches required to complete the bulk retry + EstimatedBatch *int `json:"estimated_batch,omitempty"` + // Number of estimated events to be retried + EstimatedCount *int `json:"estimated_count,omitempty"` + // Progression of the batch operations, values 0 - 1 + Progress *float64 `json:"progress,omitempty"` +} + +type GetAttemptsRequestDir uint + +const ( + GetAttemptsRequestDirAsc GetAttemptsRequestDir = iota + 1 + GetAttemptsRequestDirDesc +) + +func (g GetAttemptsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetAttemptsRequestDirAsc: + return "asc" + case GetAttemptsRequestDirDesc: + return "desc" + } +} + +func (g GetAttemptsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetAttemptsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetAttemptsRequestDirAsc + *g = value + case "desc": + value := GetAttemptsRequestDirDesc + *g = value + } + return nil +} + +type GetBookmarksRequestDir uint + +const ( + GetBookmarksRequestDirAsc GetBookmarksRequestDir = iota + 1 + GetBookmarksRequestDirDesc +) + +func (g GetBookmarksRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetBookmarksRequestDirAsc: + return "asc" + case GetBookmarksRequestDirDesc: + return "desc" + } +} + +func (g GetBookmarksRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetBookmarksRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetBookmarksRequestDirAsc + *g = value + case "desc": + value := GetBookmarksRequestDirDesc + *g = value + } + return nil +} + +type GetConnectionsRequestDir uint + +const ( + GetConnectionsRequestDirAsc GetConnectionsRequestDir = iota + 1 + GetConnectionsRequestDirDesc +) + +func (g GetConnectionsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetConnectionsRequestDirAsc: + return "asc" + case GetConnectionsRequestDirDesc: + return "desc" + } +} + +func (g GetConnectionsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetConnectionsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetConnectionsRequestDirAsc + *g = value + case "desc": + value := GetConnectionsRequestDirDesc + *g = value + } + return nil +} + +type GetConnectionsRequestOrderBy uint + +const ( + GetConnectionsRequestOrderByCreatedAt GetConnectionsRequestOrderBy = iota + 1 + GetConnectionsRequestOrderByUpdatedAt + GetConnectionsRequestOrderBySourcesUpdatedAt + GetConnectionsRequestOrderBySourcesCreatedAt + GetConnectionsRequestOrderByDestinationsUpdatedAt + GetConnectionsRequestOrderByDestinationsCreatedAt +) + +func (g GetConnectionsRequestOrderBy) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetConnectionsRequestOrderByCreatedAt: + return "created_at" + case GetConnectionsRequestOrderByUpdatedAt: + return "updated_at" + case GetConnectionsRequestOrderBySourcesUpdatedAt: + return "sources.updated_at" + case GetConnectionsRequestOrderBySourcesCreatedAt: + return "sources.created_at" + case GetConnectionsRequestOrderByDestinationsUpdatedAt: + return "destinations.updated_at" + case GetConnectionsRequestOrderByDestinationsCreatedAt: + return "destinations.created_at" + } +} + +func (g GetConnectionsRequestOrderBy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetConnectionsRequestOrderBy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "created_at": + value := GetConnectionsRequestOrderByCreatedAt + *g = value + case "updated_at": + value := GetConnectionsRequestOrderByUpdatedAt + *g = value + case "sources.updated_at": + value := GetConnectionsRequestOrderBySourcesUpdatedAt + *g = value + case "sources.created_at": + value := GetConnectionsRequestOrderBySourcesCreatedAt + *g = value + case "destinations.updated_at": + value := GetConnectionsRequestOrderByDestinationsUpdatedAt + *g = value + case "destinations.created_at": + value := GetConnectionsRequestOrderByDestinationsCreatedAt + *g = value + } + return nil +} + +type GetDestinationsRequestDir uint + +const ( + GetDestinationsRequestDirAsc GetDestinationsRequestDir = iota + 1 + GetDestinationsRequestDirDesc +) + +func (g GetDestinationsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetDestinationsRequestDirAsc: + return "asc" + case GetDestinationsRequestDirDesc: + return "desc" + } +} + +func (g GetDestinationsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetDestinationsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetDestinationsRequestDirAsc + *g = value + case "desc": + value := GetDestinationsRequestDirDesc + *g = value + } + return nil +} + +type GetEventBulkRetriesRequestDir uint + +const ( + GetEventBulkRetriesRequestDirAsc GetEventBulkRetriesRequestDir = iota + 1 + GetEventBulkRetriesRequestDirDesc +) + +func (g GetEventBulkRetriesRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetEventBulkRetriesRequestDirAsc: + return "asc" + case GetEventBulkRetriesRequestDirDesc: + return "desc" + } +} + +func (g GetEventBulkRetriesRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetEventBulkRetriesRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetEventBulkRetriesRequestDirAsc + *g = value + case "desc": + value := GetEventBulkRetriesRequestDirDesc + *g = value + } + return nil +} + +// Sort direction +type GetEventsRequestDir uint + +const ( + GetEventsRequestDirAsc GetEventsRequestDir = iota + 1 + GetEventsRequestDirDesc +) + +func (g GetEventsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetEventsRequestDirAsc: + return "asc" + case GetEventsRequestDirDesc: + return "desc" + } +} + +func (g GetEventsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetEventsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetEventsRequestDirAsc + *g = value + case "desc": + value := GetEventsRequestDirDesc + *g = value + } + return nil +} + +// Sort key +type GetEventsRequestOrderBy uint + +const ( + GetEventsRequestOrderByLastAttemptAt GetEventsRequestOrderBy = iota + 1 + GetEventsRequestOrderByCreatedAt +) + +func (g GetEventsRequestOrderBy) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetEventsRequestOrderByLastAttemptAt: + return "last_attempt_at" + case GetEventsRequestOrderByCreatedAt: + return "created_at" + } +} + +func (g GetEventsRequestOrderBy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetEventsRequestOrderBy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "last_attempt_at": + value := GetEventsRequestOrderByLastAttemptAt + *g = value + case "created_at": + value := GetEventsRequestOrderByCreatedAt + *g = value + } + return nil +} + +type GetIgnoredEventBulkRetriesRequestDir uint + +const ( + GetIgnoredEventBulkRetriesRequestDirAsc GetIgnoredEventBulkRetriesRequestDir = iota + 1 + GetIgnoredEventBulkRetriesRequestDirDesc +) + +func (g GetIgnoredEventBulkRetriesRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIgnoredEventBulkRetriesRequestDirAsc: + return "asc" + case GetIgnoredEventBulkRetriesRequestDirDesc: + return "desc" + } +} + +func (g GetIgnoredEventBulkRetriesRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIgnoredEventBulkRetriesRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetIgnoredEventBulkRetriesRequestDirAsc + *g = value + case "desc": + value := GetIgnoredEventBulkRetriesRequestDirDesc + *g = value + } + return nil +} + +type GetIssueCountRequestDir uint + +const ( + GetIssueCountRequestDirAsc GetIssueCountRequestDir = iota + 1 + GetIssueCountRequestDirDesc +) + +func (g GetIssueCountRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssueCountRequestDirAsc: + return "asc" + case GetIssueCountRequestDirDesc: + return "desc" + } +} + +func (g GetIssueCountRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssueCountRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetIssueCountRequestDirAsc + *g = value + case "desc": + value := GetIssueCountRequestDirDesc + *g = value + } + return nil +} + +type GetIssueCountRequestOrderBy uint + +const ( + GetIssueCountRequestOrderByCreatedAt GetIssueCountRequestOrderBy = iota + 1 + GetIssueCountRequestOrderByFirstSeenAt + GetIssueCountRequestOrderByLastSeenAt + GetIssueCountRequestOrderByOpenedAt + GetIssueCountRequestOrderByStatus +) + +func (g GetIssueCountRequestOrderBy) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssueCountRequestOrderByCreatedAt: + return "created_at" + case GetIssueCountRequestOrderByFirstSeenAt: + return "first_seen_at" + case GetIssueCountRequestOrderByLastSeenAt: + return "last_seen_at" + case GetIssueCountRequestOrderByOpenedAt: + return "opened_at" + case GetIssueCountRequestOrderByStatus: + return "status" + } +} + +func (g GetIssueCountRequestOrderBy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssueCountRequestOrderBy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "created_at": + value := GetIssueCountRequestOrderByCreatedAt + *g = value + case "first_seen_at": + value := GetIssueCountRequestOrderByFirstSeenAt + *g = value + case "last_seen_at": + value := GetIssueCountRequestOrderByLastSeenAt + *g = value + case "opened_at": + value := GetIssueCountRequestOrderByOpenedAt + *g = value + case "status": + value := GetIssueCountRequestOrderByStatus + *g = value + } + return nil +} + +// Issue status +type GetIssueCountRequestStatus uint + +const ( + GetIssueCountRequestStatusOpened GetIssueCountRequestStatus = iota + 1 + GetIssueCountRequestStatusIgnored + GetIssueCountRequestStatusAcknowledged + GetIssueCountRequestStatusResolved +) + +func (g GetIssueCountRequestStatus) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssueCountRequestStatusOpened: + return "OPENED" + case GetIssueCountRequestStatusIgnored: + return "IGNORED" + case GetIssueCountRequestStatusAcknowledged: + return "ACKNOWLEDGED" + case GetIssueCountRequestStatusResolved: + return "RESOLVED" + } +} + +func (g GetIssueCountRequestStatus) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssueCountRequestStatus) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "OPENED": + value := GetIssueCountRequestStatusOpened + *g = value + case "IGNORED": + value := GetIssueCountRequestStatusIgnored + *g = value + case "ACKNOWLEDGED": + value := GetIssueCountRequestStatusAcknowledged + *g = value + case "RESOLVED": + value := GetIssueCountRequestStatusResolved + *g = value + } + return nil +} + +// Issue type +type GetIssueCountRequestType uint + +const ( + GetIssueCountRequestTypeDelivery GetIssueCountRequestType = iota + 1 + GetIssueCountRequestTypeTransformation + GetIssueCountRequestTypeBackpressure +) + +func (g GetIssueCountRequestType) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssueCountRequestTypeDelivery: + return "delivery" + case GetIssueCountRequestTypeTransformation: + return "transformation" + case GetIssueCountRequestTypeBackpressure: + return "backpressure" + } +} + +func (g GetIssueCountRequestType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssueCountRequestType) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "delivery": + value := GetIssueCountRequestTypeDelivery + *g = value + case "transformation": + value := GetIssueCountRequestTypeTransformation + *g = value + case "backpressure": + value := GetIssueCountRequestTypeBackpressure + *g = value + } + return nil +} + +type GetIssueTriggersRequestDir uint + +const ( + GetIssueTriggersRequestDirAsc GetIssueTriggersRequestDir = iota + 1 + GetIssueTriggersRequestDirDesc +) + +func (g GetIssueTriggersRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssueTriggersRequestDirAsc: + return "asc" + case GetIssueTriggersRequestDirDesc: + return "desc" + } +} + +func (g GetIssueTriggersRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssueTriggersRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetIssueTriggersRequestDirAsc + *g = value + case "desc": + value := GetIssueTriggersRequestDirDesc + *g = value + } + return nil +} + +type GetIssueTriggersRequestOrderBy uint + +const ( + GetIssueTriggersRequestOrderByCreatedAt GetIssueTriggersRequestOrderBy = iota + 1 + GetIssueTriggersRequestOrderByType +) + +func (g GetIssueTriggersRequestOrderBy) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssueTriggersRequestOrderByCreatedAt: + return "created_at" + case GetIssueTriggersRequestOrderByType: + return "type" + } +} + +func (g GetIssueTriggersRequestOrderBy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssueTriggersRequestOrderBy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "created_at": + value := GetIssueTriggersRequestOrderByCreatedAt + *g = value + case "type": + value := GetIssueTriggersRequestOrderByType + *g = value + } + return nil +} + +type GetIssuesRequestDir uint + +const ( + GetIssuesRequestDirAsc GetIssuesRequestDir = iota + 1 + GetIssuesRequestDirDesc +) + +func (g GetIssuesRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssuesRequestDirAsc: + return "asc" + case GetIssuesRequestDirDesc: + return "desc" + } +} + +func (g GetIssuesRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssuesRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetIssuesRequestDirAsc + *g = value + case "desc": + value := GetIssuesRequestDirDesc + *g = value + } + return nil +} + +type GetIssuesRequestOrderBy uint + +const ( + GetIssuesRequestOrderByCreatedAt GetIssuesRequestOrderBy = iota + 1 + GetIssuesRequestOrderByFirstSeenAt + GetIssuesRequestOrderByLastSeenAt + GetIssuesRequestOrderByOpenedAt + GetIssuesRequestOrderByStatus +) + +func (g GetIssuesRequestOrderBy) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssuesRequestOrderByCreatedAt: + return "created_at" + case GetIssuesRequestOrderByFirstSeenAt: + return "first_seen_at" + case GetIssuesRequestOrderByLastSeenAt: + return "last_seen_at" + case GetIssuesRequestOrderByOpenedAt: + return "opened_at" + case GetIssuesRequestOrderByStatus: + return "status" + } +} + +func (g GetIssuesRequestOrderBy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssuesRequestOrderBy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "created_at": + value := GetIssuesRequestOrderByCreatedAt + *g = value + case "first_seen_at": + value := GetIssuesRequestOrderByFirstSeenAt + *g = value + case "last_seen_at": + value := GetIssuesRequestOrderByLastSeenAt + *g = value + case "opened_at": + value := GetIssuesRequestOrderByOpenedAt + *g = value + case "status": + value := GetIssuesRequestOrderByStatus + *g = value + } + return nil +} + +// Issue status +type GetIssuesRequestStatus uint + +const ( + GetIssuesRequestStatusOpened GetIssuesRequestStatus = iota + 1 + GetIssuesRequestStatusIgnored + GetIssuesRequestStatusAcknowledged + GetIssuesRequestStatusResolved +) + +func (g GetIssuesRequestStatus) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssuesRequestStatusOpened: + return "OPENED" + case GetIssuesRequestStatusIgnored: + return "IGNORED" + case GetIssuesRequestStatusAcknowledged: + return "ACKNOWLEDGED" + case GetIssuesRequestStatusResolved: + return "RESOLVED" + } +} + +func (g GetIssuesRequestStatus) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssuesRequestStatus) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "OPENED": + value := GetIssuesRequestStatusOpened + *g = value + case "IGNORED": + value := GetIssuesRequestStatusIgnored + *g = value + case "ACKNOWLEDGED": + value := GetIssuesRequestStatusAcknowledged + *g = value + case "RESOLVED": + value := GetIssuesRequestStatusResolved + *g = value + } + return nil +} + +// Issue type +type GetIssuesRequestType uint + +const ( + GetIssuesRequestTypeDelivery GetIssuesRequestType = iota + 1 + GetIssuesRequestTypeTransformation + GetIssuesRequestTypeBackpressure +) + +func (g GetIssuesRequestType) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetIssuesRequestTypeDelivery: + return "delivery" + case GetIssuesRequestTypeTransformation: + return "transformation" + case GetIssuesRequestTypeBackpressure: + return "backpressure" + } +} + +func (g GetIssuesRequestType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetIssuesRequestType) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "delivery": + value := GetIssuesRequestTypeDelivery + *g = value + case "transformation": + value := GetIssuesRequestTypeTransformation + *g = value + case "backpressure": + value := GetIssuesRequestTypeBackpressure + *g = value + } + return nil +} + +type GetRequestBulkRetriesRequestDir uint + +const ( + GetRequestBulkRetriesRequestDirAsc GetRequestBulkRetriesRequestDir = iota + 1 + GetRequestBulkRetriesRequestDirDesc +) + +func (g GetRequestBulkRetriesRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetRequestBulkRetriesRequestDirAsc: + return "asc" + case GetRequestBulkRetriesRequestDirDesc: + return "desc" + } +} + +func (g GetRequestBulkRetriesRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetRequestBulkRetriesRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetRequestBulkRetriesRequestDirAsc + *g = value + case "desc": + value := GetRequestBulkRetriesRequestDirDesc + *g = value + } + return nil +} + +// Sort direction +type GetRequestEventsRequestDir uint + +const ( + GetRequestEventsRequestDirAsc GetRequestEventsRequestDir = iota + 1 + GetRequestEventsRequestDirDesc +) + +func (g GetRequestEventsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetRequestEventsRequestDirAsc: + return "asc" + case GetRequestEventsRequestDirDesc: + return "desc" + } +} + +func (g GetRequestEventsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetRequestEventsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetRequestEventsRequestDirAsc + *g = value + case "desc": + value := GetRequestEventsRequestDirDesc + *g = value + } + return nil +} + +// Sort key +type GetRequestEventsRequestOrderBy uint + +const ( + GetRequestEventsRequestOrderByLastAttemptAt GetRequestEventsRequestOrderBy = iota + 1 + GetRequestEventsRequestOrderByCreatedAt +) + +func (g GetRequestEventsRequestOrderBy) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetRequestEventsRequestOrderByLastAttemptAt: + return "last_attempt_at" + case GetRequestEventsRequestOrderByCreatedAt: + return "created_at" + } +} + +func (g GetRequestEventsRequestOrderBy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetRequestEventsRequestOrderBy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "last_attempt_at": + value := GetRequestEventsRequestOrderByLastAttemptAt + *g = value + case "created_at": + value := GetRequestEventsRequestOrderByCreatedAt + *g = value + } + return nil +} + +type GetRequestIgnoredEventsRequestDir uint + +const ( + GetRequestIgnoredEventsRequestDirAsc GetRequestIgnoredEventsRequestDir = iota + 1 + GetRequestIgnoredEventsRequestDirDesc +) + +func (g GetRequestIgnoredEventsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetRequestIgnoredEventsRequestDirAsc: + return "asc" + case GetRequestIgnoredEventsRequestDirDesc: + return "desc" + } +} + +func (g GetRequestIgnoredEventsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetRequestIgnoredEventsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetRequestIgnoredEventsRequestDirAsc + *g = value + case "desc": + value := GetRequestIgnoredEventsRequestDirDesc + *g = value + } + return nil +} + +// Sort direction +type GetRequestsRequestDir uint + +const ( + GetRequestsRequestDirAsc GetRequestsRequestDir = iota + 1 + GetRequestsRequestDirDesc +) + +func (g GetRequestsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetRequestsRequestDirAsc: + return "asc" + case GetRequestsRequestDirDesc: + return "desc" + } +} + +func (g GetRequestsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetRequestsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetRequestsRequestDirAsc + *g = value + case "desc": + value := GetRequestsRequestDirDesc + *g = value + } + return nil +} + +// Sort key +type GetRequestsRequestOrderBy uint + +const ( + GetRequestsRequestOrderByIngestedAt GetRequestsRequestOrderBy = iota + 1 + GetRequestsRequestOrderByCreatedAt +) + +func (g GetRequestsRequestOrderBy) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetRequestsRequestOrderByIngestedAt: + return "ingested_at" + case GetRequestsRequestOrderByCreatedAt: + return "created_at" + } +} + +func (g GetRequestsRequestOrderBy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetRequestsRequestOrderBy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "ingested_at": + value := GetRequestsRequestOrderByIngestedAt + *g = value + case "created_at": + value := GetRequestsRequestOrderByCreatedAt + *g = value + } + return nil +} + +// Filter by status +type GetRequestsRequestStatus uint + +const ( + GetRequestsRequestStatusAccepted GetRequestsRequestStatus = iota + 1 + GetRequestsRequestStatusRejected +) + +func (g GetRequestsRequestStatus) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetRequestsRequestStatusAccepted: + return "accepted" + case GetRequestsRequestStatusRejected: + return "rejected" + } +} + +func (g GetRequestsRequestStatus) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetRequestsRequestStatus) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "accepted": + value := GetRequestsRequestStatusAccepted + *g = value + case "rejected": + value := GetRequestsRequestStatusRejected + *g = value + } + return nil +} + +type GetSourcesRequestDir uint + +const ( + GetSourcesRequestDirAsc GetSourcesRequestDir = iota + 1 + GetSourcesRequestDirDesc +) + +func (g GetSourcesRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetSourcesRequestDirAsc: + return "asc" + case GetSourcesRequestDirDesc: + return "desc" + } +} + +func (g GetSourcesRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetSourcesRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetSourcesRequestDirAsc + *g = value + case "desc": + value := GetSourcesRequestDirDesc + *g = value + } + return nil +} + +type GetTransformationExecutionsRequestDir uint + +const ( + GetTransformationExecutionsRequestDirAsc GetTransformationExecutionsRequestDir = iota + 1 + GetTransformationExecutionsRequestDirDesc +) + +func (g GetTransformationExecutionsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetTransformationExecutionsRequestDirAsc: + return "asc" + case GetTransformationExecutionsRequestDirDesc: + return "desc" + } +} + +func (g GetTransformationExecutionsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetTransformationExecutionsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetTransformationExecutionsRequestDirAsc + *g = value + case "desc": + value := GetTransformationExecutionsRequestDirDesc + *g = value + } + return nil +} + +type GetTransformationExecutionsRequestLogLevel uint + +const ( + GetTransformationExecutionsRequestLogLevelDebug GetTransformationExecutionsRequestLogLevel = iota + 1 + GetTransformationExecutionsRequestLogLevelInfo + GetTransformationExecutionsRequestLogLevelWarn + GetTransformationExecutionsRequestLogLevelError + GetTransformationExecutionsRequestLogLevelFatal +) + +func (g GetTransformationExecutionsRequestLogLevel) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetTransformationExecutionsRequestLogLevelDebug: + return "debug" + case GetTransformationExecutionsRequestLogLevelInfo: + return "info" + case GetTransformationExecutionsRequestLogLevelWarn: + return "warn" + case GetTransformationExecutionsRequestLogLevelError: + return "error" + case GetTransformationExecutionsRequestLogLevelFatal: + return "fatal" + } +} + +func (g GetTransformationExecutionsRequestLogLevel) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetTransformationExecutionsRequestLogLevel) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "debug": + value := GetTransformationExecutionsRequestLogLevelDebug + *g = value + case "info": + value := GetTransformationExecutionsRequestLogLevelInfo + *g = value + case "warn": + value := GetTransformationExecutionsRequestLogLevelWarn + *g = value + case "error": + value := GetTransformationExecutionsRequestLogLevelError + *g = value + case "fatal": + value := GetTransformationExecutionsRequestLogLevelFatal + *g = value + } + return nil +} + +type GetTransformationsRequestDir uint + +const ( + GetTransformationsRequestDirAsc GetTransformationsRequestDir = iota + 1 + GetTransformationsRequestDirDesc +) + +func (g GetTransformationsRequestDir) String() string { + switch g { + default: + return strconv.Itoa(int(g)) + case GetTransformationsRequestDirAsc: + return "asc" + case GetTransformationsRequestDirDesc: + return "desc" + } +} + +func (g GetTransformationsRequestDir) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", g.String())), nil +} + +func (g *GetTransformationsRequestDir) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := GetTransformationsRequestDirAsc + *g = value + case "desc": + value := GetTransformationsRequestDirDesc + *g = value + } + return nil +} + +type GitHub struct { + Configs *GitHubConfigs `json:"configs,omitempty"` + type_ string +} + +func (g *GitHub) Type() string { + return g.type_ +} + +func (g *GitHub) UnmarshalJSON(data []byte) error { + type unmarshaler GitHub + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GitHub(value) + g.type_ = "github" + return nil +} + +func (g *GitHub) MarshalJSON() ([]byte, error) { + type embed GitHub + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*g), + Type: "github", + } + return json.Marshal(marshaler) +} + +// The verification configs for GitHub. Only included if the ?include=verification.configs query param is present +type GitHubConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type GitLab struct { + Configs *GitLabConfigs `json:"configs,omitempty"` + type_ string +} + +func (g *GitLab) Type() string { + return g.type_ +} + +func (g *GitLab) UnmarshalJSON(data []byte) error { + type unmarshaler GitLab + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *g = GitLab(value) + g.type_ = "gitlab" + return nil +} + +func (g *GitLab) MarshalJSON() ([]byte, error) { + type embed GitLab + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*g), + Type: "gitlab", + } + return json.Marshal(marshaler) +} + +// The verification configs for GitLab. Only included if the ?include=verification.configs query param is present +type GitLabConfigs struct { + ApiKey string `json:"api_key"` +} + +type HandledApiKeyIntegrationConfigs struct { + ApiKey string `json:"api_key"` +} + +type HandledHmacConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Hmac struct { + Configs *HmacConfigs `json:"configs,omitempty"` + type_ string +} + +func (h *Hmac) Type() string { + return h.type_ +} + +func (h *Hmac) UnmarshalJSON(data []byte) error { + type unmarshaler Hmac + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *h = Hmac(value) + h.type_ = "hmac" + return nil +} + +func (h *Hmac) MarshalJSON() ([]byte, error) { + type embed Hmac + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*h), + Type: "hmac", + } + return json.Marshal(marshaler) +} + +type HmacAlgorithms uint + +const ( + HmacAlgorithmsMd5 HmacAlgorithms = iota + 1 + HmacAlgorithmsSha1 + HmacAlgorithmsSha256 + HmacAlgorithmsSha512 +) + +func (h HmacAlgorithms) String() string { + switch h { + default: + return strconv.Itoa(int(h)) + case HmacAlgorithmsMd5: + return "md5" + case HmacAlgorithmsSha1: + return "sha1" + case HmacAlgorithmsSha256: + return "sha256" + case HmacAlgorithmsSha512: + return "sha512" + } +} + +func (h HmacAlgorithms) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", h.String())), nil +} + +func (h *HmacAlgorithms) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "md5": + value := HmacAlgorithmsMd5 + *h = value + case "sha1": + value := HmacAlgorithmsSha1 + *h = value + case "sha256": + value := HmacAlgorithmsSha256 + *h = value + case "sha512": + value := HmacAlgorithmsSha512 + *h = value + } + return nil +} + +// The verification configs for HMAC. Only included if the ?include=verification.configs query param is present +type HmacConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` + Algorithm HmacAlgorithms `json:"algorithm,omitempty"` + HeaderKey string `json:"header_key"` + Encoding HmacConfigsEncoding `json:"encoding,omitempty"` +} + +type HmacConfigsEncoding uint + +const ( + HmacConfigsEncodingBase64 HmacConfigsEncoding = iota + 1 + HmacConfigsEncodingHex +) + +func (h HmacConfigsEncoding) String() string { + switch h { + default: + return strconv.Itoa(int(h)) + case HmacConfigsEncodingBase64: + return "base64" + case HmacConfigsEncodingHex: + return "hex" + } +} + +func (h HmacConfigsEncoding) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", h.String())), nil +} + +func (h *HmacConfigsEncoding) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "base64": + value := HmacConfigsEncodingBase64 + *h = value + case "hex": + value := HmacConfigsEncodingHex + *h = value + } + return nil +} + +type HmacIntegrationConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` + Algorithm HmacAlgorithms `json:"algorithm,omitempty"` + HeaderKey string `json:"header_key"` + Encoding HmacIntegrationConfigsEncoding `json:"encoding,omitempty"` +} + +type HmacIntegrationConfigsEncoding uint + +const ( + HmacIntegrationConfigsEncodingBase64 HmacIntegrationConfigsEncoding = iota + 1 + HmacIntegrationConfigsEncodingHex +) + +func (h HmacIntegrationConfigsEncoding) String() string { + switch h { + default: + return strconv.Itoa(int(h)) + case HmacIntegrationConfigsEncodingBase64: + return "base64" + case HmacIntegrationConfigsEncodingHex: + return "hex" + } +} + +func (h HmacIntegrationConfigsEncoding) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", h.String())), nil +} + +func (h *HmacIntegrationConfigsEncoding) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "base64": + value := HmacIntegrationConfigsEncodingBase64 + *h = value + case "hex": + value := HmacIntegrationConfigsEncodingHex + *h = value + } + return nil +} + +// Hookdeck Signature +type HookdeckSignature struct { + Config *DestinationAuthMethodSignatureConfig `json:"config,omitempty"` + type_ string +} + +func (h *HookdeckSignature) Type() string { + return h.type_ +} + +func (h *HookdeckSignature) UnmarshalJSON(data []byte) error { + type unmarshaler HookdeckSignature + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *h = HookdeckSignature(value) + h.type_ = "HOOKDECK_SIGNATURE" + return nil +} + +func (h *HookdeckSignature) MarshalJSON() ([]byte, error) { + type embed HookdeckSignature + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*h), + Type: "HOOKDECK_SIGNATURE", + } + return json.Marshal(marshaler) +} + +type IgnoredEvent struct { + Id string `json:"id"` + TeamId string `json:"team_id"` + WebhookId string `json:"webhook_id"` + Cause IgnoredEventCause `json:"cause,omitempty"` + RequestId string `json:"request_id"` + Meta *IgnoredEventMeta `json:"meta,omitempty"` + UpdatedAt time.Time `json:"updated_at"` + CreatedAt time.Time `json:"created_at"` +} + +type IgnoredEventCause uint + +const ( + IgnoredEventCauseArchived IgnoredEventCause = iota + 1 + IgnoredEventCauseFiltered + IgnoredEventCauseTransformationFailed + IgnoredEventCauseCliDisconnected +) + +func (i IgnoredEventCause) String() string { + switch i { + default: + return strconv.Itoa(int(i)) + case IgnoredEventCauseArchived: + return "ARCHIVED" + case IgnoredEventCauseFiltered: + return "FILTERED" + case IgnoredEventCauseTransformationFailed: + return "TRANSFORMATION_FAILED" + case IgnoredEventCauseCliDisconnected: + return "CLI_DISCONNECTED" + } +} + +func (i IgnoredEventCause) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", i.String())), nil +} + +func (i *IgnoredEventCause) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "ARCHIVED": + value := IgnoredEventCauseArchived + *i = value + case "FILTERED": + value := IgnoredEventCauseFiltered + *i = value + case "TRANSFORMATION_FAILED": + value := IgnoredEventCauseTransformationFailed + *i = value + case "CLI_DISCONNECTED": + value := IgnoredEventCauseCliDisconnected + *i = value + } + return nil +} + +type IgnoredEventMeta struct { + typeName string + FilteredMeta FilteredMeta + TransformationFailedMeta *TransformationFailedMeta +} + +func NewIgnoredEventMetaFromFilteredMeta(value FilteredMeta) *IgnoredEventMeta { + return &IgnoredEventMeta{typeName: "filteredMeta", FilteredMeta: value} +} + +func NewIgnoredEventMetaFromTransformationFailedMeta(value *TransformationFailedMeta) *IgnoredEventMeta { + return &IgnoredEventMeta{typeName: "transformationFailedMeta", TransformationFailedMeta: value} +} + +func (i *IgnoredEventMeta) UnmarshalJSON(data []byte) error { + var valueFilteredMeta FilteredMeta + if err := json.Unmarshal(data, &valueFilteredMeta); err == nil { + i.typeName = "filteredMeta" + i.FilteredMeta = valueFilteredMeta + return nil + } + valueTransformationFailedMeta := new(TransformationFailedMeta) + if err := json.Unmarshal(data, &valueTransformationFailedMeta); err == nil { + i.typeName = "transformationFailedMeta" + i.TransformationFailedMeta = valueTransformationFailedMeta + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IgnoredEventMeta) MarshalJSON() ([]byte, error) { + switch i.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "filteredMeta": + return json.Marshal(i.FilteredMeta) + case "transformationFailedMeta": + return json.Marshal(i.TransformationFailedMeta) + } +} + +type IgnoredEventMetaVisitor interface { + VisitFilteredMeta(FilteredMeta) error + VisitTransformationFailedMeta(*TransformationFailedMeta) error +} + +func (i *IgnoredEventMeta) Accept(visitor IgnoredEventMetaVisitor) error { + switch i.typeName { + default: + return fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "filteredMeta": + return visitor.VisitFilteredMeta(i.FilteredMeta) + case "transformationFailedMeta": + return visitor.VisitTransformationFailedMeta(i.TransformationFailedMeta) + } +} + +type IgnoredEventPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*IgnoredEvent `json:"models,omitempty"` +} + +type Integration struct { + // ID of the integration + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + // Label of the integration + Label string `json:"label"` + Provider IntegrationProvider `json:"provider,omitempty"` + // List of features to enable (see features list below) + Features []IntegrationFeature `json:"features,omitempty"` + // Decrypted Key/Value object of the associated configuration for that provider + Configs *IntegrationConfigs `json:"configs,omitempty"` + // List of source IDs the integration is attached to + Sources []string `json:"sources,omitempty"` + // Date the integration was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the integration was created + CreatedAt time.Time `json:"created_at"` +} + +// Decrypted Key/Value object of the associated configuration for that provider +type IntegrationConfigs struct { + typeName string + HmacIntegrationConfigs *HmacIntegrationConfigs + ApiKeyIntegrationConfigs *ApiKeyIntegrationConfigs + HandledApiKeyIntegrationConfigs *HandledApiKeyIntegrationConfigs + HandledHmacConfigs *HandledHmacConfigs + BasicAuthIntegrationConfigs *BasicAuthIntegrationConfigs + ShopifyIntegrationConfigs *ShopifyIntegrationConfigs + IntegrationConfigsSix *IntegrationConfigsSix +} + +func NewIntegrationConfigsFromHmacIntegrationConfigs(value *HmacIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typeName: "hmacIntegrationConfigs", HmacIntegrationConfigs: value} +} + +func NewIntegrationConfigsFromApiKeyIntegrationConfigs(value *ApiKeyIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typeName: "apiKeyIntegrationConfigs", ApiKeyIntegrationConfigs: value} +} + +func NewIntegrationConfigsFromHandledApiKeyIntegrationConfigs(value *HandledApiKeyIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typeName: "handledApiKeyIntegrationConfigs", HandledApiKeyIntegrationConfigs: value} +} + +func NewIntegrationConfigsFromHandledHmacConfigs(value *HandledHmacConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typeName: "handledHmacConfigs", HandledHmacConfigs: value} +} + +func NewIntegrationConfigsFromBasicAuthIntegrationConfigs(value *BasicAuthIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typeName: "basicAuthIntegrationConfigs", BasicAuthIntegrationConfigs: value} +} + +func NewIntegrationConfigsFromShopifyIntegrationConfigs(value *ShopifyIntegrationConfigs) *IntegrationConfigs { + return &IntegrationConfigs{typeName: "shopifyIntegrationConfigs", ShopifyIntegrationConfigs: value} +} + +func NewIntegrationConfigsFromIntegrationConfigsSix(value *IntegrationConfigsSix) *IntegrationConfigs { + return &IntegrationConfigs{typeName: "integrationConfigsSix", IntegrationConfigsSix: value} +} + +func (i *IntegrationConfigs) UnmarshalJSON(data []byte) error { + valueHmacIntegrationConfigs := new(HmacIntegrationConfigs) + if err := json.Unmarshal(data, &valueHmacIntegrationConfigs); err == nil { + i.typeName = "hmacIntegrationConfigs" + i.HmacIntegrationConfigs = valueHmacIntegrationConfigs + return nil + } + valueApiKeyIntegrationConfigs := new(ApiKeyIntegrationConfigs) + if err := json.Unmarshal(data, &valueApiKeyIntegrationConfigs); err == nil { + i.typeName = "apiKeyIntegrationConfigs" + i.ApiKeyIntegrationConfigs = valueApiKeyIntegrationConfigs + return nil + } + valueHandledApiKeyIntegrationConfigs := new(HandledApiKeyIntegrationConfigs) + if err := json.Unmarshal(data, &valueHandledApiKeyIntegrationConfigs); err == nil { + i.typeName = "handledApiKeyIntegrationConfigs" + i.HandledApiKeyIntegrationConfigs = valueHandledApiKeyIntegrationConfigs + return nil + } + valueHandledHmacConfigs := new(HandledHmacConfigs) + if err := json.Unmarshal(data, &valueHandledHmacConfigs); err == nil { + i.typeName = "handledHmacConfigs" + i.HandledHmacConfigs = valueHandledHmacConfigs + return nil + } + valueBasicAuthIntegrationConfigs := new(BasicAuthIntegrationConfigs) + if err := json.Unmarshal(data, &valueBasicAuthIntegrationConfigs); err == nil { + i.typeName = "basicAuthIntegrationConfigs" + i.BasicAuthIntegrationConfigs = valueBasicAuthIntegrationConfigs + return nil + } + valueShopifyIntegrationConfigs := new(ShopifyIntegrationConfigs) + if err := json.Unmarshal(data, &valueShopifyIntegrationConfigs); err == nil { + i.typeName = "shopifyIntegrationConfigs" + i.ShopifyIntegrationConfigs = valueShopifyIntegrationConfigs + return nil + } + valueIntegrationConfigsSix := new(IntegrationConfigsSix) + if err := json.Unmarshal(data, &valueIntegrationConfigsSix); err == nil { + i.typeName = "integrationConfigsSix" + i.IntegrationConfigsSix = valueIntegrationConfigsSix + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IntegrationConfigs) MarshalJSON() ([]byte, error) { + switch i.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "hmacIntegrationConfigs": + return json.Marshal(i.HmacIntegrationConfigs) + case "apiKeyIntegrationConfigs": + return json.Marshal(i.ApiKeyIntegrationConfigs) + case "handledApiKeyIntegrationConfigs": + return json.Marshal(i.HandledApiKeyIntegrationConfigs) + case "handledHmacConfigs": + return json.Marshal(i.HandledHmacConfigs) + case "basicAuthIntegrationConfigs": + return json.Marshal(i.BasicAuthIntegrationConfigs) + case "shopifyIntegrationConfigs": + return json.Marshal(i.ShopifyIntegrationConfigs) + case "integrationConfigsSix": + return json.Marshal(i.IntegrationConfigsSix) + } +} + +type IntegrationConfigsVisitor interface { + VisitHmacIntegrationConfigs(*HmacIntegrationConfigs) error + VisitApiKeyIntegrationConfigs(*ApiKeyIntegrationConfigs) error + VisitHandledApiKeyIntegrationConfigs(*HandledApiKeyIntegrationConfigs) error + VisitHandledHmacConfigs(*HandledHmacConfigs) error + VisitBasicAuthIntegrationConfigs(*BasicAuthIntegrationConfigs) error + VisitShopifyIntegrationConfigs(*ShopifyIntegrationConfigs) error + VisitIntegrationConfigsSix(*IntegrationConfigsSix) error +} + +func (i *IntegrationConfigs) Accept(visitor IntegrationConfigsVisitor) error { + switch i.typeName { + default: + return fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "hmacIntegrationConfigs": + return visitor.VisitHmacIntegrationConfigs(i.HmacIntegrationConfigs) + case "apiKeyIntegrationConfigs": + return visitor.VisitApiKeyIntegrationConfigs(i.ApiKeyIntegrationConfigs) + case "handledApiKeyIntegrationConfigs": + return visitor.VisitHandledApiKeyIntegrationConfigs(i.HandledApiKeyIntegrationConfigs) + case "handledHmacConfigs": + return visitor.VisitHandledHmacConfigs(i.HandledHmacConfigs) + case "basicAuthIntegrationConfigs": + return visitor.VisitBasicAuthIntegrationConfigs(i.BasicAuthIntegrationConfigs) + case "shopifyIntegrationConfigs": + return visitor.VisitShopifyIntegrationConfigs(i.ShopifyIntegrationConfigs) + case "integrationConfigsSix": + return visitor.VisitIntegrationConfigsSix(i.IntegrationConfigsSix) + } +} + +type IntegrationConfigsSix struct { +} + +type IntegrationFeature uint + +const ( + IntegrationFeatureVerification IntegrationFeature = iota + 1 + IntegrationFeatureHandshake + IntegrationFeaturePolling +) + +func (i IntegrationFeature) String() string { + switch i { + default: + return strconv.Itoa(int(i)) + case IntegrationFeatureVerification: + return "VERIFICATION" + case IntegrationFeatureHandshake: + return "HANDSHAKE" + case IntegrationFeaturePolling: + return "POLLING" + } +} + +func (i IntegrationFeature) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", i.String())), nil +} + +func (i *IntegrationFeature) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "VERIFICATION": + value := IntegrationFeatureVerification + *i = value + case "HANDSHAKE": + value := IntegrationFeatureHandshake + *i = value + case "POLLING": + value := IntegrationFeaturePolling + *i = value + } + return nil +} + +type IntegrationPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*Integration `json:"models,omitempty"` +} + +type IntegrationProvider uint + +const ( + IntegrationProviderHmac IntegrationProvider = iota + 1 + IntegrationProviderBasicAuth + IntegrationProviderApiKey + IntegrationProviderTwitter + IntegrationProviderStripe + IntegrationProviderRecharge + IntegrationProviderGithub + IntegrationProviderShopify + IntegrationProviderPostmark + IntegrationProviderTypeform + IntegrationProviderXero + IntegrationProviderSvix + IntegrationProviderZoom + IntegrationProviderAkeneo + IntegrationProviderAdyen + IntegrationProviderGitlab + IntegrationProviderPropertyFinder + IntegrationProviderWoocommerce + IntegrationProviderOura + IntegrationProviderCommercelayer + IntegrationProviderMailgun + IntegrationProviderPipedrive + IntegrationProviderSendgrid + IntegrationProviderWorkos + IntegrationProviderSynctera + IntegrationProviderAwsSns + IntegrationProviderThreeDEye +) + +func (i IntegrationProvider) String() string { + switch i { + default: + return strconv.Itoa(int(i)) + case IntegrationProviderHmac: + return "hmac" + case IntegrationProviderBasicAuth: + return "basic_auth" + case IntegrationProviderApiKey: + return "api_key" + case IntegrationProviderTwitter: + return "twitter" + case IntegrationProviderStripe: + return "stripe" + case IntegrationProviderRecharge: + return "recharge" + case IntegrationProviderGithub: + return "github" + case IntegrationProviderShopify: + return "shopify" + case IntegrationProviderPostmark: + return "postmark" + case IntegrationProviderTypeform: + return "typeform" + case IntegrationProviderXero: + return "xero" + case IntegrationProviderSvix: + return "svix" + case IntegrationProviderZoom: + return "zoom" + case IntegrationProviderAkeneo: + return "akeneo" + case IntegrationProviderAdyen: + return "adyen" + case IntegrationProviderGitlab: + return "gitlab" + case IntegrationProviderPropertyFinder: + return "property-finder" + case IntegrationProviderWoocommerce: + return "woocommerce" + case IntegrationProviderOura: + return "oura" + case IntegrationProviderCommercelayer: + return "commercelayer" + case IntegrationProviderMailgun: + return "mailgun" + case IntegrationProviderPipedrive: + return "pipedrive" + case IntegrationProviderSendgrid: + return "sendgrid" + case IntegrationProviderWorkos: + return "workos" + case IntegrationProviderSynctera: + return "synctera" + case IntegrationProviderAwsSns: + return "aws_sns" + case IntegrationProviderThreeDEye: + return "three_d_eye" + } +} + +func (i IntegrationProvider) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", i.String())), nil +} + +func (i *IntegrationProvider) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "hmac": + value := IntegrationProviderHmac + *i = value + case "basic_auth": + value := IntegrationProviderBasicAuth + *i = value + case "api_key": + value := IntegrationProviderApiKey + *i = value + case "twitter": + value := IntegrationProviderTwitter + *i = value + case "stripe": + value := IntegrationProviderStripe + *i = value + case "recharge": + value := IntegrationProviderRecharge + *i = value + case "github": + value := IntegrationProviderGithub + *i = value + case "shopify": + value := IntegrationProviderShopify + *i = value + case "postmark": + value := IntegrationProviderPostmark + *i = value + case "typeform": + value := IntegrationProviderTypeform + *i = value + case "xero": + value := IntegrationProviderXero + *i = value + case "svix": + value := IntegrationProviderSvix + *i = value + case "zoom": + value := IntegrationProviderZoom + *i = value + case "akeneo": + value := IntegrationProviderAkeneo + *i = value + case "adyen": + value := IntegrationProviderAdyen + *i = value + case "gitlab": + value := IntegrationProviderGitlab + *i = value + case "property-finder": + value := IntegrationProviderPropertyFinder + *i = value + case "woocommerce": + value := IntegrationProviderWoocommerce + *i = value + case "oura": + value := IntegrationProviderOura + *i = value + case "commercelayer": + value := IntegrationProviderCommercelayer + *i = value + case "mailgun": + value := IntegrationProviderMailgun + *i = value + case "pipedrive": + value := IntegrationProviderPipedrive + *i = value + case "sendgrid": + value := IntegrationProviderSendgrid + *i = value + case "workos": + value := IntegrationProviderWorkos + *i = value + case "synctera": + value := IntegrationProviderSynctera + *i = value + case "aws_sns": + value := IntegrationProviderAwsSns + *i = value + case "three_d_eye": + value := IntegrationProviderThreeDEye + *i = value + } + return nil +} + +// Issue +type Issue struct { + typeName string + DeliveryIssue *DeliveryIssue + TransformationIssue *TransformationIssue +} + +func NewIssueFromDeliveryIssue(value *DeliveryIssue) *Issue { + return &Issue{typeName: "deliveryIssue", DeliveryIssue: value} +} + +func NewIssueFromTransformationIssue(value *TransformationIssue) *Issue { + return &Issue{typeName: "transformationIssue", TransformationIssue: value} +} + +func (i *Issue) UnmarshalJSON(data []byte) error { + valueDeliveryIssue := new(DeliveryIssue) + if err := json.Unmarshal(data, &valueDeliveryIssue); err == nil { + i.typeName = "deliveryIssue" + i.DeliveryIssue = valueDeliveryIssue + return nil + } + valueTransformationIssue := new(TransformationIssue) + if err := json.Unmarshal(data, &valueTransformationIssue); err == nil { + i.typeName = "transformationIssue" + i.TransformationIssue = valueTransformationIssue + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i Issue) MarshalJSON() ([]byte, error) { + switch i.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "deliveryIssue": + return json.Marshal(i.DeliveryIssue) + case "transformationIssue": + return json.Marshal(i.TransformationIssue) + } +} + +type IssueVisitor interface { + VisitDeliveryIssue(*DeliveryIssue) error + VisitTransformationIssue(*TransformationIssue) error +} + +func (i *Issue) Accept(visitor IssueVisitor) error { + switch i.typeName { + default: + return fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "deliveryIssue": + return visitor.VisitDeliveryIssue(i.DeliveryIssue) + case "transformationIssue": + return visitor.VisitTransformationIssue(i.TransformationIssue) + } +} + +type IssueCount struct { + // Number of issues + Count int `json:"count"` +} + +// Issue status +type IssueStatus uint + +const ( + IssueStatusOpened IssueStatus = iota + 1 + IssueStatusIgnored + IssueStatusAcknowledged + IssueStatusResolved +) + +func (i IssueStatus) String() string { + switch i { + default: + return strconv.Itoa(int(i)) + case IssueStatusOpened: + return "OPENED" + case IssueStatusIgnored: + return "IGNORED" + case IssueStatusAcknowledged: + return "ACKNOWLEDGED" + case IssueStatusResolved: + return "RESOLVED" + } +} + +func (i IssueStatus) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", i.String())), nil +} + +func (i *IssueStatus) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "OPENED": + value := IssueStatusOpened + *i = value + case "IGNORED": + value := IssueStatusIgnored + *i = value + case "ACKNOWLEDGED": + value := IssueStatusAcknowledged + *i = value + case "RESOLVED": + value := IssueStatusResolved + *i = value + } + return nil +} + +type IssueTrigger struct { + // ID of the issue trigger + Id string `json:"id"` + // ID of the workspace + TeamId *string `json:"team_id,omitempty"` + // Optional unique name to use as reference when using the API + Name *string `json:"name,omitempty"` + Type IssueType `json:"type,omitempty"` + Configs *IssueTriggerReference `json:"configs,omitempty"` + Channels *IssueTriggerChannels `json:"channels,omitempty"` + // ISO timestamp for when the issue trigger was disabled + DisabledAt *time.Time `json:"disabled_at,omitempty"` + // ISO timestamp for when the issue trigger was last updated + UpdatedAt time.Time `json:"updated_at"` + // ISO timestamp for when the issue trigger was created + CreatedAt time.Time `json:"created_at"` + // ISO timestamp for when the issue trigger was deleted + DeletedAt *time.Time `json:"deleted_at,omitempty"` +} + +// Configurations for a 'Backpressure' issue trigger +type IssueTriggerBackpressureConfigs struct { + Delay IssueTriggerBackpressureDelay `json:"delay"` + // A pattern to match on the destination name or array of destination IDs. Use `*` as wildcard. + Destinations *IssueTriggerBackpressureConfigsDestinations `json:"destinations,omitempty"` +} + +// A pattern to match on the destination name or array of destination IDs. Use `*` as wildcard. +type IssueTriggerBackpressureConfigsDestinations struct { + typeName string + String string + StringList []string +} + +func NewIssueTriggerBackpressureConfigsDestinationsFromString(value string) *IssueTriggerBackpressureConfigsDestinations { + return &IssueTriggerBackpressureConfigsDestinations{typeName: "string", String: value} +} + +func NewIssueTriggerBackpressureConfigsDestinationsFromStringList(value []string) *IssueTriggerBackpressureConfigsDestinations { + return &IssueTriggerBackpressureConfigsDestinations{typeName: "stringList", StringList: value} +} + +func (i *IssueTriggerBackpressureConfigsDestinations) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + i.typeName = "string" + i.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + i.typeName = "stringList" + i.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueTriggerBackpressureConfigsDestinations) MarshalJSON() ([]byte, error) { + switch i.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "string": + return json.Marshal(i.String) + case "stringList": + return json.Marshal(i.StringList) + } +} + +type IssueTriggerBackpressureConfigsDestinationsVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (i *IssueTriggerBackpressureConfigsDestinations) Accept(visitor IssueTriggerBackpressureConfigsDestinationsVisitor) error { + switch i.typeName { + default: + return fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "string": + return visitor.VisitString(i.String) + case "stringList": + return visitor.VisitStringList(i.StringList) + } +} + +// The minimum delay (backpressure) to open the issue for min of 1 minute (60000) and max of 1 day (86400000) +type IssueTriggerBackpressureDelay = int + +// Notification channels object for the specific channel type +type IssueTriggerChannels struct { + Slack *IssueTriggerSlackChannel `json:"slack,omitempty"` + Opsgenie *IssueTriggerIntegrationChannel `json:"opsgenie,omitempty"` + Email *IssueTriggerEmailChannel `json:"email,omitempty"` +} + +// Configurations for a 'delivery' issue trigger +type IssueTriggerDeliveryConfigs struct { + Strategy IssueTriggerStrategy `json:"strategy,omitempty"` + // A pattern to match on the connection name or array of connection IDs. Use `*` as wildcard. + Connections *IssueTriggerDeliveryConfigsConnections `json:"connections,omitempty"` +} + +// A pattern to match on the connection name or array of connection IDs. Use `*` as wildcard. +type IssueTriggerDeliveryConfigsConnections struct { + typeName string + String string + StringList []string +} + +func NewIssueTriggerDeliveryConfigsConnectionsFromString(value string) *IssueTriggerDeliveryConfigsConnections { + return &IssueTriggerDeliveryConfigsConnections{typeName: "string", String: value} +} + +func NewIssueTriggerDeliveryConfigsConnectionsFromStringList(value []string) *IssueTriggerDeliveryConfigsConnections { + return &IssueTriggerDeliveryConfigsConnections{typeName: "stringList", StringList: value} +} + +func (i *IssueTriggerDeliveryConfigsConnections) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + i.typeName = "string" + i.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + i.typeName = "stringList" + i.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueTriggerDeliveryConfigsConnections) MarshalJSON() ([]byte, error) { + switch i.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "string": + return json.Marshal(i.String) + case "stringList": + return json.Marshal(i.StringList) + } +} + +type IssueTriggerDeliveryConfigsConnectionsVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (i *IssueTriggerDeliveryConfigsConnections) Accept(visitor IssueTriggerDeliveryConfigsConnectionsVisitor) error { + switch i.typeName { + default: + return fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "string": + return visitor.VisitString(i.String) + case "stringList": + return visitor.VisitStringList(i.StringList) + } +} + +// Email channel for an issue trigger +type IssueTriggerEmailChannel struct { +} + +// Integration channel for an issue trigger +type IssueTriggerIntegrationChannel struct { +} + +type IssueTriggerPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*IssueTrigger `json:"models,omitempty"` +} + +// Configuration object for the specific issue type selected +type IssueTriggerReference struct { + typeName string + IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs + IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs + IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs +} + +func NewIssueTriggerReferenceFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *IssueTriggerReference { + return &IssueTriggerReference{typeName: "issueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} +} + +func NewIssueTriggerReferenceFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *IssueTriggerReference { + return &IssueTriggerReference{typeName: "issueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} +} + +func NewIssueTriggerReferenceFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *IssueTriggerReference { + return &IssueTriggerReference{typeName: "issueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} +} + +func (i *IssueTriggerReference) UnmarshalJSON(data []byte) error { + valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { + i.typeName = "issueTriggerDeliveryConfigs" + i.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs + return nil + } + valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { + i.typeName = "issueTriggerTransformationConfigs" + i.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs + return nil + } + valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { + i.typeName = "issueTriggerBackpressureConfigs" + i.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueTriggerReference) MarshalJSON() ([]byte, error) { + switch i.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "issueTriggerDeliveryConfigs": + return json.Marshal(i.IssueTriggerDeliveryConfigs) + case "issueTriggerTransformationConfigs": + return json.Marshal(i.IssueTriggerTransformationConfigs) + case "issueTriggerBackpressureConfigs": + return json.Marshal(i.IssueTriggerBackpressureConfigs) + } +} + +type IssueTriggerReferenceVisitor interface { + VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error + VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error + VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error +} + +func (i *IssueTriggerReference) Accept(visitor IssueTriggerReferenceVisitor) error { + switch i.typeName { + default: + return fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "issueTriggerDeliveryConfigs": + return visitor.VisitIssueTriggerDeliveryConfigs(i.IssueTriggerDeliveryConfigs) + case "issueTriggerTransformationConfigs": + return visitor.VisitIssueTriggerTransformationConfigs(i.IssueTriggerTransformationConfigs) + case "issueTriggerBackpressureConfigs": + return visitor.VisitIssueTriggerBackpressureConfigs(i.IssueTriggerBackpressureConfigs) + } +} + +// Slack channel for an issue trigger +type IssueTriggerSlackChannel struct { + // Channel name + ChannelName string `json:"channel_name"` +} + +// The strategy uses to open the issue +type IssueTriggerStrategy uint + +const ( + IssueTriggerStrategyFirstAttempt IssueTriggerStrategy = iota + 1 + IssueTriggerStrategyFinalAttempt +) + +func (i IssueTriggerStrategy) String() string { + switch i { + default: + return strconv.Itoa(int(i)) + case IssueTriggerStrategyFirstAttempt: + return "first_attempt" + case IssueTriggerStrategyFinalAttempt: + return "final_attempt" + } +} + +func (i IssueTriggerStrategy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", i.String())), nil +} + +func (i *IssueTriggerStrategy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "first_attempt": + value := IssueTriggerStrategyFirstAttempt + *i = value + case "final_attempt": + value := IssueTriggerStrategyFinalAttempt + *i = value + } + return nil +} + +// Configurations for a 'Transformation' issue trigger +type IssueTriggerTransformationConfigs struct { + LogLevel TransformationExecutionLogLevel `json:"log_level,omitempty"` + // A pattern to match on the transformation name or array of transformation IDs. Use `*` as wildcard. + Transformations *IssueTriggerTransformationConfigsTransformations `json:"transformations,omitempty"` +} + +// A pattern to match on the transformation name or array of transformation IDs. Use `*` as wildcard. +type IssueTriggerTransformationConfigsTransformations struct { + typeName string + String string + StringList []string +} + +func NewIssueTriggerTransformationConfigsTransformationsFromString(value string) *IssueTriggerTransformationConfigsTransformations { + return &IssueTriggerTransformationConfigsTransformations{typeName: "string", String: value} +} + +func NewIssueTriggerTransformationConfigsTransformationsFromStringList(value []string) *IssueTriggerTransformationConfigsTransformations { + return &IssueTriggerTransformationConfigsTransformations{typeName: "stringList", StringList: value} +} + +func (i *IssueTriggerTransformationConfigsTransformations) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + i.typeName = "string" + i.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + i.typeName = "stringList" + i.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueTriggerTransformationConfigsTransformations) MarshalJSON() ([]byte, error) { + switch i.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "string": + return json.Marshal(i.String) + case "stringList": + return json.Marshal(i.StringList) + } +} + +type IssueTriggerTransformationConfigsTransformationsVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (i *IssueTriggerTransformationConfigsTransformations) Accept(visitor IssueTriggerTransformationConfigsTransformationsVisitor) error { + switch i.typeName { + default: + return fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "string": + return visitor.VisitString(i.String) + case "stringList": + return visitor.VisitStringList(i.StringList) + } +} + +// Issue type +type IssueType uint + +const ( + IssueTypeDelivery IssueType = iota + 1 + IssueTypeTransformation + IssueTypeBackpressure +) + +func (i IssueType) String() string { + switch i { + default: + return strconv.Itoa(int(i)) + case IssueTypeDelivery: + return "delivery" + case IssueTypeTransformation: + return "transformation" + case IssueTypeBackpressure: + return "backpressure" + } +} + +func (i IssueType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", i.String())), nil +} + +func (i *IssueType) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "delivery": + value := IssueTypeDelivery + *i = value + case "transformation": + value := IssueTypeTransformation + *i = value + case "backpressure": + value := IssueTypeBackpressure + *i = value + } + return nil +} + +type IssueWithData struct { + typeName string + DeliveryIssueWithData *DeliveryIssueWithData + TransformationIssueWithData *TransformationIssueWithData +} + +func NewIssueWithDataFromDeliveryIssueWithData(value *DeliveryIssueWithData) *IssueWithData { + return &IssueWithData{typeName: "deliveryIssueWithData", DeliveryIssueWithData: value} +} + +func NewIssueWithDataFromTransformationIssueWithData(value *TransformationIssueWithData) *IssueWithData { + return &IssueWithData{typeName: "transformationIssueWithData", TransformationIssueWithData: value} +} + +func (i *IssueWithData) UnmarshalJSON(data []byte) error { + valueDeliveryIssueWithData := new(DeliveryIssueWithData) + if err := json.Unmarshal(data, &valueDeliveryIssueWithData); err == nil { + i.typeName = "deliveryIssueWithData" + i.DeliveryIssueWithData = valueDeliveryIssueWithData + return nil + } + valueTransformationIssueWithData := new(TransformationIssueWithData) + if err := json.Unmarshal(data, &valueTransformationIssueWithData); err == nil { + i.typeName = "transformationIssueWithData" + i.TransformationIssueWithData = valueTransformationIssueWithData + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, i) +} + +func (i IssueWithData) MarshalJSON() ([]byte, error) { + switch i.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "deliveryIssueWithData": + return json.Marshal(i.DeliveryIssueWithData) + case "transformationIssueWithData": + return json.Marshal(i.TransformationIssueWithData) + } +} + +type IssueWithDataVisitor interface { + VisitDeliveryIssueWithData(*DeliveryIssueWithData) error + VisitTransformationIssueWithData(*TransformationIssueWithData) error +} + +func (i *IssueWithData) Accept(visitor IssueWithDataVisitor) error { + switch i.typeName { + default: + return fmt.Errorf("invalid type %s in %T", i.typeName, i) + case "deliveryIssueWithData": + return visitor.VisitDeliveryIssueWithData(i.DeliveryIssueWithData) + case "transformationIssueWithData": + return visitor.VisitTransformationIssueWithData(i.TransformationIssueWithData) + } +} + +type IssueWithDataPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*IssueWithData `json:"models,omitempty"` +} + +type ListCustomDomainSchema = []*ListCustomDomainSchemaItem + +type ListCustomDomainSchemaItem struct { + Id *string `json:"id,omitempty"` + Hostname *string `json:"hostname,omitempty"` + Status *string `json:"status,omitempty"` + Ssl *ListCustomDomainSchemaItemSsl `json:"ssl,omitempty"` + VerificationErrors []string `json:"verification_errors,omitempty"` + OwnershipVerification *ListCustomDomainSchemaItemOwnershipVerification `json:"ownership_verification,omitempty"` + CreatedAt *string `json:"created_at,omitempty"` +} + +type ListCustomDomainSchemaItemOwnershipVerification struct { + Type *string `json:"type,omitempty"` + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} + +type ListCustomDomainSchemaItemSsl struct { + Id *string `json:"id,omitempty"` + Type *string `json:"type,omitempty"` + Method *string `json:"method,omitempty"` + Status *string `json:"status,omitempty"` + TxtName *string `json:"txt_name,omitempty"` + TxtValue *string `json:"txt_value,omitempty"` + ValidationRecords []*ListCustomDomainSchemaItemSslValidationRecordsItem `json:"validation_records,omitempty"` + DcvDelegationRecords []*ListCustomDomainSchemaItemSslDcvDelegationRecordsItem `json:"dcv_delegation_records,omitempty"` + Settings *ListCustomDomainSchemaItemSslSettings `json:"settings,omitempty"` + BundleMethod *string `json:"bundle_method,omitempty"` + Wildcard *bool `json:"wildcard,omitempty"` + CertificateAuthority *string `json:"certificate_authority,omitempty"` +} + +type ListCustomDomainSchemaItemSslDcvDelegationRecordsItem struct { + Cname *string `json:"cname,omitempty"` + CnameTarget *string `json:"cname_target,omitempty"` +} + +type ListCustomDomainSchemaItemSslSettings struct { + MinTlsVersion *string `json:"min_tls_version,omitempty"` +} + +type ListCustomDomainSchemaItemSslValidationRecordsItem struct { + Status *string `json:"status,omitempty"` + TxtName *string `json:"txt_name,omitempty"` + TxtValue *string `json:"txt_value,omitempty"` +} + +type Mailgun struct { + Configs *MailgunConfigs `json:"configs,omitempty"` + type_ string +} + +func (m *Mailgun) Type() string { + return m.type_ +} + +func (m *Mailgun) UnmarshalJSON(data []byte) error { + type unmarshaler Mailgun + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *m = Mailgun(value) + m.type_ = "mailgun" + return nil +} + +func (m *Mailgun) MarshalJSON() ([]byte, error) { + type embed Mailgun + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*m), + Type: "mailgun", + } + return json.Marshal(marshaler) +} + +// The verification configs for Mailgun. Only included if the ?include=verification.configs query param is present +type MailgunConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type OrderByDirection uint + +const ( + OrderByDirectionasc OrderByDirection = iota + 1 + OrderByDirectiondesc + OrderByDirectionASC + OrderByDirectionDESC +) + +func (o OrderByDirection) String() string { + switch o { + default: + return strconv.Itoa(int(o)) + case OrderByDirectionasc: + return "asc" + case OrderByDirectiondesc: + return "desc" + case OrderByDirectionASC: + return "ASC" + case OrderByDirectionDESC: + return "DESC" + } +} + +func (o OrderByDirection) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", o.String())), nil +} + +func (o *OrderByDirection) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "asc": + value := OrderByDirectionasc + *o = value + case "desc": + value := OrderByDirectiondesc + *o = value + case "ASC": + value := OrderByDirectionASC + *o = value + case "DESC": + value := OrderByDirectionDESC + *o = value + } + return nil +} + +type Oura struct { + Configs *OuraConfigs `json:"configs,omitempty"` + type_ string +} + +func (o *Oura) Type() string { + return o.type_ +} + +func (o *Oura) UnmarshalJSON(data []byte) error { + type unmarshaler Oura + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *o = Oura(value) + o.type_ = "oura" + return nil +} + +func (o *Oura) MarshalJSON() ([]byte, error) { + type embed Oura + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*o), + Type: "oura", + } + return json.Marshal(marshaler) +} + +// The verification configs for Oura. Only included if the ?include=verification.configs query param is present +type OuraConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Pipedrive struct { + Configs *PipedriveConfigs `json:"configs,omitempty"` + type_ string +} + +func (p *Pipedrive) Type() string { + return p.type_ +} + +func (p *Pipedrive) UnmarshalJSON(data []byte) error { + type unmarshaler Pipedrive + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = Pipedrive(value) + p.type_ = "pipedrive" + return nil +} + +func (p *Pipedrive) MarshalJSON() ([]byte, error) { + type embed Pipedrive + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*p), + Type: "pipedrive", + } + return json.Marshal(marshaler) +} + +// The verification configs for Pipedrive. Only included if the ?include=verification.configs query param is present +type PipedriveConfigs struct { + Name string `json:"name"` + Password string `json:"password"` +} + +type Postmark struct { + Configs *PostmarkConfigs `json:"configs,omitempty"` + type_ string +} + +func (p *Postmark) Type() string { + return p.type_ +} + +func (p *Postmark) UnmarshalJSON(data []byte) error { + type unmarshaler Postmark + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = Postmark(value) + p.type_ = "postmark" + return nil +} + +func (p *Postmark) MarshalJSON() ([]byte, error) { + type embed Postmark + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*p), + Type: "postmark", + } + return json.Marshal(marshaler) +} + +// The verification configs for Postmark. Only included if the ?include=verification.configs query param is present +type PostmarkConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type PropertyFinder struct { + Configs *PropertyFinderConfigs `json:"configs,omitempty"` + type_ string +} + +func (p *PropertyFinder) Type() string { + return p.type_ +} + +func (p *PropertyFinder) UnmarshalJSON(data []byte) error { + type unmarshaler PropertyFinder + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *p = PropertyFinder(value) + p.type_ = "property-finder" + return nil +} + +func (p *PropertyFinder) MarshalJSON() ([]byte, error) { + type embed PropertyFinder + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*p), + Type: "property-finder", + } + return json.Marshal(marshaler) +} + +// The verification configs for Property Finder. Only included if the ?include=verification.configs query param is present +type PropertyFinderConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type RawBody struct { + Body string `json:"body"` +} + +type Recharge struct { + Configs *RechargeConfigs `json:"configs,omitempty"` + type_ string +} + +func (r *Recharge) Type() string { + return r.type_ +} + +func (r *Recharge) UnmarshalJSON(data []byte) error { + type unmarshaler Recharge + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = Recharge(value) + r.type_ = "recharge" + return nil +} + +func (r *Recharge) MarshalJSON() ([]byte, error) { + type embed Recharge + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*r), + Type: "recharge", + } + return json.Marshal(marshaler) +} + +// The verification configs for Recharge. Only included if the ?include=verification.configs query param is present +type RechargeConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` + Algorithm HmacAlgorithms `json:"algorithm,omitempty"` + HeaderKey string `json:"header_key"` + Encoding RechargeConfigsEncoding `json:"encoding,omitempty"` +} + +type RechargeConfigsEncoding uint + +const ( + RechargeConfigsEncodingBase64 RechargeConfigsEncoding = iota + 1 + RechargeConfigsEncodingHex +) + +func (r RechargeConfigsEncoding) String() string { + switch r { + default: + return strconv.Itoa(int(r)) + case RechargeConfigsEncodingBase64: + return "base64" + case RechargeConfigsEncodingHex: + return "hex" + } +} + +func (r RechargeConfigsEncoding) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", r.String())), nil +} + +func (r *RechargeConfigsEncoding) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "base64": + value := RechargeConfigsEncodingBase64 + *r = value + case "hex": + value := RechargeConfigsEncodingHex + *r = value + } + return nil +} + +type Request struct { + // ID of the request + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + // Whether or not the request was verified when received + Verified *bool `json:"verified,omitempty"` + // ID of the request data + OriginalEventDataId *string `json:"original_event_data_id,omitempty"` + RejectionCause RequestRejectionCause `json:"rejection_cause,omitempty"` + // The priority attributed to the request when received + IngestPriority *RequestIngestPriority `json:"ingest_priority,omitempty"` + // The time the request was originally received + IngestedAt *time.Time `json:"ingested_at,omitempty"` + // ID of the associated source + SourceId string `json:"source_id"` + // The count of events created from this request (CLI events not included) + EventsCount *int `json:"events_count,omitempty"` + // The count of CLI events created from this request + CliEventsCount *int `json:"cli_events_count,omitempty"` + IgnoredCount *int `json:"ignored_count,omitempty"` + // Date the event was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the event was created + CreatedAt time.Time `json:"created_at"` + Data *ShortEventData `json:"data,omitempty"` +} + +// The priority attributed to the request when received +type RequestIngestPriority uint + +const ( + RequestIngestPriorityNormal RequestIngestPriority = iota + 1 + RequestIngestPriorityLow +) + +func (r RequestIngestPriority) String() string { + switch r { + default: + return strconv.Itoa(int(r)) + case RequestIngestPriorityNormal: + return "NORMAL" + case RequestIngestPriorityLow: + return "LOW" + } +} + +func (r RequestIngestPriority) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", r.String())), nil +} + +func (r *RequestIngestPriority) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "NORMAL": + value := RequestIngestPriorityNormal + *r = value + case "LOW": + value := RequestIngestPriorityLow + *r = value + } + return nil +} + +type RequestPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*Request `json:"models,omitempty"` +} + +type RequestRejectionCause uint + +const ( + RequestRejectionCauseSourceArchived RequestRejectionCause = iota + 1 + RequestRejectionCauseNoWebhook + RequestRejectionCauseVerificationFailed + RequestRejectionCauseUnsupportedHttpMethod + RequestRejectionCauseUnsupportedContentType + RequestRejectionCauseUnparsableJson + RequestRejectionCausePayloadTooLarge + RequestRejectionCauseIngestionFatal + RequestRejectionCauseUnknown +) + +func (r RequestRejectionCause) String() string { + switch r { + default: + return strconv.Itoa(int(r)) + case RequestRejectionCauseSourceArchived: + return "SOURCE_ARCHIVED" + case RequestRejectionCauseNoWebhook: + return "NO_WEBHOOK" + case RequestRejectionCauseVerificationFailed: + return "VERIFICATION_FAILED" + case RequestRejectionCauseUnsupportedHttpMethod: + return "UNSUPPORTED_HTTP_METHOD" + case RequestRejectionCauseUnsupportedContentType: + return "UNSUPPORTED_CONTENT_TYPE" + case RequestRejectionCauseUnparsableJson: + return "UNPARSABLE_JSON" + case RequestRejectionCausePayloadTooLarge: + return "PAYLOAD_TOO_LARGE" + case RequestRejectionCauseIngestionFatal: + return "INGESTION_FATAL" + case RequestRejectionCauseUnknown: + return "UNKNOWN" + } +} + +func (r RequestRejectionCause) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", r.String())), nil +} + +func (r *RequestRejectionCause) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "SOURCE_ARCHIVED": + value := RequestRejectionCauseSourceArchived + *r = value + case "NO_WEBHOOK": + value := RequestRejectionCauseNoWebhook + *r = value + case "VERIFICATION_FAILED": + value := RequestRejectionCauseVerificationFailed + *r = value + case "UNSUPPORTED_HTTP_METHOD": + value := RequestRejectionCauseUnsupportedHttpMethod + *r = value + case "UNSUPPORTED_CONTENT_TYPE": + value := RequestRejectionCauseUnsupportedContentType + *r = value + case "UNPARSABLE_JSON": + value := RequestRejectionCauseUnparsableJson + *r = value + case "PAYLOAD_TOO_LARGE": + value := RequestRejectionCausePayloadTooLarge + *r = value + case "INGESTION_FATAL": + value := RequestRejectionCauseIngestionFatal + *r = value + case "UNKNOWN": + value := RequestRejectionCauseUnknown + *r = value + } + return nil +} + +type RetriedEvent struct { + Event *Event `json:"event,omitempty"` + Attempt *EventAttempt `json:"attempt,omitempty"` +} + +type RetryRequest struct { + Request *Request `json:"request,omitempty"` + Events []*Event `json:"events,omitempty"` +} + +type RetryRule struct { + Strategy RetryStrategy `json:"strategy,omitempty"` + // Time in MS between each retry + Interval *int `json:"interval,omitempty"` + // Maximum number of retries to attempt + Count *int `json:"count,omitempty"` + type_ string +} + +func (r *RetryRule) Type() string { + return r.type_ +} + +func (r *RetryRule) UnmarshalJSON(data []byte) error { + type unmarshaler RetryRule + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *r = RetryRule(value) + r.type_ = "retry" + return nil +} + +func (r *RetryRule) MarshalJSON() ([]byte, error) { + type embed RetryRule + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*r), + Type: "retry", + } + return json.Marshal(marshaler) +} + +// Algorithm to use when calculating delay between retries +type RetryStrategy uint + +const ( + RetryStrategyLinear RetryStrategy = iota + 1 + RetryStrategyExponential +) + +func (r RetryStrategy) String() string { + switch r { + default: + return strconv.Itoa(int(r)) + case RetryStrategyLinear: + return "linear" + case RetryStrategyExponential: + return "exponential" + } +} + +func (r RetryStrategy) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", r.String())), nil +} + +func (r *RetryStrategy) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "linear": + value := RetryStrategyLinear + *r = value + case "exponential": + value := RetryStrategyExponential + *r = value + } + return nil +} + +type Rule struct { + typeName string + RetryRule *RetryRule + FilterRule *FilterRule + TransformRule *TransformRule + DelayRule *DelayRule +} + +func NewRuleFromRetryRule(value *RetryRule) *Rule { + return &Rule{typeName: "retryRule", RetryRule: value} +} + +func NewRuleFromFilterRule(value *FilterRule) *Rule { + return &Rule{typeName: "filterRule", FilterRule: value} +} + +func NewRuleFromTransformRule(value *TransformRule) *Rule { + return &Rule{typeName: "transformRule", TransformRule: value} +} + +func NewRuleFromDelayRule(value *DelayRule) *Rule { + return &Rule{typeName: "delayRule", DelayRule: value} +} + +func (r *Rule) UnmarshalJSON(data []byte) error { + valueRetryRule := new(RetryRule) + if err := json.Unmarshal(data, &valueRetryRule); err == nil { + r.typeName = "retryRule" + r.RetryRule = valueRetryRule + return nil + } + valueFilterRule := new(FilterRule) + if err := json.Unmarshal(data, &valueFilterRule); err == nil { + r.typeName = "filterRule" + r.FilterRule = valueFilterRule + return nil + } + valueTransformRule := new(TransformRule) + if err := json.Unmarshal(data, &valueTransformRule); err == nil { + r.typeName = "transformRule" + r.TransformRule = valueTransformRule + return nil + } + valueDelayRule := new(DelayRule) + if err := json.Unmarshal(data, &valueDelayRule); err == nil { + r.typeName = "delayRule" + r.DelayRule = valueDelayRule + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, r) +} + +func (r Rule) MarshalJSON() ([]byte, error) { + switch r.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", r.typeName, r) + case "retryRule": + return json.Marshal(r.RetryRule) + case "filterRule": + return json.Marshal(r.FilterRule) + case "transformRule": + return json.Marshal(r.TransformRule) + case "delayRule": + return json.Marshal(r.DelayRule) + } +} + +type RuleVisitor interface { + VisitRetryRule(*RetryRule) error + VisitFilterRule(*FilterRule) error + VisitTransformRule(*TransformRule) error + VisitDelayRule(*DelayRule) error +} + +func (r *Rule) Accept(visitor RuleVisitor) error { + switch r.typeName { + default: + return fmt.Errorf("invalid type %s in %T", r.typeName, r) + case "retryRule": + return visitor.VisitRetryRule(r.RetryRule) + case "filterRule": + return visitor.VisitFilterRule(r.FilterRule) + case "transformRule": + return visitor.VisitTransformRule(r.TransformRule) + case "delayRule": + return visitor.VisitDelayRule(r.DelayRule) + } +} + +type SeekPagination struct { + OrderBy *SeekPaginationOrderBy `json:"order_by,omitempty"` + Dir *SeekPaginationDir `json:"dir,omitempty"` + Limit *int `json:"limit,omitempty"` + Prev *string `json:"prev,omitempty"` + Next *string `json:"next,omitempty"` +} + +type SeekPaginationDir struct { + typeName string + OrderByDirection OrderByDirection + OrderByDirectionList []OrderByDirection +} + +func NewSeekPaginationDirFromOrderByDirection(value OrderByDirection) *SeekPaginationDir { + return &SeekPaginationDir{typeName: "orderByDirection", OrderByDirection: value} +} + +func NewSeekPaginationDirFromOrderByDirectionList(value []OrderByDirection) *SeekPaginationDir { + return &SeekPaginationDir{typeName: "orderByDirectionList", OrderByDirectionList: value} +} + +func (s *SeekPaginationDir) UnmarshalJSON(data []byte) error { + var valueOrderByDirection OrderByDirection + if err := json.Unmarshal(data, &valueOrderByDirection); err == nil { + s.typeName = "orderByDirection" + s.OrderByDirection = valueOrderByDirection + return nil + } + var valueOrderByDirectionList []OrderByDirection + if err := json.Unmarshal(data, &valueOrderByDirectionList); err == nil { + s.typeName = "orderByDirectionList" + s.OrderByDirectionList = valueOrderByDirectionList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s SeekPaginationDir) MarshalJSON() ([]byte, error) { + switch s.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "orderByDirection": + return json.Marshal(s.OrderByDirection) + case "orderByDirectionList": + return json.Marshal(s.OrderByDirectionList) + } +} + +type SeekPaginationDirVisitor interface { + VisitOrderByDirection(OrderByDirection) error + VisitOrderByDirectionList([]OrderByDirection) error +} + +func (s *SeekPaginationDir) Accept(visitor SeekPaginationDirVisitor) error { + switch s.typeName { + default: + return fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "orderByDirection": + return visitor.VisitOrderByDirection(s.OrderByDirection) + case "orderByDirectionList": + return visitor.VisitOrderByDirectionList(s.OrderByDirectionList) + } +} + +type SeekPaginationOrderBy struct { + typeName string + String string + StringList []string +} + +func NewSeekPaginationOrderByFromString(value string) *SeekPaginationOrderBy { + return &SeekPaginationOrderBy{typeName: "string", String: value} +} + +func NewSeekPaginationOrderByFromStringList(value []string) *SeekPaginationOrderBy { + return &SeekPaginationOrderBy{typeName: "stringList", StringList: value} +} + +func (s *SeekPaginationOrderBy) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + s.typeName = "string" + s.String = valueString + return nil + } + var valueStringList []string + if err := json.Unmarshal(data, &valueStringList); err == nil { + s.typeName = "stringList" + s.StringList = valueStringList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s SeekPaginationOrderBy) MarshalJSON() ([]byte, error) { + switch s.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "string": + return json.Marshal(s.String) + case "stringList": + return json.Marshal(s.StringList) + } +} + +type SeekPaginationOrderByVisitor interface { + VisitString(string) error + VisitStringList([]string) error +} + +func (s *SeekPaginationOrderBy) Accept(visitor SeekPaginationOrderByVisitor) error { + switch s.typeName { + default: + return fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "string": + return visitor.VisitString(s.String) + case "stringList": + return visitor.VisitStringList(s.StringList) + } +} + +type SendGrid struct { + Configs *SendGridConfigs `json:"configs,omitempty"` + type_ string +} + +func (s *SendGrid) Type() string { + return s.type_ +} + +func (s *SendGrid) UnmarshalJSON(data []byte) error { + type unmarshaler SendGrid + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = SendGrid(value) + s.type_ = "sendgrid" + return nil +} + +func (s *SendGrid) MarshalJSON() ([]byte, error) { + type embed SendGrid + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + Type: "sendgrid", + } + return json.Marshal(marshaler) +} + +// The verification configs for SendGrid. Only included if the ?include=verification.configs query param is present +type SendGridConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Shopify struct { + Configs *ShopifyConfigs `json:"configs,omitempty"` + type_ string +} + +func (s *Shopify) Type() string { + return s.type_ +} + +func (s *Shopify) UnmarshalJSON(data []byte) error { + type unmarshaler Shopify + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = Shopify(value) + s.type_ = "shopify" + return nil +} + +func (s *Shopify) MarshalJSON() ([]byte, error) { + type embed Shopify + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + Type: "shopify", + } + return json.Marshal(marshaler) +} + +// The verification configs for Shopify. Only included if the ?include=verification.configs query param is present +type ShopifyConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` + RateLimitPeriod *ShopifyConfigsRateLimitPeriod `json:"rate_limit_period,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty"` + ApiKey *string `json:"api_key,omitempty"` + ApiSecret *string `json:"api_secret,omitempty"` + Shop *string `json:"shop,omitempty"` +} + +type ShopifyConfigsRateLimitPeriod uint + +const ( + ShopifyConfigsRateLimitPeriodMinute ShopifyConfigsRateLimitPeriod = iota + 1 + ShopifyConfigsRateLimitPeriodSecond +) + +func (s ShopifyConfigsRateLimitPeriod) String() string { + switch s { + default: + return strconv.Itoa(int(s)) + case ShopifyConfigsRateLimitPeriodMinute: + return "minute" + case ShopifyConfigsRateLimitPeriodSecond: + return "second" + } +} + +func (s ShopifyConfigsRateLimitPeriod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", s.String())), nil +} + +func (s *ShopifyConfigsRateLimitPeriod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "minute": + value := ShopifyConfigsRateLimitPeriodMinute + *s = value + case "second": + value := ShopifyConfigsRateLimitPeriodSecond + *s = value + } + return nil +} + +type ShopifyIntegrationConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` + RateLimitPeriod *ShopifyIntegrationConfigsRateLimitPeriod `json:"rate_limit_period,omitempty"` + RateLimit *float64 `json:"rate_limit,omitempty"` + ApiKey *string `json:"api_key,omitempty"` + ApiSecret *string `json:"api_secret,omitempty"` + Shop *string `json:"shop,omitempty"` +} + +type ShopifyIntegrationConfigsRateLimitPeriod uint + +const ( + ShopifyIntegrationConfigsRateLimitPeriodMinute ShopifyIntegrationConfigsRateLimitPeriod = iota + 1 + ShopifyIntegrationConfigsRateLimitPeriodSecond +) + +func (s ShopifyIntegrationConfigsRateLimitPeriod) String() string { + switch s { + default: + return strconv.Itoa(int(s)) + case ShopifyIntegrationConfigsRateLimitPeriodMinute: + return "minute" + case ShopifyIntegrationConfigsRateLimitPeriodSecond: + return "second" + } +} + +func (s ShopifyIntegrationConfigsRateLimitPeriod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", s.String())), nil +} + +func (s *ShopifyIntegrationConfigsRateLimitPeriod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "minute": + value := ShopifyIntegrationConfigsRateLimitPeriodMinute + *s = value + case "second": + value := ShopifyIntegrationConfigsRateLimitPeriodSecond + *s = value + } + return nil +} + +// Request data +type ShortEventData struct { + // Request path + Path string `json:"path"` + // Raw query param string + Query *string `json:"query,omitempty"` + // JSON representation of query params + ParsedQuery *ShortEventDataParsedQuery `json:"parsed_query,omitempty"` + // JSON representation of the headers + Headers *ShortEventDataHeaders `json:"headers,omitempty"` + // JSON or string representation of the body + Body *ShortEventDataBody `json:"body,omitempty"` + // Whether the payload is considered large payload and not searchable + IsLargePayload *bool `json:"is_large_payload,omitempty"` +} + +// JSON or string representation of the body +type ShortEventDataBody struct { + typeName string + String string + ShortEventDataBodyOne *ShortEventDataBodyOne + UnknownList []any +} + +func NewShortEventDataBodyFromString(value string) *ShortEventDataBody { + return &ShortEventDataBody{typeName: "string", String: value} +} + +func NewShortEventDataBodyFromShortEventDataBodyOne(value *ShortEventDataBodyOne) *ShortEventDataBody { + return &ShortEventDataBody{typeName: "shortEventDataBodyOne", ShortEventDataBodyOne: value} +} + +func NewShortEventDataBodyFromUnknownList(value []any) *ShortEventDataBody { + return &ShortEventDataBody{typeName: "unknownList", UnknownList: value} +} + +func (s *ShortEventDataBody) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + s.typeName = "string" + s.String = valueString + return nil + } + valueShortEventDataBodyOne := new(ShortEventDataBodyOne) + if err := json.Unmarshal(data, &valueShortEventDataBodyOne); err == nil { + s.typeName = "shortEventDataBodyOne" + s.ShortEventDataBodyOne = valueShortEventDataBodyOne + return nil + } + var valueUnknownList []any + if err := json.Unmarshal(data, &valueUnknownList); err == nil { + s.typeName = "unknownList" + s.UnknownList = valueUnknownList + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s ShortEventDataBody) MarshalJSON() ([]byte, error) { + switch s.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "string": + return json.Marshal(s.String) + case "shortEventDataBodyOne": + return json.Marshal(s.ShortEventDataBodyOne) + case "unknownList": + return json.Marshal(s.UnknownList) + } +} + +type ShortEventDataBodyVisitor interface { + VisitString(string) error + VisitShortEventDataBodyOne(*ShortEventDataBodyOne) error + VisitUnknownList([]any) error +} + +func (s *ShortEventDataBody) Accept(visitor ShortEventDataBodyVisitor) error { + switch s.typeName { + default: + return fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "string": + return visitor.VisitString(s.String) + case "shortEventDataBodyOne": + return visitor.VisitShortEventDataBodyOne(s.ShortEventDataBodyOne) + case "unknownList": + return visitor.VisitUnknownList(s.UnknownList) + } +} + +type ShortEventDataBodyOne struct { +} + +// JSON representation of the headers +type ShortEventDataHeaders struct { + typeName string + String string + StringStringOptionalMap map[string]*string +} + +func NewShortEventDataHeadersFromString(value string) *ShortEventDataHeaders { + return &ShortEventDataHeaders{typeName: "string", String: value} +} + +func NewShortEventDataHeadersFromStringStringOptionalMap(value map[string]*string) *ShortEventDataHeaders { + return &ShortEventDataHeaders{typeName: "stringStringOptionalMap", StringStringOptionalMap: value} +} + +func (s *ShortEventDataHeaders) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + s.typeName = "string" + s.String = valueString + return nil + } + var valueStringStringOptionalMap map[string]*string + if err := json.Unmarshal(data, &valueStringStringOptionalMap); err == nil { + s.typeName = "stringStringOptionalMap" + s.StringStringOptionalMap = valueStringStringOptionalMap + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s ShortEventDataHeaders) MarshalJSON() ([]byte, error) { + switch s.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "string": + return json.Marshal(s.String) + case "stringStringOptionalMap": + return json.Marshal(s.StringStringOptionalMap) + } +} + +type ShortEventDataHeadersVisitor interface { + VisitString(string) error + VisitStringStringOptionalMap(map[string]*string) error +} + +func (s *ShortEventDataHeaders) Accept(visitor ShortEventDataHeadersVisitor) error { + switch s.typeName { + default: + return fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "string": + return visitor.VisitString(s.String) + case "stringStringOptionalMap": + return visitor.VisitStringStringOptionalMap(s.StringStringOptionalMap) + } +} + +// JSON representation of query params +type ShortEventDataParsedQuery struct { + typeName string + StringOptional *string + ShortEventDataParsedQueryOne *ShortEventDataParsedQueryOne +} + +func NewShortEventDataParsedQueryFromStringOptional(value *string) *ShortEventDataParsedQuery { + return &ShortEventDataParsedQuery{typeName: "stringOptional", StringOptional: value} +} + +func NewShortEventDataParsedQueryFromShortEventDataParsedQueryOne(value *ShortEventDataParsedQueryOne) *ShortEventDataParsedQuery { + return &ShortEventDataParsedQuery{typeName: "shortEventDataParsedQueryOne", ShortEventDataParsedQueryOne: value} +} + +func (s *ShortEventDataParsedQuery) UnmarshalJSON(data []byte) error { + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + s.typeName = "stringOptional" + s.StringOptional = valueStringOptional + return nil + } + valueShortEventDataParsedQueryOne := new(ShortEventDataParsedQueryOne) + if err := json.Unmarshal(data, &valueShortEventDataParsedQueryOne); err == nil { + s.typeName = "shortEventDataParsedQueryOne" + s.ShortEventDataParsedQueryOne = valueShortEventDataParsedQueryOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, s) +} + +func (s ShortEventDataParsedQuery) MarshalJSON() ([]byte, error) { + switch s.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "stringOptional": + return json.Marshal(s.StringOptional) + case "shortEventDataParsedQueryOne": + return json.Marshal(s.ShortEventDataParsedQueryOne) + } +} + +type ShortEventDataParsedQueryVisitor interface { + VisitStringOptional(*string) error + VisitShortEventDataParsedQueryOne(*ShortEventDataParsedQueryOne) error +} + +func (s *ShortEventDataParsedQuery) Accept(visitor ShortEventDataParsedQueryVisitor) error { + switch s.typeName { + default: + return fmt.Errorf("invalid type %s in %T", s.typeName, s) + case "stringOptional": + return visitor.VisitStringOptional(s.StringOptional) + case "shortEventDataParsedQueryOne": + return visitor.VisitShortEventDataParsedQueryOne(s.ShortEventDataParsedQueryOne) + } +} + +type ShortEventDataParsedQueryOne struct { +} + +// Associated [Source](#source-object) object +type Source struct { + // ID of the source + Id string `json:"id"` + // Name for the source + Name string `json:"name"` + // Description of the source + Description *string `json:"description,omitempty"` + // ID of the workspace + TeamId string `json:"team_id"` + // A unique URL that must be supplied to your webhook's provider + Url string `json:"url"` + Verification *VerificationConfig `json:"verification,omitempty"` + AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty"` + CustomResponse *SourceCustomResponse `json:"custom_response,omitempty"` + // Date the source was archived + ArchivedAt *time.Time `json:"archived_at,omitempty"` + // Date the source was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the source was created + CreatedAt time.Time `json:"created_at"` +} + +// List of allowed HTTP methods. Defaults to PUT, POST, PATCH, DELETE. +type SourceAllowedHttpMethod = []SourceAllowedHttpMethodItem + +type SourceAllowedHttpMethodItem uint + +const ( + SourceAllowedHttpMethodItemGet SourceAllowedHttpMethodItem = iota + 1 + SourceAllowedHttpMethodItemPost + SourceAllowedHttpMethodItemPut + SourceAllowedHttpMethodItemPatch + SourceAllowedHttpMethodItemDelete +) + +func (s SourceAllowedHttpMethodItem) String() string { + switch s { + default: + return strconv.Itoa(int(s)) + case SourceAllowedHttpMethodItemGet: + return "GET" + case SourceAllowedHttpMethodItemPost: + return "POST" + case SourceAllowedHttpMethodItemPut: + return "PUT" + case SourceAllowedHttpMethodItemPatch: + return "PATCH" + case SourceAllowedHttpMethodItemDelete: + return "DELETE" + } +} + +func (s SourceAllowedHttpMethodItem) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", s.String())), nil +} + +func (s *SourceAllowedHttpMethodItem) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "GET": + value := SourceAllowedHttpMethodItemGet + *s = value + case "POST": + value := SourceAllowedHttpMethodItemPost + *s = value + case "PUT": + value := SourceAllowedHttpMethodItemPut + *s = value + case "PATCH": + value := SourceAllowedHttpMethodItemPatch + *s = value + case "DELETE": + value := SourceAllowedHttpMethodItemDelete + *s = value + } + return nil +} + +// Custom response object +type SourceCustomResponse struct { + ContentType SourceCustomResponseContentType `json:"content_type,omitempty"` + // Body of the custom response `<= 1000 characters` + Body string `json:"body"` +} + +// Content type of the custom response +type SourceCustomResponseContentType uint + +const ( + SourceCustomResponseContentTypeJson SourceCustomResponseContentType = iota + 1 + SourceCustomResponseContentTypeText + SourceCustomResponseContentTypeXml +) + +func (s SourceCustomResponseContentType) String() string { + switch s { + default: + return strconv.Itoa(int(s)) + case SourceCustomResponseContentTypeJson: + return "json" + case SourceCustomResponseContentTypeText: + return "text" + case SourceCustomResponseContentTypeXml: + return "xml" + } +} + +func (s SourceCustomResponseContentType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", s.String())), nil +} + +func (s *SourceCustomResponseContentType) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "json": + value := SourceCustomResponseContentTypeJson + *s = value + case "text": + value := SourceCustomResponseContentTypeText + *s = value + case "xml": + value := SourceCustomResponseContentTypeXml + *s = value + } + return nil +} + +type SourcePaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*Source `json:"models,omitempty"` +} + +type Stripe struct { + Configs *StripeConfigs `json:"configs,omitempty"` + type_ string +} + +func (s *Stripe) Type() string { + return s.type_ +} + +func (s *Stripe) UnmarshalJSON(data []byte) error { + type unmarshaler Stripe + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = Stripe(value) + s.type_ = "stripe" + return nil +} + +func (s *Stripe) MarshalJSON() ([]byte, error) { + type embed Stripe + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + Type: "stripe", + } + return json.Marshal(marshaler) +} + +// The verification configs for Stripe. Only included if the ?include=verification.configs query param is present +type StripeConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Svix struct { + Configs *SvixConfigs `json:"configs,omitempty"` + type_ string +} + +func (s *Svix) Type() string { + return s.type_ +} + +func (s *Svix) UnmarshalJSON(data []byte) error { + type unmarshaler Svix + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = Svix(value) + s.type_ = "svix" + return nil +} + +func (s *Svix) MarshalJSON() ([]byte, error) { + type embed Svix + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + Type: "svix", + } + return json.Marshal(marshaler) +} + +// The verification configs for Svix. Only included if the ?include=verification.configs query param is present +type SvixConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Synctera struct { + Configs *SyncteraConfigs `json:"configs,omitempty"` + type_ string +} + +func (s *Synctera) Type() string { + return s.type_ +} + +func (s *Synctera) UnmarshalJSON(data []byte) error { + type unmarshaler Synctera + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *s = Synctera(value) + s.type_ = "synctera" + return nil +} + +func (s *Synctera) MarshalJSON() ([]byte, error) { + type embed Synctera + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + Type: "synctera", + } + return json.Marshal(marshaler) +} + +// The verification configs for Synctera. Only included if the ?include=verification.configs query param is present +type SyncteraConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +// Key-value environment variables to be passed to the transformation +type TestTransformationRequestEnv struct { +} + +// Request input to use for the transformation execution +type TestTransformationRequestRequest struct { + // Headers of the request + Headers map[string]string `json:"headers,omitempty"` + // Body of the request + Body *TestTransformationRequestRequestBody `json:"body,omitempty"` + // Path of the request + Path *string `json:"path,omitempty"` + // String representation of the query params of the request + Query *string `json:"query,omitempty"` + // JSON representation of the query params + ParsedQuery *TestTransformationRequestRequestParsedQuery `json:"parsed_query,omitempty"` +} + +// Body of the request +type TestTransformationRequestRequestBody struct { + typeName string + TestTransformationRequestRequestBodyZero *TestTransformationRequestRequestBodyZero + String string +} + +func NewTestTransformationRequestRequestBodyFromTestTransformationRequestRequestBodyZero(value *TestTransformationRequestRequestBodyZero) *TestTransformationRequestRequestBody { + return &TestTransformationRequestRequestBody{typeName: "testTransformationRequestRequestBodyZero", TestTransformationRequestRequestBodyZero: value} +} + +func NewTestTransformationRequestRequestBodyFromString(value string) *TestTransformationRequestRequestBody { + return &TestTransformationRequestRequestBody{typeName: "string", String: value} +} + +func (t *TestTransformationRequestRequestBody) UnmarshalJSON(data []byte) error { + valueTestTransformationRequestRequestBodyZero := new(TestTransformationRequestRequestBodyZero) + if err := json.Unmarshal(data, &valueTestTransformationRequestRequestBodyZero); err == nil { + t.typeName = "testTransformationRequestRequestBodyZero" + t.TestTransformationRequestRequestBodyZero = valueTestTransformationRequestRequestBodyZero + return nil + } + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + t.typeName = "string" + t.String = valueString + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TestTransformationRequestRequestBody) MarshalJSON() ([]byte, error) { + switch t.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "testTransformationRequestRequestBodyZero": + return json.Marshal(t.TestTransformationRequestRequestBodyZero) + case "string": + return json.Marshal(t.String) + } +} + +type TestTransformationRequestRequestBodyVisitor interface { + VisitTestTransformationRequestRequestBodyZero(*TestTransformationRequestRequestBodyZero) error + VisitString(string) error +} + +func (t *TestTransformationRequestRequestBody) Accept(visitor TestTransformationRequestRequestBodyVisitor) error { + switch t.typeName { + default: + return fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "testTransformationRequestRequestBodyZero": + return visitor.VisitTestTransformationRequestRequestBodyZero(t.TestTransformationRequestRequestBodyZero) + case "string": + return visitor.VisitString(t.String) + } +} + +type TestTransformationRequestRequestBodyZero struct { +} + +// JSON representation of the query params +type TestTransformationRequestRequestParsedQuery struct { +} + +type ThreeDEye struct { + Configs *ThreeDEyeConfigs `json:"configs,omitempty"` + type_ string +} + +func (t *ThreeDEye) Type() string { + return t.type_ +} + +func (t *ThreeDEye) UnmarshalJSON(data []byte) error { + type unmarshaler ThreeDEye + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = ThreeDEye(value) + t.type_ = "three_d_eye" + return nil +} + +func (t *ThreeDEye) MarshalJSON() ([]byte, error) { + type embed ThreeDEye + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "three_d_eye", + } + return json.Marshal(marshaler) +} + +// The verification configs for 3dEye. Only included if the ?include=verification.configs query param is present +type ThreeDEyeConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type ToggleWebhookNotifications struct { + Enabled bool `json:"enabled"` + Topics []TopicsValue `json:"topics,omitempty"` + SourceId string `json:"source_id"` +} + +// Supported topics +type TopicsValue uint + +const ( + TopicsValueIssueOpened TopicsValue = iota + 1 + TopicsValueIssueUpdated + TopicsValueDeprecatedAttemptFailed + TopicsValueEventSuccessful +) + +func (t TopicsValue) String() string { + switch t { + default: + return strconv.Itoa(int(t)) + case TopicsValueIssueOpened: + return "issue.opened" + case TopicsValueIssueUpdated: + return "issue.updated" + case TopicsValueDeprecatedAttemptFailed: + return "deprecated.attempt-failed" + case TopicsValueEventSuccessful: + return "event.successful" + } +} + +func (t TopicsValue) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", t.String())), nil +} + +func (t *TopicsValue) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "issue.opened": + value := TopicsValueIssueOpened + *t = value + case "issue.updated": + value := TopicsValueIssueUpdated + *t = value + case "deprecated.attempt-failed": + value := TopicsValueDeprecatedAttemptFailed + *t = value + case "event.successful": + value := TopicsValueEventSuccessful + *t = value + } + return nil +} + +type TransformFull struct { + // ID of the attached transformation object. Optional input, always set once the rule is defined + TransformationId *string `json:"transformation_id,omitempty"` + // You can optionally define a new transformation while creating a transform rule + Transformation *TransformFullTransformation `json:"transformation,omitempty"` + type_ string +} + +func (t *TransformFull) Type() string { + return t.type_ +} + +func (t *TransformFull) UnmarshalJSON(data []byte) error { + type unmarshaler TransformFull + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformFull(value) + t.type_ = "transform" + return nil +} + +func (t *TransformFull) MarshalJSON() ([]byte, error) { + type embed TransformFull + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "transform", + } + return json.Marshal(marshaler) +} + +// You can optionally define a new transformation while creating a transform rule +type TransformFullTransformation struct { + // The unique name of the transformation + Name string `json:"name"` + // A string representation of your JavaScript (ES6) code to run + Code string `json:"code"` + // A key-value object of environment variables to encrypt and expose to your transformation code + Env map[string]*string `json:"env,omitempty"` +} + +type TransformReference struct { + // ID of the attached transformation object. Optional input, always set once the rule is defined + TransformationId string `json:"transformation_id"` + type_ string +} + +func (t *TransformReference) Type() string { + return t.type_ +} + +func (t *TransformReference) UnmarshalJSON(data []byte) error { + type unmarshaler TransformReference + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformReference(value) + t.type_ = "transform" + return nil +} + +func (t *TransformReference) MarshalJSON() ([]byte, error) { + type embed TransformReference + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "transform", + } + return json.Marshal(marshaler) +} + +type TransformRule struct { + typeName string + TransformReference *TransformReference + TransformFull *TransformFull +} + +func NewTransformRuleFromTransformReference(value *TransformReference) *TransformRule { + return &TransformRule{typeName: "transformReference", TransformReference: value} +} + +func NewTransformRuleFromTransformFull(value *TransformFull) *TransformRule { + return &TransformRule{typeName: "transformFull", TransformFull: value} +} + +func (t *TransformRule) UnmarshalJSON(data []byte) error { + valueTransformReference := new(TransformReference) + if err := json.Unmarshal(data, &valueTransformReference); err == nil { + t.typeName = "transformReference" + t.TransformReference = valueTransformReference + return nil + } + valueTransformFull := new(TransformFull) + if err := json.Unmarshal(data, &valueTransformFull); err == nil { + t.typeName = "transformFull" + t.TransformFull = valueTransformFull + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformRule) MarshalJSON() ([]byte, error) { + switch t.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "transformReference": + return json.Marshal(t.TransformReference) + case "transformFull": + return json.Marshal(t.TransformFull) + } +} + +type TransformRuleVisitor interface { + VisitTransformReference(*TransformReference) error + VisitTransformFull(*TransformFull) error +} + +func (t *TransformRule) Accept(visitor TransformRuleVisitor) error { + switch t.typeName { + default: + return fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "transformReference": + return visitor.VisitTransformReference(t.TransformReference) + case "transformFull": + return visitor.VisitTransformFull(t.TransformFull) + } +} + +type Transformation struct { + // ID of the transformation + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + // A unique, human-friendly name for the transformation + Name string `json:"name"` + // JavaScript code to be executed + Code string `json:"code"` + EncryptedEnv *string `json:"encrypted_env,omitempty"` + Iv *string `json:"iv,omitempty"` + // Key-value environment variables to be passed to the transformation + Env map[string]*string `json:"env,omitempty"` + // Date the transformation was last updated + UpdatedAt time.Time `json:"updated_at"` + // Date the transformation was created + CreatedAt time.Time `json:"created_at"` +} + +type TransformationExecution struct { + Id string `json:"id"` + TransformedEventDataId string `json:"transformed_event_data_id"` + OriginalEventDataId string `json:"original_event_data_id"` + TransformationId string `json:"transformation_id"` + TeamId string `json:"team_id"` + WebhookId string `json:"webhook_id"` + LogLevel TransformationExecutionLogLevel `json:"log_level,omitempty"` + Logs []*ConsoleLine `json:"logs,omitempty"` + UpdatedAt time.Time `json:"updated_at"` + CreatedAt time.Time `json:"created_at"` + OriginalEventData *ShortEventData `json:"original_event_data,omitempty"` + TransformedEventData *ShortEventData `json:"transformed_event_data,omitempty"` + IssueId *string `json:"issue_id,omitempty"` +} + +// The minimum log level to open the issue on +type TransformationExecutionLogLevel uint + +const ( + TransformationExecutionLogLevelDebug TransformationExecutionLogLevel = iota + 1 + TransformationExecutionLogLevelInfo + TransformationExecutionLogLevelWarn + TransformationExecutionLogLevelError + TransformationExecutionLogLevelFatal +) + +func (t TransformationExecutionLogLevel) String() string { + switch t { + default: + return strconv.Itoa(int(t)) + case TransformationExecutionLogLevelDebug: + return "debug" + case TransformationExecutionLogLevelInfo: + return "info" + case TransformationExecutionLogLevelWarn: + return "warn" + case TransformationExecutionLogLevelError: + return "error" + case TransformationExecutionLogLevelFatal: + return "fatal" + } +} + +func (t TransformationExecutionLogLevel) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", t.String())), nil +} + +func (t *TransformationExecutionLogLevel) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "debug": + value := TransformationExecutionLogLevelDebug + *t = value + case "info": + value := TransformationExecutionLogLevelInfo + *t = value + case "warn": + value := TransformationExecutionLogLevelWarn + *t = value + case "error": + value := TransformationExecutionLogLevelError + *t = value + case "fatal": + value := TransformationExecutionLogLevelFatal + *t = value + } + return nil +} + +type TransformationExecutionPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*TransformationExecution `json:"models,omitempty"` +} + +type TransformationExecutorOutput struct { + RequestId *string `json:"request_id,omitempty"` + TransformationId *string `json:"transformation_id,omitempty"` + ExecutionId *string `json:"execution_id,omitempty"` + LogLevel TransformationExecutionLogLevel `json:"log_level,omitempty"` + Request *TransformationExecutorOutputRequest `json:"request,omitempty"` + Console []*ConsoleLine `json:"console,omitempty"` +} + +type TransformationExecutorOutputRequest struct { + Headers *TransformationExecutorOutputRequestHeaders `json:"headers,omitempty"` + Path string `json:"path"` + Query *TransformationExecutorOutputRequestQuery `json:"query,omitempty"` + ParsedQuery *TransformationExecutorOutputRequestParsedQuery `json:"parsed_query,omitempty"` + Body *TransformationExecutorOutputRequestBody `json:"body,omitempty"` +} + +type TransformationExecutorOutputRequestBody struct { + typeName string + StringOptional *string + TransformationExecutorOutputRequestBodyOne *TransformationExecutorOutputRequestBodyOne +} + +func NewTransformationExecutorOutputRequestBodyFromStringOptional(value *string) *TransformationExecutorOutputRequestBody { + return &TransformationExecutorOutputRequestBody{typeName: "stringOptional", StringOptional: value} +} + +func NewTransformationExecutorOutputRequestBodyFromTransformationExecutorOutputRequestBodyOne(value *TransformationExecutorOutputRequestBodyOne) *TransformationExecutorOutputRequestBody { + return &TransformationExecutorOutputRequestBody{typeName: "transformationExecutorOutputRequestBodyOne", TransformationExecutorOutputRequestBodyOne: value} +} + +func (t *TransformationExecutorOutputRequestBody) UnmarshalJSON(data []byte) error { + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + t.typeName = "stringOptional" + t.StringOptional = valueStringOptional + return nil + } + valueTransformationExecutorOutputRequestBodyOne := new(TransformationExecutorOutputRequestBodyOne) + if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestBodyOne); err == nil { + t.typeName = "transformationExecutorOutputRequestBodyOne" + t.TransformationExecutorOutputRequestBodyOne = valueTransformationExecutorOutputRequestBodyOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationExecutorOutputRequestBody) MarshalJSON() ([]byte, error) { + switch t.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "stringOptional": + return json.Marshal(t.StringOptional) + case "transformationExecutorOutputRequestBodyOne": + return json.Marshal(t.TransformationExecutorOutputRequestBodyOne) + } +} + +type TransformationExecutorOutputRequestBodyVisitor interface { + VisitStringOptional(*string) error + VisitTransformationExecutorOutputRequestBodyOne(*TransformationExecutorOutputRequestBodyOne) error +} + +func (t *TransformationExecutorOutputRequestBody) Accept(visitor TransformationExecutorOutputRequestBodyVisitor) error { + switch t.typeName { + default: + return fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "stringOptional": + return visitor.VisitStringOptional(t.StringOptional) + case "transformationExecutorOutputRequestBodyOne": + return visitor.VisitTransformationExecutorOutputRequestBodyOne(t.TransformationExecutorOutputRequestBodyOne) + } +} + +type TransformationExecutorOutputRequestBodyOne struct { +} + +type TransformationExecutorOutputRequestHeaders struct { + typeName string + String string + StringUnknownMap map[string]any +} + +func NewTransformationExecutorOutputRequestHeadersFromString(value string) *TransformationExecutorOutputRequestHeaders { + return &TransformationExecutorOutputRequestHeaders{typeName: "string", String: value} +} + +func NewTransformationExecutorOutputRequestHeadersFromStringUnknownMap(value map[string]any) *TransformationExecutorOutputRequestHeaders { + return &TransformationExecutorOutputRequestHeaders{typeName: "stringUnknownMap", StringUnknownMap: value} +} + +func (t *TransformationExecutorOutputRequestHeaders) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + t.typeName = "string" + t.String = valueString + return nil + } + var valueStringUnknownMap map[string]any + if err := json.Unmarshal(data, &valueStringUnknownMap); err == nil { + t.typeName = "stringUnknownMap" + t.StringUnknownMap = valueStringUnknownMap + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationExecutorOutputRequestHeaders) MarshalJSON() ([]byte, error) { + switch t.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "string": + return json.Marshal(t.String) + case "stringUnknownMap": + return json.Marshal(t.StringUnknownMap) + } +} + +type TransformationExecutorOutputRequestHeadersVisitor interface { + VisitString(string) error + VisitStringUnknownMap(map[string]any) error +} + +func (t *TransformationExecutorOutputRequestHeaders) Accept(visitor TransformationExecutorOutputRequestHeadersVisitor) error { + switch t.typeName { + default: + return fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "string": + return visitor.VisitString(t.String) + case "stringUnknownMap": + return visitor.VisitStringUnknownMap(t.StringUnknownMap) + } +} + +type TransformationExecutorOutputRequestParsedQuery struct { + typeName string + StringOptional *string + TransformationExecutorOutputRequestParsedQueryOne *TransformationExecutorOutputRequestParsedQueryOne +} + +func NewTransformationExecutorOutputRequestParsedQueryFromStringOptional(value *string) *TransformationExecutorOutputRequestParsedQuery { + return &TransformationExecutorOutputRequestParsedQuery{typeName: "stringOptional", StringOptional: value} +} + +func NewTransformationExecutorOutputRequestParsedQueryFromTransformationExecutorOutputRequestParsedQueryOne(value *TransformationExecutorOutputRequestParsedQueryOne) *TransformationExecutorOutputRequestParsedQuery { + return &TransformationExecutorOutputRequestParsedQuery{typeName: "transformationExecutorOutputRequestParsedQueryOne", TransformationExecutorOutputRequestParsedQueryOne: value} +} + +func (t *TransformationExecutorOutputRequestParsedQuery) UnmarshalJSON(data []byte) error { + var valueStringOptional *string + if err := json.Unmarshal(data, &valueStringOptional); err == nil { + t.typeName = "stringOptional" + t.StringOptional = valueStringOptional + return nil + } + valueTransformationExecutorOutputRequestParsedQueryOne := new(TransformationExecutorOutputRequestParsedQueryOne) + if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestParsedQueryOne); err == nil { + t.typeName = "transformationExecutorOutputRequestParsedQueryOne" + t.TransformationExecutorOutputRequestParsedQueryOne = valueTransformationExecutorOutputRequestParsedQueryOne + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationExecutorOutputRequestParsedQuery) MarshalJSON() ([]byte, error) { + switch t.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "stringOptional": + return json.Marshal(t.StringOptional) + case "transformationExecutorOutputRequestParsedQueryOne": + return json.Marshal(t.TransformationExecutorOutputRequestParsedQueryOne) + } +} + +type TransformationExecutorOutputRequestParsedQueryVisitor interface { + VisitStringOptional(*string) error + VisitTransformationExecutorOutputRequestParsedQueryOne(*TransformationExecutorOutputRequestParsedQueryOne) error +} + +func (t *TransformationExecutorOutputRequestParsedQuery) Accept(visitor TransformationExecutorOutputRequestParsedQueryVisitor) error { + switch t.typeName { + default: + return fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "stringOptional": + return visitor.VisitStringOptional(t.StringOptional) + case "transformationExecutorOutputRequestParsedQueryOne": + return visitor.VisitTransformationExecutorOutputRequestParsedQueryOne(t.TransformationExecutorOutputRequestParsedQueryOne) + } +} + +type TransformationExecutorOutputRequestParsedQueryOne struct { +} + +type TransformationExecutorOutputRequestQuery struct { + typeName string + TransformationExecutorOutputRequestQueryZeroOptional *TransformationExecutorOutputRequestQueryZero + String string +} + +func NewTransformationExecutorOutputRequestQueryFromTransformationExecutorOutputRequestQueryZeroOptional(value *TransformationExecutorOutputRequestQueryZero) *TransformationExecutorOutputRequestQuery { + return &TransformationExecutorOutputRequestQuery{typeName: "transformationExecutorOutputRequestQueryZeroOptional", TransformationExecutorOutputRequestQueryZeroOptional: value} +} + +func NewTransformationExecutorOutputRequestQueryFromString(value string) *TransformationExecutorOutputRequestQuery { + return &TransformationExecutorOutputRequestQuery{typeName: "string", String: value} +} + +func (t *TransformationExecutorOutputRequestQuery) UnmarshalJSON(data []byte) error { + var valueTransformationExecutorOutputRequestQueryZeroOptional *TransformationExecutorOutputRequestQueryZero + if err := json.Unmarshal(data, &valueTransformationExecutorOutputRequestQueryZeroOptional); err == nil { + t.typeName = "transformationExecutorOutputRequestQueryZeroOptional" + t.TransformationExecutorOutputRequestQueryZeroOptional = valueTransformationExecutorOutputRequestQueryZeroOptional + return nil + } + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + t.typeName = "string" + t.String = valueString + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TransformationExecutorOutputRequestQuery) MarshalJSON() ([]byte, error) { + switch t.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "transformationExecutorOutputRequestQueryZeroOptional": + return json.Marshal(t.TransformationExecutorOutputRequestQueryZeroOptional) + case "string": + return json.Marshal(t.String) + } +} + +type TransformationExecutorOutputRequestQueryVisitor interface { + VisitTransformationExecutorOutputRequestQueryZeroOptional(*TransformationExecutorOutputRequestQueryZero) error + VisitString(string) error +} + +func (t *TransformationExecutorOutputRequestQuery) Accept(visitor TransformationExecutorOutputRequestQueryVisitor) error { + switch t.typeName { + default: + return fmt.Errorf("invalid type %s in %T", t.typeName, t) + case "transformationExecutorOutputRequestQueryZeroOptional": + return visitor.VisitTransformationExecutorOutputRequestQueryZeroOptional(t.TransformationExecutorOutputRequestQueryZeroOptional) + case "string": + return visitor.VisitString(t.String) + } +} + +type TransformationExecutorOutputRequestQueryZero struct { +} + +type TransformationFailedMeta struct { + TransformationId string `json:"transformation_id"` +} + +// Transformation issue +type TransformationIssue struct { + // Issue ID + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + Status IssueStatus `json:"status,omitempty"` + // ISO timestamp for when the issue was last opened + OpenedAt time.Time `json:"opened_at"` + // ISO timestamp for when the issue was first opened + FirstSeenAt time.Time `json:"first_seen_at"` + // ISO timestamp for when the issue last occured + LastSeenAt time.Time `json:"last_seen_at"` + // ID of the team member who last updated the issue status + LastUpdatedBy *string `json:"last_updated_by,omitempty"` + // ISO timestamp for when the issue was dismissed + DismissedAt *time.Time `json:"dismissed_at,omitempty"` + AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty"` + MergedWith *string `json:"merged_with,omitempty"` + // ISO timestamp for when the issue was last updated + UpdatedAt string `json:"updated_at"` + // ISO timestamp for when the issue was created + CreatedAt string `json:"created_at"` + AggregationKeys *TransformationIssueAggregationKeys `json:"aggregation_keys,omitempty"` + Reference *TransformationIssueReference `json:"reference,omitempty"` + type_ string +} + +func (t *TransformationIssue) Type() string { + return t.type_ +} + +func (t *TransformationIssue) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationIssue + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationIssue(value) + t.type_ = "transformation" + return nil +} + +func (t *TransformationIssue) MarshalJSON() ([]byte, error) { + type embed TransformationIssue + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "transformation", + } + return json.Marshal(marshaler) +} + +// Keys used as the aggregation keys a 'transformation' type issue +type TransformationIssueAggregationKeys struct { + TransformationId []string `json:"transformation_id,omitempty"` + LogLevel TransformationExecutionLogLevel `json:"log_level,omitempty"` +} + +// Transformation issue data +type TransformationIssueData struct { + TransformationExecution *TransformationExecution `json:"transformation_execution,omitempty"` + TriggerAttempt *EventAttempt `json:"trigger_attempt,omitempty"` +} + +// Reference to the event request transformation an issue is being created for. +type TransformationIssueReference struct { + TransformationExecutionId string `json:"transformation_execution_id"` + // Deprecated but still found on historical issues + TriggerEventRequestTransformationId *string `json:"trigger_event_request_transformation_id,omitempty"` +} + +// Transformation issue +type TransformationIssueWithData struct { + // Issue ID + Id string `json:"id"` + // ID of the workspace + TeamId string `json:"team_id"` + Status IssueStatus `json:"status,omitempty"` + // ISO timestamp for when the issue was last opened + OpenedAt time.Time `json:"opened_at"` + // ISO timestamp for when the issue was first opened + FirstSeenAt time.Time `json:"first_seen_at"` + // ISO timestamp for when the issue last occured + LastSeenAt time.Time `json:"last_seen_at"` + // ID of the team member who last updated the issue status + LastUpdatedBy *string `json:"last_updated_by,omitempty"` + // ISO timestamp for when the issue was dismissed + DismissedAt *time.Time `json:"dismissed_at,omitempty"` + AutoResolvedAt *time.Time `json:"auto_resolved_at,omitempty"` + MergedWith *string `json:"merged_with,omitempty"` + // ISO timestamp for when the issue was last updated + UpdatedAt string `json:"updated_at"` + // ISO timestamp for when the issue was created + CreatedAt string `json:"created_at"` + AggregationKeys *TransformationIssueAggregationKeys `json:"aggregation_keys,omitempty"` + Reference *TransformationIssueReference `json:"reference,omitempty"` + Data *TransformationIssueData `json:"data,omitempty"` + type_ string +} + +func (t *TransformationIssueWithData) Type() string { + return t.type_ +} + +func (t *TransformationIssueWithData) UnmarshalJSON(data []byte) error { + type unmarshaler TransformationIssueWithData + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = TransformationIssueWithData(value) + t.type_ = "transformation" + return nil +} + +func (t *TransformationIssueWithData) MarshalJSON() ([]byte, error) { + type embed TransformationIssueWithData + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "transformation", + } + return json.Marshal(marshaler) +} + +type TransformationPaginatedResult struct { + Pagination *SeekPagination `json:"pagination,omitempty"` + Count *int `json:"count,omitempty"` + Models []*Transformation `json:"models,omitempty"` +} + +// Bookmark target +type TriggerBookmarkRequestTarget uint + +const ( + TriggerBookmarkRequestTargetHttp TriggerBookmarkRequestTarget = iota + 1 + TriggerBookmarkRequestTargetCli +) + +func (t TriggerBookmarkRequestTarget) String() string { + switch t { + default: + return strconv.Itoa(int(t)) + case TriggerBookmarkRequestTargetHttp: + return "http" + case TriggerBookmarkRequestTargetCli: + return "cli" + } +} + +func (t TriggerBookmarkRequestTarget) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", t.String())), nil +} + +func (t *TriggerBookmarkRequestTarget) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "http": + value := TriggerBookmarkRequestTargetHttp + *t = value + case "cli": + value := TriggerBookmarkRequestTargetCli + *t = value + } + return nil +} + +type Twitter struct { + Configs *TwitterConfigs `json:"configs,omitempty"` + type_ string +} + +func (t *Twitter) Type() string { + return t.type_ +} + +func (t *Twitter) UnmarshalJSON(data []byte) error { + type unmarshaler Twitter + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = Twitter(value) + t.type_ = "twitter" + return nil +} + +func (t *Twitter) MarshalJSON() ([]byte, error) { + type embed Twitter + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "twitter", + } + return json.Marshal(marshaler) +} + +// The verification configs for Twitter. Only included if the ?include=verification.configs query param is present +type TwitterConfigs struct { + ApiKey string `json:"api_key"` +} + +type Typeform struct { + Configs *TypeformConfigs `json:"configs,omitempty"` + type_ string +} + +func (t *Typeform) Type() string { + return t.type_ +} + +func (t *Typeform) UnmarshalJSON(data []byte) error { + type unmarshaler Typeform + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *t = Typeform(value) + t.type_ = "typeform" + return nil +} + +func (t *Typeform) MarshalJSON() ([]byte, error) { + type embed Typeform + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "typeform", + } + return json.Marshal(marshaler) +} + +// The verification configs for Typeform. Only included if the ?include=verification.configs query param is present +type TypeformConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +// Period to rate limit attempts +type UpdateDestinationRequestRateLimitPeriod uint + +const ( + UpdateDestinationRequestRateLimitPeriodSecond UpdateDestinationRequestRateLimitPeriod = iota + 1 + UpdateDestinationRequestRateLimitPeriodMinute + UpdateDestinationRequestRateLimitPeriodHour +) + +func (u UpdateDestinationRequestRateLimitPeriod) String() string { + switch u { + default: + return strconv.Itoa(int(u)) + case UpdateDestinationRequestRateLimitPeriodSecond: + return "second" + case UpdateDestinationRequestRateLimitPeriodMinute: + return "minute" + case UpdateDestinationRequestRateLimitPeriodHour: + return "hour" + } +} + +func (u UpdateDestinationRequestRateLimitPeriod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", u.String())), nil +} + +func (u *UpdateDestinationRequestRateLimitPeriod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "second": + value := UpdateDestinationRequestRateLimitPeriodSecond + *u = value + case "minute": + value := UpdateDestinationRequestRateLimitPeriodMinute + *u = value + case "hour": + value := UpdateDestinationRequestRateLimitPeriodHour + *u = value + } + return nil +} + +// Decrypted Key/Value object of the associated configuration for that provider +type UpdateIntegrationRequestConfigs struct { + typeName string + HmacIntegrationConfigs *HmacIntegrationConfigs + ApiKeyIntegrationConfigs *ApiKeyIntegrationConfigs + HandledApiKeyIntegrationConfigs *HandledApiKeyIntegrationConfigs + HandledHmacConfigs *HandledHmacConfigs + BasicAuthIntegrationConfigs *BasicAuthIntegrationConfigs + ShopifyIntegrationConfigs *ShopifyIntegrationConfigs + UpdateIntegrationRequestConfigsSix *UpdateIntegrationRequestConfigsSix +} + +func NewUpdateIntegrationRequestConfigsFromHmacIntegrationConfigs(value *HmacIntegrationConfigs) *UpdateIntegrationRequestConfigs { + return &UpdateIntegrationRequestConfigs{typeName: "hmacIntegrationConfigs", HmacIntegrationConfigs: value} +} + +func NewUpdateIntegrationRequestConfigsFromApiKeyIntegrationConfigs(value *ApiKeyIntegrationConfigs) *UpdateIntegrationRequestConfigs { + return &UpdateIntegrationRequestConfigs{typeName: "apiKeyIntegrationConfigs", ApiKeyIntegrationConfigs: value} +} + +func NewUpdateIntegrationRequestConfigsFromHandledApiKeyIntegrationConfigs(value *HandledApiKeyIntegrationConfigs) *UpdateIntegrationRequestConfigs { + return &UpdateIntegrationRequestConfigs{typeName: "handledApiKeyIntegrationConfigs", HandledApiKeyIntegrationConfigs: value} +} + +func NewUpdateIntegrationRequestConfigsFromHandledHmacConfigs(value *HandledHmacConfigs) *UpdateIntegrationRequestConfigs { + return &UpdateIntegrationRequestConfigs{typeName: "handledHmacConfigs", HandledHmacConfigs: value} +} + +func NewUpdateIntegrationRequestConfigsFromBasicAuthIntegrationConfigs(value *BasicAuthIntegrationConfigs) *UpdateIntegrationRequestConfigs { + return &UpdateIntegrationRequestConfigs{typeName: "basicAuthIntegrationConfigs", BasicAuthIntegrationConfigs: value} +} + +func NewUpdateIntegrationRequestConfigsFromShopifyIntegrationConfigs(value *ShopifyIntegrationConfigs) *UpdateIntegrationRequestConfigs { + return &UpdateIntegrationRequestConfigs{typeName: "shopifyIntegrationConfigs", ShopifyIntegrationConfigs: value} +} + +func NewUpdateIntegrationRequestConfigsFromUpdateIntegrationRequestConfigsSix(value *UpdateIntegrationRequestConfigsSix) *UpdateIntegrationRequestConfigs { + return &UpdateIntegrationRequestConfigs{typeName: "updateIntegrationRequestConfigsSix", UpdateIntegrationRequestConfigsSix: value} +} + +func (u *UpdateIntegrationRequestConfigs) UnmarshalJSON(data []byte) error { + valueHmacIntegrationConfigs := new(HmacIntegrationConfigs) + if err := json.Unmarshal(data, &valueHmacIntegrationConfigs); err == nil { + u.typeName = "hmacIntegrationConfigs" + u.HmacIntegrationConfigs = valueHmacIntegrationConfigs + return nil + } + valueApiKeyIntegrationConfigs := new(ApiKeyIntegrationConfigs) + if err := json.Unmarshal(data, &valueApiKeyIntegrationConfigs); err == nil { + u.typeName = "apiKeyIntegrationConfigs" + u.ApiKeyIntegrationConfigs = valueApiKeyIntegrationConfigs + return nil + } + valueHandledApiKeyIntegrationConfigs := new(HandledApiKeyIntegrationConfigs) + if err := json.Unmarshal(data, &valueHandledApiKeyIntegrationConfigs); err == nil { + u.typeName = "handledApiKeyIntegrationConfigs" + u.HandledApiKeyIntegrationConfigs = valueHandledApiKeyIntegrationConfigs + return nil + } + valueHandledHmacConfigs := new(HandledHmacConfigs) + if err := json.Unmarshal(data, &valueHandledHmacConfigs); err == nil { + u.typeName = "handledHmacConfigs" + u.HandledHmacConfigs = valueHandledHmacConfigs + return nil + } + valueBasicAuthIntegrationConfigs := new(BasicAuthIntegrationConfigs) + if err := json.Unmarshal(data, &valueBasicAuthIntegrationConfigs); err == nil { + u.typeName = "basicAuthIntegrationConfigs" + u.BasicAuthIntegrationConfigs = valueBasicAuthIntegrationConfigs + return nil + } + valueShopifyIntegrationConfigs := new(ShopifyIntegrationConfigs) + if err := json.Unmarshal(data, &valueShopifyIntegrationConfigs); err == nil { + u.typeName = "shopifyIntegrationConfigs" + u.ShopifyIntegrationConfigs = valueShopifyIntegrationConfigs + return nil + } + valueUpdateIntegrationRequestConfigsSix := new(UpdateIntegrationRequestConfigsSix) + if err := json.Unmarshal(data, &valueUpdateIntegrationRequestConfigsSix); err == nil { + u.typeName = "updateIntegrationRequestConfigsSix" + u.UpdateIntegrationRequestConfigsSix = valueUpdateIntegrationRequestConfigsSix + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UpdateIntegrationRequestConfigs) MarshalJSON() ([]byte, error) { + switch u.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "hmacIntegrationConfigs": + return json.Marshal(u.HmacIntegrationConfigs) + case "apiKeyIntegrationConfigs": + return json.Marshal(u.ApiKeyIntegrationConfigs) + case "handledApiKeyIntegrationConfigs": + return json.Marshal(u.HandledApiKeyIntegrationConfigs) + case "handledHmacConfigs": + return json.Marshal(u.HandledHmacConfigs) + case "basicAuthIntegrationConfigs": + return json.Marshal(u.BasicAuthIntegrationConfigs) + case "shopifyIntegrationConfigs": + return json.Marshal(u.ShopifyIntegrationConfigs) + case "updateIntegrationRequestConfigsSix": + return json.Marshal(u.UpdateIntegrationRequestConfigsSix) + } +} + +type UpdateIntegrationRequestConfigsVisitor interface { + VisitHmacIntegrationConfigs(*HmacIntegrationConfigs) error + VisitApiKeyIntegrationConfigs(*ApiKeyIntegrationConfigs) error + VisitHandledApiKeyIntegrationConfigs(*HandledApiKeyIntegrationConfigs) error + VisitHandledHmacConfigs(*HandledHmacConfigs) error + VisitBasicAuthIntegrationConfigs(*BasicAuthIntegrationConfigs) error + VisitShopifyIntegrationConfigs(*ShopifyIntegrationConfigs) error + VisitUpdateIntegrationRequestConfigsSix(*UpdateIntegrationRequestConfigsSix) error +} + +func (u *UpdateIntegrationRequestConfigs) Accept(visitor UpdateIntegrationRequestConfigsVisitor) error { + switch u.typeName { + default: + return fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "hmacIntegrationConfigs": + return visitor.VisitHmacIntegrationConfigs(u.HmacIntegrationConfigs) + case "apiKeyIntegrationConfigs": + return visitor.VisitApiKeyIntegrationConfigs(u.ApiKeyIntegrationConfigs) + case "handledApiKeyIntegrationConfigs": + return visitor.VisitHandledApiKeyIntegrationConfigs(u.HandledApiKeyIntegrationConfigs) + case "handledHmacConfigs": + return visitor.VisitHandledHmacConfigs(u.HandledHmacConfigs) + case "basicAuthIntegrationConfigs": + return visitor.VisitBasicAuthIntegrationConfigs(u.BasicAuthIntegrationConfigs) + case "shopifyIntegrationConfigs": + return visitor.VisitShopifyIntegrationConfigs(u.ShopifyIntegrationConfigs) + case "updateIntegrationRequestConfigsSix": + return visitor.VisitUpdateIntegrationRequestConfigsSix(u.UpdateIntegrationRequestConfigsSix) + } +} + +type UpdateIntegrationRequestConfigsSix struct { +} + +// New status +type UpdateIssueRequestStatus uint + +const ( + UpdateIssueRequestStatusOpened UpdateIssueRequestStatus = iota + 1 + UpdateIssueRequestStatusIgnored + UpdateIssueRequestStatusAcknowledged + UpdateIssueRequestStatusResolved +) + +func (u UpdateIssueRequestStatus) String() string { + switch u { + default: + return strconv.Itoa(int(u)) + case UpdateIssueRequestStatusOpened: + return "OPENED" + case UpdateIssueRequestStatusIgnored: + return "IGNORED" + case UpdateIssueRequestStatusAcknowledged: + return "ACKNOWLEDGED" + case UpdateIssueRequestStatusResolved: + return "RESOLVED" + } +} + +func (u UpdateIssueRequestStatus) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", u.String())), nil +} + +func (u *UpdateIssueRequestStatus) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "OPENED": + value := UpdateIssueRequestStatusOpened + *u = value + case "IGNORED": + value := UpdateIssueRequestStatusIgnored + *u = value + case "ACKNOWLEDGED": + value := UpdateIssueRequestStatusAcknowledged + *u = value + case "RESOLVED": + value := UpdateIssueRequestStatusResolved + *u = value + } + return nil +} + +// Configuration object for the specific issue type selected +type UpdateIssueTriggerRequestConfigs struct { + typeName string + IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs + IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs + IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs +} + +func NewUpdateIssueTriggerRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *UpdateIssueTriggerRequestConfigs { + return &UpdateIssueTriggerRequestConfigs{typeName: "issueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} +} + +func NewUpdateIssueTriggerRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *UpdateIssueTriggerRequestConfigs { + return &UpdateIssueTriggerRequestConfigs{typeName: "issueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} +} + +func NewUpdateIssueTriggerRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *UpdateIssueTriggerRequestConfigs { + return &UpdateIssueTriggerRequestConfigs{typeName: "issueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} +} + +func (u *UpdateIssueTriggerRequestConfigs) UnmarshalJSON(data []byte) error { + valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { + u.typeName = "issueTriggerDeliveryConfigs" + u.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs + return nil + } + valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { + u.typeName = "issueTriggerTransformationConfigs" + u.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs + return nil + } + valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { + u.typeName = "issueTriggerBackpressureConfigs" + u.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UpdateIssueTriggerRequestConfigs) MarshalJSON() ([]byte, error) { + switch u.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "issueTriggerDeliveryConfigs": + return json.Marshal(u.IssueTriggerDeliveryConfigs) + case "issueTriggerTransformationConfigs": + return json.Marshal(u.IssueTriggerTransformationConfigs) + case "issueTriggerBackpressureConfigs": + return json.Marshal(u.IssueTriggerBackpressureConfigs) + } +} + +type UpdateIssueTriggerRequestConfigsVisitor interface { + VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error + VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error + VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error +} + +func (u *UpdateIssueTriggerRequestConfigs) Accept(visitor UpdateIssueTriggerRequestConfigsVisitor) error { + switch u.typeName { + default: + return fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "issueTriggerDeliveryConfigs": + return visitor.VisitIssueTriggerDeliveryConfigs(u.IssueTriggerDeliveryConfigs) + case "issueTriggerTransformationConfigs": + return visitor.VisitIssueTriggerTransformationConfigs(u.IssueTriggerTransformationConfigs) + case "issueTriggerBackpressureConfigs": + return visitor.VisitIssueTriggerBackpressureConfigs(u.IssueTriggerBackpressureConfigs) + } +} + +type UpdateTransformationRequestEnvValue struct { + typeName string + String string + Double float64 +} + +func NewUpdateTransformationRequestEnvValueFromString(value string) *UpdateTransformationRequestEnvValue { + return &UpdateTransformationRequestEnvValue{typeName: "string", String: value} +} + +func NewUpdateTransformationRequestEnvValueFromDouble(value float64) *UpdateTransformationRequestEnvValue { + return &UpdateTransformationRequestEnvValue{typeName: "double", Double: value} +} + +func (u *UpdateTransformationRequestEnvValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + u.typeName = "string" + u.String = valueString + return nil + } + var valueDouble float64 + if err := json.Unmarshal(data, &valueDouble); err == nil { + u.typeName = "double" + u.Double = valueDouble + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UpdateTransformationRequestEnvValue) MarshalJSON() ([]byte, error) { + switch u.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "string": + return json.Marshal(u.String) + case "double": + return json.Marshal(u.Double) + } +} + +type UpdateTransformationRequestEnvValueVisitor interface { + VisitString(string) error + VisitDouble(float64) error +} + +func (u *UpdateTransformationRequestEnvValue) Accept(visitor UpdateTransformationRequestEnvValueVisitor) error { + switch u.typeName { + default: + return fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "string": + return visitor.VisitString(u.String) + case "double": + return visitor.VisitDouble(u.Double) + } +} + +// Destination input object +type UpsertConnectionRequestDestination struct { + // Name for the destination `<= 155 characters` + Name string `json:"name"` + // Description for the destination + Description *string `json:"description,omitempty"` + // Endpoint of the destination + Url *string `json:"url,omitempty"` + // Path for the CLI destination + CliPath *string `json:"cli_path,omitempty"` + // Period to rate limit attempts + RateLimitPeriod *UpsertConnectionRequestDestinationRateLimitPeriod `json:"rate_limit_period,omitempty"` + // Limit event attempts to receive per period + RateLimit *int `json:"rate_limit,omitempty"` + HttpMethod *DestinationHttpMethod `json:"http_method,omitempty"` + AuthMethod *DestinationAuthMethodConfig `json:"auth_method,omitempty"` + PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` +} + +// Period to rate limit attempts +type UpsertConnectionRequestDestinationRateLimitPeriod uint + +const ( + UpsertConnectionRequestDestinationRateLimitPeriodSecond UpsertConnectionRequestDestinationRateLimitPeriod = iota + 1 + UpsertConnectionRequestDestinationRateLimitPeriodMinute + UpsertConnectionRequestDestinationRateLimitPeriodHour +) + +func (u UpsertConnectionRequestDestinationRateLimitPeriod) String() string { + switch u { + default: + return strconv.Itoa(int(u)) + case UpsertConnectionRequestDestinationRateLimitPeriodSecond: + return "second" + case UpsertConnectionRequestDestinationRateLimitPeriodMinute: + return "minute" + case UpsertConnectionRequestDestinationRateLimitPeriodHour: + return "hour" + } +} + +func (u UpsertConnectionRequestDestinationRateLimitPeriod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", u.String())), nil +} + +func (u *UpsertConnectionRequestDestinationRateLimitPeriod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "second": + value := UpsertConnectionRequestDestinationRateLimitPeriodSecond + *u = value + case "minute": + value := UpsertConnectionRequestDestinationRateLimitPeriodMinute + *u = value + case "hour": + value := UpsertConnectionRequestDestinationRateLimitPeriodHour + *u = value + } + return nil +} + +// Source input object +type UpsertConnectionRequestSource struct { + // A unique name for the source `<= 155 characters` + Name string `json:"name"` + // Description for the source + Description *string `json:"description,omitempty"` + AllowedHttpMethods *SourceAllowedHttpMethod `json:"allowed_http_methods,omitempty"` + CustomResponse *SourceCustomResponse `json:"custom_response,omitempty"` + Verification *VerificationConfig `json:"verification,omitempty"` +} + +// Period to rate limit attempts +type UpsertDestinationRequestRateLimitPeriod uint + +const ( + UpsertDestinationRequestRateLimitPeriodSecond UpsertDestinationRequestRateLimitPeriod = iota + 1 + UpsertDestinationRequestRateLimitPeriodMinute + UpsertDestinationRequestRateLimitPeriodHour +) + +func (u UpsertDestinationRequestRateLimitPeriod) String() string { + switch u { + default: + return strconv.Itoa(int(u)) + case UpsertDestinationRequestRateLimitPeriodSecond: + return "second" + case UpsertDestinationRequestRateLimitPeriodMinute: + return "minute" + case UpsertDestinationRequestRateLimitPeriodHour: + return "hour" + } +} + +func (u UpsertDestinationRequestRateLimitPeriod) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", u.String())), nil +} + +func (u *UpsertDestinationRequestRateLimitPeriod) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "second": + value := UpsertDestinationRequestRateLimitPeriodSecond + *u = value + case "minute": + value := UpsertDestinationRequestRateLimitPeriodMinute + *u = value + case "hour": + value := UpsertDestinationRequestRateLimitPeriodHour + *u = value + } + return nil +} + +// Configuration object for the specific issue type selected +type UpsertIssueTriggerRequestConfigs struct { + typeName string + IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs + IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs + IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs +} + +func NewUpsertIssueTriggerRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *UpsertIssueTriggerRequestConfigs { + return &UpsertIssueTriggerRequestConfigs{typeName: "issueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} +} + +func NewUpsertIssueTriggerRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *UpsertIssueTriggerRequestConfigs { + return &UpsertIssueTriggerRequestConfigs{typeName: "issueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} +} + +func NewUpsertIssueTriggerRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *UpsertIssueTriggerRequestConfigs { + return &UpsertIssueTriggerRequestConfigs{typeName: "issueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} +} + +func (u *UpsertIssueTriggerRequestConfigs) UnmarshalJSON(data []byte) error { + valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { + u.typeName = "issueTriggerDeliveryConfigs" + u.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs + return nil + } + valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { + u.typeName = "issueTriggerTransformationConfigs" + u.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs + return nil + } + valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) + if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { + u.typeName = "issueTriggerBackpressureConfigs" + u.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UpsertIssueTriggerRequestConfigs) MarshalJSON() ([]byte, error) { + switch u.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "issueTriggerDeliveryConfigs": + return json.Marshal(u.IssueTriggerDeliveryConfigs) + case "issueTriggerTransformationConfigs": + return json.Marshal(u.IssueTriggerTransformationConfigs) + case "issueTriggerBackpressureConfigs": + return json.Marshal(u.IssueTriggerBackpressureConfigs) + } +} + +type UpsertIssueTriggerRequestConfigsVisitor interface { + VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error + VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error + VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error +} + +func (u *UpsertIssueTriggerRequestConfigs) Accept(visitor UpsertIssueTriggerRequestConfigsVisitor) error { + switch u.typeName { + default: + return fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "issueTriggerDeliveryConfigs": + return visitor.VisitIssueTriggerDeliveryConfigs(u.IssueTriggerDeliveryConfigs) + case "issueTriggerTransformationConfigs": + return visitor.VisitIssueTriggerTransformationConfigs(u.IssueTriggerTransformationConfigs) + case "issueTriggerBackpressureConfigs": + return visitor.VisitIssueTriggerBackpressureConfigs(u.IssueTriggerBackpressureConfigs) + } +} + +type UpsertTransformationRequestEnvValue struct { + typeName string + String string + Double float64 +} + +func NewUpsertTransformationRequestEnvValueFromString(value string) *UpsertTransformationRequestEnvValue { + return &UpsertTransformationRequestEnvValue{typeName: "string", String: value} +} + +func NewUpsertTransformationRequestEnvValueFromDouble(value float64) *UpsertTransformationRequestEnvValue { + return &UpsertTransformationRequestEnvValue{typeName: "double", Double: value} +} + +func (u *UpsertTransformationRequestEnvValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + u.typeName = "string" + u.String = valueString + return nil + } + var valueDouble float64 + if err := json.Unmarshal(data, &valueDouble); err == nil { + u.typeName = "double" + u.Double = valueDouble + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UpsertTransformationRequestEnvValue) MarshalJSON() ([]byte, error) { + switch u.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "string": + return json.Marshal(u.String) + case "double": + return json.Marshal(u.Double) + } +} + +type UpsertTransformationRequestEnvValueVisitor interface { + VisitString(string) error + VisitDouble(float64) error +} + +func (u *UpsertTransformationRequestEnvValue) Accept(visitor UpsertTransformationRequestEnvValueVisitor) error { + switch u.typeName { + default: + return fmt.Errorf("invalid type %s in %T", u.typeName, u) + case "string": + return visitor.VisitString(u.String) + case "double": + return visitor.VisitDouble(u.Double) + } +} + +// The verification configs for the specific verification type +type VerificationConfig struct { + typeName string + Hmac *Hmac + BasicAuth *BasicAuth + ApiKey *ApiKey + Twitter *Twitter + Stripe *Stripe + Recharge *Recharge + GitHub *GitHub + Shopify *Shopify + Postmark *Postmark + Typeform *Typeform + Xero *Xero + Svix *Svix + Zoom *Zoom + Akeneo *Akeneo + Adyen *Adyen + GitLab *GitLab + PropertyFinder *PropertyFinder + WooCommerce *WooCommerce + Oura *Oura + Commercelayer *Commercelayer + Mailgun *Mailgun + Pipedrive *Pipedrive + SendGrid *SendGrid + WorkOs *WorkOs + Synctera *Synctera + AwsSns *AwsSns + ThreeDEye *ThreeDEye +} + +func NewVerificationConfigFromHmac(value *Hmac) *VerificationConfig { + return &VerificationConfig{typeName: "hmac", Hmac: value} +} + +func NewVerificationConfigFromBasicAuth(value *BasicAuth) *VerificationConfig { + return &VerificationConfig{typeName: "basicAuth", BasicAuth: value} +} + +func NewVerificationConfigFromApiKey(value *ApiKey) *VerificationConfig { + return &VerificationConfig{typeName: "apiKey", ApiKey: value} +} + +func NewVerificationConfigFromTwitter(value *Twitter) *VerificationConfig { + return &VerificationConfig{typeName: "twitter", Twitter: value} +} + +func NewVerificationConfigFromStripe(value *Stripe) *VerificationConfig { + return &VerificationConfig{typeName: "stripe", Stripe: value} +} + +func NewVerificationConfigFromRecharge(value *Recharge) *VerificationConfig { + return &VerificationConfig{typeName: "recharge", Recharge: value} +} + +func NewVerificationConfigFromGitHub(value *GitHub) *VerificationConfig { + return &VerificationConfig{typeName: "gitHub", GitHub: value} +} + +func NewVerificationConfigFromShopify(value *Shopify) *VerificationConfig { + return &VerificationConfig{typeName: "shopify", Shopify: value} +} + +func NewVerificationConfigFromPostmark(value *Postmark) *VerificationConfig { + return &VerificationConfig{typeName: "postmark", Postmark: value} +} + +func NewVerificationConfigFromTypeform(value *Typeform) *VerificationConfig { + return &VerificationConfig{typeName: "typeform", Typeform: value} +} + +func NewVerificationConfigFromXero(value *Xero) *VerificationConfig { + return &VerificationConfig{typeName: "xero", Xero: value} +} + +func NewVerificationConfigFromSvix(value *Svix) *VerificationConfig { + return &VerificationConfig{typeName: "svix", Svix: value} +} + +func NewVerificationConfigFromZoom(value *Zoom) *VerificationConfig { + return &VerificationConfig{typeName: "zoom", Zoom: value} +} + +func NewVerificationConfigFromAkeneo(value *Akeneo) *VerificationConfig { + return &VerificationConfig{typeName: "akeneo", Akeneo: value} +} + +func NewVerificationConfigFromAdyen(value *Adyen) *VerificationConfig { + return &VerificationConfig{typeName: "adyen", Adyen: value} +} + +func NewVerificationConfigFromGitLab(value *GitLab) *VerificationConfig { + return &VerificationConfig{typeName: "gitLab", GitLab: value} +} + +func NewVerificationConfigFromPropertyFinder(value *PropertyFinder) *VerificationConfig { + return &VerificationConfig{typeName: "propertyFinder", PropertyFinder: value} +} + +func NewVerificationConfigFromWooCommerce(value *WooCommerce) *VerificationConfig { + return &VerificationConfig{typeName: "wooCommerce", WooCommerce: value} +} + +func NewVerificationConfigFromOura(value *Oura) *VerificationConfig { + return &VerificationConfig{typeName: "oura", Oura: value} +} + +func NewVerificationConfigFromCommercelayer(value *Commercelayer) *VerificationConfig { + return &VerificationConfig{typeName: "commercelayer", Commercelayer: value} +} + +func NewVerificationConfigFromMailgun(value *Mailgun) *VerificationConfig { + return &VerificationConfig{typeName: "mailgun", Mailgun: value} +} + +func NewVerificationConfigFromPipedrive(value *Pipedrive) *VerificationConfig { + return &VerificationConfig{typeName: "pipedrive", Pipedrive: value} +} + +func NewVerificationConfigFromSendGrid(value *SendGrid) *VerificationConfig { + return &VerificationConfig{typeName: "sendGrid", SendGrid: value} +} + +func NewVerificationConfigFromWorkOs(value *WorkOs) *VerificationConfig { + return &VerificationConfig{typeName: "workOs", WorkOs: value} +} + +func NewVerificationConfigFromSynctera(value *Synctera) *VerificationConfig { + return &VerificationConfig{typeName: "synctera", Synctera: value} +} + +func NewVerificationConfigFromAwsSns(value *AwsSns) *VerificationConfig { + return &VerificationConfig{typeName: "awsSns", AwsSns: value} +} + +func NewVerificationConfigFromThreeDEye(value *ThreeDEye) *VerificationConfig { + return &VerificationConfig{typeName: "threeDEye", ThreeDEye: value} +} + +func (v *VerificationConfig) UnmarshalJSON(data []byte) error { + valueHmac := new(Hmac) + if err := json.Unmarshal(data, &valueHmac); err == nil { + v.typeName = "hmac" + v.Hmac = valueHmac + return nil + } + valueBasicAuth := new(BasicAuth) + if err := json.Unmarshal(data, &valueBasicAuth); err == nil { + v.typeName = "basicAuth" + v.BasicAuth = valueBasicAuth + return nil + } + valueApiKey := new(ApiKey) + if err := json.Unmarshal(data, &valueApiKey); err == nil { + v.typeName = "apiKey" + v.ApiKey = valueApiKey + return nil + } + valueTwitter := new(Twitter) + if err := json.Unmarshal(data, &valueTwitter); err == nil { + v.typeName = "twitter" + v.Twitter = valueTwitter + return nil + } + valueStripe := new(Stripe) + if err := json.Unmarshal(data, &valueStripe); err == nil { + v.typeName = "stripe" + v.Stripe = valueStripe + return nil + } + valueRecharge := new(Recharge) + if err := json.Unmarshal(data, &valueRecharge); err == nil { + v.typeName = "recharge" + v.Recharge = valueRecharge + return nil + } + valueGitHub := new(GitHub) + if err := json.Unmarshal(data, &valueGitHub); err == nil { + v.typeName = "gitHub" + v.GitHub = valueGitHub + return nil + } + valueShopify := new(Shopify) + if err := json.Unmarshal(data, &valueShopify); err == nil { + v.typeName = "shopify" + v.Shopify = valueShopify + return nil + } + valuePostmark := new(Postmark) + if err := json.Unmarshal(data, &valuePostmark); err == nil { + v.typeName = "postmark" + v.Postmark = valuePostmark + return nil + } + valueTypeform := new(Typeform) + if err := json.Unmarshal(data, &valueTypeform); err == nil { + v.typeName = "typeform" + v.Typeform = valueTypeform + return nil + } + valueXero := new(Xero) + if err := json.Unmarshal(data, &valueXero); err == nil { + v.typeName = "xero" + v.Xero = valueXero + return nil + } + valueSvix := new(Svix) + if err := json.Unmarshal(data, &valueSvix); err == nil { + v.typeName = "svix" + v.Svix = valueSvix + return nil + } + valueZoom := new(Zoom) + if err := json.Unmarshal(data, &valueZoom); err == nil { + v.typeName = "zoom" + v.Zoom = valueZoom + return nil + } + valueAkeneo := new(Akeneo) + if err := json.Unmarshal(data, &valueAkeneo); err == nil { + v.typeName = "akeneo" + v.Akeneo = valueAkeneo + return nil + } + valueAdyen := new(Adyen) + if err := json.Unmarshal(data, &valueAdyen); err == nil { + v.typeName = "adyen" + v.Adyen = valueAdyen + return nil + } + valueGitLab := new(GitLab) + if err := json.Unmarshal(data, &valueGitLab); err == nil { + v.typeName = "gitLab" + v.GitLab = valueGitLab + return nil + } + valuePropertyFinder := new(PropertyFinder) + if err := json.Unmarshal(data, &valuePropertyFinder); err == nil { + v.typeName = "propertyFinder" + v.PropertyFinder = valuePropertyFinder + return nil + } + valueWooCommerce := new(WooCommerce) + if err := json.Unmarshal(data, &valueWooCommerce); err == nil { + v.typeName = "wooCommerce" + v.WooCommerce = valueWooCommerce + return nil + } + valueOura := new(Oura) + if err := json.Unmarshal(data, &valueOura); err == nil { + v.typeName = "oura" + v.Oura = valueOura + return nil + } + valueCommercelayer := new(Commercelayer) + if err := json.Unmarshal(data, &valueCommercelayer); err == nil { + v.typeName = "commercelayer" + v.Commercelayer = valueCommercelayer + return nil + } + valueMailgun := new(Mailgun) + if err := json.Unmarshal(data, &valueMailgun); err == nil { + v.typeName = "mailgun" + v.Mailgun = valueMailgun + return nil + } + valuePipedrive := new(Pipedrive) + if err := json.Unmarshal(data, &valuePipedrive); err == nil { + v.typeName = "pipedrive" + v.Pipedrive = valuePipedrive + return nil + } + valueSendGrid := new(SendGrid) + if err := json.Unmarshal(data, &valueSendGrid); err == nil { + v.typeName = "sendGrid" + v.SendGrid = valueSendGrid + return nil + } + valueWorkOs := new(WorkOs) + if err := json.Unmarshal(data, &valueWorkOs); err == nil { + v.typeName = "workOs" + v.WorkOs = valueWorkOs + return nil + } + valueSynctera := new(Synctera) + if err := json.Unmarshal(data, &valueSynctera); err == nil { + v.typeName = "synctera" + v.Synctera = valueSynctera + return nil + } + valueAwsSns := new(AwsSns) + if err := json.Unmarshal(data, &valueAwsSns); err == nil { + v.typeName = "awsSns" + v.AwsSns = valueAwsSns + return nil + } + valueThreeDEye := new(ThreeDEye) + if err := json.Unmarshal(data, &valueThreeDEye); err == nil { + v.typeName = "threeDEye" + v.ThreeDEye = valueThreeDEye + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, v) +} + +func (v VerificationConfig) MarshalJSON() ([]byte, error) { + switch v.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", v.typeName, v) + case "hmac": + return json.Marshal(v.Hmac) + case "basicAuth": + return json.Marshal(v.BasicAuth) + case "apiKey": + return json.Marshal(v.ApiKey) + case "twitter": + return json.Marshal(v.Twitter) + case "stripe": + return json.Marshal(v.Stripe) + case "recharge": + return json.Marshal(v.Recharge) + case "gitHub": + return json.Marshal(v.GitHub) + case "shopify": + return json.Marshal(v.Shopify) + case "postmark": + return json.Marshal(v.Postmark) + case "typeform": + return json.Marshal(v.Typeform) + case "xero": + return json.Marshal(v.Xero) + case "svix": + return json.Marshal(v.Svix) + case "zoom": + return json.Marshal(v.Zoom) + case "akeneo": + return json.Marshal(v.Akeneo) + case "adyen": + return json.Marshal(v.Adyen) + case "gitLab": + return json.Marshal(v.GitLab) + case "propertyFinder": + return json.Marshal(v.PropertyFinder) + case "wooCommerce": + return json.Marshal(v.WooCommerce) + case "oura": + return json.Marshal(v.Oura) + case "commercelayer": + return json.Marshal(v.Commercelayer) + case "mailgun": + return json.Marshal(v.Mailgun) + case "pipedrive": + return json.Marshal(v.Pipedrive) + case "sendGrid": + return json.Marshal(v.SendGrid) + case "workOs": + return json.Marshal(v.WorkOs) + case "synctera": + return json.Marshal(v.Synctera) + case "awsSns": + return json.Marshal(v.AwsSns) + case "threeDEye": + return json.Marshal(v.ThreeDEye) + } +} + +type VerificationConfigVisitor interface { + VisitHmac(*Hmac) error + VisitBasicAuth(*BasicAuth) error + VisitApiKey(*ApiKey) error + VisitTwitter(*Twitter) error + VisitStripe(*Stripe) error + VisitRecharge(*Recharge) error + VisitGitHub(*GitHub) error + VisitShopify(*Shopify) error + VisitPostmark(*Postmark) error + VisitTypeform(*Typeform) error + VisitXero(*Xero) error + VisitSvix(*Svix) error + VisitZoom(*Zoom) error + VisitAkeneo(*Akeneo) error + VisitAdyen(*Adyen) error + VisitGitLab(*GitLab) error + VisitPropertyFinder(*PropertyFinder) error + VisitWooCommerce(*WooCommerce) error + VisitOura(*Oura) error + VisitCommercelayer(*Commercelayer) error + VisitMailgun(*Mailgun) error + VisitPipedrive(*Pipedrive) error + VisitSendGrid(*SendGrid) error + VisitWorkOs(*WorkOs) error + VisitSynctera(*Synctera) error + VisitAwsSns(*AwsSns) error + VisitThreeDEye(*ThreeDEye) error +} + +func (v *VerificationConfig) Accept(visitor VerificationConfigVisitor) error { + switch v.typeName { + default: + return fmt.Errorf("invalid type %s in %T", v.typeName, v) + case "hmac": + return visitor.VisitHmac(v.Hmac) + case "basicAuth": + return visitor.VisitBasicAuth(v.BasicAuth) + case "apiKey": + return visitor.VisitApiKey(v.ApiKey) + case "twitter": + return visitor.VisitTwitter(v.Twitter) + case "stripe": + return visitor.VisitStripe(v.Stripe) + case "recharge": + return visitor.VisitRecharge(v.Recharge) + case "gitHub": + return visitor.VisitGitHub(v.GitHub) + case "shopify": + return visitor.VisitShopify(v.Shopify) + case "postmark": + return visitor.VisitPostmark(v.Postmark) + case "typeform": + return visitor.VisitTypeform(v.Typeform) + case "xero": + return visitor.VisitXero(v.Xero) + case "svix": + return visitor.VisitSvix(v.Svix) + case "zoom": + return visitor.VisitZoom(v.Zoom) + case "akeneo": + return visitor.VisitAkeneo(v.Akeneo) + case "adyen": + return visitor.VisitAdyen(v.Adyen) + case "gitLab": + return visitor.VisitGitLab(v.GitLab) + case "propertyFinder": + return visitor.VisitPropertyFinder(v.PropertyFinder) + case "wooCommerce": + return visitor.VisitWooCommerce(v.WooCommerce) + case "oura": + return visitor.VisitOura(v.Oura) + case "commercelayer": + return visitor.VisitCommercelayer(v.Commercelayer) + case "mailgun": + return visitor.VisitMailgun(v.Mailgun) + case "pipedrive": + return visitor.VisitPipedrive(v.Pipedrive) + case "sendGrid": + return visitor.VisitSendGrid(v.SendGrid) + case "workOs": + return visitor.VisitWorkOs(v.WorkOs) + case "synctera": + return visitor.VisitSynctera(v.Synctera) + case "awsSns": + return visitor.VisitAwsSns(v.AwsSns) + case "threeDEye": + return visitor.VisitThreeDEye(v.ThreeDEye) + } +} + +type WooCommerce struct { + Configs *WooCommerceConfigs `json:"configs,omitempty"` + type_ string +} + +func (w *WooCommerce) Type() string { + return w.type_ +} + +func (w *WooCommerce) UnmarshalJSON(data []byte) error { + type unmarshaler WooCommerce + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WooCommerce(value) + w.type_ = "woocommerce" + return nil +} + +func (w *WooCommerce) MarshalJSON() ([]byte, error) { + type embed WooCommerce + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*w), + Type: "woocommerce", + } + return json.Marshal(marshaler) +} + +// The verification configs for WooCommerce. Only included if the ?include=verification.configs query param is present +type WooCommerceConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type WorkOs struct { + Configs *WorkOsConfigs `json:"configs,omitempty"` + type_ string +} + +func (w *WorkOs) Type() string { + return w.type_ +} + +func (w *WorkOs) UnmarshalJSON(data []byte) error { + type unmarshaler WorkOs + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *w = WorkOs(value) + w.type_ = "workos" + return nil +} + +func (w *WorkOs) MarshalJSON() ([]byte, error) { + type embed WorkOs + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*w), + Type: "workos", + } + return json.Marshal(marshaler) +} + +// The verification configs for WorkOS. Only included if the ?include=verification.configs query param is present +type WorkOsConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Xero struct { + Configs *XeroConfigs `json:"configs,omitempty"` + type_ string +} + +func (x *Xero) Type() string { + return x.type_ +} + +func (x *Xero) UnmarshalJSON(data []byte) error { + type unmarshaler Xero + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *x = Xero(value) + x.type_ = "xero" + return nil +} + +func (x *Xero) MarshalJSON() ([]byte, error) { + type embed Xero + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*x), + Type: "xero", + } + return json.Marshal(marshaler) +} + +// The verification configs for Xero. Only included if the ?include=verification.configs query param is present +type XeroConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} + +type Zoom struct { + Configs *ZoomConfigs `json:"configs,omitempty"` + type_ string +} + +func (z *Zoom) Type() string { + return z.type_ +} + +func (z *Zoom) UnmarshalJSON(data []byte) error { + type unmarshaler Zoom + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *z = Zoom(value) + z.type_ = "zoom" + return nil +} + +func (z *Zoom) MarshalJSON() ([]byte, error) { + type embed Zoom + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*z), + Type: "zoom", + } + return json.Marshal(marshaler) +} + +// The verification configs for Zoom. Only included if the ?include=verification.configs query param is present +type ZoomConfigs struct { + WebhookSecretKey string `json:"webhook_secret_key"` +} diff --git a/unprocessable_entity_error.go b/unprocessable_entity_error.go deleted file mode 100644 index bf80cfd..0000000 --- a/unprocessable_entity_error.go +++ /dev/null @@ -1,27 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - core "github.com/fern-hookdeck/hookdeck-go/core" -) - -type UnprocessableEntityError struct { - *core.APIError - Body *ApiErrorResponse -} - -func (u *UnprocessableEntityError) UnmarshalJSON(data []byte) error { - body := new(ApiErrorResponse) - if err := json.Unmarshal(data, &body); err != nil { - return err - } - u.StatusCode = 422 - u.Body = body - return nil -} - -func (u *UnprocessableEntityError) MarshalJSON() ([]byte, error) { - return json.Marshal(u.Body) -} diff --git a/update_bookmark_request.go b/update_bookmark_request.go deleted file mode 100644 index cd927ac..0000000 --- a/update_bookmark_request.go +++ /dev/null @@ -1,15 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateBookmarkRequest is an in-lined request used by the UpdateBookmark endpoint. -type UpdateBookmarkRequest struct { - // ID of the event data to bookmark `<= 255 characters` - EventDataId *string `json:"event_data_id,omitempty"` - // ID of the associated connection `<= 255 characters` - WebhookId *string `json:"webhook_id,omitempty"` - // Descriptive name of the bookmark `<= 255 characters` - Label *string `json:"label,omitempty"` - // A unique, human-friendly name for the bookmark `<= 155 characters` - Name *string `json:"name,omitempty"` -} diff --git a/update_connection_request.go b/update_connection_request.go deleted file mode 100644 index e9aa75b..0000000 --- a/update_connection_request.go +++ /dev/null @@ -1,15 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateConnectionRequest is an in-lined request used by the UpdateConnection endpoint. -type UpdateConnectionRequest struct { - // Unique name of the connection for the source `<= 155 characters` - Name *string `json:"name,omitempty"` - // Ruleset input object - Ruleset *UpdateConnectionRequestRuleset `json:"ruleset,omitempty"` - // ID of a rule to bind to the connection. Default to the Workspace default ruleset - RulesetId *string `json:"ruleset_id,omitempty"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` -} diff --git a/update_connection_request_ruleset.go b/update_connection_request_ruleset.go deleted file mode 100644 index 3771d72..0000000 --- a/update_connection_request_ruleset.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Ruleset input object -type UpdateConnectionRequestRuleset struct { - // Name for the ruleset `<= 155 characters` - Name string `json:"name"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` - IsTeamDefault *bool `json:"is_team_default,omitempty"` -} diff --git a/update_destination_request.go b/update_destination_request.go deleted file mode 100644 index f296a54..0000000 --- a/update_destination_request.go +++ /dev/null @@ -1,20 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateDestinationRequest is an in-lined request used by the UpdateDestination endpoint. -type UpdateDestinationRequest struct { - // Name for the destination `<= 155 characters` - Name string `json:"name"` - // Endpoint of the destination - Url *string `json:"url,omitempty"` - // Path for the CLI destination - CliPath *string `json:"cli_path,omitempty"` - // Period to rate limit attempts - RateLimitPeriod *UpdateDestinationRequestRateLimitPeriod `json:"rate_limit_period,omitempty"` - // Limit event attempts to receive per period - RateLimit *int `json:"rate_limit,omitempty"` - // Date the destination was archived - ArchivedAt *string `json:"archived_at,omitempty"` - PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` -} diff --git a/update_destination_request_rate_limit_period.go b/update_destination_request_rate_limit_period.go deleted file mode 100644 index fa7f81b..0000000 --- a/update_destination_request_rate_limit_period.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Period to rate limit attempts -type UpdateDestinationRequestRateLimitPeriod uint8 - -const ( - UpdateDestinationRequestRateLimitPeriodSecond UpdateDestinationRequestRateLimitPeriod = iota + 1 - UpdateDestinationRequestRateLimitPeriodMinute - UpdateDestinationRequestRateLimitPeriodHour -) - -func (u UpdateDestinationRequestRateLimitPeriod) String() string { - switch u { - default: - return strconv.Itoa(int(u)) - case UpdateDestinationRequestRateLimitPeriodSecond: - return "second" - case UpdateDestinationRequestRateLimitPeriodMinute: - return "minute" - case UpdateDestinationRequestRateLimitPeriodHour: - return "hour" - } -} - -func (u UpdateDestinationRequestRateLimitPeriod) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", u.String())), nil -} - -func (u *UpdateDestinationRequestRateLimitPeriod) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "second": - value := UpdateDestinationRequestRateLimitPeriodSecond - *u = value - case "minute": - value := UpdateDestinationRequestRateLimitPeriodMinute - *u = value - case "hour": - value := UpdateDestinationRequestRateLimitPeriodHour - *u = value - } - return nil -} diff --git a/update_integration_request.go b/update_integration_request.go deleted file mode 100644 index fe5fb9d..0000000 --- a/update_integration_request.go +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateIntegrationRequest is an in-lined request used by the UpdateIntegration endpoint. -type UpdateIntegrationRequest struct { - // Label of the integration - Label *string `json:"label,omitempty"` - // Decrypted Key/Value object of the associated configuration for that provider - Configs *UpdateIntegrationRequestConfigs `json:"configs,omitempty"` - Provider *IntegrationProvider `json:"provider,omitempty"` - // List of features to enable (see features list above) - Features *[]IntegrationFeature `json:"features,omitempty"` -} diff --git a/update_integration_request_configs.go b/update_integration_request_configs.go deleted file mode 100644 index cd62192..0000000 --- a/update_integration_request_configs.go +++ /dev/null @@ -1,114 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Decrypted Key/Value object of the associated configuration for that provider -type UpdateIntegrationRequestConfigs struct { - typeName string - HmacIntegrationConfigs *HmacIntegrationConfigs - ApiKeyIntegrationConfigs *ApiKeyIntegrationConfigs - HandledHmacConfigs *HandledHmacConfigs - BasicAuthIntegrationConfigs *BasicAuthIntegrationConfigs - ShopifyIntegrationConfigs *ShopifyIntegrationConfigs -} - -func NewUpdateIntegrationRequestConfigsFromHmacIntegrationConfigs(value *HmacIntegrationConfigs) *UpdateIntegrationRequestConfigs { - return &UpdateIntegrationRequestConfigs{typeName: "hmacIntegrationConfigs", HmacIntegrationConfigs: value} -} - -func NewUpdateIntegrationRequestConfigsFromApiKeyIntegrationConfigs(value *ApiKeyIntegrationConfigs) *UpdateIntegrationRequestConfigs { - return &UpdateIntegrationRequestConfigs{typeName: "apiKeyIntegrationConfigs", ApiKeyIntegrationConfigs: value} -} - -func NewUpdateIntegrationRequestConfigsFromHandledHmacConfigs(value *HandledHmacConfigs) *UpdateIntegrationRequestConfigs { - return &UpdateIntegrationRequestConfigs{typeName: "handledHmacConfigs", HandledHmacConfigs: value} -} - -func NewUpdateIntegrationRequestConfigsFromBasicAuthIntegrationConfigs(value *BasicAuthIntegrationConfigs) *UpdateIntegrationRequestConfigs { - return &UpdateIntegrationRequestConfigs{typeName: "basicAuthIntegrationConfigs", BasicAuthIntegrationConfigs: value} -} - -func NewUpdateIntegrationRequestConfigsFromShopifyIntegrationConfigs(value *ShopifyIntegrationConfigs) *UpdateIntegrationRequestConfigs { - return &UpdateIntegrationRequestConfigs{typeName: "shopifyIntegrationConfigs", ShopifyIntegrationConfigs: value} -} - -func (u *UpdateIntegrationRequestConfigs) UnmarshalJSON(data []byte) error { - valueHmacIntegrationConfigs := new(HmacIntegrationConfigs) - if err := json.Unmarshal(data, &valueHmacIntegrationConfigs); err == nil { - u.typeName = "hmacIntegrationConfigs" - u.HmacIntegrationConfigs = valueHmacIntegrationConfigs - return nil - } - valueApiKeyIntegrationConfigs := new(ApiKeyIntegrationConfigs) - if err := json.Unmarshal(data, &valueApiKeyIntegrationConfigs); err == nil { - u.typeName = "apiKeyIntegrationConfigs" - u.ApiKeyIntegrationConfigs = valueApiKeyIntegrationConfigs - return nil - } - valueHandledHmacConfigs := new(HandledHmacConfigs) - if err := json.Unmarshal(data, &valueHandledHmacConfigs); err == nil { - u.typeName = "handledHmacConfigs" - u.HandledHmacConfigs = valueHandledHmacConfigs - return nil - } - valueBasicAuthIntegrationConfigs := new(BasicAuthIntegrationConfigs) - if err := json.Unmarshal(data, &valueBasicAuthIntegrationConfigs); err == nil { - u.typeName = "basicAuthIntegrationConfigs" - u.BasicAuthIntegrationConfigs = valueBasicAuthIntegrationConfigs - return nil - } - valueShopifyIntegrationConfigs := new(ShopifyIntegrationConfigs) - if err := json.Unmarshal(data, &valueShopifyIntegrationConfigs); err == nil { - u.typeName = "shopifyIntegrationConfigs" - u.ShopifyIntegrationConfigs = valueShopifyIntegrationConfigs - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, u) -} - -func (u UpdateIntegrationRequestConfigs) MarshalJSON() ([]byte, error) { - switch u.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "hmacIntegrationConfigs": - return json.Marshal(u.HmacIntegrationConfigs) - case "apiKeyIntegrationConfigs": - return json.Marshal(u.ApiKeyIntegrationConfigs) - case "handledHmacConfigs": - return json.Marshal(u.HandledHmacConfigs) - case "basicAuthIntegrationConfigs": - return json.Marshal(u.BasicAuthIntegrationConfigs) - case "shopifyIntegrationConfigs": - return json.Marshal(u.ShopifyIntegrationConfigs) - } -} - -type UpdateIntegrationRequestConfigsVisitor interface { - VisitHmacIntegrationConfigs(*HmacIntegrationConfigs) error - VisitApiKeyIntegrationConfigs(*ApiKeyIntegrationConfigs) error - VisitHandledHmacConfigs(*HandledHmacConfigs) error - VisitBasicAuthIntegrationConfigs(*BasicAuthIntegrationConfigs) error - VisitShopifyIntegrationConfigs(*ShopifyIntegrationConfigs) error -} - -func (u *UpdateIntegrationRequestConfigs) Accept(v UpdateIntegrationRequestConfigsVisitor) error { - switch u.typeName { - default: - return fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "hmacIntegrationConfigs": - return v.VisitHmacIntegrationConfigs(u.HmacIntegrationConfigs) - case "apiKeyIntegrationConfigs": - return v.VisitApiKeyIntegrationConfigs(u.ApiKeyIntegrationConfigs) - case "handledHmacConfigs": - return v.VisitHandledHmacConfigs(u.HandledHmacConfigs) - case "basicAuthIntegrationConfigs": - return v.VisitBasicAuthIntegrationConfigs(u.BasicAuthIntegrationConfigs) - case "shopifyIntegrationConfigs": - return v.VisitShopifyIntegrationConfigs(u.ShopifyIntegrationConfigs) - } -} diff --git a/update_issue_request.go b/update_issue_request.go deleted file mode 100644 index 6115e7f..0000000 --- a/update_issue_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateIssueRequest is an in-lined request used by the UpdateIssue endpoint. -type UpdateIssueRequest struct { - // New status - Status UpdateIssueRequestStatus `json:"status,omitempty"` -} diff --git a/update_issue_request_status.go b/update_issue_request_status.go deleted file mode 100644 index 4636de2..0000000 --- a/update_issue_request_status.go +++ /dev/null @@ -1,60 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// New status -type UpdateIssueRequestStatus uint8 - -const ( - UpdateIssueRequestStatusOpened UpdateIssueRequestStatus = iota + 1 - UpdateIssueRequestStatusIgnored - UpdateIssueRequestStatusAcknowledged - UpdateIssueRequestStatusResolved -) - -func (u UpdateIssueRequestStatus) String() string { - switch u { - default: - return strconv.Itoa(int(u)) - case UpdateIssueRequestStatusOpened: - return "OPENED" - case UpdateIssueRequestStatusIgnored: - return "IGNORED" - case UpdateIssueRequestStatusAcknowledged: - return "ACKNOWLEDGED" - case UpdateIssueRequestStatusResolved: - return "RESOLVED" - } -} - -func (u UpdateIssueRequestStatus) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", u.String())), nil -} - -func (u *UpdateIssueRequestStatus) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "OPENED": - value := UpdateIssueRequestStatusOpened - *u = value - case "IGNORED": - value := UpdateIssueRequestStatusIgnored - *u = value - case "ACKNOWLEDGED": - value := UpdateIssueRequestStatusAcknowledged - *u = value - case "RESOLVED": - value := UpdateIssueRequestStatusResolved - *u = value - } - return nil -} diff --git a/update_issue_trigger_request.go b/update_issue_trigger_request.go deleted file mode 100644 index 89ea6f7..0000000 --- a/update_issue_trigger_request.go +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateIssueTriggerRequest is an in-lined request used by the UpdateIssueTrigger endpoint. -type UpdateIssueTriggerRequest struct { - // Configuration object for the specific issue type selected - Configs *UpdateIssueTriggerRequestConfigs `json:"configs,omitempty"` - Channels *IssueTriggerChannels `json:"channels,omitempty"` - // Date when the issue trigger was disabled - DisabledAt *string `json:"disabled_at,omitempty"` - // Optional unique name to use as reference when using the API `<= 255 characters` - Name *string `json:"name,omitempty"` -} diff --git a/update_issue_trigger_request_configs.go b/update_issue_trigger_request_configs.go deleted file mode 100644 index 4e61353..0000000 --- a/update_issue_trigger_request_configs.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Configuration object for the specific issue type selected -type UpdateIssueTriggerRequestConfigs struct { - typeName string - IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs - IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs - IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs -} - -func NewUpdateIssueTriggerRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *UpdateIssueTriggerRequestConfigs { - return &UpdateIssueTriggerRequestConfigs{typeName: "issueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} -} - -func NewUpdateIssueTriggerRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *UpdateIssueTriggerRequestConfigs { - return &UpdateIssueTriggerRequestConfigs{typeName: "issueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} -} - -func NewUpdateIssueTriggerRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *UpdateIssueTriggerRequestConfigs { - return &UpdateIssueTriggerRequestConfigs{typeName: "issueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} -} - -func (u *UpdateIssueTriggerRequestConfigs) UnmarshalJSON(data []byte) error { - valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { - u.typeName = "issueTriggerDeliveryConfigs" - u.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs - return nil - } - valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { - u.typeName = "issueTriggerTransformationConfigs" - u.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs - return nil - } - valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { - u.typeName = "issueTriggerBackpressureConfigs" - u.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, u) -} - -func (u UpdateIssueTriggerRequestConfigs) MarshalJSON() ([]byte, error) { - switch u.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "issueTriggerDeliveryConfigs": - return json.Marshal(u.IssueTriggerDeliveryConfigs) - case "issueTriggerTransformationConfigs": - return json.Marshal(u.IssueTriggerTransformationConfigs) - case "issueTriggerBackpressureConfigs": - return json.Marshal(u.IssueTriggerBackpressureConfigs) - } -} - -type UpdateIssueTriggerRequestConfigsVisitor interface { - VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error - VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error - VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error -} - -func (u *UpdateIssueTriggerRequestConfigs) Accept(v UpdateIssueTriggerRequestConfigsVisitor) error { - switch u.typeName { - default: - return fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "issueTriggerDeliveryConfigs": - return v.VisitIssueTriggerDeliveryConfigs(u.IssueTriggerDeliveryConfigs) - case "issueTriggerTransformationConfigs": - return v.VisitIssueTriggerTransformationConfigs(u.IssueTriggerTransformationConfigs) - case "issueTriggerBackpressureConfigs": - return v.VisitIssueTriggerBackpressureConfigs(u.IssueTriggerBackpressureConfigs) - } -} diff --git a/update_ruleset_request.go b/update_ruleset_request.go deleted file mode 100644 index 6488bb8..0000000 --- a/update_ruleset_request.go +++ /dev/null @@ -1,14 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateRulesetRequest is an in-lined request used by the UpdateRuleset endpoint. -type UpdateRulesetRequest struct { - // Name for the ruleset `<= 155 characters` - Name *string `json:"name,omitempty"` - // Date the ruleset was archived - ArchivedAt *string `json:"archived_at,omitempty"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` - IsTeamDefault *bool `json:"is_team_default,omitempty"` -} diff --git a/update_source_request.go b/update_source_request.go deleted file mode 100644 index 074c896..0000000 --- a/update_source_request.go +++ /dev/null @@ -1,11 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateSourceRequest is an in-lined request used by the UpdateSource endpoint. -type UpdateSourceRequest struct { - // A unique name for the source `<= 155 characters` - Name *string `json:"name,omitempty"` - // Date the source was archived - ArchivedAt *string `json:"archived_at,omitempty"` -} diff --git a/update_transformation_request.go b/update_transformation_request.go deleted file mode 100644 index cbbe0a6..0000000 --- a/update_transformation_request.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpdateTransformationRequest is an in-lined request used by the UpdateTransformation endpoint. -type UpdateTransformationRequest struct { - // A unique, human-friendly name for the transformation `<= 155 characters` - Name *string `json:"name,omitempty"` - // JavaScript code to be executed - Code *string `json:"code,omitempty"` - // Key-value environment variables to be passed to the transformation - Env *map[string]*UpdateTransformationRequestEnvValue `json:"env,omitempty"` -} diff --git a/update_transformation_request_env_value.go b/update_transformation_request_env_value.go deleted file mode 100644 index 9009e28..0000000 --- a/update_transformation_request_env_value.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type UpdateTransformationRequestEnvValue struct { - typeName string - String string - Double float64 -} - -func NewUpdateTransformationRequestEnvValueFromString(value string) *UpdateTransformationRequestEnvValue { - return &UpdateTransformationRequestEnvValue{typeName: "string", String: value} -} - -func NewUpdateTransformationRequestEnvValueFromDouble(value float64) *UpdateTransformationRequestEnvValue { - return &UpdateTransformationRequestEnvValue{typeName: "double", Double: value} -} - -func (u *UpdateTransformationRequestEnvValue) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - u.typeName = "string" - u.String = valueString - return nil - } - var valueDouble float64 - if err := json.Unmarshal(data, &valueDouble); err == nil { - u.typeName = "double" - u.Double = valueDouble - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, u) -} - -func (u UpdateTransformationRequestEnvValue) MarshalJSON() ([]byte, error) { - switch u.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "string": - return json.Marshal(u.String) - case "double": - return json.Marshal(u.Double) - } -} - -type UpdateTransformationRequestEnvValueVisitor interface { - VisitString(string) error - VisitDouble(float64) error -} - -func (u *UpdateTransformationRequestEnvValue) Accept(v UpdateTransformationRequestEnvValueVisitor) error { - switch u.typeName { - default: - return fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "string": - return v.VisitString(u.String) - case "double": - return v.VisitDouble(u.Double) - } -} diff --git a/upsert_connection_request.go b/upsert_connection_request.go deleted file mode 100644 index 3649e2c..0000000 --- a/upsert_connection_request.go +++ /dev/null @@ -1,23 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpsertConnectionRequest is an in-lined request used by the UpsertConnection endpoint. -type UpsertConnectionRequest struct { - // A unique name of the connection for the source `<= 155 characters` - Name string `json:"name"` - // ID of a destination to bind to the connection - DestinationId *string `json:"destination_id,omitempty"` - // ID of a source to bind to the connection - SourceId *string `json:"source_id,omitempty"` - // Destination input object - Destination *UpsertConnectionRequestDestination `json:"destination,omitempty"` - // Source input object - Source *UpsertConnectionRequestSource `json:"source,omitempty"` - // Ruleset input object - Ruleset *UpsertConnectionRequestRuleset `json:"ruleset,omitempty"` - // ID of a rule to bind to the connection. Default to the Workspace default ruleset - RulesetId *string `json:"ruleset_id,omitempty"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` -} diff --git a/upsert_connection_request_destination.go b/upsert_connection_request_destination.go deleted file mode 100644 index e863d68..0000000 --- a/upsert_connection_request_destination.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Destination input object -type UpsertConnectionRequestDestination struct { - // Name for the destination `<= 155 characters` - Name string `json:"name"` - // Endpoint of the destination - Url *string `json:"url,omitempty"` - // Path for the CLI destination - CliPath *string `json:"cli_path,omitempty"` - // Period to rate limit attempts - RateLimitPeriod *UpsertConnectionRequestDestinationRateLimitPeriod `json:"rate_limit_period,omitempty"` - // Limit event attempts to receive per period - RateLimit *int `json:"rate_limit,omitempty"` - PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` -} diff --git a/upsert_connection_request_destination_rate_limit_period.go b/upsert_connection_request_destination_rate_limit_period.go deleted file mode 100644 index bbc7dae..0000000 --- a/upsert_connection_request_destination_rate_limit_period.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Period to rate limit attempts -type UpsertConnectionRequestDestinationRateLimitPeriod uint8 - -const ( - UpsertConnectionRequestDestinationRateLimitPeriodSecond UpsertConnectionRequestDestinationRateLimitPeriod = iota + 1 - UpsertConnectionRequestDestinationRateLimitPeriodMinute - UpsertConnectionRequestDestinationRateLimitPeriodHour -) - -func (u UpsertConnectionRequestDestinationRateLimitPeriod) String() string { - switch u { - default: - return strconv.Itoa(int(u)) - case UpsertConnectionRequestDestinationRateLimitPeriodSecond: - return "second" - case UpsertConnectionRequestDestinationRateLimitPeriodMinute: - return "minute" - case UpsertConnectionRequestDestinationRateLimitPeriodHour: - return "hour" - } -} - -func (u UpsertConnectionRequestDestinationRateLimitPeriod) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", u.String())), nil -} - -func (u *UpsertConnectionRequestDestinationRateLimitPeriod) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "second": - value := UpsertConnectionRequestDestinationRateLimitPeriodSecond - *u = value - case "minute": - value := UpsertConnectionRequestDestinationRateLimitPeriodMinute - *u = value - case "hour": - value := UpsertConnectionRequestDestinationRateLimitPeriodHour - *u = value - } - return nil -} diff --git a/upsert_connection_request_ruleset.go b/upsert_connection_request_ruleset.go deleted file mode 100644 index 4142773..0000000 --- a/upsert_connection_request_ruleset.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Ruleset input object -type UpsertConnectionRequestRuleset struct { - // Name for the ruleset `<= 155 characters` - Name string `json:"name"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` - IsTeamDefault *bool `json:"is_team_default,omitempty"` -} diff --git a/upsert_connection_request_source.go b/upsert_connection_request_source.go deleted file mode 100644 index b425d77..0000000 --- a/upsert_connection_request_source.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// Source input object -type UpsertConnectionRequestSource struct { - // A unique name for the source `<= 155 characters` - Name string `json:"name"` -} diff --git a/upsert_destination_request.go b/upsert_destination_request.go deleted file mode 100644 index cbc47ba..0000000 --- a/upsert_destination_request.go +++ /dev/null @@ -1,18 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpsertDestinationRequest is an in-lined request used by the UpsertDestination endpoint. -type UpsertDestinationRequest struct { - // Name for the destination `<= 155 characters` - Name string `json:"name"` - // Endpoint of the destination - Url *string `json:"url,omitempty"` - // Path for the CLI destination - CliPath *string `json:"cli_path,omitempty"` - // Period to rate limit attempts - RateLimitPeriod *UpsertDestinationRequestRateLimitPeriod `json:"rate_limit_period,omitempty"` - // Limit event attempts to receive per period - RateLimit *int `json:"rate_limit,omitempty"` - PathForwardingDisabled *bool `json:"path_forwarding_disabled,omitempty"` -} diff --git a/upsert_destination_request_rate_limit_period.go b/upsert_destination_request_rate_limit_period.go deleted file mode 100644 index dd5d7d3..0000000 --- a/upsert_destination_request_rate_limit_period.go +++ /dev/null @@ -1,54 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" - strconv "strconv" -) - -// Period to rate limit attempts -type UpsertDestinationRequestRateLimitPeriod uint8 - -const ( - UpsertDestinationRequestRateLimitPeriodSecond UpsertDestinationRequestRateLimitPeriod = iota + 1 - UpsertDestinationRequestRateLimitPeriodMinute - UpsertDestinationRequestRateLimitPeriodHour -) - -func (u UpsertDestinationRequestRateLimitPeriod) String() string { - switch u { - default: - return strconv.Itoa(int(u)) - case UpsertDestinationRequestRateLimitPeriodSecond: - return "second" - case UpsertDestinationRequestRateLimitPeriodMinute: - return "minute" - case UpsertDestinationRequestRateLimitPeriodHour: - return "hour" - } -} - -func (u UpsertDestinationRequestRateLimitPeriod) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf("%q", u.String())), nil -} - -func (u *UpsertDestinationRequestRateLimitPeriod) UnmarshalJSON(data []byte) error { - var raw string - if err := json.Unmarshal(data, &raw); err != nil { - return err - } - switch raw { - case "second": - value := UpsertDestinationRequestRateLimitPeriodSecond - *u = value - case "minute": - value := UpsertDestinationRequestRateLimitPeriodMinute - *u = value - case "hour": - value := UpsertDestinationRequestRateLimitPeriodHour - *u = value - } - return nil -} diff --git a/upsert_issue_trigger_request.go b/upsert_issue_trigger_request.go deleted file mode 100644 index 012bbee..0000000 --- a/upsert_issue_trigger_request.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpsertIssueTriggerRequest is an in-lined request used by the UpsertIssueTrigger endpoint. -type UpsertIssueTriggerRequest struct { - Type IssueType `json:"type,omitempty"` - // Configuration object for the specific issue type selected - Configs *UpsertIssueTriggerRequestConfigs `json:"configs,omitempty"` - Channels *IssueTriggerChannels `json:"channels,omitempty"` - // Required unique name to use as reference when using the API `<= 255 characters` - Name string `json:"name"` -} diff --git a/upsert_issue_trigger_request_configs.go b/upsert_issue_trigger_request_configs.go deleted file mode 100644 index ca2afaf..0000000 --- a/upsert_issue_trigger_request_configs.go +++ /dev/null @@ -1,82 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -// Configuration object for the specific issue type selected -type UpsertIssueTriggerRequestConfigs struct { - typeName string - IssueTriggerDeliveryConfigs *IssueTriggerDeliveryConfigs - IssueTriggerTransformationConfigs *IssueTriggerTransformationConfigs - IssueTriggerBackpressureConfigs *IssueTriggerBackpressureConfigs -} - -func NewUpsertIssueTriggerRequestConfigsFromIssueTriggerDeliveryConfigs(value *IssueTriggerDeliveryConfigs) *UpsertIssueTriggerRequestConfigs { - return &UpsertIssueTriggerRequestConfigs{typeName: "issueTriggerDeliveryConfigs", IssueTriggerDeliveryConfigs: value} -} - -func NewUpsertIssueTriggerRequestConfigsFromIssueTriggerTransformationConfigs(value *IssueTriggerTransformationConfigs) *UpsertIssueTriggerRequestConfigs { - return &UpsertIssueTriggerRequestConfigs{typeName: "issueTriggerTransformationConfigs", IssueTriggerTransformationConfigs: value} -} - -func NewUpsertIssueTriggerRequestConfigsFromIssueTriggerBackpressureConfigs(value *IssueTriggerBackpressureConfigs) *UpsertIssueTriggerRequestConfigs { - return &UpsertIssueTriggerRequestConfigs{typeName: "issueTriggerBackpressureConfigs", IssueTriggerBackpressureConfigs: value} -} - -func (u *UpsertIssueTriggerRequestConfigs) UnmarshalJSON(data []byte) error { - valueIssueTriggerDeliveryConfigs := new(IssueTriggerDeliveryConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerDeliveryConfigs); err == nil { - u.typeName = "issueTriggerDeliveryConfigs" - u.IssueTriggerDeliveryConfigs = valueIssueTriggerDeliveryConfigs - return nil - } - valueIssueTriggerTransformationConfigs := new(IssueTriggerTransformationConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerTransformationConfigs); err == nil { - u.typeName = "issueTriggerTransformationConfigs" - u.IssueTriggerTransformationConfigs = valueIssueTriggerTransformationConfigs - return nil - } - valueIssueTriggerBackpressureConfigs := new(IssueTriggerBackpressureConfigs) - if err := json.Unmarshal(data, &valueIssueTriggerBackpressureConfigs); err == nil { - u.typeName = "issueTriggerBackpressureConfigs" - u.IssueTriggerBackpressureConfigs = valueIssueTriggerBackpressureConfigs - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, u) -} - -func (u UpsertIssueTriggerRequestConfigs) MarshalJSON() ([]byte, error) { - switch u.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "issueTriggerDeliveryConfigs": - return json.Marshal(u.IssueTriggerDeliveryConfigs) - case "issueTriggerTransformationConfigs": - return json.Marshal(u.IssueTriggerTransformationConfigs) - case "issueTriggerBackpressureConfigs": - return json.Marshal(u.IssueTriggerBackpressureConfigs) - } -} - -type UpsertIssueTriggerRequestConfigsVisitor interface { - VisitIssueTriggerDeliveryConfigs(*IssueTriggerDeliveryConfigs) error - VisitIssueTriggerTransformationConfigs(*IssueTriggerTransformationConfigs) error - VisitIssueTriggerBackpressureConfigs(*IssueTriggerBackpressureConfigs) error -} - -func (u *UpsertIssueTriggerRequestConfigs) Accept(v UpsertIssueTriggerRequestConfigsVisitor) error { - switch u.typeName { - default: - return fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "issueTriggerDeliveryConfigs": - return v.VisitIssueTriggerDeliveryConfigs(u.IssueTriggerDeliveryConfigs) - case "issueTriggerTransformationConfigs": - return v.VisitIssueTriggerTransformationConfigs(u.IssueTriggerTransformationConfigs) - case "issueTriggerBackpressureConfigs": - return v.VisitIssueTriggerBackpressureConfigs(u.IssueTriggerBackpressureConfigs) - } -} diff --git a/upsert_ruleset_request.go b/upsert_ruleset_request.go deleted file mode 100644 index 0de9cbb..0000000 --- a/upsert_ruleset_request.go +++ /dev/null @@ -1,12 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpsertRulesetRequest is an in-lined request used by the UpsertRuleset endpoint. -type UpsertRulesetRequest struct { - // Name for the ruleset `<= 155 characters` - Name string `json:"name"` - // Array of rules to apply - Rules *[]*Rule `json:"rules,omitempty"` - IsTeamDefault *bool `json:"is_team_default,omitempty"` -} diff --git a/upsert_source_request.go b/upsert_source_request.go deleted file mode 100644 index 9a7ed63..0000000 --- a/upsert_source_request.go +++ /dev/null @@ -1,9 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpsertSourceRequest is an in-lined request used by the UpsertSource endpoint. -type UpsertSourceRequest struct { - // A unique name for the source `<= 155 characters` - Name string `json:"name"` -} diff --git a/upsert_transformation_request.go b/upsert_transformation_request.go deleted file mode 100644 index 9603d98..0000000 --- a/upsert_transformation_request.go +++ /dev/null @@ -1,13 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -// UpsertTransformationRequest is an in-lined request used by the UpsertTransformation endpoint. -type UpsertTransformationRequest struct { - // A unique, human-friendly name for the transformation `<= 155 characters` - Name string `json:"name"` - // JavaScript code to be executed - Code string `json:"code"` - // Key-value environment variables to be passed to the transformation - Env *map[string]*UpsertTransformationRequestEnvValue `json:"env,omitempty"` -} diff --git a/upsert_transformation_request_env_value.go b/upsert_transformation_request_env_value.go deleted file mode 100644 index ced30bb..0000000 --- a/upsert_transformation_request_env_value.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file was auto-generated by Fern from our API Definition. - -package api - -import ( - json "encoding/json" - fmt "fmt" -) - -type UpsertTransformationRequestEnvValue struct { - typeName string - String string - Double float64 -} - -func NewUpsertTransformationRequestEnvValueFromString(value string) *UpsertTransformationRequestEnvValue { - return &UpsertTransformationRequestEnvValue{typeName: "string", String: value} -} - -func NewUpsertTransformationRequestEnvValueFromDouble(value float64) *UpsertTransformationRequestEnvValue { - return &UpsertTransformationRequestEnvValue{typeName: "double", Double: value} -} - -func (u *UpsertTransformationRequestEnvValue) UnmarshalJSON(data []byte) error { - var valueString string - if err := json.Unmarshal(data, &valueString); err == nil { - u.typeName = "string" - u.String = valueString - return nil - } - var valueDouble float64 - if err := json.Unmarshal(data, &valueDouble); err == nil { - u.typeName = "double" - u.Double = valueDouble - return nil - } - return fmt.Errorf("%s cannot be deserialized as a %T", data, u) -} - -func (u UpsertTransformationRequestEnvValue) MarshalJSON() ([]byte, error) { - switch u.typeName { - default: - return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "string": - return json.Marshal(u.String) - case "double": - return json.Marshal(u.Double) - } -} - -type UpsertTransformationRequestEnvValueVisitor interface { - VisitString(string) error - VisitDouble(float64) error -} - -func (u *UpsertTransformationRequestEnvValue) Accept(v UpsertTransformationRequestEnvValueVisitor) error { - switch u.typeName { - default: - return fmt.Errorf("invalid type %s in %T", u.typeName, u) - case "string": - return v.VisitString(u.String) - case "double": - return v.VisitDouble(u.Double) - } -}