diff --git a/lib/convoy_api.rb b/lib/convoy_api.rb index d3527ce..3d32d7f 100644 --- a/lib/convoy_api.rb +++ b/lib/convoy_api.rb @@ -101,6 +101,8 @@ require 'convoy_api/models/datastore_verifier_type' require 'convoy_api/models/get_delivery_attempt200_response' require 'convoy_api/models/get_delivery_attempts200_response' +require 'convoy_api/models/get_delivery_attempts200_response_all_of_data' +require 'convoy_api/models/get_delivery_attempts200_response_all_of_data_one_of' require 'convoy_api/models/get_endpoint_event200_response' require 'convoy_api/models/get_endpoint_period_failure_rates200_response' require 'convoy_api/models/get_endpoints200_response' diff --git a/lib/convoy_api/api/delivery_attempts_api.rb b/lib/convoy_api/api/delivery_attempts_api.rb index f16a01a..97afaa3 100644 --- a/lib/convoy_api/api/delivery_attempts_api.rb +++ b/lib/convoy_api/api/delivery_attempts_api.rb @@ -95,10 +95,12 @@ def get_delivery_attempt_with_http_info(project_id, event_delivery_id, delivery_ end # List delivery attempts - # This endpoint fetches an app message's delivery attempts + # This endpoint fetches an app message's delivery attempts Default: latest ten attempts as an array. With paginated=true: content and next_cursor. Pass next_cursor as before for older history; empty means last page. Pages are oldest first. # @param project_id [String] Project ID # @param event_delivery_id [String] event delivery id # @param [Hash] opts the optional parameters + # @option opts [Boolean] :paginated Return a page of ten attempts and next_cursor + # @option opts [String] :before Exclusive attempt cursor from next_cursor; requires paginated=true # @return [GetDeliveryAttempts200Response] def get_delivery_attempts(project_id, event_delivery_id, opts = {}) data, _status_code, _headers = get_delivery_attempts_with_http_info(project_id, event_delivery_id, opts) @@ -106,10 +108,12 @@ def get_delivery_attempts(project_id, event_delivery_id, opts = {}) end # List delivery attempts - # This endpoint fetches an app message's delivery attempts + # This endpoint fetches an app message's delivery attempts Default: latest ten attempts as an array. With paginated=true: content and next_cursor. Pass next_cursor as before for older history; empty means last page. Pages are oldest first. # @param project_id [String] Project ID # @param event_delivery_id [String] event delivery id # @param [Hash] opts the optional parameters + # @option opts [Boolean] :paginated Return a page of ten attempts and next_cursor + # @option opts [String] :before Exclusive attempt cursor from next_cursor; requires paginated=true # @return [Array<(GetDeliveryAttempts200Response, Integer, Hash)>] GetDeliveryAttempts200Response data, response status code and response headers def get_delivery_attempts_with_http_info(project_id, event_delivery_id, opts = {}) if @api_client.config.debugging @@ -128,6 +132,8 @@ def get_delivery_attempts_with_http_info(project_id, event_delivery_id, opts = { # query parameters query_params = opts[:query_params] || {} + query_params[:'paginated'] = opts[:'paginated'] if !opts[:'paginated'].nil? + query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? # header parameters header_params = opts[:header_params] || {} diff --git a/lib/convoy_api/api/event_deliveries_api.rb b/lib/convoy_api/api/event_deliveries_api.rb index cab3fb1..e22d58a 100644 --- a/lib/convoy_api/api/event_deliveries_api.rb +++ b/lib/convoy_api/api/event_deliveries_api.rb @@ -29,11 +29,14 @@ def initialize(api_client = ApiClient.default) # @option opts [String] :event_id Event ID to filter by # @option opts [String] :event_type EventType to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. + # @option opts [Integer] :min_trials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches delivery id, event id, event type prefix, and endpoint name. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` + # @option opts [Array] :source_id Limits idempotencyValue matching to these source IDs. # @option opts [String] :start_date The start date # @option opts [Array] :status A list of event delivery statuses to filter by # @option opts [String] :subscription_id SubscriptionID to filter by @@ -53,11 +56,14 @@ def batch_retry_event_delivery(project_id, opts = {}) # @option opts [String] :event_id Event ID to filter by # @option opts [String] :event_type EventType to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. + # @option opts [Integer] :min_trials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches delivery id, event id, event type prefix, and endpoint name. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` + # @option opts [Array] :source_id Limits idempotencyValue matching to these source IDs. # @option opts [String] :start_date The start date # @option opts [Array] :status A list of event delivery statuses to filter by # @option opts [String] :subscription_id SubscriptionID to filter by @@ -83,13 +89,16 @@ def batch_retry_event_delivery_with_http_info(project_id, opts = {}) query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'endpointId'] = @api_client.build_collection_param(opts[:'endpoint_id'], :multi) if !opts[:'endpoint_id'].nil? query_params[:'eventId'] = opts[:'event_id'] if !opts[:'event_id'].nil? - query_params[:'event_type'] = opts[:'event_type'] if !opts[:'event_type'].nil? + query_params[:'eventType'] = opts[:'event_type'] if !opts[:'event_type'].nil? query_params[:'idempotencyKey'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? + query_params[:'idempotencyValue'] = opts[:'idempotency_value'] if !opts[:'idempotency_value'].nil? + query_params[:'minTrials'] = opts[:'min_trials'] if !opts[:'min_trials'].nil? query_params[:'next_page_cursor'] = opts[:'next_page_cursor'] if !opts[:'next_page_cursor'].nil? query_params[:'perPage'] = opts[:'per_page'] if !opts[:'per_page'].nil? query_params[:'prev_page_cursor'] = opts[:'prev_page_cursor'] if !opts[:'prev_page_cursor'].nil? query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? + query_params[:'sourceId'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if !opts[:'source_id'].nil? query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if !opts[:'status'].nil? query_params[:'subscriptionId'] = opts[:'subscription_id'] if !opts[:'subscription_id'].nil? @@ -212,11 +221,14 @@ def force_resend_event_deliveries_with_http_info(project_id, models_ids, opts = # @option opts [String] :event_id Event ID to filter by # @option opts [String] :event_type EventType to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. + # @option opts [Integer] :min_trials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches delivery id, event id, event type prefix, and endpoint name. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` + # @option opts [Array] :source_id Limits idempotencyValue matching to these source IDs. # @option opts [String] :start_date The start date # @option opts [Array] :status A list of event delivery statuses to filter by # @option opts [String] :subscription_id SubscriptionID to filter by @@ -236,11 +248,14 @@ def get_event_deliveries_paged(project_id, opts = {}) # @option opts [String] :event_id Event ID to filter by # @option opts [String] :event_type EventType to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. + # @option opts [Integer] :min_trials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches delivery id, event id, event type prefix, and endpoint name. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` + # @option opts [Array] :source_id Limits idempotencyValue matching to these source IDs. # @option opts [String] :start_date The start date # @option opts [Array] :status A list of event delivery statuses to filter by # @option opts [String] :subscription_id SubscriptionID to filter by @@ -266,13 +281,16 @@ def get_event_deliveries_paged_with_http_info(project_id, opts = {}) query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'endpointId'] = @api_client.build_collection_param(opts[:'endpoint_id'], :multi) if !opts[:'endpoint_id'].nil? query_params[:'eventId'] = opts[:'event_id'] if !opts[:'event_id'].nil? - query_params[:'event_type'] = opts[:'event_type'] if !opts[:'event_type'].nil? + query_params[:'eventType'] = opts[:'event_type'] if !opts[:'event_type'].nil? query_params[:'idempotencyKey'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? + query_params[:'idempotencyValue'] = opts[:'idempotency_value'] if !opts[:'idempotency_value'].nil? + query_params[:'minTrials'] = opts[:'min_trials'] if !opts[:'min_trials'].nil? query_params[:'next_page_cursor'] = opts[:'next_page_cursor'] if !opts[:'next_page_cursor'].nil? query_params[:'perPage'] = opts[:'per_page'] if !opts[:'per_page'].nil? query_params[:'prev_page_cursor'] = opts[:'prev_page_cursor'] if !opts[:'prev_page_cursor'].nil? query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? + query_params[:'sourceId'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if !opts[:'source_id'].nil? query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if !opts[:'status'].nil? query_params[:'subscriptionId'] = opts[:'subscription_id'] if !opts[:'subscription_id'].nil? diff --git a/lib/convoy_api/api/events_api.rb b/lib/convoy_api/api/events_api.rb index 5f34f95..7e1f679 100644 --- a/lib/convoy_api/api/events_api.rb +++ b/lib/convoy_api/api/events_api.rb @@ -28,10 +28,12 @@ def initialize(api_client = ApiClient.default) # @option opts [String] :end_date The end date # @option opts [Array] :endpoint_id A list of endpoint ids to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. + # @option opts [String] :query_mode Set to text to search metadata literally, without interpreting JSON in query. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` # @option opts [Array] :source_id A list of Source IDs to filter the events by. # @option opts [String] :start_date The start date @@ -50,10 +52,12 @@ def batch_replay_events(project_id, opts = {}) # @option opts [String] :end_date The end date # @option opts [Array] :endpoint_id A list of endpoint ids to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. + # @option opts [String] :query_mode Set to text to search metadata literally, without interpreting JSON in query. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` # @option opts [Array] :source_id A list of Source IDs to filter the events by. # @option opts [String] :start_date The start date @@ -80,10 +84,12 @@ def batch_replay_events_with_http_info(project_id, opts = {}) query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'endpointId'] = @api_client.build_collection_param(opts[:'endpoint_id'], :multi) if !opts[:'endpoint_id'].nil? query_params[:'idempotencyKey'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? + query_params[:'idempotencyValue'] = opts[:'idempotency_value'] if !opts[:'idempotency_value'].nil? query_params[:'next_page_cursor'] = opts[:'next_page_cursor'] if !opts[:'next_page_cursor'].nil? query_params[:'perPage'] = opts[:'per_page'] if !opts[:'per_page'].nil? query_params[:'prev_page_cursor'] = opts[:'prev_page_cursor'] if !opts[:'prev_page_cursor'].nil? query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil? + query_params[:'queryMode'] = opts[:'query_mode'] if !opts[:'query_mode'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'sourceId'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if !opts[:'source_id'].nil? query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? @@ -131,10 +137,12 @@ def batch_replay_events_with_http_info(project_id, opts = {}) # @option opts [String] :end_date The end date # @option opts [Array] :endpoint_id A list of endpoint ids to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. + # @option opts [String] :query_mode Set to text to search metadata literally, without interpreting JSON in query. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` # @option opts [Array] :source_id A list of Source IDs to filter the events by. # @option opts [String] :start_date The start date @@ -153,10 +161,12 @@ def count_affected_events(project_id, opts = {}) # @option opts [String] :end_date The end date # @option opts [Array] :endpoint_id A list of endpoint ids to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. + # @option opts [String] :query_mode Set to text to search metadata literally, without interpreting JSON in query. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` # @option opts [Array] :source_id A list of Source IDs to filter the events by. # @option opts [String] :start_date The start date @@ -183,10 +193,12 @@ def count_affected_events_with_http_info(project_id, opts = {}) query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'endpointId'] = @api_client.build_collection_param(opts[:'endpoint_id'], :multi) if !opts[:'endpoint_id'].nil? query_params[:'idempotencyKey'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? + query_params[:'idempotencyValue'] = opts[:'idempotency_value'] if !opts[:'idempotency_value'].nil? query_params[:'next_page_cursor'] = opts[:'next_page_cursor'] if !opts[:'next_page_cursor'].nil? query_params[:'perPage'] = opts[:'per_page'] if !opts[:'per_page'].nil? query_params[:'prev_page_cursor'] = opts[:'prev_page_cursor'] if !opts[:'prev_page_cursor'].nil? query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil? + query_params[:'queryMode'] = opts[:'query_mode'] if !opts[:'query_mode'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'sourceId'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if !opts[:'source_id'].nil? query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? @@ -599,10 +611,12 @@ def get_endpoint_event_with_http_info(project_id, event_id, opts = {}) # @option opts [String] :end_date The end date # @option opts [Array] :endpoint_id A list of endpoint ids to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. + # @option opts [String] :query_mode Set to text to search metadata literally, without interpreting JSON in query. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` # @option opts [Array] :source_id A list of Source IDs to filter the events by. # @option opts [String] :start_date The start date @@ -621,10 +635,12 @@ def get_events_paged(project_id, opts = {}) # @option opts [String] :end_date The end date # @option opts [Array] :endpoint_id A list of endpoint ids to filter by # @option opts [String] :idempotency_key IdempotencyKey to filter by + # @option opts [String] :idempotency_value Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. # @option opts [String] :next_page_cursor A pagination cursor to fetch the next page of a list # @option opts [Integer] :per_page The number of items to return per page # @option opts [String] :prev_page_cursor A pagination cursor to fetch the previous page of a list # @option opts [String] :query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. + # @option opts [String] :query_mode Set to text to search metadata literally, without interpreting JSON in query. # @option opts [String] :sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` # @option opts [Array] :source_id A list of Source IDs to filter the events by. # @option opts [String] :start_date The start date @@ -651,10 +667,12 @@ def get_events_paged_with_http_info(project_id, opts = {}) query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'endpointId'] = @api_client.build_collection_param(opts[:'endpoint_id'], :multi) if !opts[:'endpoint_id'].nil? query_params[:'idempotencyKey'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? + query_params[:'idempotencyValue'] = opts[:'idempotency_value'] if !opts[:'idempotency_value'].nil? query_params[:'next_page_cursor'] = opts[:'next_page_cursor'] if !opts[:'next_page_cursor'].nil? query_params[:'perPage'] = opts[:'per_page'] if !opts[:'per_page'].nil? query_params[:'prev_page_cursor'] = opts[:'prev_page_cursor'] if !opts[:'prev_page_cursor'].nil? query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil? + query_params[:'queryMode'] = opts[:'query_mode'] if !opts[:'query_mode'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'sourceId'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if !opts[:'source_id'].nil? query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? diff --git a/lib/convoy_api/models/get_delivery_attempts200_response.rb b/lib/convoy_api/models/get_delivery_attempts200_response.rb index 9e851b0..120caba 100644 --- a/lib/convoy_api/models/get_delivery_attempts200_response.rb +++ b/lib/convoy_api/models/get_delivery_attempts200_response.rb @@ -45,7 +45,7 @@ def self.openapi_types { :'message' => :'String', :'status' => :'Boolean', - :'data' => :'Array' + :'data' => :'GetDeliveryAttempts200ResponseAllOfData' } end @@ -87,9 +87,7 @@ def initialize(attributes = {}) end if attributes.key?(:'data') - if (value = attributes[:'data']).is_a?(Array) - self.data = value - end + self.data = attributes[:'data'] end end diff --git a/lib/convoy_api/models/get_delivery_attempts200_response_all_of_data.rb b/lib/convoy_api/models/get_delivery_attempts200_response_all_of_data.rb new file mode 100644 index 0000000..7fac49b --- /dev/null +++ b/lib/convoy_api/models/get_delivery_attempts200_response_all_of_data.rb @@ -0,0 +1,104 @@ +=begin +#Convoy API Reference + +#Convoy is a fast and secure webhooks proxy. This document contains datastore's API specification. + +The version of the OpenAPI document: 26.3.5 +Contact: support@getconvoy.io +Generated by: https://openapi-generator.tech +Generator version: 7.23.0 + +=end + +require 'date' +require 'time' + +module ConvoyApi + module GetDeliveryAttempts200ResponseAllOfData + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Array', + :'GetDeliveryAttempts200ResponseAllOfDataOneOf' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + return find_and_cast_into_type(klass, data) + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.iso8601(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = ConvoyApi.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/convoy_api/models/get_delivery_attempts200_response_all_of_data_one_of.rb b/lib/convoy_api/models/get_delivery_attempts200_response_all_of_data_one_of.rb new file mode 100644 index 0000000..ed62d60 --- /dev/null +++ b/lib/convoy_api/models/get_delivery_attempts200_response_all_of_data_one_of.rb @@ -0,0 +1,193 @@ +=begin +#Convoy API Reference + +#Convoy is a fast and secure webhooks proxy. This document contains datastore's API specification. + +The version of the OpenAPI document: 26.3.5 +Contact: support@getconvoy.io +Generated by: https://openapi-generator.tech +Generator version: 7.23.0 + +=end + +require 'date' +require 'time' + +module ConvoyApi + class GetDeliveryAttempts200ResponseAllOfDataOneOf < ApiModelBase + attr_accessor :content + + # Pass as before to fetch older attempts. Empty on the last page. + attr_accessor :next_cursor + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'content' => :'content', + :'next_cursor' => :'next_cursor' + } + end + + # Returns attribute mapping this model knows about + def self.acceptable_attribute_map + attribute_map + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + acceptable_attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'content' => :'Array', + :'next_cursor' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ConvoyApi::GetDeliveryAttempts200ResponseAllOfDataOneOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + acceptable_attribute_map = self.class.acceptable_attribute_map + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!acceptable_attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ConvoyApi::GetDeliveryAttempts200ResponseAllOfDataOneOf`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'content') + if (value = attributes[:'content']).is_a?(Array) + self.content = value + end + else + self.content = nil + end + + if attributes.key?(:'next_cursor') + self.next_cursor = attributes[:'next_cursor'] + else + self.next_cursor = nil + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @content.nil? + invalid_properties.push('invalid value for "content", content cannot be nil.') + end + + if @next_cursor.nil? + invalid_properties.push('invalid value for "next_cursor", next_cursor cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @content.nil? + return false if @next_cursor.nil? + true + end + + # Custom attribute writer method with validation + # @param [Object] content Value to be assigned + def content=(content) + if content.nil? + fail ArgumentError, 'content cannot be nil' + end + + @content = content + end + + # Custom attribute writer method with validation + # @param [Object] next_cursor Value to be assigned + def next_cursor=(next_cursor) + if next_cursor.nil? + fail ArgumentError, 'next_cursor cannot be nil' + end + + @next_cursor = next_cursor + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + content == o.content && + next_cursor == o.next_cursor + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [content, next_cursor].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + end + +end diff --git a/lib/convoy_api/models/models_update_source.rb b/lib/convoy_api/models/models_update_source.rb index 6daeea1..8961901 100644 --- a/lib/convoy_api/models/models_update_source.rb +++ b/lib/convoy_api/models/models_update_source.rb @@ -39,6 +39,9 @@ class ModelsUpdateSource < ApiModelBase # Source name. attr_accessor :name + # Use this to specify one of our predefined source types. + attr_accessor :provider + # PubSub are used to specify message broker sources for outgoing webhooks projects, you only need to specify this when the source type is `pub_sub`. attr_accessor :pub_sub @@ -81,6 +84,7 @@ def self.attribute_map :'idempotency_keys' => :'idempotency_keys', :'is_disabled' => :'is_disabled', :'name' => :'name', + :'provider' => :'provider', :'pub_sub' => :'pub_sub', :'type' => :'type', :'verifier' => :'verifier' @@ -108,6 +112,7 @@ def self.openapi_types :'idempotency_keys' => :'Array', :'is_disabled' => :'Boolean', :'name' => :'String', + :'provider' => :'DatastoreSourceProvider', :'pub_sub' => :'ModelsPubSubConfig', :'type' => :'DatastoreSourceType', :'verifier' => :'ModelsVerifierConfig' @@ -172,6 +177,10 @@ def initialize(attributes = {}) self.name = attributes[:'name'] end + if attributes.key?(:'provider') + self.provider = attributes[:'provider'] + end + if attributes.key?(:'pub_sub') self.pub_sub = attributes[:'pub_sub'] end @@ -213,6 +222,7 @@ def ==(o) idempotency_keys == o.idempotency_keys && is_disabled == o.is_disabled && name == o.name && + provider == o.provider && pub_sub == o.pub_sub && type == o.type && verifier == o.verifier @@ -227,7 +237,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [body_function, custom_response, event_type_location, forward_headers, header_function, idempotency_keys, is_disabled, name, pub_sub, type, verifier].hash + [body_function, custom_response, event_type_location, forward_headers, header_function, idempotency_keys, is_disabled, name, provider, pub_sub, type, verifier].hash end # Builds the object from hash