lib/svix/api/stream_api.rb in svix-1.39.0 vs lib/svix/api/stream_api.rb in svix-1.40.0
- old
+ new
@@ -88,10 +88,87 @@
@api_client.config.logger.debug "API called: StreamApi#v1_stream_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
+ # Append To Stream
+ # Creates streaming events.
+ # @param stream_id [String]
+ # @param create_stream_in [CreateStreamIn]
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :idempotency_key The request's idempotency key
+ # @return [Object]
+ def v1_stream_create_events(stream_id, create_stream_in, opts = {})
+ data, _status_code, _headers = v1_stream_create_events_with_http_info(stream_id, create_stream_in, opts)
+ data
+ end
+
+ # Append To Stream
+ # Creates streaming events.
+ # @param stream_id [String]
+ # @param create_stream_in [CreateStreamIn]
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :idempotency_key The request's idempotency key
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
+ def v1_stream_create_events_with_http_info(stream_id, create_stream_in, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: StreamApi.v1_stream_create_events ...'
+ end
+ # verify the required parameter 'stream_id' is set
+ if @api_client.config.client_side_validation && stream_id.nil?
+ fail ArgumentError, "Missing the required parameter 'stream_id' when calling StreamApi.v1_stream_create_events"
+ end
+ # verify the required parameter 'create_stream_in' is set
+ if @api_client.config.client_side_validation && create_stream_in.nil?
+ fail ArgumentError, "Missing the required parameter 'create_stream_in' when calling StreamApi.v1_stream_create_events"
+ end
+ # resource path
+ local_var_path = '/api/v1/stream/{stream_id}/events'.sub('{' + 'stream_id' + '}', CGI.escape(stream_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
+ # HTTP header 'Content-Type'
+ content_type = @api_client.select_header_content_type(['application/json'])
+ if !content_type.nil?
+ header_params['Content-Type'] = content_type
+ end
+ header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_stream_in)
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Object'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
+
+ new_options = opts.merge(
+ :operation => :"StreamApi.v1_stream_create_events",
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: StreamApi#v1_stream_create_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
# Delete Stream
# Delete a stream.
# @param stream_id [String]
# @param [Hash] opts the optional parameters
# @return [nil]
@@ -147,9 +224,89 @@
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: StreamApi#v1_stream_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Stream Events
+ # Iterate over a stream of events.
+ # @param stream_id [String]
+ # @param [Hash] opts the optional parameters
+ # @option opts [Integer] :limit Limit the number of returned items
+ # @option opts [String] :iterator The iterator returned from a prior invocation
+ # @option opts [Time] :after
+ # @return [EventStreamOut]
+ def v1_stream_events_get(stream_id, opts = {})
+ data, _status_code, _headers = v1_stream_events_get_with_http_info(stream_id, opts)
+ data
+ end
+
+ # Stream Events
+ # Iterate over a stream of events.
+ # @param stream_id [String]
+ # @param [Hash] opts the optional parameters
+ # @option opts [Integer] :limit Limit the number of returned items
+ # @option opts [String] :iterator The iterator returned from a prior invocation
+ # @option opts [Time] :after
+ # @return [Array<(EventStreamOut, Integer, Hash)>] EventStreamOut data, response status code and response headers
+ def v1_stream_events_get_with_http_info(stream_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: StreamApi.v1_stream_events_get ...'
+ end
+ # verify the required parameter 'stream_id' is set
+ if @api_client.config.client_side_validation && stream_id.nil?
+ fail ArgumentError, "Missing the required parameter 'stream_id' when calling StreamApi.v1_stream_events_get"
+ end
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling StreamApi.v1_stream_events_get, must be smaller than or equal to 250.'
+ end
+
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling StreamApi.v1_stream_events_get, must be greater than or equal to 1.'
+ end
+
+ # resource path
+ local_var_path = '/api/v1/stream/{stream_id}/events'.sub('{' + 'stream_id' + '}', CGI.escape(stream_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
+ query_params[:'iterator'] = opts[:'iterator'] if !opts[:'iterator'].nil?
+ query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'EventStreamOut'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['HTTPBearer']
+
+ new_options = opts.merge(
+ :operation => :"StreamApi.v1_stream_events_get",
+ :header_params => header_params,
+ :query_params => query_params,
+ :form_params => form_params,
+ :body => post_body,
+ :auth_names => auth_names,
+ :return_type => return_type
+ )
+
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: StreamApi#v1_stream_events_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
# Get Stream