10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/event_store_client/adapters/http/commands/streams/append.rb', line 10
def call(stream_name, events, options: {})
expected_version = options[:expected_version]
serialized_events = events.map { |event| config.mapper.serialize(event) }
= {
'ES-ExpectedVersion' => expected_version&.to_s
}.reject { |_key, val| val.nil? || val.empty? }
data = build_events_data(serialized_events)
response =
connection.call(:post, "/streams/#{stream_name}", body: data, headers: )
validate_response(response, expected_version)
end
|