lib/svix/models/endpoint_in.rb in svix-0.41.0 vs lib/svix/models/endpoint_in.rb in svix-0.43.2

- old
+ new

@@ -1,9 +1,9 @@ =begin #Svix API -#Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. +#Welcome to the Svix API documentation! Useful links: [Homepage](https://www.svix.com) | [Support email](mailto:support+docs@svix.com) | [Blog](https://www.svix.com/blog/) | [Slack Community](https://www.svix.com/slack/) # Introduction This is the reference documentation and schemas for the [Svix webhook service](https://www.svix.com) API. For tutorials and other documentation please refer to [the documentation](https://docs.svix.com). ## Main concepts In Svix you have four important entities you will be interacting with: - `messages`: these are the webhooks being sent. They can have contents and a few other properties. - `application`: this is where `messages` are sent to. Usually you want to create one application for each user on your platform. - `endpoint`: endpoints are the URLs messages will be sent to. Each application can have multiple `endpoints` and each message sent to that application will be sent to all of them (unless they are not subscribed to the sent event type). - `event-type`: event types are identifiers denoting the type of the message being sent. Event types are primarily used to decide which events are sent to which endpoint. ## Authentication Get your authentication token (`AUTH_TOKEN`) from the [Svix dashboard](https://dashboard.svix.com) and use it as part of the `Authorization` header as such: `Authorization: Bearer ${AUTH_TOKEN}`. <SecurityDefinitions /> ## Code samples The code samples assume you already have the respective libraries installed and you know how to use them. For the latest information on how to do that, please refer to [the documentation](https://docs.svix.com/). ## Idempotency Svix supports [idempotency](https://en.wikipedia.org/wiki/Idempotence) for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call is disrupted in transit and you do not receive a response. To perform an idempotent request, pass the idempotency key in the `Idempotency-Key` header to the request. The idempotency key should be a unique value generated by the client. You can create the key in however way you like, though we suggest using UUID v4, or any other string with enough entropy to avoid collisions. Svix's idempotency works by saving the resulting status code and body of the first request made for any given idempotency key for any successful request. Subsequent requests with the same key return the same result. Please note that idempotency is only supported for `POST` requests. ## Cross-Origin Resource Sharing This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. The version of the OpenAPI document: 1.4 Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.2.0 @@ -13,10 +13,13 @@ require 'date' require 'time' module Svix class EndpointIn + # List of message channels this endpoint listens to (omit for all) + attr_accessor :channels + attr_accessor :description attr_accessor :disabled attr_accessor :filter_types @@ -34,10 +37,11 @@ attr_accessor :version # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { + :'channels' => :'channels', :'description' => :'description', :'disabled' => :'disabled', :'filter_types' => :'filterTypes', :'rate_limit' => :'rateLimit', :'secret' => :'secret', @@ -53,10 +57,11 @@ end # Attribute type mapping. def self.openapi_types { + :'channels' => :'Array<String>', :'description' => :'String', :'disabled' => :'Boolean', :'filter_types' => :'Array<String>', :'rate_limit' => :'Integer', :'secret' => :'String', @@ -85,10 +90,16 @@ fail ArgumentError, "`#{k}` is not a valid attribute in `Svix::EndpointIn`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } + if attributes.key?(:'channels') + if (value = attributes[:'channels']).is_a?(Array) + self.channels = value + end + end + if attributes.key?(:'description') self.description = attributes[:'description'] else self.description = '' end @@ -128,10 +139,18 @@ # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties invalid_properties = Array.new + if !@channels.nil? && @channels.length > 10 + invalid_properties.push('invalid value for "channels", number of items must be less than or equal to 10.') + end + + if !@channels.nil? && @channels.length < 1 + invalid_properties.push('invalid value for "channels", number of items must be greater than or equal to 1.') + end + if !@filter_types.nil? && @filter_types.length < 1 invalid_properties.push('invalid value for "filter_types", number of items must be greater than or equal to 1.') end pattern = Regexp.new(/^whsec_[a-zA-Z0-9+\/]{32}$/) @@ -172,10 +191,12 @@ end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + return false if !@channels.nil? && @channels.length > 10 + return false if !@channels.nil? && @channels.length < 1 return false if !@filter_types.nil? && @filter_types.length < 1 return false if !@secret.nil? && @secret !~ Regexp.new(/^whsec_[a-zA-Z0-9+\/]{32}$/) return false if !@uid.nil? && @uid.to_s.length > 256 return false if !@uid.nil? && @uid.to_s.length < 1 return false if !@uid.nil? && @uid !~ Regexp.new(/^[a-zA-Z0-9\-_.]+$/) @@ -185,10 +206,24 @@ return false if @version.nil? true end # Custom attribute writer method with validation + # @param [Object] channels Value to be assigned + def channels=(channels) + if !channels.nil? && channels.length > 10 + fail ArgumentError, 'invalid value for "channels", number of items must be less than or equal to 10.' + end + + if !channels.nil? && channels.length < 1 + fail ArgumentError, 'invalid value for "channels", number of items must be greater than or equal to 1.' + end + + @channels = channels + end + + # Custom attribute writer method with validation # @param [Object] filter_types Value to be assigned def filter_types=(filter_types) if !filter_types.nil? && filter_types.length < 1 fail ArgumentError, 'invalid value for "filter_types", number of items must be greater than or equal to 1.' end @@ -247,10 +282,11 @@ # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && + channels == o.channels && description == o.description && disabled == o.disabled && filter_types == o.filter_types && rate_limit == o.rate_limit && secret == o.secret && @@ -266,10 +302,10 @@ end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [description, disabled, filter_types, rate_limit, secret, uid, url, version].hash + [channels, description, disabled, filter_types, rate_limit, secret, uid, url, version].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself