Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/gems
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-08-18 13:50:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-08-18 13:50:51 +0300
commitdb384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch)
tree34beaef37df5f47ccbcf5729d7583aae093cffa0 /gems
parent54fd7b1bad233e3944434da91d257fa7f63c3996 (diff)
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'gems')
-rw-r--r--gems/activerecord-gitlab/lib/activerecord-gitlab.rb5
-rw-r--r--gems/click_house-client/lib/click_house/client.rb46
-rw-r--r--gems/click_house-client/lib/click_house/client/database.rb9
-rw-r--r--gems/click_house-client/lib/click_house/client/response.rb5
-rw-r--r--gems/click_house-client/spec/click_house/client/configuration_spec.rb2
-rw-r--r--gems/click_house-client/spec/click_house/client/database_spec.rb4
-rw-r--r--gems/config/rubocop.yml12
-rw-r--r--gems/csv_builder/.gitignore11
-rw-r--r--gems/csv_builder/.gitlab-ci.yml4
-rw-r--r--gems/csv_builder/.rspec3
-rw-r--r--gems/csv_builder/.rubocop.yml8
-rw-r--r--gems/csv_builder/Gemfile6
-rw-r--r--gems/csv_builder/Gemfile.lock100
-rw-r--r--gems/csv_builder/README.md48
-rw-r--r--gems/csv_builder/csv_builder.gemspec26
-rw-r--r--gems/csv_builder/lib/csv_builder.rb38
-rw-r--r--gems/csv_builder/lib/csv_builder/builder.rb111
-rw-r--r--gems/csv_builder/lib/csv_builder/gzip.rb23
-rw-r--r--gems/csv_builder/lib/csv_builder/single_batch.rb11
-rw-r--r--gems/csv_builder/lib/csv_builder/stream.rb17
-rw-r--r--gems/csv_builder/lib/csv_builder/version.rb7
-rw-r--r--gems/csv_builder/spec/csv_builder/gzip_spec.rb33
-rw-r--r--gems/csv_builder/spec/csv_builder/stream_spec.rb44
-rw-r--r--gems/csv_builder/spec/csv_builder_spec.rb142
-rw-r--r--gems/csv_builder/spec/spec_helper.rb15
-rw-r--r--gems/error_tracking_open_api/.gitignore39
-rw-r--r--gems/error_tracking_open_api/.openapi-generator-ignore23
-rw-r--r--gems/error_tracking_open_api/.openapi-generator/FILES60
-rw-r--r--gems/error_tracking_open_api/.openapi-generator/VERSION1
-rw-r--r--gems/error_tracking_open_api/LICENSE7
-rw-r--r--gems/error_tracking_open_api/README.md127
-rw-r--r--gems/error_tracking_open_api/Rakefile10
-rw-r--r--gems/error_tracking_open_api/docs/Error.md38
-rw-r--r--gems/error_tracking_open_api/docs/ErrorEvent.md32
-rw-r--r--gems/error_tracking_open_api/docs/ErrorStats.md18
-rw-r--r--gems/error_tracking_open_api/docs/ErrorUpdatePayload.md20
-rw-r--r--gems/error_tracking_open_api/docs/ErrorV2.md34
-rw-r--r--gems/error_tracking_open_api/docs/ErrorsApi.md319
-rw-r--r--gems/error_tracking_open_api/docs/ErrorsV2Api.md235
-rw-r--r--gems/error_tracking_open_api/docs/EventsApi.md227
-rw-r--r--gems/error_tracking_open_api/docs/MessageEvent.md32
-rw-r--r--gems/error_tracking_open_api/docs/MessagesApi.md81
-rw-r--r--gems/error_tracking_open_api/docs/Project.md22
-rw-r--r--gems/error_tracking_open_api/docs/ProjectsApi.md76
-rw-r--r--gems/error_tracking_open_api/docs/StatsObject.md24
-rw-r--r--gems/error_tracking_open_api/docs/StatsObjectGroupInner.md22
-rw-r--r--gems/error_tracking_open_api/error_tracking_open_api.gemspec38
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api.rb53
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_api.rb361
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_v2_api.rb249
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/api/events_api.rb232
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/api/messages_api.rb94
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/api/projects_api.rb81
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/api_client.rb392
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/api_error.rb57
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/configuration.rb283
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/error.rb344
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_event.rb283
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_stats.rb219
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_update_payload.rb264
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_v2.rb326
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/message_event.rb282
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/project.rb240
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object.rb253
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object_group_inner.rb243
-rw-r--r--gems/error_tracking_open_api/lib/error_tracking_open_api/version.rb15
-rw-r--r--gems/gem.gitlab-ci.yml8
-rw-r--r--gems/gitlab-safe_request_store/.gitignore11
-rw-r--r--gems/gitlab-safe_request_store/.gitlab-ci.yml4
-rw-r--r--gems/gitlab-safe_request_store/.rspec3
-rw-r--r--gems/gitlab-safe_request_store/.rubocop.yml2
-rw-r--r--gems/gitlab-safe_request_store/Gemfile6
-rw-r--r--gems/gitlab-safe_request_store/Gemfile.lock103
-rw-r--r--gems/gitlab-safe_request_store/README.md42
-rw-r--r--gems/gitlab-safe_request_store/gitlab-safe_request_store.gemspec28
-rw-r--r--gems/gitlab-safe_request_store/lib/gitlab/safe_request_store.rb73
-rw-r--r--gems/gitlab-safe_request_store/lib/gitlab/safe_request_store/null_store.rb45
-rw-r--r--gems/gitlab-safe_request_store/lib/gitlab/safe_request_store/version.rb9
-rw-r--r--gems/gitlab-safe_request_store/spec/gitlab/safe_request_store/null_store_spec.rb75
-rw-r--r--gems/gitlab-safe_request_store/spec/gitlab/safe_request_store_spec.rb281
-rw-r--r--gems/gitlab-safe_request_store/spec/spec_helper.rb19
-rw-r--r--gems/gitlab-schema-validation/Gemfile.lock2
-rw-r--r--gems/gitlab-schema-validation/gitlab-schema-validation.gemspec1
-rw-r--r--gems/gitlab-schema-validation/lib/gitlab/schema/validation.rb4
-rw-r--r--gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection.rb57
-rw-r--r--gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/active_record_adapter.rb25
-rw-r--r--gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/base.rb33
-rw-r--r--gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/pg_adapter.rb30
-rw-r--r--gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/database.rb10
-rw-r--r--gems/gitlab-schema-validation/spec/lib/gitlab/schema/validation/sources/connection_spec.rb57
-rw-r--r--gems/gitlab-schema-validation/spec/spec_helper.rb1
-rw-r--r--gems/gitlab-schema-validation/spec/support/shared_examples/connection_adapter_shared_examples.rb36
-rw-r--r--gems/gitlab-schema-validation/spec/support/shared_examples/foreign_key_validators_shared_examples.rb5
-rw-r--r--gems/gitlab-schema-validation/spec/support/shared_examples/index_validators_shared_examples.rb5
-rw-r--r--gems/gitlab-schema-validation/spec/support/shared_examples/table_validators_shared_examples.rb6
-rw-r--r--gems/gitlab-schema-validation/spec/support/shared_examples/trigger_validators_shared_examples.rb5
96 files changed, 7434 insertions, 38 deletions
diff --git a/gems/activerecord-gitlab/lib/activerecord-gitlab.rb b/gems/activerecord-gitlab/lib/activerecord-gitlab.rb
new file mode 100644
index 00000000000..31cf29c70a1
--- /dev/null
+++ b/gems/activerecord-gitlab/lib/activerecord-gitlab.rb
@@ -0,0 +1,5 @@
+# rubocop:disable Naming/FileName
+# frozen_string_literal: true
+
+require_relative "active_record/gitlab_patches"
+# rubocop:enable Naming/FileName
diff --git a/gems/click_house-client/lib/click_house/client.rb b/gems/click_house-client/lib/click_house/client.rb
index 22c42d7be6e..abc54f2bce0 100644
--- a/gems/click_house-client/lib/click_house/client.rb
+++ b/gems/click_house-client/lib/click_house/client.rb
@@ -3,6 +3,7 @@
require 'addressable'
require 'json'
require 'active_support/time'
+require 'active_support/notifications'
require_relative "client/database"
require_relative "client/configuration"
require_relative "client/formatter"
@@ -27,30 +28,23 @@ module ClickHouse
# Executes a SELECT database query
def self.select(query, database, configuration = self.configuration)
- db = lookup_database(configuration, database)
-
- response = configuration.http_post_proc.call(
- db.uri.to_s,
- db.headers,
- "#{query} FORMAT JSON" # always return JSON
- )
+ instrumented_execute(query, database, configuration) do |response, instrument|
+ parsed_response = configuration.json_parser.parse(response.body)
- raise DatabaseError, response.body unless response.success?
+ instrument[:statistics] = parsed_response['statistics']&.symbolize_keys
- Formatter.format(configuration.json_parser.parse(response.body))
+ Formatter.format(parsed_response)
+ end
end
# Executes any kinds of database query without returning any data (INSERT, DELETE)
def self.execute(query, database, configuration = self.configuration)
- db = lookup_database(configuration, database)
-
- response = configuration.http_post_proc.call(
- db.uri.to_s,
- db.headers,
- query
- )
-
- raise DatabaseError, response.body unless response.success?
+ instrumented_execute(query, database, configuration) do |response, instrument|
+ if response.headers['x-clickhouse-summary']
+ instrument[:statistics] =
+ Gitlab::Json.parse(response.headers['x-clickhouse-summary']).symbolize_keys
+ end
+ end
true
end
@@ -60,5 +54,21 @@ module ClickHouse
raise ConfigurationError, "The database '#{database}' is not configured" unless db
end
end
+
+ private_class_method def self.instrumented_execute(query, database, configuration)
+ db = lookup_database(configuration, database)
+
+ ActiveSupport::Notifications.instrument('sql.click_house', { query: query, database: database }) do |instrument|
+ response = configuration.http_post_proc.call(
+ db.uri.to_s,
+ db.headers,
+ query
+ )
+
+ raise DatabaseError, response.body unless response.success?
+
+ yield response, instrument
+ end
+ end
end
end
diff --git a/gems/click_house-client/lib/click_house/client/database.rb b/gems/click_house-client/lib/click_house/client/database.rb
index beeb2a8cbd6..faf5a953a12 100644
--- a/gems/click_house-client/lib/click_house/client/database.rb
+++ b/gems/click_house-client/lib/click_house/client/database.rb
@@ -10,7 +10,10 @@ module ClickHouse
@url = url
@username = username
@password = password
- @variables = variables.merge(database: database).freeze
+ @variables = {
+ database: database,
+ enable_http_compression: 1 # enable HTTP compression by default
+ }.merge(variables).freeze
end
def uri
@@ -24,7 +27,9 @@ module ClickHouse
def headers
@headers ||= {
'X-ClickHouse-User' => @username,
- 'X-ClickHouse-Key' => @password
+ 'X-ClickHouse-Key' => @password,
+ 'X-ClickHouse-Format' => 'JSON', # always return JSON data
+ 'Content-Encoding' => 'gzip' # tell the server that we send compressed data
}.freeze
end
end
diff --git a/gems/click_house-client/lib/click_house/client/response.rb b/gems/click_house-client/lib/click_house/client/response.rb
index 898f0b0e024..8eb5eb50cc0 100644
--- a/gems/click_house-client/lib/click_house/client/response.rb
+++ b/gems/click_house-client/lib/click_house/client/response.rb
@@ -3,11 +3,12 @@
module ClickHouse
module Client
class Response
- attr_reader :body
+ attr_reader :body, :headers
- def initialize(body, http_status_code)
+ def initialize(body, http_status_code, headers = {})
@body = body
@http_status_code = http_status_code
+ @headers = headers
end
def success?
diff --git a/gems/click_house-client/spec/click_house/client/configuration_spec.rb b/gems/click_house-client/spec/click_house/client/configuration_spec.rb
index 8cbd64ca650..c6bd2974b7e 100644
--- a/gems/click_house-client/spec/click_house/client/configuration_spec.rb
+++ b/gems/click_house-client/spec/click_house/client/configuration_spec.rb
@@ -29,7 +29,7 @@ RSpec.describe ClickHouse::Client::Configuration do
expect(configuration.databases.size).to eq(1)
database = configuration.databases[:my_db]
- expect(database.uri.to_s).to eq('http://localhost:3333?database=test_db&join_use_nulls=1')
+ expect(database.uri.to_s).to eq('http://localhost:3333?database=test_db&enable_http_compression=1&join_use_nulls=1')
end
context 'when adding the same DB multiple times' do
diff --git a/gems/click_house-client/spec/click_house/client/database_spec.rb b/gems/click_house-client/spec/click_house/client/database_spec.rb
index 112b2ee12b1..a74d4a119a4 100644
--- a/gems/click_house-client/spec/click_house/client/database_spec.rb
+++ b/gems/click_house-client/spec/click_house/client/database_spec.rb
@@ -17,13 +17,15 @@ RSpec.describe ClickHouse::Client::Database do
describe '#uri' do
it 'builds the correct URL' do
- expect(database.uri.to_s).to eq('http://localhost:3333?database=test_db&join_use_nulls=1')
+ expect(database.uri.to_s).to eq('http://localhost:3333?database=test_db&enable_http_compression=1&join_use_nulls=1')
end
end
describe '#headers' do
it 'returns the correct headers' do
expect(database.headers).to eq({
+ "Content-Encoding" => "gzip",
+ "X-ClickHouse-Format" => "JSON",
'X-ClickHouse-User' => 'user',
'X-ClickHouse-Key' => 'pass'
})
diff --git a/gems/config/rubocop.yml b/gems/config/rubocop.yml
index a97d759b471..58746de53b0 100644
--- a/gems/config/rubocop.yml
+++ b/gems/config/rubocop.yml
@@ -1,3 +1,11 @@
+# We need to ignore exclusions defined in parent RuboCop configuration
+# (AllCops/Exclude: 'gems/**/*') if RuboCop cop is run within `gems/...`.
+# See https://gitlab.com/gitlab-org/gitlab/-/issues/417281
+<%
+ relative_path = ENV['PWD'].delete_prefix(File.expand_path('../..'))
+ RuboCop::ConfigLoader.ignore_parent_exclusion = relative_path.start_with?('/gems/')
+%>
+---
inherit_gem:
gitlab-styles:
- rubocop-default.yml
@@ -57,6 +65,10 @@ Graphql/AuthorizeTypes:
Graphql/Descriptions:
Enabled: false
+# This cop doesn't make sense in the context of gems
+RSpec/BeforeAll:
+ Enabled: false
+
Naming/FileName:
Exclude:
- spec/**/*.rb
diff --git a/gems/csv_builder/.gitignore b/gems/csv_builder/.gitignore
new file mode 100644
index 00000000000..b04a8c840df
--- /dev/null
+++ b/gems/csv_builder/.gitignore
@@ -0,0 +1,11 @@
+/.bundle/
+/.yardoc
+/_yardoc/
+/coverage/
+/doc/
+/pkg/
+/spec/reports/
+/tmp/
+
+# rspec failure tracking
+.rspec_status
diff --git a/gems/csv_builder/.gitlab-ci.yml b/gems/csv_builder/.gitlab-ci.yml
new file mode 100644
index 00000000000..e620c7bacd5
--- /dev/null
+++ b/gems/csv_builder/.gitlab-ci.yml
@@ -0,0 +1,4 @@
+include:
+ - local: gems/gem.gitlab-ci.yml
+ inputs:
+ gem_name: "csv_builder" \ No newline at end of file
diff --git a/gems/csv_builder/.rspec b/gems/csv_builder/.rspec
new file mode 100644
index 00000000000..34c5164d9b5
--- /dev/null
+++ b/gems/csv_builder/.rspec
@@ -0,0 +1,3 @@
+--format documentation
+--color
+--require spec_helper
diff --git a/gems/csv_builder/.rubocop.yml b/gems/csv_builder/.rubocop.yml
new file mode 100644
index 00000000000..d004dd48db7
--- /dev/null
+++ b/gems/csv_builder/.rubocop.yml
@@ -0,0 +1,8 @@
+inherit_from:
+ - ../config/rubocop.yml
+
+RSpec/MultipleMemoizedHelpers:
+ Max: 25
+
+RSpec/VerifiedDoubles:
+ Enabled: false \ No newline at end of file
diff --git a/gems/csv_builder/Gemfile b/gems/csv_builder/Gemfile
new file mode 100644
index 00000000000..81bdfcabdae
--- /dev/null
+++ b/gems/csv_builder/Gemfile
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+# Specify your gem's dependencies in csv_builder.gemspec
+gemspec
diff --git a/gems/csv_builder/Gemfile.lock b/gems/csv_builder/Gemfile.lock
new file mode 100644
index 00000000000..04992abc4d6
--- /dev/null
+++ b/gems/csv_builder/Gemfile.lock
@@ -0,0 +1,100 @@
+PATH
+ remote: .
+ specs:
+ csv_builder (0.1.0)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ activesupport (7.0.6)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (>= 1.6, < 2)
+ minitest (>= 5.1)
+ tzinfo (~> 2.0)
+ ast (2.4.2)
+ coderay (1.1.3)
+ concurrent-ruby (1.2.2)
+ diff-lcs (1.5.0)
+ gitlab-styles (10.1.0)
+ rubocop (~> 1.50.2)
+ rubocop-graphql (~> 0.18)
+ rubocop-performance (~> 1.15)
+ rubocop-rails (~> 2.17)
+ rubocop-rspec (~> 2.22)
+ i18n (1.14.1)
+ concurrent-ruby (~> 1.0)
+ json (2.6.3)
+ method_source (1.0.0)
+ minitest (5.19.0)
+ parallel (1.23.0)
+ parser (3.2.2.3)
+ ast (~> 2.4.1)
+ racc
+ pry (0.14.2)
+ coderay (~> 1.1)
+ method_source (~> 1.0)
+ racc (1.7.1)
+ rack (3.0.8)
+ rainbow (3.1.1)
+ regexp_parser (2.8.1)
+ rexml (3.2.6)
+ rspec (3.12.0)
+ rspec-core (~> 3.12.0)
+ rspec-expectations (~> 3.12.0)
+ rspec-mocks (~> 3.12.0)
+ rspec-core (3.12.2)
+ rspec-support (~> 3.12.0)
+ rspec-expectations (3.12.3)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.12.0)
+ rspec-mocks (3.12.6)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.12.0)
+ rspec-support (3.12.1)
+ rubocop (1.50.2)
+ json (~> 2.3)
+ parallel (~> 1.10)
+ parser (>= 3.2.0.0)
+ rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 1.8, < 3.0)
+ rexml (>= 3.2.5, < 4.0)
+ rubocop-ast (>= 1.28.0, < 2.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 2.4.0, < 3.0)
+ rubocop-ast (1.29.0)
+ parser (>= 3.2.1.0)
+ rubocop-capybara (2.18.0)
+ rubocop (~> 1.41)
+ rubocop-factory_bot (2.23.1)
+ rubocop (~> 1.33)
+ rubocop-graphql (0.19.0)
+ rubocop (>= 0.87, < 2)
+ rubocop-performance (1.18.0)
+ rubocop (>= 1.7.0, < 2.0)
+ rubocop-ast (>= 0.4.0)
+ rubocop-rails (2.20.2)
+ activesupport (>= 4.2.0)
+ rack (>= 1.1)
+ rubocop (>= 1.33.0, < 2.0)
+ rubocop-rspec (2.22.0)
+ rubocop (~> 1.33)
+ rubocop-capybara (~> 2.17)
+ rubocop-factory_bot (~> 2.22)
+ ruby-progressbar (1.13.0)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
+ unicode-display_width (2.4.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ csv_builder!
+ gitlab-styles (~> 10.1.0)
+ pry
+ rspec (~> 3.0)
+ rubocop (~> 1.50)
+ rubocop-rspec (~> 2.22)
+
+BUNDLED WITH
+ 2.4.17
diff --git a/gems/csv_builder/README.md b/gems/csv_builder/README.md
new file mode 100644
index 00000000000..37dde4b334c
--- /dev/null
+++ b/gems/csv_builder/README.md
@@ -0,0 +1,48 @@
+# CsvBuilder
+
+## Usage
+
+Generate a CSV given a collection and a mapping.
+
+```ruby
+columns = {
+ 'Title' => 'title',
+ 'Comment' => 'comment',
+ 'Author' => -> (post) { post.author.full_name }
+ 'Created At (UTC)' => -> (post) { post.created_at&.strftime('%Y-%m-%d %H:%M:%S') }
+}
+
+CsvBuilder.new(@posts, columns).render
+```
+
+When the value of the mapping is a string, a method is called with the given name
+on the record (for example: `post.title`).
+When the value of the mapping is a lambda, it is lazily executed.
+
+It's possible to also pass ActiveRecord associations to preload when batching
+through the collection:
+
+```ruby
+CsvBuilder.new(@posts, columns, [:author, :comments]).render
+```
+
+### SingleBatch builder
+
+When the collection is an array or enumerable you can use:
+
+```ruby
+CsvBuilder::SingleBatch.new(@posts, columns).render
+```
+
+### Stream builder
+
+A stream builder uses a lazy and more efficient iterator and by default returns
+up to 100,000 records from the collection.
+
+```ruby
+CsvBuilder::Stream.new(@posts, columns).render(1_000)
+```
+
+## Development
+
+Follow the GitLab [gems development guidelines](../../doc/development/gems.md).
diff --git a/gems/csv_builder/csv_builder.gemspec b/gems/csv_builder/csv_builder.gemspec
new file mode 100644
index 00000000000..956fe2d6108
--- /dev/null
+++ b/gems/csv_builder/csv_builder.gemspec
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require_relative "lib/csv_builder/version"
+
+Gem::Specification.new do |spec|
+ spec.name = "csv_builder"
+ spec.version = CsvBuilder::Version::VERSION
+ spec.authors = ["group::tenant-scale"]
+ spec.email = ["engineering@gitlab.com"]
+
+ spec.summary = "Provides enhancements to the CSV standard library"
+ spec.description = "Provides enhancements to the CSV standard library"
+ spec.homepage = "https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/csv_builder"
+ spec.license = 'MIT'
+ spec.required_ruby_version = ">= 3.0.0"
+ spec.metadata["rubygems_mfa_required"] = "true"
+
+ spec.files = Dir['lib/**/*.rb']
+ spec.require_paths = ["lib"]
+
+ spec.add_development_dependency "gitlab-styles", "~> 10.1.0"
+ spec.add_development_dependency "pry"
+ spec.add_development_dependency "rspec", "~> 3.0"
+ spec.add_development_dependency "rubocop", "~> 1.50"
+ spec.add_development_dependency "rubocop-rspec", "~> 2.22"
+end
diff --git a/gems/csv_builder/lib/csv_builder.rb b/gems/csv_builder/lib/csv_builder.rb
new file mode 100644
index 00000000000..86b682939dc
--- /dev/null
+++ b/gems/csv_builder/lib/csv_builder.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require 'csv'
+require 'tempfile'
+require 'zlib'
+
+require_relative "csv_builder/version"
+require_relative "csv_builder/builder"
+require_relative "csv_builder/single_batch"
+require_relative "csv_builder/stream"
+require_relative "csv_builder/gzip"
+
+# Generates CSV when given a collection and a mapping.
+#
+# Example:
+#
+# columns = {
+# 'Title' => 'title',
+# 'Comment' => 'comment',
+# 'Author' => -> (post) { post.author.full_name }
+# 'Created At (UTC)' => -> (post) { post.created_at&.strftime('%Y-%m-%d %H:%M:%S') }
+# }
+#
+# CsvBuilder.new(@posts, columns).render
+#
+module CsvBuilder
+ #
+ # * +collection+ - The data collection to be used
+ # * +header_to_value_hash+ - A hash of 'Column Heading' => 'value_method'.
+ # * +associations_to_preload+ - An array of records to preload with a batch of records.
+ #
+ # The value method will be called once for each object in the collection, to
+ # determine the value for that row. It can either be the name of a method on
+ # the object, or a lamda to call passing in the object.
+ def self.new(collection, header_to_value_hash, associations_to_preload = [])
+ CsvBuilder::Builder.new(collection, header_to_value_hash, associations_to_preload)
+ end
+end
diff --git a/gems/csv_builder/lib/csv_builder/builder.rb b/gems/csv_builder/lib/csv_builder/builder.rb
new file mode 100644
index 00000000000..99b63153ab2
--- /dev/null
+++ b/gems/csv_builder/lib/csv_builder/builder.rb
@@ -0,0 +1,111 @@
+# frozen_string_literal: true
+
+module CsvBuilder
+ class Builder
+ UNSAFE_EXCEL_PREFIX = /\A[=\+\-@;]/ # rubocop:disable Style/RedundantRegexpEscape
+
+ attr_reader :rows_written
+
+ def initialize(collection, header_to_value_hash, associations_to_preload = [])
+ @header_to_value_hash = header_to_value_hash
+ @collection = collection
+ @truncated = false
+ @rows_written = 0
+ @associations_to_preload = associations_to_preload
+ end
+
+ # Renders the csv to a string
+ def render(truncate_after_bytes = nil)
+ Tempfile.open(['csv']) do |tempfile|
+ csv = CSV.new(tempfile)
+
+ write_csv csv, until_condition: -> do
+ truncate_after_bytes && tempfile.size > truncate_after_bytes
+ end
+
+ if block_given?
+ yield tempfile
+ else
+ tempfile.rewind
+ tempfile.read
+ end
+ end
+ end
+
+ def truncated?
+ @truncated
+ end
+
+ def rows_expected
+ if truncated? || rows_written.zero?
+ @collection.count
+ else
+ rows_written
+ end
+ end
+
+ def status
+ {
+ truncated: truncated?,
+ rows_written: rows_written,
+ rows_expected: rows_expected
+ }
+ end
+
+ protected
+
+ def each(&block)
+ if @associations_to_preload&.any? && @collection.respond_to?(:each_batch)
+ @collection.each_batch(order_hint: :created_at) do |relation|
+ relation.preload(@associations_to_preload).order(:id).each(&block)
+ end
+ elsif @collection.respond_to?(:find_each)
+ @collection.find_each(&block)
+ else
+ @collection.each(&block)
+ end
+ end
+
+ private
+
+ def headers
+ @headers ||= @header_to_value_hash.keys
+ end
+
+ def attributes
+ @attributes ||= @header_to_value_hash.values
+ end
+
+ def row(object)
+ attributes.map do |attribute|
+ if attribute.respond_to?(:call)
+ excel_sanitize(attribute.call(object))
+ else
+ excel_sanitize(object.public_send(attribute)) # rubocop:disable GitlabSecurity/PublicSend
+ end
+ end
+ end
+
+ def write_csv(csv, until_condition:)
+ csv << headers
+
+ each do |object|
+ csv << row(object)
+
+ @rows_written += 1
+
+ if until_condition.call
+ @truncated = true
+ break
+ end
+ end
+ end
+
+ def excel_sanitize(line)
+ return if line.nil?
+ return line unless line.is_a?(String) && line.match?(UNSAFE_EXCEL_PREFIX)
+
+ ["'", line].join
+ end
+ end
+end
diff --git a/gems/csv_builder/lib/csv_builder/gzip.rb b/gems/csv_builder/lib/csv_builder/gzip.rb
new file mode 100644
index 00000000000..60875006a35
--- /dev/null
+++ b/gems/csv_builder/lib/csv_builder/gzip.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module CsvBuilder
+ class Gzip < CsvBuilder::Builder
+ # Writes the CSV file compressed and yields the written tempfile.
+ #
+ # Example:
+ # > CsvBuilder::Gzip.new(Issue, { title: -> (row) { row.title.upcase }, id: :id }).render do |tempfile|
+ # > puts tempfile.path
+ # > puts `zcat #{tempfile.path}`
+ # > end
+ def render
+ Tempfile.open(['csv_builder_gzip', '.csv.gz']) do |tempfile|
+ csv = CSV.new(Zlib::GzipWriter.open(tempfile.path))
+
+ write_csv csv, until_condition: -> {} # truncation must be handled outside of the CsvBuilder
+
+ csv.close
+ yield tempfile
+ end
+ end
+ end
+end
diff --git a/gems/csv_builder/lib/csv_builder/single_batch.rb b/gems/csv_builder/lib/csv_builder/single_batch.rb
new file mode 100644
index 00000000000..e7731f27fd0
--- /dev/null
+++ b/gems/csv_builder/lib/csv_builder/single_batch.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module CsvBuilder
+ class SingleBatch < CsvBuilder::Builder
+ protected
+
+ def each(&block)
+ @collection.each(&block)
+ end
+ end
+end
diff --git a/gems/csv_builder/lib/csv_builder/stream.rb b/gems/csv_builder/lib/csv_builder/stream.rb
new file mode 100644
index 00000000000..3e1a6c84ce9
--- /dev/null
+++ b/gems/csv_builder/lib/csv_builder/stream.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+module CsvBuilder
+ class Stream < CsvBuilder::Builder
+ def render(max_rows = 100_000)
+ max_rows_including_header = max_rows + 1
+
+ Enumerator.new do |csv|
+ csv << CSV.generate_line(headers)
+
+ each do |object|
+ csv << CSV.generate_line(row(object))
+ end
+ end.lazy.take(max_rows_including_header)
+ end
+ end
+end
diff --git a/gems/csv_builder/lib/csv_builder/version.rb b/gems/csv_builder/lib/csv_builder/version.rb
new file mode 100644
index 00000000000..b7baf16ad0a
--- /dev/null
+++ b/gems/csv_builder/lib/csv_builder/version.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+module CsvBuilder
+ module Version
+ VERSION = "0.1.0"
+ end
+end
diff --git a/gems/csv_builder/spec/csv_builder/gzip_spec.rb b/gems/csv_builder/spec/csv_builder/gzip_spec.rb
new file mode 100644
index 00000000000..9d24d351247
--- /dev/null
+++ b/gems/csv_builder/spec/csv_builder/gzip_spec.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe CsvBuilder::Gzip do
+ let(:event_1) { double(title: 'Added salt', description: 'A teaspoon') }
+ let(:event_2) { double(title: 'Added sugar', description: 'Just a pinch') }
+ let(:items) { [event_1, event_2] }
+
+ subject(:builder) { described_class.new(items, 'Title' => 'title', 'Description' => 'description') }
+
+ describe '#render' do
+ it 'returns yields a tempfile' do
+ written_content = nil
+
+ builder.render do |tempfile|
+ reader = Zlib::GzipReader.new(tempfile)
+ written_content = reader.read.split("\n")
+ end
+
+ expect(written_content).to eq(
+ [
+ "Title,Description",
+ "Added salt,A teaspoon",
+ "Added sugar,Just a pinch"
+ ])
+ end
+
+ it 'requires a block' do
+ expect { builder.render }.to raise_error(LocalJumpError)
+ end
+ end
+end
diff --git a/gems/csv_builder/spec/csv_builder/stream_spec.rb b/gems/csv_builder/spec/csv_builder/stream_spec.rb
new file mode 100644
index 00000000000..d23e63520af
--- /dev/null
+++ b/gems/csv_builder/spec/csv_builder/stream_spec.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe CsvBuilder::Stream do
+ let(:event_1) { double(title: 'Added salt', description: 'A teaspoon') }
+ let(:event_2) { double(title: 'Added sugar', description: 'Just a pinch') }
+ let(:fake_relation) { described_class::FakeRelation.new([event_1, event_2]) }
+
+ subject(:builder) { described_class.new(fake_relation, 'Title' => 'title', 'Description' => 'description') }
+
+ describe '#render' do
+ before do
+ stub_const("#{described_class}::FakeRelation", Array)
+
+ described_class::FakeRelation.class_eval do
+ def find_each(&block)
+ each(&block)
+ end
+ end
+ end
+
+ it 'returns a lazy enumerator' do
+ expect(builder.render).to be_an(Enumerator::Lazy)
+ end
+
+ it 'returns all rows up to default max value' do
+ expect(builder.render.to_a).to eq(
+ [
+ "Title,Description\n",
+ "Added salt,A teaspoon\n",
+ "Added sugar,Just a pinch\n"
+ ])
+ end
+
+ it 'truncates to max rows' do
+ expect(builder.render(1).to_a).to eq(
+ [
+ "Title,Description\n",
+ "Added salt,A teaspoon\n"
+ ])
+ end
+ end
+end
diff --git a/gems/csv_builder/spec/csv_builder_spec.rb b/gems/csv_builder/spec/csv_builder_spec.rb
new file mode 100644
index 00000000000..9d6283b3985
--- /dev/null
+++ b/gems/csv_builder/spec/csv_builder_spec.rb
@@ -0,0 +1,142 @@
+# frozen_string_literal: true
+
+RSpec.describe CsvBuilder do
+ let(:object) { double(question: :answer) }
+ let(:csv_data) { subject.render }
+
+ let(:subject) do
+ described_class.new(
+ enumerable, 'Q & A' => :question, 'Reversed' => ->(o) { o.question.to_s.reverse })
+ end
+
+ shared_examples 'csv builder examples' do
+ let(:items) { [object] }
+
+ it "has a version number" do
+ expect(CsvBuilder::Version::VERSION).not_to be nil
+ end
+
+ it 'generates a csv' do
+ expect(csv_data.scan(/(,|\n)/).join).to include ",\n,"
+ end
+
+ it 'uses a temporary file to reduce memory allocation' do
+ expect(CSV).to receive(:new).with(instance_of(Tempfile)).and_call_original
+
+ subject.render
+ end
+
+ it 'counts the number of rows' do
+ subject.render
+
+ expect(subject.rows_written).to eq 1
+ end
+
+ describe 'rows_expected' do
+ it 'uses rows_written if CSV rendered successfully' do
+ subject.render
+
+ expect(enumerable).not_to receive(:count)
+ expect(subject.rows_expected).to eq 1
+ end
+
+ it 'falls back to calling .count before rendering begins' do
+ expect(subject.rows_expected).to eq 1
+ end
+ end
+
+ describe 'truncation' do
+ let(:big_object) { double(question: 'Long' * 1024) }
+ let(:row_size) { big_object.question.length * 2 }
+ let(:items) { [big_object, big_object, big_object] }
+
+ it 'occurs after given number of bytes' do
+ expect(subject.render(row_size * 2).length).to be_between(row_size * 2, row_size * 3)
+ expect(subject).to be_truncated
+ expect(subject.rows_written).to eq 2
+ end
+
+ it 'is ignored by default' do
+ expect(subject.render.length).to be > row_size * 3
+ expect(subject.rows_written).to eq 3
+ end
+
+ it 'causes rows_expected to fall back to .count' do
+ subject.render(0)
+
+ expect(enumerable).to receive(:count).and_call_original
+ expect(subject.rows_expected).to eq 3
+ end
+ end
+
+ it 'avoids loading all data in a single query' do
+ expect(enumerable).to receive(:find_each)
+
+ subject.render
+ end
+
+ it 'uses hash keys as headers' do
+ expect(csv_data).to start_with 'Q & A'
+ end
+
+ it 'gets data by calling method provided as hash value' do
+ expect(csv_data).to include 'answer'
+ end
+
+ it 'allows lamdas to look up more complicated data' do
+ expect(csv_data).to include 'rewsna'
+ end
+
+ describe 'excel sanitization' do
+ let(:dangerous_title) { double(title: "=cmd|' /C calc'!A0 title", description: "*safe_desc") }
+ let(:dangerous_desc) { double(title: "*safe_title", description: "=cmd|' /C calc'!A0 desc") }
+ let(:items) { [dangerous_title, dangerous_desc] }
+ let(:subject) { described_class.new(enumerable, 'Title' => 'title', 'Description' => 'description') }
+ let(:csv_data) { subject.render }
+
+ it 'sanitizes dangerous characters at the beginning of a column' do
+ expect(csv_data).to include "'=cmd|' /C calc'!A0 title"
+ expect(csv_data).to include "'=cmd|' /C calc'!A0 desc"
+ end
+
+ it 'does not sanitize safe symbols at the beginning of a column' do
+ expect(csv_data).not_to include "'*safe_desc"
+ expect(csv_data).not_to include "'*safe_title"
+ end
+
+ context 'when dangerous characters are after a line break' do
+ let(:items) { [double(title: "Safe title", description: "With task list\n-[x] todo 1")] }
+
+ it 'does not append single quote to description' do
+ builder = described_class.new(enumerable, 'Title' => 'title', 'Description' => 'description')
+
+ csv_data = builder.render
+
+ expect(csv_data).to eq("Title,Description\nSafe title,\"With task list\n-[x] todo 1\"\n")
+ end
+ end
+ end
+ end
+
+ context 'when ActiveRecord::Relation like object is given' do
+ let(:enumerable) { described_class::FakeRelation.new(items) }
+
+ before do
+ stub_const("#{described_class}::FakeRelation", Array)
+
+ described_class::FakeRelation.class_eval do
+ def find_each(&block)
+ each(&block)
+ end
+ end
+ end
+
+ it_behaves_like 'csv builder examples'
+ end
+
+ context 'when Enumerable like object is given' do
+ let(:enumerable) { items }
+
+ it_behaves_like 'csv builder examples'
+ end
+end
diff --git a/gems/csv_builder/spec/spec_helper.rb b/gems/csv_builder/spec/spec_helper.rb
new file mode 100644
index 00000000000..eb21c2271f6
--- /dev/null
+++ b/gems/csv_builder/spec/spec_helper.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require "csv_builder"
+
+RSpec.configure do |config|
+ # Enable flags like --only-failures and --next-failure
+ config.example_status_persistence_file_path = ".rspec_status"
+
+ # Disable RSpec exposing methods globally on `Module` and `main`
+ config.disable_monkey_patching!
+
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ end
+end
diff --git a/gems/error_tracking_open_api/.gitignore b/gems/error_tracking_open_api/.gitignore
new file mode 100644
index 00000000000..05a17cb8f0a
--- /dev/null
+++ b/gems/error_tracking_open_api/.gitignore
@@ -0,0 +1,39 @@
+# Generated by: https://openapi-generator.tech
+#
+
+*.gem
+*.rbc
+/.config
+/coverage/
+/InstalledFiles
+/pkg/
+/spec/reports/
+/spec/examples.txt
+/test/tmp/
+/test/version_tmp/
+/tmp/
+
+## Specific to RubyMotion:
+.dat*
+.repl_history
+build/
+
+## Documentation cache and generated files:
+/.yardoc/
+/_yardoc/
+/doc/
+/rdoc/
+
+## Environment normalization:
+/.bundle/
+/vendor/bundle
+/lib/bundler/man/
+
+# for a library or gem, you might want to ignore these files since the code is
+# intended to run in multiple environments; otherwise, check them in:
+# Gemfile.lock
+# .ruby-version
+# .ruby-gemset
+
+# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
+.rvmrc
diff --git a/gems/error_tracking_open_api/.openapi-generator-ignore b/gems/error_tracking_open_api/.openapi-generator-ignore
new file mode 100644
index 00000000000..7484ee590a3
--- /dev/null
+++ b/gems/error_tracking_open_api/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/gems/error_tracking_open_api/.openapi-generator/FILES b/gems/error_tracking_open_api/.openapi-generator/FILES
new file mode 100644
index 00000000000..dac42207e8b
--- /dev/null
+++ b/gems/error_tracking_open_api/.openapi-generator/FILES
@@ -0,0 +1,60 @@
+.gitignore
+.openapi-generator-ignore
+.rspec
+.rubocop.yml
+.travis.yml
+Gemfile
+README.md
+Rakefile
+docs/Error.md
+docs/ErrorEvent.md
+docs/ErrorStats.md
+docs/ErrorUpdatePayload.md
+docs/ErrorV2.md
+docs/ErrorsApi.md
+docs/ErrorsV2Api.md
+docs/EventsApi.md
+docs/MessageEvent.md
+docs/MessagesApi.md
+docs/Project.md
+docs/ProjectsApi.md
+docs/StatsObject.md
+docs/StatsObjectGroupInner.md
+error_tracking_open_api.gemspec
+git_push.sh
+lib/error_tracking_open_api.rb
+lib/error_tracking_open_api/api/errors_api.rb
+lib/error_tracking_open_api/api/errors_v2_api.rb
+lib/error_tracking_open_api/api/events_api.rb
+lib/error_tracking_open_api/api/messages_api.rb
+lib/error_tracking_open_api/api/projects_api.rb
+lib/error_tracking_open_api/api_client.rb
+lib/error_tracking_open_api/api_error.rb
+lib/error_tracking_open_api/configuration.rb
+lib/error_tracking_open_api/models/error.rb
+lib/error_tracking_open_api/models/error_event.rb
+lib/error_tracking_open_api/models/error_stats.rb
+lib/error_tracking_open_api/models/error_update_payload.rb
+lib/error_tracking_open_api/models/error_v2.rb
+lib/error_tracking_open_api/models/message_event.rb
+lib/error_tracking_open_api/models/project.rb
+lib/error_tracking_open_api/models/stats_object.rb
+lib/error_tracking_open_api/models/stats_object_group_inner.rb
+lib/error_tracking_open_api/version.rb
+spec/api/errors_api_spec.rb
+spec/api/errors_v2_api_spec.rb
+spec/api/events_api_spec.rb
+spec/api/messages_api_spec.rb
+spec/api/projects_api_spec.rb
+spec/api_client_spec.rb
+spec/configuration_spec.rb
+spec/models/error_event_spec.rb
+spec/models/error_spec.rb
+spec/models/error_stats_spec.rb
+spec/models/error_update_payload_spec.rb
+spec/models/error_v2_spec.rb
+spec/models/message_event_spec.rb
+spec/models/project_spec.rb
+spec/models/stats_object_group_inner_spec.rb
+spec/models/stats_object_spec.rb
+spec/spec_helper.rb
diff --git a/gems/error_tracking_open_api/.openapi-generator/VERSION b/gems/error_tracking_open_api/.openapi-generator/VERSION
new file mode 100644
index 00000000000..f4965a313a2
--- /dev/null
+++ b/gems/error_tracking_open_api/.openapi-generator/VERSION
@@ -0,0 +1 @@
+6.0.0 \ No newline at end of file
diff --git a/gems/error_tracking_open_api/LICENSE b/gems/error_tracking_open_api/LICENSE
new file mode 100644
index 00000000000..6ea83cb3a5d
--- /dev/null
+++ b/gems/error_tracking_open_api/LICENSE
@@ -0,0 +1,7 @@
+Copyright 2022-2023 GitLab B.V.
+
+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/gems/error_tracking_open_api/README.md b/gems/error_tracking_open_api/README.md
new file mode 100644
index 00000000000..2b5d66e59c1
--- /dev/null
+++ b/gems/error_tracking_open_api/README.md
@@ -0,0 +1,127 @@
+# Generated by `rake gems:error_tracking_open_api:generate` on 2023-07-13
+
+See https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/development/rake_tasks.md#update-openapi-client-for-error-tracking-feature
+
+# error_tracking_open_api
+
+ErrorTrackingOpenAPI - the Ruby gem for the Error Tracking REST API
+
+This schema describes the API endpoints for the error tracking feature
+
+This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
+
+- API version: 0.0.1
+- Package version: 1.0.0
+- Build package: org.openapitools.codegen.languages.RubyClientCodegen
+
+## Installation
+
+### Build a gem
+
+To build the Ruby code into a gem:
+
+```shell
+gem build error_tracking_open_api.gemspec
+```
+
+Then either install the gem locally:
+
+```shell
+gem install ./error_tracking_open_api-1.0.0.gem
+```
+
+(for development, run `gem install --dev ./error_tracking_open_api-1.0.0.gem` to install the development dependencies)
+
+or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
+
+Finally add this to the Gemfile:
+
+ gem 'error_tracking_open_api', '~> 1.0.0'
+
+### Install from Git
+
+If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
+
+ gem 'error_tracking_open_api', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
+
+### Include the Ruby code directly
+
+Include the Ruby code directly using `-I` as follows:
+
+```shell
+ruby -Ilib script.rb
+```
+
+## Getting Started
+
+Please follow the [installation](#installation) procedure and then run the following code:
+
+```ruby
+# Load the gem
+require 'error_tracking_open_api'
+
+# Setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ErrorsApi.new
+project_id = 56 # Integer | ID of the project where the error was created
+fingerprint = 56 # Integer | ID of the error that needs to be updated deleted
+
+begin
+ #Get information about the error
+ result = api_instance.get_error(project_id, fingerprint)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Exception when calling ErrorsApi->get_error: #{e}"
+end
+
+```
+
+## Documentation for API Endpoints
+
+All URIs are relative to *https://localhost/errortracking/api/v1*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*ErrorTrackingOpenAPI::ErrorsApi* | [**get_error**](docs/ErrorsApi.md#get_error) | **GET** /projects/{projectId}/errors/{fingerprint} | Get information about the error
+*ErrorTrackingOpenAPI::ErrorsApi* | [**list_errors**](docs/ErrorsApi.md#list_errors) | **GET** /projects/{projectId}/errors | List of errors
+*ErrorTrackingOpenAPI::ErrorsApi* | [**list_events**](docs/ErrorsApi.md#list_events) | **GET** /projects/{projectId}/errors/{fingerprint}/events | Get information about the events related to the error
+*ErrorTrackingOpenAPI::ErrorsApi* | [**update_error**](docs/ErrorsApi.md#update_error) | **PUT** /projects/{projectId}/errors/{fingerprint} | Update the status of the error
+*ErrorTrackingOpenAPI::ErrorsV2Api* | [**get_stats_v2**](docs/ErrorsV2Api.md#get_stats_v2) | **GET** /api/0/organizations/{groupId}/stats_v2 | Stats of events received for the group
+*ErrorTrackingOpenAPI::ErrorsV2Api* | [**list_errors_v2**](docs/ErrorsV2Api.md#list_errors_v2) | **GET** /api/0/organizations/{groupId}/issues/ | List of errors(V2)
+*ErrorTrackingOpenAPI::ErrorsV2Api* | [**list_projects**](docs/ErrorsV2Api.md#list_projects) | **GET** /api/0/organizations/{groupId}/projects/ | List of projects
+*ErrorTrackingOpenAPI::EventsApi* | [**list_events**](docs/EventsApi.md#list_events) | **GET** /projects/{projectId}/errors/{fingerprint}/events | Get information about the events related to the error
+*ErrorTrackingOpenAPI::EventsApi* | [**projects_api_project_id_envelope_post**](docs/EventsApi.md#projects_api_project_id_envelope_post) | **POST** /projects/api/{projectId}/envelope | Ingestion endpoint for error events sent from client SDKs
+*ErrorTrackingOpenAPI::EventsApi* | [**projects_api_project_id_store_post**](docs/EventsApi.md#projects_api_project_id_store_post) | **POST** /projects/api/{projectId}/store | Ingestion endpoint for error events sent from client SDKs
+*ErrorTrackingOpenAPI::MessagesApi* | [**list_messages**](docs/MessagesApi.md#list_messages) | **GET** /projects/{projectId}/messages | List of messages
+*ErrorTrackingOpenAPI::ProjectsApi* | [**delete_project**](docs/ProjectsApi.md#delete_project) | **DELETE** /projects/{id} | Deletes all project related data. Mostly for testing purposes and later for production to clean updeleted projects.
+
+
+## Documentation for Models
+
+ - [ErrorTrackingOpenAPI::Error](docs/Error.md)
+ - [ErrorTrackingOpenAPI::ErrorEvent](docs/ErrorEvent.md)
+ - [ErrorTrackingOpenAPI::ErrorStats](docs/ErrorStats.md)
+ - [ErrorTrackingOpenAPI::ErrorUpdatePayload](docs/ErrorUpdatePayload.md)
+ - [ErrorTrackingOpenAPI::ErrorV2](docs/ErrorV2.md)
+ - [ErrorTrackingOpenAPI::MessageEvent](docs/MessageEvent.md)
+ - [ErrorTrackingOpenAPI::Project](docs/Project.md)
+ - [ErrorTrackingOpenAPI::StatsObject](docs/StatsObject.md)
+ - [ErrorTrackingOpenAPI::StatsObjectGroupInner](docs/StatsObjectGroupInner.md)
+
+
+## Documentation for Authorization
+
+
+### internalToken
+
+
+- **Type**: API key
+- **API key parameter name**: Gitlab-Error-Tracking-Token
+- **Location**: HTTP header
+
diff --git a/gems/error_tracking_open_api/Rakefile b/gems/error_tracking_open_api/Rakefile
new file mode 100644
index 00000000000..c72ca30d454
--- /dev/null
+++ b/gems/error_tracking_open_api/Rakefile
@@ -0,0 +1,10 @@
+require "bundler/gem_tasks"
+
+begin
+ require 'rspec/core/rake_task'
+
+ RSpec::Core::RakeTask.new(:spec)
+ task default: :spec
+rescue LoadError
+ # no rspec available
+end
diff --git a/gems/error_tracking_open_api/docs/Error.md b/gems/error_tracking_open_api/docs/Error.md
new file mode 100644
index 00000000000..55a013ebfb7
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/Error.md
@@ -0,0 +1,38 @@
+# ErrorTrackingOpenAPI::Error
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **fingerprint** | **Integer** | | [optional] |
+| **project_id** | **Integer** | | [optional] |
+| **name** | **String** | | [optional] |
+| **description** | **String** | | [optional] |
+| **actor** | **String** | | [optional] |
+| **event_count** | **Integer** | | [optional] |
+| **approximated_user_count** | **Integer** | | [optional] |
+| **last_seen_at** | **Time** | | [optional] |
+| **first_seen_at** | **Time** | | [optional] |
+| **status** | **String** | Status of the error | [optional] |
+| **stats** | [**ErrorStats**](ErrorStats.md) | | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::Error.new(
+ fingerprint: null,
+ project_id: null,
+ name: ActionView::MissingTemplate,
+ description: Missing template posts/edit,
+ actor: PostsController#edit,
+ event_count: null,
+ approximated_user_count: null,
+ last_seen_at: null,
+ first_seen_at: null,
+ status: null,
+ stats: null
+)
+```
+
diff --git a/gems/error_tracking_open_api/docs/ErrorEvent.md b/gems/error_tracking_open_api/docs/ErrorEvent.md
new file mode 100644
index 00000000000..205b7b57cc9
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/ErrorEvent.md
@@ -0,0 +1,32 @@
+# ErrorTrackingOpenAPI::ErrorEvent
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **fingerprint** | **Integer** | | [optional] |
+| **project_id** | **Integer** | | [optional] |
+| **payload** | **String** | JSON encoded string | [optional] |
+| **name** | **String** | | [optional] |
+| **description** | **String** | | [optional] |
+| **actor** | **String** | | [optional] |
+| **environment** | **String** | | [optional] |
+| **platform** | **String** | | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::ErrorEvent.new(
+ fingerprint: null,
+ project_id: null,
+ payload: null,
+ name: ActionView::MissingTemplate,
+ description: Missing template posts/edit,
+ actor: PostsController#edit,
+ environment: production,
+ platform: ruby
+)
+```
+
diff --git a/gems/error_tracking_open_api/docs/ErrorStats.md b/gems/error_tracking_open_api/docs/ErrorStats.md
new file mode 100644
index 00000000000..3b8ab24b54b
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/ErrorStats.md
@@ -0,0 +1,18 @@
+# ErrorTrackingOpenAPI::ErrorStats
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **frequency** | **Object** | | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::ErrorStats.new(
+ frequency: null
+)
+```
+
diff --git a/gems/error_tracking_open_api/docs/ErrorUpdatePayload.md b/gems/error_tracking_open_api/docs/ErrorUpdatePayload.md
new file mode 100644
index 00000000000..8a6180f835e
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/ErrorUpdatePayload.md
@@ -0,0 +1,20 @@
+# ErrorTrackingOpenAPI::ErrorUpdatePayload
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **status** | **String** | Status of the error | [optional] |
+| **updated_by_id** | **Integer** | GitLab user id who triggered the update | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::ErrorUpdatePayload.new(
+ status: null,
+ updated_by_id: null
+)
+```
+
diff --git a/gems/error_tracking_open_api/docs/ErrorV2.md b/gems/error_tracking_open_api/docs/ErrorV2.md
new file mode 100644
index 00000000000..77aa58e601c
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/ErrorV2.md
@@ -0,0 +1,34 @@
+# ErrorTrackingOpenAPI::ErrorV2
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **id** | **String** | | [optional] |
+| **project** | [**Project**](Project.md) | | [optional] |
+| **title** | **String** | | [optional] |
+| **actor** | **String** | | [optional] |
+| **count** | **String** | | [optional] |
+| **user_count** | **Integer** | | [optional] |
+| **last_seen** | **Time** | | [optional] |
+| **first_seen** | **Time** | | [optional] |
+| **status** | **String** | Status of the error | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::ErrorV2.new(
+ id: null,
+ project: null,
+ title: ActionView::MissingTemplate,
+ actor: PostsController#edit,
+ count: null,
+ user_count: null,
+ last_seen: null,
+ first_seen: null,
+ status: null
+)
+```
+
diff --git a/gems/error_tracking_open_api/docs/ErrorsApi.md b/gems/error_tracking_open_api/docs/ErrorsApi.md
new file mode 100644
index 00000000000..fc7f35e8d03
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/ErrorsApi.md
@@ -0,0 +1,319 @@
+# ErrorTrackingOpenAPI::ErrorsApi
+
+All URIs are relative to *https://localhost/errortracking/api/v1*
+
+| Method | HTTP request | Description |
+| ------ | ------------ | ----------- |
+| [**get_error**](ErrorsApi.md#get_error) | **GET** /projects/{projectId}/errors/{fingerprint} | Get information about the error |
+| [**list_errors**](ErrorsApi.md#list_errors) | **GET** /projects/{projectId}/errors | List of errors |
+| [**list_events**](ErrorsApi.md#list_events) | **GET** /projects/{projectId}/errors/{fingerprint}/events | Get information about the events related to the error |
+| [**update_error**](ErrorsApi.md#update_error) | **PUT** /projects/{projectId}/errors/{fingerprint} | Update the status of the error |
+
+
+## get_error
+
+> <Error> get_error(project_id, fingerprint)
+
+Get information about the error
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ErrorsApi.new
+project_id = 56 # Integer | ID of the project where the error was created
+fingerprint = 56 # Integer | ID of the error that needs to be updated deleted
+
+begin
+ # Get information about the error
+ result = api_instance.get_error(project_id, fingerprint)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsApi->get_error: #{e}"
+end
+```
+
+#### Using the get_error_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Error>, Integer, Hash)> get_error_with_http_info(project_id, fingerprint)
+
+```ruby
+begin
+ # Get information about the error
+ data, status_code, headers = api_instance.get_error_with_http_info(project_id, fingerprint)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Error>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsApi->get_error_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | ID of the project where the error was created | |
+| **fingerprint** | **Integer** | ID of the error that needs to be updated deleted | |
+
+### Return type
+
+[**Error**](Error.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+
+## list_errors
+
+> <Array<Error>> list_errors(project_id, opts)
+
+List of errors
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ErrorsApi.new
+project_id = 56 # Integer | ID of the project where the error was created
+opts = {
+ sort: 'last_seen_desc', # String |
+ status: 'unresolved', # String |
+ query: 'query_example', # String |
+ cursor: 'cursor_example', # String | Base64 encoded information for pagination
+ limit: 56, # Integer | Number of entries to return
+ stats_period: '15m', # String |
+ query_period: '15m' # String |
+}
+
+begin
+ # List of errors
+ result = api_instance.list_errors(project_id, opts)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsApi->list_errors: #{e}"
+end
+```
+
+#### Using the list_errors_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Array<Error>>, Integer, Hash)> list_errors_with_http_info(project_id, opts)
+
+```ruby
+begin
+ # List of errors
+ data, status_code, headers = api_instance.list_errors_with_http_info(project_id, opts)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Array<Error>>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsApi->list_errors_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | ID of the project where the error was created | |
+| **sort** | **String** | | [optional][default to &#39;last_seen_desc&#39;] |
+| **status** | **String** | | [optional][default to &#39;unresolved&#39;] |
+| **query** | **String** | | [optional] |
+| **cursor** | **String** | Base64 encoded information for pagination | [optional] |
+| **limit** | **Integer** | Number of entries to return | [optional][default to 20] |
+| **stats_period** | **String** | | [optional][default to &#39;24h&#39;] |
+| **query_period** | **String** | | [optional][default to &#39;30d&#39;] |
+
+### Return type
+
+[**Array&lt;Error&gt;**](Error.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+
+## list_events
+
+> <Array<ErrorEvent>> list_events(project_id, fingerprint, opts)
+
+Get information about the events related to the error
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ErrorsApi.new
+project_id = 56 # Integer | ID of the project where the error was created
+fingerprint = 56 # Integer | ID of the error within the project
+opts = {
+ sort: 'occurred_at_asc', # String |
+ cursor: 'cursor_example', # String | Base64 encoded information for pagination
+ limit: 56 # Integer | Number of entries to return
+}
+
+begin
+ # Get information about the events related to the error
+ result = api_instance.list_events(project_id, fingerprint, opts)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsApi->list_events: #{e}"
+end
+```
+
+#### Using the list_events_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Array<ErrorEvent>>, Integer, Hash)> list_events_with_http_info(project_id, fingerprint, opts)
+
+```ruby
+begin
+ # Get information about the events related to the error
+ data, status_code, headers = api_instance.list_events_with_http_info(project_id, fingerprint, opts)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Array<ErrorEvent>>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsApi->list_events_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | ID of the project where the error was created | |
+| **fingerprint** | **Integer** | ID of the error within the project | |
+| **sort** | **String** | | [optional][default to &#39;occurred_at_asc&#39;] |
+| **cursor** | **String** | Base64 encoded information for pagination | [optional] |
+| **limit** | **Integer** | Number of entries to return | [optional][default to 20] |
+
+### Return type
+
+[**Array&lt;ErrorEvent&gt;**](ErrorEvent.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+
+## update_error
+
+> <Error> update_error(project_id, fingerprint, body)
+
+Update the status of the error
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ErrorsApi.new
+project_id = 56 # Integer | ID of the project where the error was created
+fingerprint = 56 # Integer | ID of the error that needs to be updated deleted
+body = ErrorTrackingOpenAPI::ErrorUpdatePayload.new # ErrorUpdatePayload | Error update object with the new values
+
+begin
+ # Update the status of the error
+ result = api_instance.update_error(project_id, fingerprint, body)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsApi->update_error: #{e}"
+end
+```
+
+#### Using the update_error_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Error>, Integer, Hash)> update_error_with_http_info(project_id, fingerprint, body)
+
+```ruby
+begin
+ # Update the status of the error
+ data, status_code, headers = api_instance.update_error_with_http_info(project_id, fingerprint, body)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Error>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsApi->update_error_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | ID of the project where the error was created | |
+| **fingerprint** | **Integer** | ID of the error that needs to be updated deleted | |
+| **body** | [**ErrorUpdatePayload**](ErrorUpdatePayload.md) | Error update object with the new values | |
+
+### Return type
+
+[**Error**](Error.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
diff --git a/gems/error_tracking_open_api/docs/ErrorsV2Api.md b/gems/error_tracking_open_api/docs/ErrorsV2Api.md
new file mode 100644
index 00000000000..23f3e43bdf8
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/ErrorsV2Api.md
@@ -0,0 +1,235 @@
+# ErrorTrackingOpenAPI::ErrorsV2Api
+
+All URIs are relative to *https://localhost/errortracking/api/v1*
+
+| Method | HTTP request | Description |
+| ------ | ------------ | ----------- |
+| [**get_stats_v2**](ErrorsV2Api.md#get_stats_v2) | **GET** /api/0/organizations/{groupId}/stats_v2 | Stats of events received for the group |
+| [**list_errors_v2**](ErrorsV2Api.md#list_errors_v2) | **GET** /api/0/organizations/{groupId}/issues/ | List of errors(V2) |
+| [**list_projects**](ErrorsV2Api.md#list_projects) | **GET** /api/0/organizations/{groupId}/projects/ | List of projects |
+
+
+## get_stats_v2
+
+> <Array<StatsObject>> get_stats_v2(group_id)
+
+Stats of events received for the group
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ErrorsV2Api.new
+group_id = 56 # Integer | ID of the group
+
+begin
+ # Stats of events received for the group
+ result = api_instance.get_stats_v2(group_id)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsV2Api->get_stats_v2: #{e}"
+end
+```
+
+#### Using the get_stats_v2_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Array<StatsObject>>, Integer, Hash)> get_stats_v2_with_http_info(group_id)
+
+```ruby
+begin
+ # Stats of events received for the group
+ data, status_code, headers = api_instance.get_stats_v2_with_http_info(group_id)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Array<StatsObject>>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsV2Api->get_stats_v2_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **group_id** | **Integer** | ID of the group | |
+
+### Return type
+
+[**Array&lt;StatsObject&gt;**](StatsObject.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+
+## list_errors_v2
+
+> <Array<ErrorV2>> list_errors_v2(project, group_id, opts)
+
+List of errors(V2)
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ErrorsV2Api.new
+project = [37] # Array<Integer> | ID of the project where the error was created
+group_id = 56 # Integer | ID of the group
+opts = {
+ status: 'unresolved', # String |
+ query: 'query_example', # String |
+ start: 'start_example', # String | Optional start of the stat period in format 2006-01-02T15:04:05
+ _end: '_end_example', # String | Optional end of the stat period in format 2006-01-02T15:04:05
+ environment: 'environment_example', # String |
+ limit: 56, # Integer | Number of entries to return
+ sort: 'date' # String | Optional sorting column of the entries
+}
+
+begin
+ # List of errors(V2)
+ result = api_instance.list_errors_v2(project, group_id, opts)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsV2Api->list_errors_v2: #{e}"
+end
+```
+
+#### Using the list_errors_v2_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Array<ErrorV2>>, Integer, Hash)> list_errors_v2_with_http_info(project, group_id, opts)
+
+```ruby
+begin
+ # List of errors(V2)
+ data, status_code, headers = api_instance.list_errors_v2_with_http_info(project, group_id, opts)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Array<ErrorV2>>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsV2Api->list_errors_v2_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project** | [**Array&lt;Integer&gt;**](Integer.md) | ID of the project where the error was created | |
+| **group_id** | **Integer** | ID of the group | |
+| **status** | **String** | | [optional][default to &#39;unresolved&#39;] |
+| **query** | **String** | | [optional] |
+| **start** | **String** | Optional start of the stat period in format 2006-01-02T15:04:05 | [optional] |
+| **_end** | **String** | Optional end of the stat period in format 2006-01-02T15:04:05 | [optional] |
+| **environment** | **String** | | [optional] |
+| **limit** | **Integer** | Number of entries to return | [optional][default to 20] |
+| **sort** | **String** | Optional sorting column of the entries | [optional][default to &#39;date&#39;] |
+
+### Return type
+
+[**Array&lt;ErrorV2&gt;**](ErrorV2.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+
+## list_projects
+
+> <Array<Project>> list_projects(group_id)
+
+List of projects
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ErrorsV2Api.new
+group_id = 56 # Integer | ID of the group
+
+begin
+ # List of projects
+ result = api_instance.list_projects(group_id)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsV2Api->list_projects: #{e}"
+end
+```
+
+#### Using the list_projects_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Array<Project>>, Integer, Hash)> list_projects_with_http_info(group_id)
+
+```ruby
+begin
+ # List of projects
+ data, status_code, headers = api_instance.list_projects_with_http_info(group_id)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Array<Project>>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ErrorsV2Api->list_projects_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **group_id** | **Integer** | ID of the group | |
+
+### Return type
+
+[**Array&lt;Project&gt;**](Project.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
diff --git a/gems/error_tracking_open_api/docs/EventsApi.md b/gems/error_tracking_open_api/docs/EventsApi.md
new file mode 100644
index 00000000000..a9882fac515
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/EventsApi.md
@@ -0,0 +1,227 @@
+# ErrorTrackingOpenAPI::EventsApi
+
+All URIs are relative to *https://localhost/errortracking/api/v1*
+
+| Method | HTTP request | Description |
+| ------ | ------------ | ----------- |
+| [**list_events**](EventsApi.md#list_events) | **GET** /projects/{projectId}/errors/{fingerprint}/events | Get information about the events related to the error |
+| [**projects_api_project_id_envelope_post**](EventsApi.md#projects_api_project_id_envelope_post) | **POST** /projects/api/{projectId}/envelope | Ingestion endpoint for error events sent from client SDKs |
+| [**projects_api_project_id_store_post**](EventsApi.md#projects_api_project_id_store_post) | **POST** /projects/api/{projectId}/store | Ingestion endpoint for error events sent from client SDKs |
+
+
+## list_events
+
+> <Array<ErrorEvent>> list_events(project_id, fingerprint, opts)
+
+Get information about the events related to the error
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::EventsApi.new
+project_id = 56 # Integer | ID of the project where the error was created
+fingerprint = 56 # Integer | ID of the error within the project
+opts = {
+ sort: 'occurred_at_asc', # String |
+ cursor: 'cursor_example', # String | Base64 encoded information for pagination
+ limit: 56 # Integer | Number of entries to return
+}
+
+begin
+ # Get information about the events related to the error
+ result = api_instance.list_events(project_id, fingerprint, opts)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling EventsApi->list_events: #{e}"
+end
+```
+
+#### Using the list_events_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Array<ErrorEvent>>, Integer, Hash)> list_events_with_http_info(project_id, fingerprint, opts)
+
+```ruby
+begin
+ # Get information about the events related to the error
+ data, status_code, headers = api_instance.list_events_with_http_info(project_id, fingerprint, opts)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Array<ErrorEvent>>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling EventsApi->list_events_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | ID of the project where the error was created | |
+| **fingerprint** | **Integer** | ID of the error within the project | |
+| **sort** | **String** | | [optional][default to &#39;occurred_at_asc&#39;] |
+| **cursor** | **String** | Base64 encoded information for pagination | [optional] |
+| **limit** | **Integer** | Number of entries to return | [optional][default to 20] |
+
+### Return type
+
+[**Array&lt;ErrorEvent&gt;**](ErrorEvent.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+
+## projects_api_project_id_envelope_post
+
+> <ErrorEvent> projects_api_project_id_envelope_post(project_id)
+
+Ingestion endpoint for error events sent from client SDKs
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::EventsApi.new
+project_id = 56 # Integer | ID of the project where the error was created
+
+begin
+ # Ingestion endpoint for error events sent from client SDKs
+ result = api_instance.projects_api_project_id_envelope_post(project_id)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling EventsApi->projects_api_project_id_envelope_post: #{e}"
+end
+```
+
+#### Using the projects_api_project_id_envelope_post_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<ErrorEvent>, Integer, Hash)> projects_api_project_id_envelope_post_with_http_info(project_id)
+
+```ruby
+begin
+ # Ingestion endpoint for error events sent from client SDKs
+ data, status_code, headers = api_instance.projects_api_project_id_envelope_post_with_http_info(project_id)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <ErrorEvent>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling EventsApi->projects_api_project_id_envelope_post_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | ID of the project where the error was created | |
+
+### Return type
+
+[**ErrorEvent**](ErrorEvent.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
+
+## projects_api_project_id_store_post
+
+> <ErrorEvent> projects_api_project_id_store_post(project_id)
+
+Ingestion endpoint for error events sent from client SDKs
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::EventsApi.new
+project_id = 56 # Integer | ID of the project where the error was created
+
+begin
+ # Ingestion endpoint for error events sent from client SDKs
+ result = api_instance.projects_api_project_id_store_post(project_id)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling EventsApi->projects_api_project_id_store_post: #{e}"
+end
+```
+
+#### Using the projects_api_project_id_store_post_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<ErrorEvent>, Integer, Hash)> projects_api_project_id_store_post_with_http_info(project_id)
+
+```ruby
+begin
+ # Ingestion endpoint for error events sent from client SDKs
+ data, status_code, headers = api_instance.projects_api_project_id_store_post_with_http_info(project_id)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <ErrorEvent>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling EventsApi->projects_api_project_id_store_post_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | ID of the project where the error was created | |
+
+### Return type
+
+[**ErrorEvent**](ErrorEvent.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
diff --git a/gems/error_tracking_open_api/docs/MessageEvent.md b/gems/error_tracking_open_api/docs/MessageEvent.md
new file mode 100644
index 00000000000..d96974b150e
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/MessageEvent.md
@@ -0,0 +1,32 @@
+# ErrorTrackingOpenAPI::MessageEvent
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | | [optional] |
+| **event_id** | **String** | | [optional] |
+| **timestamp** | **Time** | | [optional] |
+| **level** | **String** | | [optional] |
+| **message** | **String** | | [optional] |
+| **release** | **String** | | [optional] |
+| **environment** | **String** | | [optional] |
+| **platform** | **String** | | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::MessageEvent.new(
+ project_id: null,
+ event_id: null,
+ timestamp: null,
+ level: info,
+ message: some message from the SDK,
+ release: v1.0.0,
+ environment: production,
+ platform: ruby
+)
+```
+
diff --git a/gems/error_tracking_open_api/docs/MessagesApi.md b/gems/error_tracking_open_api/docs/MessagesApi.md
new file mode 100644
index 00000000000..abaf2f9dbe6
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/MessagesApi.md
@@ -0,0 +1,81 @@
+# ErrorTrackingOpenAPI::MessagesApi
+
+All URIs are relative to *https://localhost/errortracking/api/v1*
+
+| Method | HTTP request | Description |
+| ------ | ------------ | ----------- |
+| [**list_messages**](MessagesApi.md#list_messages) | **GET** /projects/{projectId}/messages | List of messages |
+
+
+## list_messages
+
+> <Array<MessageEvent>> list_messages(project_id, opts)
+
+List of messages
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::MessagesApi.new
+project_id = 56 # Integer | ID of the project where the message was created
+opts = {
+ limit: 56 # Integer | Number of entries to return
+}
+
+begin
+ # List of messages
+ result = api_instance.list_messages(project_id, opts)
+ p result
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling MessagesApi->list_messages: #{e}"
+end
+```
+
+#### Using the list_messages_with_http_info variant
+
+This returns an Array which contains the response data, status code and headers.
+
+> <Array(<Array<MessageEvent>>, Integer, Hash)> list_messages_with_http_info(project_id, opts)
+
+```ruby
+begin
+ # List of messages
+ data, status_code, headers = api_instance.list_messages_with_http_info(project_id, opts)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => <Array<MessageEvent>>
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling MessagesApi->list_messages_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **project_id** | **Integer** | ID of the project where the message was created | |
+| **limit** | **Integer** | Number of entries to return | [optional][default to 20] |
+
+### Return type
+
+[**Array&lt;MessageEvent&gt;**](MessageEvent.md)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: */*
+
diff --git a/gems/error_tracking_open_api/docs/Project.md b/gems/error_tracking_open_api/docs/Project.md
new file mode 100644
index 00000000000..fbaeb7e6986
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/Project.md
@@ -0,0 +1,22 @@
+# ErrorTrackingOpenAPI::Project
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **id** | **String** | ID of the project | [optional] |
+| **name** | **String** | Name of the project | [optional] |
+| **slug** | **String** | Slug of the project | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::Project.new(
+ id: null,
+ name: null,
+ slug: null
+)
+```
+
diff --git a/gems/error_tracking_open_api/docs/ProjectsApi.md b/gems/error_tracking_open_api/docs/ProjectsApi.md
new file mode 100644
index 00000000000..adcb4a84ad9
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/ProjectsApi.md
@@ -0,0 +1,76 @@
+# ErrorTrackingOpenAPI::ProjectsApi
+
+All URIs are relative to *https://localhost/errortracking/api/v1*
+
+| Method | HTTP request | Description |
+| ------ | ------------ | ----------- |
+| [**delete_project**](ProjectsApi.md#delete_project) | **DELETE** /projects/{id} | Deletes all project related data. Mostly for testing purposes and later for production to clean updeleted projects. |
+
+
+## delete_project
+
+> delete_project(id)
+
+Deletes all project related data. Mostly for testing purposes and later for production to clean updeleted projects.
+
+### Examples
+
+```ruby
+require 'time'
+require 'error_tracking_open_api'
+# setup authorization
+ErrorTrackingOpenAPI.configure do |config|
+ # Configure API key authorization: internalToken
+ config.api_key['internalToken'] = 'YOUR API KEY'
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
+ # config.api_key_prefix['internalToken'] = 'Bearer'
+end
+
+api_instance = ErrorTrackingOpenAPI::ProjectsApi.new
+id = 56 # Integer | ID of the project
+
+begin
+ # Deletes all project related data. Mostly for testing purposes and later for production to clean updeleted projects.
+ api_instance.delete_project(id)
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ProjectsApi->delete_project: #{e}"
+end
+```
+
+#### Using the delete_project_with_http_info variant
+
+This returns an Array which contains the response data (`nil` in this case), status code and headers.
+
+> <Array(nil, Integer, Hash)> delete_project_with_http_info(id)
+
+```ruby
+begin
+ # Deletes all project related data. Mostly for testing purposes and later for production to clean updeleted projects.
+ data, status_code, headers = api_instance.delete_project_with_http_info(id)
+ p status_code # => 2xx
+ p headers # => { ... }
+ p data # => nil
+rescue ErrorTrackingOpenAPI::ApiError => e
+ puts "Error when calling ProjectsApi->delete_project_with_http_info: #{e}"
+end
+```
+
+### Parameters
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **id** | **Integer** | ID of the project | |
+
+### Return type
+
+nil (empty response body)
+
+### Authorization
+
+[internalToken](../README.md#internalToken)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: Not defined
+
diff --git a/gems/error_tracking_open_api/docs/StatsObject.md b/gems/error_tracking_open_api/docs/StatsObject.md
new file mode 100644
index 00000000000..ef3007aecd0
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/StatsObject.md
@@ -0,0 +1,24 @@
+# ErrorTrackingOpenAPI::StatsObject
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **start** | **String** | ID of the project | [optional] |
+| **_end** | **String** | Name of the project | [optional] |
+| **interval** | **Array&lt;String&gt;** | Slug of the project | [optional] |
+| **group** | [**Array&lt;StatsObjectGroupInner&gt;**](StatsObjectGroupInner.md) | | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::StatsObject.new(
+ start: null,
+ _end: null,
+ interval: null,
+ group: null
+)
+```
+
diff --git a/gems/error_tracking_open_api/docs/StatsObjectGroupInner.md b/gems/error_tracking_open_api/docs/StatsObjectGroupInner.md
new file mode 100644
index 00000000000..c72da9c6616
--- /dev/null
+++ b/gems/error_tracking_open_api/docs/StatsObjectGroupInner.md
@@ -0,0 +1,22 @@
+# ErrorTrackingOpenAPI::StatsObjectGroupInner
+
+## Properties
+
+| Name | Type | Description | Notes |
+| ---- | ---- | ----------- | ----- |
+| **by** | **Hash&lt;String, Object&gt;** | | [optional] |
+| **totals** | **Hash&lt;String, Object&gt;** | | [optional] |
+| **series** | **Hash&lt;String, Object&gt;** | | [optional] |
+
+## Example
+
+```ruby
+require 'error_tracking_open_api'
+
+instance = ErrorTrackingOpenAPI::StatsObjectGroupInner.new(
+ by: null,
+ totals: null,
+ series: null
+)
+```
+
diff --git a/gems/error_tracking_open_api/error_tracking_open_api.gemspec b/gems/error_tracking_open_api/error_tracking_open_api.gemspec
new file mode 100644
index 00000000000..405b5ae94c0
--- /dev/null
+++ b/gems/error_tracking_open_api/error_tracking_open_api.gemspec
@@ -0,0 +1,38 @@
+# -*- encoding: utf-8 -*-
+
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+$:.push File.expand_path("../lib", __FILE__)
+require "error_tracking_open_api/version"
+
+Gem::Specification.new do |s|
+ s.name = "error_tracking_open_api"
+ s.version = ErrorTrackingOpenAPI::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["OpenAPI-Generator"]
+ s.email = [""]
+ s.homepage = "https://openapi-generator.tech"
+ s.summary = "Error Tracking REST API Ruby Gem"
+ s.description = "This schema describes the API endpoints for the error tracking feature"
+ s.license = "MIT"
+ s.required_ruby_version = ">= 2.4"
+
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
+
+
+
+ s.files = Dir.glob("lib/**/*")
+ s.test_files = []
+ s.executables = []
+ s.require_paths = ["lib"]
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api.rb
new file mode 100644
index 00000000000..63ad3ce7194
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api.rb
@@ -0,0 +1,53 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+# Common files
+require 'error_tracking_open_api/api_client'
+require 'error_tracking_open_api/api_error'
+require 'error_tracking_open_api/version'
+require 'error_tracking_open_api/configuration'
+
+# Models
+require 'error_tracking_open_api/models/error'
+require 'error_tracking_open_api/models/error_event'
+require 'error_tracking_open_api/models/error_stats'
+require 'error_tracking_open_api/models/error_update_payload'
+require 'error_tracking_open_api/models/error_v2'
+require 'error_tracking_open_api/models/message_event'
+require 'error_tracking_open_api/models/project'
+require 'error_tracking_open_api/models/stats_object'
+require 'error_tracking_open_api/models/stats_object_group_inner'
+
+# APIs
+require 'error_tracking_open_api/api/errors_api'
+require 'error_tracking_open_api/api/errors_v2_api'
+require 'error_tracking_open_api/api/events_api'
+require 'error_tracking_open_api/api/messages_api'
+require 'error_tracking_open_api/api/projects_api'
+
+module ErrorTrackingOpenAPI
+ class << self
+ # Customize default settings for the SDK using block.
+ # ErrorTrackingOpenAPI.configure do |config|
+ # config.username = "xxx"
+ # config.password = "xxx"
+ # end
+ # If no block given, return the default Configuration object.
+ def configure
+ if block_given?
+ yield(Configuration.default)
+ else
+ Configuration.default
+ end
+ end
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_api.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_api.rb
new file mode 100644
index 00000000000..6b4aae416b3
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_api.rb
@@ -0,0 +1,361 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'cgi'
+
+module ErrorTrackingOpenAPI
+ class ErrorsApi
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Get information about the error
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param fingerprint [Integer] ID of the error that needs to be updated deleted
+ # @param [Hash] opts the optional parameters
+ # @return [Error]
+ def get_error(project_id, fingerprint, opts = {})
+ data, _status_code, _headers = get_error_with_http_info(project_id, fingerprint, opts)
+ data
+ end
+
+ # Get information about the error
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param fingerprint [Integer] ID of the error that needs to be updated deleted
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Error, Integer, Hash)>] Error data, response status code and response headers
+ def get_error_with_http_info(project_id, fingerprint, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ErrorsApi.get_error ...'
+ end
+ # verify the required parameter 'project_id' is set
+ if @api_client.config.client_side_validation && project_id.nil?
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ErrorsApi.get_error"
+ end
+ # verify the required parameter 'fingerprint' is set
+ if @api_client.config.client_side_validation && fingerprint.nil?
+ fail ArgumentError, "Missing the required parameter 'fingerprint' when calling ErrorsApi.get_error"
+ end
+ # resource path
+ local_var_path = '/projects/{projectId}/errors/{fingerprint}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'fingerprint' + '}', CGI.escape(fingerprint.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(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Error'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"ErrorsApi.get_error",
+ :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: ErrorsApi#get_error\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # List of errors
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :sort (default to 'last_seen_desc')
+ # @option opts [String] :status (default to 'unresolved')
+ # @option opts [String] :query
+ # @option opts [String] :cursor Base64 encoded information for pagination
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @option opts [String] :stats_period (default to '24h')
+ # @option opts [String] :query_period (default to '30d')
+ # @return [Array<Error>]
+ def list_errors(project_id, opts = {})
+ data, _status_code, _headers = list_errors_with_http_info(project_id, opts)
+ data
+ end
+
+ # List of errors
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :sort (default to 'last_seen_desc')
+ # @option opts [String] :status (default to 'unresolved')
+ # @option opts [String] :query
+ # @option opts [String] :cursor Base64 encoded information for pagination
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @option opts [String] :stats_period (default to '24h')
+ # @option opts [String] :query_period (default to '30d')
+ # @return [Array<(Array<Error>, Integer, Hash)>] Array<Error> data, response status code and response headers
+ def list_errors_with_http_info(project_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ErrorsApi.list_errors ...'
+ end
+ # verify the required parameter 'project_id' is set
+ if @api_client.config.client_side_validation && project_id.nil?
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ErrorsApi.list_errors"
+ end
+ allowable_values = ["last_seen_desc", "first_seen_desc", "frequency_desc"]
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
+ end
+ allowable_values = ["unresolved", "resolved", "ignored"]
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
+ end
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ErrorsApi.list_errors, must be smaller than or equal to 100.'
+ end
+
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ErrorsApi.list_errors, must be greater than or equal to 1.'
+ end
+
+ allowable_values = ["15m", "30m", "1h", "24h", "7d", "14d", "30d"]
+ if @api_client.config.client_side_validation && opts[:'stats_period'] && !allowable_values.include?(opts[:'stats_period'])
+ fail ArgumentError, "invalid value for \"stats_period\", must be one of #{allowable_values}"
+ end
+ allowable_values = ["15m", "30m", "1h", "1d", "7d", "14d", "30d"]
+ if @api_client.config.client_side_validation && opts[:'query_period'] && !allowable_values.include?(opts[:'query_period'])
+ fail ArgumentError, "invalid value for \"query_period\", must be one of #{allowable_values}"
+ end
+ # resource path
+ local_var_path = '/projects/{projectId}/errors'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
+ query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
+ query_params[:'statsPeriod'] = opts[:'stats_period'] if !opts[:'stats_period'].nil?
+ query_params[:'queryPeriod'] = opts[:'query_period'] if !opts[:'query_period'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Array<Error>'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"ErrorsApi.list_errors",
+ :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: ErrorsApi#list_errors\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Get information about the events related to the error
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param fingerprint [Integer] ID of the error within the project
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :sort (default to 'occurred_at_asc')
+ # @option opts [String] :cursor Base64 encoded information for pagination
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @return [Array<ErrorEvent>]
+ def list_events(project_id, fingerprint, opts = {})
+ data, _status_code, _headers = list_events_with_http_info(project_id, fingerprint, opts)
+ data
+ end
+
+ # Get information about the events related to the error
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param fingerprint [Integer] ID of the error within the project
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :sort (default to 'occurred_at_asc')
+ # @option opts [String] :cursor Base64 encoded information for pagination
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @return [Array<(Array<ErrorEvent>, Integer, Hash)>] Array<ErrorEvent> data, response status code and response headers
+ def list_events_with_http_info(project_id, fingerprint, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ErrorsApi.list_events ...'
+ end
+ # verify the required parameter 'project_id' is set
+ if @api_client.config.client_side_validation && project_id.nil?
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ErrorsApi.list_events"
+ end
+ # verify the required parameter 'fingerprint' is set
+ if @api_client.config.client_side_validation && fingerprint.nil?
+ fail ArgumentError, "Missing the required parameter 'fingerprint' when calling ErrorsApi.list_events"
+ end
+ allowable_values = ["occurred_at_asc", "occurred_at_desc"]
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
+ end
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ErrorsApi.list_events, must be smaller than or equal to 100.'
+ end
+
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ErrorsApi.list_events, must be greater than or equal to 1.'
+ end
+
+ # resource path
+ local_var_path = '/projects/{projectId}/errors/{fingerprint}/events'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'fingerprint' + '}', CGI.escape(fingerprint.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Array<ErrorEvent>'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"ErrorsApi.list_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(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ErrorsApi#list_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Update the status of the error
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param fingerprint [Integer] ID of the error that needs to be updated deleted
+ # @param body [ErrorUpdatePayload] Error update object with the new values
+ # @param [Hash] opts the optional parameters
+ # @return [Error]
+ def update_error(project_id, fingerprint, body, opts = {})
+ data, _status_code, _headers = update_error_with_http_info(project_id, fingerprint, body, opts)
+ data
+ end
+
+ # Update the status of the error
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param fingerprint [Integer] ID of the error that needs to be updated deleted
+ # @param body [ErrorUpdatePayload] Error update object with the new values
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Error, Integer, Hash)>] Error data, response status code and response headers
+ def update_error_with_http_info(project_id, fingerprint, body, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ErrorsApi.update_error ...'
+ end
+ # verify the required parameter 'project_id' is set
+ if @api_client.config.client_side_validation && project_id.nil?
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling ErrorsApi.update_error"
+ end
+ # verify the required parameter 'fingerprint' is set
+ if @api_client.config.client_side_validation && fingerprint.nil?
+ fail ArgumentError, "Missing the required parameter 'fingerprint' when calling ErrorsApi.update_error"
+ end
+ # verify the required parameter 'body' is set
+ if @api_client.config.client_side_validation && body.nil?
+ fail ArgumentError, "Missing the required parameter 'body' when calling ErrorsApi.update_error"
+ end
+ # resource path
+ local_var_path = '/projects/{projectId}/errors/{fingerprint}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'fingerprint' + '}', CGI.escape(fingerprint.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'])
+ # 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
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Error'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"ErrorsApi.update_error",
+ :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(:PUT, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ErrorsApi#update_error\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_v2_api.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_v2_api.rb
new file mode 100644
index 00000000000..e7ebfdbef99
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/errors_v2_api.rb
@@ -0,0 +1,249 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'cgi'
+
+module ErrorTrackingOpenAPI
+ class ErrorsV2Api
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Stats of events received for the group
+ # @param group_id [Integer] ID of the group
+ # @param [Hash] opts the optional parameters
+ # @return [Array<StatsObject>]
+ def get_stats_v2(group_id, opts = {})
+ data, _status_code, _headers = get_stats_v2_with_http_info(group_id, opts)
+ data
+ end
+
+ # Stats of events received for the group
+ # @param group_id [Integer] ID of the group
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Array<StatsObject>, Integer, Hash)>] Array<StatsObject> data, response status code and response headers
+ def get_stats_v2_with_http_info(group_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ErrorsV2Api.get_stats_v2 ...'
+ end
+ # verify the required parameter 'group_id' is set
+ if @api_client.config.client_side_validation && group_id.nil?
+ fail ArgumentError, "Missing the required parameter 'group_id' when calling ErrorsV2Api.get_stats_v2"
+ end
+ # resource path
+ local_var_path = '/api/0/organizations/{groupId}/stats_v2'.sub('{' + 'groupId' + '}', CGI.escape(group_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(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Array<StatsObject>'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"ErrorsV2Api.get_stats_v2",
+ :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: ErrorsV2Api#get_stats_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # List of errors(V2)
+ # @param project [Array<Integer>] ID of the project where the error was created
+ # @param group_id [Integer] ID of the group
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :status (default to 'unresolved')
+ # @option opts [String] :query
+ # @option opts [String] :start Optional start of the stat period in format 2006-01-02T15:04:05
+ # @option opts [String] :_end Optional end of the stat period in format 2006-01-02T15:04:05
+ # @option opts [String] :environment
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @option opts [String] :sort Optional sorting column of the entries (default to 'date')
+ # @return [Array<ErrorV2>]
+ def list_errors_v2(project, group_id, opts = {})
+ data, _status_code, _headers = list_errors_v2_with_http_info(project, group_id, opts)
+ data
+ end
+
+ # List of errors(V2)
+ # @param project [Array<Integer>] ID of the project where the error was created
+ # @param group_id [Integer] ID of the group
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :status (default to 'unresolved')
+ # @option opts [String] :query
+ # @option opts [String] :start Optional start of the stat period in format 2006-01-02T15:04:05
+ # @option opts [String] :_end Optional end of the stat period in format 2006-01-02T15:04:05
+ # @option opts [String] :environment
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @option opts [String] :sort Optional sorting column of the entries (default to 'date')
+ # @return [Array<(Array<ErrorV2>, Integer, Hash)>] Array<ErrorV2> data, response status code and response headers
+ def list_errors_v2_with_http_info(project, group_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ErrorsV2Api.list_errors_v2 ...'
+ end
+ # verify the required parameter 'project' is set
+ if @api_client.config.client_side_validation && project.nil?
+ fail ArgumentError, "Missing the required parameter 'project' when calling ErrorsV2Api.list_errors_v2"
+ end
+ # verify the required parameter 'group_id' is set
+ if @api_client.config.client_side_validation && group_id.nil?
+ fail ArgumentError, "Missing the required parameter 'group_id' when calling ErrorsV2Api.list_errors_v2"
+ end
+ allowable_values = ["unresolved", "resolved", "ignored"]
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
+ end
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 10000
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ErrorsV2Api.list_errors_v2, must be smaller than or equal to 10000.'
+ end
+
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling ErrorsV2Api.list_errors_v2, must be greater than or equal to 1.'
+ end
+
+ allowable_values = ["date", "new", "priority", "freq", "user"]
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
+ end
+ # resource path
+ local_var_path = '/api/0/organizations/{groupId}/issues/'.sub('{' + 'groupId' + '}', CGI.escape(group_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'project'] = @api_client.build_collection_param(project, :multi)
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
+ query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
+ query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?
+ query_params[:'end'] = opts[:'_end'] if !opts[:'_end'].nil?
+ query_params[:'environment'] = opts[:'environment'] if !opts[:'environment'].nil?
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Array<ErrorV2>'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"ErrorsV2Api.list_errors_v2",
+ :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: ErrorsV2Api#list_errors_v2\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # List of projects
+ # @param group_id [Integer] ID of the group
+ # @param [Hash] opts the optional parameters
+ # @return [Array<Project>]
+ def list_projects(group_id, opts = {})
+ data, _status_code, _headers = list_projects_with_http_info(group_id, opts)
+ data
+ end
+
+ # List of projects
+ # @param group_id [Integer] ID of the group
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(Array<Project>, Integer, Hash)>] Array<Project> data, response status code and response headers
+ def list_projects_with_http_info(group_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ErrorsV2Api.list_projects ...'
+ end
+ # verify the required parameter 'group_id' is set
+ if @api_client.config.client_side_validation && group_id.nil?
+ fail ArgumentError, "Missing the required parameter 'group_id' when calling ErrorsV2Api.list_projects"
+ end
+ # resource path
+ local_var_path = '/api/0/organizations/{groupId}/projects/'.sub('{' + 'groupId' + '}', CGI.escape(group_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(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Array<Project>'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"ErrorsV2Api.list_projects",
+ :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: ErrorsV2Api#list_projects\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/api/events_api.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/events_api.rb
new file mode 100644
index 00000000000..53665702083
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/events_api.rb
@@ -0,0 +1,232 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'cgi'
+
+module ErrorTrackingOpenAPI
+ class EventsApi
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Get information about the events related to the error
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param fingerprint [Integer] ID of the error within the project
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :sort (default to 'occurred_at_asc')
+ # @option opts [String] :cursor Base64 encoded information for pagination
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @return [Array<ErrorEvent>]
+ def list_events(project_id, fingerprint, opts = {})
+ data, _status_code, _headers = list_events_with_http_info(project_id, fingerprint, opts)
+ data
+ end
+
+ # Get information about the events related to the error
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param fingerprint [Integer] ID of the error within the project
+ # @param [Hash] opts the optional parameters
+ # @option opts [String] :sort (default to 'occurred_at_asc')
+ # @option opts [String] :cursor Base64 encoded information for pagination
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @return [Array<(Array<ErrorEvent>, Integer, Hash)>] Array<ErrorEvent> data, response status code and response headers
+ def list_events_with_http_info(project_id, fingerprint, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: EventsApi.list_events ...'
+ end
+ # verify the required parameter 'project_id' is set
+ if @api_client.config.client_side_validation && project_id.nil?
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling EventsApi.list_events"
+ end
+ # verify the required parameter 'fingerprint' is set
+ if @api_client.config.client_side_validation && fingerprint.nil?
+ fail ArgumentError, "Missing the required parameter 'fingerprint' when calling EventsApi.list_events"
+ end
+ allowable_values = ["occurred_at_asc", "occurred_at_desc"]
+ if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort'])
+ fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}"
+ end
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EventsApi.list_events, must be smaller than or equal to 100.'
+ end
+
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling EventsApi.list_events, must be greater than or equal to 1.'
+ end
+
+ # resource path
+ local_var_path = '/projects/{projectId}/errors/{fingerprint}/events'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'fingerprint' + '}', CGI.escape(fingerprint.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Array<ErrorEvent>'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"EventsApi.list_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(:GET, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: EventsApi#list_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Ingestion endpoint for error events sent from client SDKs
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param [Hash] opts the optional parameters
+ # @return [ErrorEvent]
+ def projects_api_project_id_envelope_post(project_id, opts = {})
+ data, _status_code, _headers = projects_api_project_id_envelope_post_with_http_info(project_id, opts)
+ data
+ end
+
+ # Ingestion endpoint for error events sent from client SDKs
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(ErrorEvent, Integer, Hash)>] ErrorEvent data, response status code and response headers
+ def projects_api_project_id_envelope_post_with_http_info(project_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: EventsApi.projects_api_project_id_envelope_post ...'
+ end
+ # verify the required parameter 'project_id' is set
+ if @api_client.config.client_side_validation && project_id.nil?
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling EventsApi.projects_api_project_id_envelope_post"
+ end
+ # resource path
+ local_var_path = '/projects/api/{projectId}/envelope'.sub('{' + 'projectId' + '}', CGI.escape(project_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(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'ErrorEvent'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"EventsApi.projects_api_project_id_envelope_post",
+ :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: EventsApi#projects_api_project_id_envelope_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+
+ # Ingestion endpoint for error events sent from client SDKs
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param [Hash] opts the optional parameters
+ # @return [ErrorEvent]
+ def projects_api_project_id_store_post(project_id, opts = {})
+ data, _status_code, _headers = projects_api_project_id_store_post_with_http_info(project_id, opts)
+ data
+ end
+
+ # Ingestion endpoint for error events sent from client SDKs
+ # @param project_id [Integer] ID of the project where the error was created
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(ErrorEvent, Integer, Hash)>] ErrorEvent data, response status code and response headers
+ def projects_api_project_id_store_post_with_http_info(project_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: EventsApi.projects_api_project_id_store_post ...'
+ end
+ # verify the required parameter 'project_id' is set
+ if @api_client.config.client_side_validation && project_id.nil?
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling EventsApi.projects_api_project_id_store_post"
+ end
+ # resource path
+ local_var_path = '/projects/api/{projectId}/store'.sub('{' + 'projectId' + '}', CGI.escape(project_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(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'ErrorEvent'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"EventsApi.projects_api_project_id_store_post",
+ :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: EventsApi#projects_api_project_id_store_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/api/messages_api.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/messages_api.rb
new file mode 100644
index 00000000000..391c63124ef
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/messages_api.rb
@@ -0,0 +1,94 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'cgi'
+
+module ErrorTrackingOpenAPI
+ class MessagesApi
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # List of messages
+ # @param project_id [Integer] ID of the project where the message was created
+ # @param [Hash] opts the optional parameters
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @return [Array<MessageEvent>]
+ def list_messages(project_id, opts = {})
+ data, _status_code, _headers = list_messages_with_http_info(project_id, opts)
+ data
+ end
+
+ # List of messages
+ # @param project_id [Integer] ID of the project where the message was created
+ # @param [Hash] opts the optional parameters
+ # @option opts [Integer] :limit Number of entries to return (default to 20)
+ # @return [Array<(Array<MessageEvent>, Integer, Hash)>] Array<MessageEvent> data, response status code and response headers
+ def list_messages_with_http_info(project_id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: MessagesApi.list_messages ...'
+ end
+ # verify the required parameter 'project_id' is set
+ if @api_client.config.client_side_validation && project_id.nil?
+ fail ArgumentError, "Missing the required parameter 'project_id' when calling MessagesApi.list_messages"
+ end
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagesApi.list_messages, must be smaller than or equal to 100.'
+ end
+
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessagesApi.list_messages, must be greater than or equal to 1.'
+ end
+
+ # resource path
+ local_var_path = '/projects/{projectId}/messages'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+ # HTTP header 'Accept' (if needed)
+ header_params['Accept'] = @api_client.select_header_accept(['*/*'])
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type] || 'Array<MessageEvent>'
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"MessagesApi.list_messages",
+ :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: MessagesApi#list_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/api/projects_api.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/projects_api.rb
new file mode 100644
index 00000000000..42597a3ed67
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/api/projects_api.rb
@@ -0,0 +1,81 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'cgi'
+
+module ErrorTrackingOpenAPI
+ class ProjectsApi
+ attr_accessor :api_client
+
+ def initialize(api_client = ApiClient.default)
+ @api_client = api_client
+ end
+ # Deletes all project related data. Mostly for testing purposes and later for production to clean updeleted projects.
+ # @param id [Integer] ID of the project
+ # @param [Hash] opts the optional parameters
+ # @return [nil]
+ def delete_project(id, opts = {})
+ delete_project_with_http_info(id, opts)
+ nil
+ end
+
+ # Deletes all project related data. Mostly for testing purposes and later for production to clean updeleted projects.
+ # @param id [Integer] ID of the project
+ # @param [Hash] opts the optional parameters
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
+ def delete_project_with_http_info(id, opts = {})
+ if @api_client.config.debugging
+ @api_client.config.logger.debug 'Calling API: ProjectsApi.delete_project ...'
+ end
+ # verify the required parameter 'id' is set
+ if @api_client.config.client_side_validation && id.nil?
+ fail ArgumentError, "Missing the required parameter 'id' when calling ProjectsApi.delete_project"
+ end
+ # resource path
+ local_var_path = '/projects/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
+
+ # query parameters
+ query_params = opts[:query_params] || {}
+
+ # header parameters
+ header_params = opts[:header_params] || {}
+
+ # form parameters
+ form_params = opts[:form_params] || {}
+
+ # http body (model)
+ post_body = opts[:debug_body]
+
+ # return_type
+ return_type = opts[:debug_return_type]
+
+ # auth_names
+ auth_names = opts[:debug_auth_names] || ['internalToken']
+
+ new_options = opts.merge(
+ :operation => :"ProjectsApi.delete_project",
+ :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(:DELETE, local_var_path, new_options)
+ if @api_client.config.debugging
+ @api_client.config.logger.debug "API called: ProjectsApi#delete_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
+ end
+ return data, status_code, headers
+ end
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/api_client.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/api_client.rb
new file mode 100644
index 00000000000..a189ee5a707
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/api_client.rb
@@ -0,0 +1,392 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'json'
+require 'logger'
+require 'tempfile'
+require 'time'
+require 'typhoeus'
+
+module ErrorTrackingOpenAPI
+ class ApiClient
+ # The Configuration object holding settings to be used in the API client.
+ attr_accessor :config
+
+ # Defines the headers to be used in HTTP requests of all API calls by default.
+ #
+ # @return [Hash]
+ attr_accessor :default_headers
+
+ # Initializes the ApiClient
+ # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
+ def initialize(config = Configuration.default)
+ @config = config
+ @user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
+ @default_headers = {
+ 'Content-Type' => 'application/json',
+ 'User-Agent' => @user_agent
+ }
+ end
+
+ def self.default
+ @@default ||= ApiClient.new
+ end
+
+ # Call an API with given options.
+ #
+ # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
+ # the data deserialized from response body (could be nil), response status code and response headers.
+ def call_api(http_method, path, opts = {})
+ request = build_request(http_method, path, opts)
+ response = request.run
+
+ if @config.debugging
+ @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n"
+ end
+
+ unless response.success?
+ if response.timed_out?
+ fail ApiError.new('Connection timed out')
+ elsif response.code == 0
+ # Errors from libcurl will be made visible here
+ fail ApiError.new(:code => 0,
+ :message => response.return_message)
+ else
+ fail ApiError.new(:code => response.code,
+ :response_headers => response.headers,
+ :response_body => response.body),
+ response.status_message
+ end
+ end
+
+ if opts[:return_type]
+ data = deserialize(response, opts[:return_type])
+ else
+ data = nil
+ end
+ return data, response.code, response.headers
+ end
+
+ # Builds the HTTP request
+ #
+ # @param [String] http_method HTTP method/verb (e.g. POST)
+ # @param [String] path URL path (e.g. /account/new)
+ # @option opts [Hash] :header_params Header parameters
+ # @option opts [Hash] :query_params Query parameters
+ # @option opts [Hash] :form_params Query parameters
+ # @option opts [Object] :body HTTP body (JSON/XML)
+ # @return [Typhoeus::Request] A Typhoeus Request
+ def build_request(http_method, path, opts = {})
+ url = build_request_url(path, opts)
+ http_method = http_method.to_sym.downcase
+
+ header_params = @default_headers.merge(opts[:header_params] || {})
+ query_params = opts[:query_params] || {}
+ form_params = opts[:form_params] || {}
+ follow_location = opts[:follow_location] || true
+
+ update_params_for_auth! header_params, query_params, opts[:auth_names]
+
+ # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
+ _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
+
+ req_opts = {
+ :method => http_method,
+ :headers => header_params,
+ :params => query_params,
+ :params_encoding => @config.params_encoding,
+ :timeout => @config.timeout,
+ :ssl_verifypeer => @config.verify_ssl,
+ :ssl_verifyhost => _verify_ssl_host,
+ :sslcert => @config.cert_file,
+ :sslkey => @config.key_file,
+ :verbose => @config.debugging,
+ :followlocation => follow_location
+ }
+
+ # set custom cert, if provided
+ req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
+
+ if [:post, :patch, :put, :delete].include?(http_method)
+ req_body = build_request_body(header_params, form_params, opts[:body])
+ req_opts.update :body => req_body
+ if @config.debugging
+ @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
+ end
+ end
+
+ request = Typhoeus::Request.new(url, req_opts)
+ download_file(request) if opts[:return_type] == 'File'
+ request
+ end
+
+ # Builds the HTTP request body
+ #
+ # @param [Hash] header_params Header parameters
+ # @param [Hash] form_params Query parameters
+ # @param [Object] body HTTP body (JSON/XML)
+ # @return [String] HTTP body data in the form of string
+ def build_request_body(header_params, form_params, body)
+ # http form
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
+ header_params['Content-Type'] == 'multipart/form-data'
+ data = {}
+ form_params.each do |key, value|
+ case value
+ when ::File, ::Array, nil
+ # let typhoeus handle File, Array and nil parameters
+ data[key] = value
+ else
+ data[key] = value.to_s
+ end
+ end
+ elsif body
+ data = body.is_a?(String) ? body : body.to_json
+ else
+ data = nil
+ end
+ data
+ end
+
+ # Save response body into a file in (the defined) temporary folder, using the filename
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
+ # The response body is written to the file in chunks in order to handle files which
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
+ # process can use.
+ #
+ # @see Configuration#temp_folder_path
+ def download_file(request)
+ tempfile = nil
+ encoding = nil
+ request.on_headers do |response|
+ content_disposition = response.headers['Content-Disposition']
+ if content_disposition && content_disposition =~ /filename=/i
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
+ prefix = sanitize_filename(filename)
+ else
+ prefix = 'download-'
+ end
+ prefix = prefix + '-' unless prefix.end_with?('-')
+ encoding = response.body.encoding
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
+ @tempfile = tempfile
+ end
+ request.on_body do |chunk|
+ chunk.force_encoding(encoding)
+ tempfile.write(chunk)
+ end
+ request.on_complete do |response|
+ if tempfile
+ tempfile.close
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
+ "explicitly with `tempfile.delete`"
+ end
+ end
+ end
+
+ # Check if the given MIME is a JSON MIME.
+ # JSON MIME examples:
+ # application/json
+ # application/json; charset=UTF8
+ # APPLICATION/JSON
+ # */*
+ # @param [String] mime MIME
+ # @return [Boolean] True if the MIME is application/json
+ def json_mime?(mime)
+ (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
+ end
+
+ # Deserialize the response to the given return type.
+ #
+ # @param [Response] response HTTP response
+ # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
+ def deserialize(response, return_type)
+ body = response.body
+
+ # handle file downloading - return the File instance processed in request callbacks
+ # note that response body is empty when the file is written in chunks in request on_body callback
+ return @tempfile if return_type == 'File'
+
+ return nil if body.nil? || body.empty?
+
+ # return response body directly for String return type
+ return body if return_type == 'String'
+
+ # ensuring a default content type
+ content_type = response.headers['Content-Type'] || 'application/json'
+
+ fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
+
+ begin
+ data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
+ rescue JSON::ParserError => e
+ if %w(String Date Time).include?(return_type)
+ data = body
+ else
+ raise e
+ end
+ end
+
+ convert_to_type data, return_type
+ end
+
+ # Convert data to the given return type.
+ # @param [Object] data Data to be converted
+ # @param [String] return_type Return type
+ # @return [Mixed] Data in a particular type
+ def convert_to_type(data, return_type)
+ return nil if data.nil?
+ case return_type
+ when 'String'
+ data.to_s
+ when 'Integer'
+ data.to_i
+ when 'Float'
+ data.to_f
+ when 'Boolean'
+ data == true
+ when 'Time'
+ # parse date time (expecting ISO 8601 format)
+ Time.parse data
+ when 'Date'
+ # parse date time (expecting ISO 8601 format)
+ Date.parse data
+ when 'Object'
+ # generic object (usually a Hash), return directly
+ data
+ when /\AArray<(.+)>\z/
+ # e.g. Array<Pet>
+ sub_type = $1
+ data.map { |item| convert_to_type(item, sub_type) }
+ when /\AHash\<String, (.+)\>\z/
+ # e.g. Hash<String, Integer>
+ sub_type = $1
+ {}.tap do |hash|
+ data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
+ end
+ else
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(return_type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
+ end
+ end
+
+ # Sanitize filename by removing path.
+ # e.g. ../../sun.gif becomes sun.gif
+ #
+ # @param [String] filename the filename to be sanitized
+ # @return [String] the sanitized filename
+ def sanitize_filename(filename)
+ filename.gsub(/.*[\/\\]/, '')
+ end
+
+ def build_request_url(path, opts = {})
+ # Add leading and trailing slashes to path
+ path = "/#{path}".gsub(/\/+/, '/')
+ @config.base_url(opts[:operation]) + path
+ end
+
+ # Update header and query params based on authentication settings.
+ #
+ # @param [Hash] header_params Header parameters
+ # @param [Hash] query_params Query parameters
+ # @param [String] auth_names Authentication scheme name
+ def update_params_for_auth!(header_params, query_params, auth_names)
+ Array(auth_names).each do |auth_name|
+ auth_setting = @config.auth_settings[auth_name]
+ next unless auth_setting
+ case auth_setting[:in]
+ when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
+ when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
+ else fail ArgumentError, 'Authentication token must be in `query` or `header`'
+ end
+ end
+ end
+
+ # Sets user agent in HTTP header
+ #
+ # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
+ def user_agent=(user_agent)
+ @user_agent = user_agent
+ @default_headers['User-Agent'] = @user_agent
+ end
+
+ # Return Accept header based on an array of accepts provided.
+ # @param [Array] accepts array for Accept
+ # @return [String] the Accept header (e.g. application/json)
+ def select_header_accept(accepts)
+ return nil if accepts.nil? || accepts.empty?
+ # use JSON when present, otherwise use all of the provided
+ json_accept = accepts.find { |s| json_mime?(s) }
+ json_accept || accepts.join(',')
+ end
+
+ # Return Content-Type header based on an array of content types provided.
+ # @param [Array] content_types array for Content-Type
+ # @return [String] the Content-Type header (e.g. application/json)
+ def select_header_content_type(content_types)
+ # return nil by default
+ return if content_types.nil? || content_types.empty?
+ # use JSON when present, otherwise use the first one
+ json_content_type = content_types.find { |s| json_mime?(s) }
+ json_content_type || content_types.first
+ end
+
+ # Convert object (array, hash, object, etc) to JSON string.
+ # @param [Object] model object to be converted into JSON string
+ # @return [String] JSON string representation of the object
+ def object_to_http_body(model)
+ return model if model.nil? || model.is_a?(String)
+ local_body = nil
+ if model.is_a?(Array)
+ local_body = model.map { |m| object_to_hash(m) }
+ else
+ local_body = object_to_hash(model)
+ end
+ local_body.to_json
+ end
+
+ # Convert object(non-array) to hash.
+ # @param [Object] obj object to be converted into JSON string
+ # @return [String] JSON string representation of the object
+ def object_to_hash(obj)
+ if obj.respond_to?(:to_hash)
+ obj.to_hash
+ else
+ obj
+ end
+ end
+
+ # Build parameter value according to the given collection format.
+ # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
+ def build_collection_param(param, collection_format)
+ case collection_format
+ when :csv
+ param.join(',')
+ when :ssv
+ param.join(' ')
+ when :tsv
+ param.join("\t")
+ when :pipes
+ param.join('|')
+ when :multi
+ # return the array directly as typhoeus will handle it as expected
+ param
+ else
+ fail "unknown collection format: #{collection_format.inspect}"
+ end
+ end
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/api_error.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/api_error.rb
new file mode 100644
index 00000000000..7eddaa05a0c
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/api_error.rb
@@ -0,0 +1,57 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+module ErrorTrackingOpenAPI
+ class ApiError < StandardError
+ attr_reader :code, :response_headers, :response_body
+
+ # Usage examples:
+ # ApiError.new
+ # ApiError.new("message")
+ # ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
+ # ApiError.new(:code => 404, :message => "Not Found")
+ def initialize(arg = nil)
+ if arg.is_a? Hash
+ if arg.key?(:message) || arg.key?('message')
+ super(arg[:message] || arg['message'])
+ else
+ super arg
+ end
+
+ arg.each do |k, v|
+ instance_variable_set "@#{k}", v
+ end
+ else
+ super arg
+ end
+ end
+
+ # Override to_s to display a friendly error message
+ def to_s
+ message
+ end
+
+ def message
+ if @message.nil?
+ msg = "Error message: the server returns an error"
+ else
+ msg = @message
+ end
+
+ msg += "\nHTTP status code: #{code}" if code
+ msg += "\nResponse headers: #{response_headers}" if response_headers
+ msg += "\nResponse body: #{response_body}" if response_body
+
+ msg
+ end
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/configuration.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/configuration.rb
new file mode 100644
index 00000000000..4accd0b2cfd
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/configuration.rb
@@ -0,0 +1,283 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+module ErrorTrackingOpenAPI
+ class Configuration
+ # Defines url scheme
+ attr_accessor :scheme
+
+ # Defines url host
+ attr_accessor :host
+
+ # Defines url base path
+ attr_accessor :base_path
+
+ # Define server configuration index
+ attr_accessor :server_index
+
+ # Define server operation configuration index
+ attr_accessor :server_operation_index
+
+ # Default server variables
+ attr_accessor :server_variables
+
+ # Default server operation variables
+ attr_accessor :server_operation_variables
+
+ # Defines API keys used with API Key authentications.
+ #
+ # @return [Hash] key: parameter name, value: parameter value (API key)
+ #
+ # @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
+ # config.api_key['api_key'] = 'xxx'
+ attr_accessor :api_key
+
+ # Defines API key prefixes used with API Key authentications.
+ #
+ # @return [Hash] key: parameter name, value: API key prefix
+ #
+ # @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
+ # config.api_key_prefix['api_key'] = 'Token'
+ attr_accessor :api_key_prefix
+
+ # Defines the username used with HTTP basic authentication.
+ #
+ # @return [String]
+ attr_accessor :username
+
+ # Defines the password used with HTTP basic authentication.
+ #
+ # @return [String]
+ attr_accessor :password
+
+ # Defines the access token (Bearer) used with OAuth2.
+ attr_accessor :access_token
+
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
+ # details will be logged with `logger.debug` (see the `logger` attribute).
+ # Default to false.
+ #
+ # @return [true, false]
+ attr_accessor :debugging
+
+ # Defines the logger used for debugging.
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
+ #
+ # @return [#debug]
+ attr_accessor :logger
+
+ # Defines the temporary folder to store downloaded files
+ # (for API endpoints that have file response).
+ # Default to use `Tempfile`.
+ #
+ # @return [String]
+ attr_accessor :temp_folder_path
+
+ # The time limit for HTTP request in seconds.
+ # Default to 0 (never times out).
+ attr_accessor :timeout
+
+ # Set this to false to skip client side validation in the operation.
+ # Default to true.
+ # @return [true, false]
+ attr_accessor :client_side_validation
+
+ ### TLS/SSL setting
+ # Set this to false to skip verifying SSL certificate when calling API from https server.
+ # Default to true.
+ #
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
+ #
+ # @return [true, false]
+ attr_accessor :verify_ssl
+
+ ### TLS/SSL setting
+ # Set this to false to skip verifying SSL host name
+ # Default to true.
+ #
+ # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
+ #
+ # @return [true, false]
+ attr_accessor :verify_ssl_host
+
+ ### TLS/SSL setting
+ # Set this to customize the certificate file to verify the peer.
+ #
+ # @return [String] the path to the certificate file
+ #
+ # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
+ # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
+ attr_accessor :ssl_ca_cert
+
+ ### TLS/SSL setting
+ # Client certificate file (for client certificate)
+ attr_accessor :cert_file
+
+ ### TLS/SSL setting
+ # Client private key file (for client certificate)
+ attr_accessor :key_file
+
+ # Set this to customize parameters encoding of array parameter with multi collectionFormat.
+ # Default to nil.
+ #
+ # @see The params_encoding option of Ethon. Related source code:
+ # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
+ attr_accessor :params_encoding
+
+
+ attr_accessor :inject_format
+
+ attr_accessor :force_ending_format
+
+ def initialize
+ @scheme = 'https'
+ @host = 'localhost'
+ @base_path = '/errortracking/api/v1'
+ @server_index = 0
+ @server_operation_index = {}
+ @server_variables = {}
+ @server_operation_variables = {}
+ @api_key = {}
+ @api_key_prefix = {}
+ @client_side_validation = true
+ @verify_ssl = true
+ @verify_ssl_host = true
+ @cert_file = nil
+ @key_file = nil
+ @timeout = 0
+ @params_encoding = nil
+ @debugging = false
+ @inject_format = false
+ @force_ending_format = false
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
+
+ yield(self) if block_given?
+ end
+
+ # The default Configuration object.
+ def self.default
+ @@default ||= Configuration.new
+ end
+
+ def configure
+ yield(self) if block_given?
+ end
+
+ def scheme=(scheme)
+ # remove :// from scheme
+ @scheme = scheme.sub(/:\/\//, '')
+ end
+
+ def host=(host)
+ # remove http(s):// and anything after a slash
+ @host = host.sub(/https?:\/\//, '').split('/').first
+ end
+
+ def base_path=(base_path)
+ # Add leading and trailing slashes to base_path
+ @base_path = "/#{base_path}".gsub(/\/+/, '/')
+ @base_path = '' if @base_path == '/'
+ end
+
+ # Returns base URL for specified operation based on server settings
+ def base_url(operation = nil)
+ index = server_operation_index.fetch(operation, server_index)
+ return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
+
+ server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
+ end
+
+ # Gets API key (with prefix if set).
+ # @param [String] param_name the parameter name of API key auth
+ def api_key_with_prefix(param_name, param_alias = nil)
+ key = @api_key[param_name]
+ key = @api_key.fetch(param_alias, key) unless param_alias.nil?
+ if @api_key_prefix[param_name]
+ "#{@api_key_prefix[param_name]} #{key}"
+ else
+ key
+ end
+ end
+
+ # Gets Basic Auth token string
+ def basic_auth_token
+ 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
+ end
+
+ # Returns Auth Settings hash for api client.
+ def auth_settings
+ {
+ 'internalToken' =>
+ {
+ type: 'api_key',
+ in: 'header',
+ key: 'Gitlab-Error-Tracking-Token',
+ value: api_key_with_prefix('internalToken')
+ },
+ }
+ end
+
+ # Returns an array of Server setting
+ def server_settings
+ [
+ {
+ url: "https://localhost/errortracking/api/v1",
+ description: "No description provided",
+ },
+ {
+ url: "http://localhost/errortracking/api/v1",
+ description: "No description provided",
+ }
+ ]
+ end
+
+ def operation_server_settings
+ {
+ }
+ end
+
+ # Returns URL based on server settings
+ #
+ # @param index array index of the server settings
+ # @param variables hash of variable and the corresponding value
+ def server_url(index, variables = {}, servers = nil)
+ servers = server_settings if servers == nil
+
+ # check array index out of bound
+ if (index < 0 || index >= servers.size)
+ fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
+ end
+
+ server = servers[index]
+ url = server[:url]
+
+ return url unless server.key? :variables
+
+ # go through variable and assign a value
+ server[:variables].each do |name, variable|
+ if variables.key?(name)
+ if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
+ url.gsub! "{" + name.to_s + "}", variables[name]
+ else
+ fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
+ end
+ else
+ # use default value
+ url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
+ end
+ end
+
+ url
+ end
+
+ end
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error.rb
new file mode 100644
index 00000000000..5c2e62a0166
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error.rb
@@ -0,0 +1,344 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class Error
+ attr_accessor :fingerprint
+
+ attr_accessor :project_id
+
+ attr_accessor :name
+
+ attr_accessor :description
+
+ attr_accessor :actor
+
+ attr_accessor :event_count
+
+ attr_accessor :approximated_user_count
+
+ attr_accessor :last_seen_at
+
+ attr_accessor :first_seen_at
+
+ # Status of the error
+ attr_accessor :status
+
+ attr_accessor :stats
+
+ class EnumAttributeValidator
+ attr_reader :datatype
+ attr_reader :allowable_values
+
+ def initialize(datatype, allowable_values)
+ @allowable_values = allowable_values.map do |value|
+ case datatype.to_s
+ when /Integer/i
+ value.to_i
+ when /Float/i
+ value.to_f
+ else
+ value
+ end
+ end
+ end
+
+ def valid?(value)
+ !value || allowable_values.include?(value)
+ end
+ end
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'fingerprint' => :'fingerprint',
+ :'project_id' => :'project_id',
+ :'name' => :'name',
+ :'description' => :'description',
+ :'actor' => :'actor',
+ :'event_count' => :'event_count',
+ :'approximated_user_count' => :'approximated_user_count',
+ :'last_seen_at' => :'last_seen_at',
+ :'first_seen_at' => :'first_seen_at',
+ :'status' => :'status',
+ :'stats' => :'stats'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'fingerprint' => :'Integer',
+ :'project_id' => :'Integer',
+ :'name' => :'String',
+ :'description' => :'String',
+ :'actor' => :'String',
+ :'event_count' => :'Integer',
+ :'approximated_user_count' => :'Integer',
+ :'last_seen_at' => :'Time',
+ :'first_seen_at' => :'Time',
+ :'status' => :'String',
+ :'stats' => :'ErrorStats'
+ }
+ 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 `ErrorTrackingOpenAPI::Error` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::Error`. 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?(:'fingerprint')
+ self.fingerprint = attributes[:'fingerprint']
+ end
+
+ if attributes.key?(:'project_id')
+ self.project_id = attributes[:'project_id']
+ end
+
+ if attributes.key?(:'name')
+ self.name = attributes[:'name']
+ end
+
+ if attributes.key?(:'description')
+ self.description = attributes[:'description']
+ end
+
+ if attributes.key?(:'actor')
+ self.actor = attributes[:'actor']
+ end
+
+ if attributes.key?(:'event_count')
+ self.event_count = attributes[:'event_count']
+ end
+
+ if attributes.key?(:'approximated_user_count')
+ self.approximated_user_count = attributes[:'approximated_user_count']
+ end
+
+ if attributes.key?(:'last_seen_at')
+ self.last_seen_at = attributes[:'last_seen_at']
+ end
+
+ if attributes.key?(:'first_seen_at')
+ self.first_seen_at = attributes[:'first_seen_at']
+ end
+
+ if attributes.key?(:'status')
+ self.status = attributes[:'status']
+ end
+
+ if attributes.key?(:'stats')
+ self.stats = attributes[:'stats']
+ 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
+ invalid_properties = Array.new
+ 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?
+ status_validator = EnumAttributeValidator.new('String', ["unresolved", "resolved", "ignored"])
+ return false unless status_validator.valid?(@status)
+ true
+ end
+
+ # Custom attribute writer method checking allowed values (enum).
+ # @param [Object] status Object to be assigned
+ def status=(status)
+ validator = EnumAttributeValidator.new('String', ["unresolved", "resolved", "ignored"])
+ unless validator.valid?(status)
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
+ end
+ @status = status
+ 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 &&
+ fingerprint == o.fingerprint &&
+ project_id == o.project_id &&
+ name == o.name &&
+ description == o.description &&
+ actor == o.actor &&
+ event_count == o.event_count &&
+ approximated_user_count == o.approximated_user_count &&
+ last_seen_at == o.last_seen_at &&
+ first_seen_at == o.first_seen_at &&
+ status == o.status &&
+ stats == o.stats
+ 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
+ [fingerprint, project_id, name, description, actor, event_count, approximated_user_count, last_seen_at, first_seen_at, status, stats].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_event.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_event.rb
new file mode 100644
index 00000000000..9e44534e7a6
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_event.rb
@@ -0,0 +1,283 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class ErrorEvent
+ attr_accessor :fingerprint
+
+ attr_accessor :project_id
+
+ # JSON encoded string
+ attr_accessor :payload
+
+ attr_accessor :name
+
+ attr_accessor :description
+
+ attr_accessor :actor
+
+ attr_accessor :environment
+
+ attr_accessor :platform
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'fingerprint' => :'fingerprint',
+ :'project_id' => :'projectId',
+ :'payload' => :'payload',
+ :'name' => :'name',
+ :'description' => :'description',
+ :'actor' => :'actor',
+ :'environment' => :'environment',
+ :'platform' => :'platform'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'fingerprint' => :'Integer',
+ :'project_id' => :'Integer',
+ :'payload' => :'String',
+ :'name' => :'String',
+ :'description' => :'String',
+ :'actor' => :'String',
+ :'environment' => :'String',
+ :'platform' => :'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 `ErrorTrackingOpenAPI::ErrorEvent` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::ErrorEvent`. 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?(:'fingerprint')
+ self.fingerprint = attributes[:'fingerprint']
+ end
+
+ if attributes.key?(:'project_id')
+ self.project_id = attributes[:'project_id']
+ end
+
+ if attributes.key?(:'payload')
+ self.payload = attributes[:'payload']
+ end
+
+ if attributes.key?(:'name')
+ self.name = attributes[:'name']
+ end
+
+ if attributes.key?(:'description')
+ self.description = attributes[:'description']
+ end
+
+ if attributes.key?(:'actor')
+ self.actor = attributes[:'actor']
+ end
+
+ if attributes.key?(:'environment')
+ self.environment = attributes[:'environment']
+ end
+
+ if attributes.key?(:'platform')
+ self.platform = attributes[:'platform']
+ 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
+ invalid_properties = Array.new
+ 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?
+ true
+ 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 &&
+ fingerprint == o.fingerprint &&
+ project_id == o.project_id &&
+ payload == o.payload &&
+ name == o.name &&
+ description == o.description &&
+ actor == o.actor &&
+ environment == o.environment &&
+ platform == o.platform
+ 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
+ [fingerprint, project_id, payload, name, description, actor, environment, platform].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_stats.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_stats.rb
new file mode 100644
index 00000000000..7931ddd8747
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_stats.rb
@@ -0,0 +1,219 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class ErrorStats
+ attr_accessor :frequency
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'frequency' => :'frequency'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'frequency' => :'Object'
+ }
+ 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 `ErrorTrackingOpenAPI::ErrorStats` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::ErrorStats`. 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?(:'frequency')
+ self.frequency = attributes[:'frequency']
+ 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
+ invalid_properties = Array.new
+ 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?
+ true
+ 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 &&
+ frequency == o.frequency
+ 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
+ [frequency].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_update_payload.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_update_payload.rb
new file mode 100644
index 00000000000..2be48755535
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_update_payload.rb
@@ -0,0 +1,264 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class ErrorUpdatePayload
+ # Status of the error
+ attr_accessor :status
+
+ # GitLab user id who triggered the update
+ attr_accessor :updated_by_id
+
+ class EnumAttributeValidator
+ attr_reader :datatype
+ attr_reader :allowable_values
+
+ def initialize(datatype, allowable_values)
+ @allowable_values = allowable_values.map do |value|
+ case datatype.to_s
+ when /Integer/i
+ value.to_i
+ when /Float/i
+ value.to_f
+ else
+ value
+ end
+ end
+ end
+
+ def valid?(value)
+ !value || allowable_values.include?(value)
+ end
+ end
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'status' => :'status',
+ :'updated_by_id' => :'updated_by_id'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'status' => :'String',
+ :'updated_by_id' => :'Integer'
+ }
+ 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 `ErrorTrackingOpenAPI::ErrorUpdatePayload` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::ErrorUpdatePayload`. 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?(:'status')
+ self.status = attributes[:'status']
+ end
+
+ if attributes.key?(:'updated_by_id')
+ self.updated_by_id = attributes[:'updated_by_id']
+ 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
+ invalid_properties = Array.new
+ 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?
+ status_validator = EnumAttributeValidator.new('String', ["unresolved", "resolved", "ignored"])
+ return false unless status_validator.valid?(@status)
+ true
+ end
+
+ # Custom attribute writer method checking allowed values (enum).
+ # @param [Object] status Object to be assigned
+ def status=(status)
+ validator = EnumAttributeValidator.new('String', ["unresolved", "resolved", "ignored"])
+ unless validator.valid?(status)
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
+ end
+ @status = status
+ 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 &&
+ status == o.status &&
+ updated_by_id == o.updated_by_id
+ 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
+ [status, updated_by_id].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_v2.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_v2.rb
new file mode 100644
index 00000000000..552ed0d79e8
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/error_v2.rb
@@ -0,0 +1,326 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class ErrorV2
+ attr_accessor :id
+
+ attr_accessor :project
+
+ attr_accessor :title
+
+ attr_accessor :actor
+
+ attr_accessor :count
+
+ attr_accessor :user_count
+
+ attr_accessor :last_seen
+
+ attr_accessor :first_seen
+
+ # Status of the error
+ attr_accessor :status
+
+ class EnumAttributeValidator
+ attr_reader :datatype
+ attr_reader :allowable_values
+
+ def initialize(datatype, allowable_values)
+ @allowable_values = allowable_values.map do |value|
+ case datatype.to_s
+ when /Integer/i
+ value.to_i
+ when /Float/i
+ value.to_f
+ else
+ value
+ end
+ end
+ end
+
+ def valid?(value)
+ !value || allowable_values.include?(value)
+ end
+ end
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'id' => :'id',
+ :'project' => :'project',
+ :'title' => :'title',
+ :'actor' => :'actor',
+ :'count' => :'count',
+ :'user_count' => :'userCount',
+ :'last_seen' => :'lastSeen',
+ :'first_seen' => :'firstSeen',
+ :'status' => :'status'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'id' => :'String',
+ :'project' => :'Project',
+ :'title' => :'String',
+ :'actor' => :'String',
+ :'count' => :'String',
+ :'user_count' => :'Integer',
+ :'last_seen' => :'Time',
+ :'first_seen' => :'Time',
+ :'status' => :'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 `ErrorTrackingOpenAPI::ErrorV2` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::ErrorV2`. 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?(:'id')
+ self.id = attributes[:'id']
+ end
+
+ if attributes.key?(:'project')
+ self.project = attributes[:'project']
+ end
+
+ if attributes.key?(:'title')
+ self.title = attributes[:'title']
+ end
+
+ if attributes.key?(:'actor')
+ self.actor = attributes[:'actor']
+ end
+
+ if attributes.key?(:'count')
+ self.count = attributes[:'count']
+ end
+
+ if attributes.key?(:'user_count')
+ self.user_count = attributes[:'user_count']
+ end
+
+ if attributes.key?(:'last_seen')
+ self.last_seen = attributes[:'last_seen']
+ end
+
+ if attributes.key?(:'first_seen')
+ self.first_seen = attributes[:'first_seen']
+ end
+
+ if attributes.key?(:'status')
+ self.status = attributes[:'status']
+ 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
+ invalid_properties = Array.new
+ 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?
+ status_validator = EnumAttributeValidator.new('String', ["unresolved", "resolved", "ignored"])
+ return false unless status_validator.valid?(@status)
+ true
+ end
+
+ # Custom attribute writer method checking allowed values (enum).
+ # @param [Object] status Object to be assigned
+ def status=(status)
+ validator = EnumAttributeValidator.new('String', ["unresolved", "resolved", "ignored"])
+ unless validator.valid?(status)
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
+ end
+ @status = status
+ 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 &&
+ id == o.id &&
+ project == o.project &&
+ title == o.title &&
+ actor == o.actor &&
+ count == o.count &&
+ user_count == o.user_count &&
+ last_seen == o.last_seen &&
+ first_seen == o.first_seen &&
+ status == o.status
+ 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
+ [id, project, title, actor, count, user_count, last_seen, first_seen, status].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/message_event.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/message_event.rb
new file mode 100644
index 00000000000..ba90536c949
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/message_event.rb
@@ -0,0 +1,282 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class MessageEvent
+ attr_accessor :project_id
+
+ attr_accessor :event_id
+
+ attr_accessor :timestamp
+
+ attr_accessor :level
+
+ attr_accessor :message
+
+ attr_accessor :release
+
+ attr_accessor :environment
+
+ attr_accessor :platform
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'project_id' => :'projectId',
+ :'event_id' => :'eventId',
+ :'timestamp' => :'timestamp',
+ :'level' => :'level',
+ :'message' => :'message',
+ :'release' => :'release',
+ :'environment' => :'environment',
+ :'platform' => :'platform'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'project_id' => :'Integer',
+ :'event_id' => :'String',
+ :'timestamp' => :'Time',
+ :'level' => :'String',
+ :'message' => :'String',
+ :'release' => :'String',
+ :'environment' => :'String',
+ :'platform' => :'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 `ErrorTrackingOpenAPI::MessageEvent` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::MessageEvent`. 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?(:'project_id')
+ self.project_id = attributes[:'project_id']
+ end
+
+ if attributes.key?(:'event_id')
+ self.event_id = attributes[:'event_id']
+ end
+
+ if attributes.key?(:'timestamp')
+ self.timestamp = attributes[:'timestamp']
+ end
+
+ if attributes.key?(:'level')
+ self.level = attributes[:'level']
+ end
+
+ if attributes.key?(:'message')
+ self.message = attributes[:'message']
+ end
+
+ if attributes.key?(:'release')
+ self.release = attributes[:'release']
+ end
+
+ if attributes.key?(:'environment')
+ self.environment = attributes[:'environment']
+ end
+
+ if attributes.key?(:'platform')
+ self.platform = attributes[:'platform']
+ 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
+ invalid_properties = Array.new
+ 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?
+ true
+ 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 &&
+ project_id == o.project_id &&
+ event_id == o.event_id &&
+ timestamp == o.timestamp &&
+ level == o.level &&
+ message == o.message &&
+ release == o.release &&
+ environment == o.environment &&
+ platform == o.platform
+ 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
+ [project_id, event_id, timestamp, level, message, release, environment, platform].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/project.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/project.rb
new file mode 100644
index 00000000000..1b8afafd316
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/project.rb
@@ -0,0 +1,240 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class Project
+ # ID of the project
+ attr_accessor :id
+
+ # Name of the project
+ attr_accessor :name
+
+ # Slug of the project
+ attr_accessor :slug
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'id' => :'id',
+ :'name' => :'name',
+ :'slug' => :'slug'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'id' => :'String',
+ :'name' => :'String',
+ :'slug' => :'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 `ErrorTrackingOpenAPI::Project` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::Project`. 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?(:'id')
+ self.id = attributes[:'id']
+ end
+
+ if attributes.key?(:'name')
+ self.name = attributes[:'name']
+ end
+
+ if attributes.key?(:'slug')
+ self.slug = attributes[:'slug']
+ 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
+ invalid_properties = Array.new
+ 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?
+ true
+ 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 &&
+ id == o.id &&
+ name == o.name &&
+ slug == o.slug
+ 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
+ [id, name, slug].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object.rb
new file mode 100644
index 00000000000..142e3c482fc
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object.rb
@@ -0,0 +1,253 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class StatsObject
+ # ID of the project
+ attr_accessor :start
+
+ # Name of the project
+ attr_accessor :_end
+
+ # Slug of the project
+ attr_accessor :interval
+
+ attr_accessor :group
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'start' => :'start',
+ :'_end' => :'end',
+ :'interval' => :'interval',
+ :'group' => :'group'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'start' => :'String',
+ :'_end' => :'String',
+ :'interval' => :'Array<String>',
+ :'group' => :'Array<StatsObjectGroupInner>'
+ }
+ 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 `ErrorTrackingOpenAPI::StatsObject` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::StatsObject`. 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?(:'start')
+ self.start = attributes[:'start']
+ end
+
+ if attributes.key?(:'_end')
+ self._end = attributes[:'_end']
+ end
+
+ if attributes.key?(:'interval')
+ if (value = attributes[:'interval']).is_a?(Array)
+ self.interval = value
+ end
+ end
+
+ if attributes.key?(:'group')
+ if (value = attributes[:'group']).is_a?(Array)
+ self.group = value
+ end
+ 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
+ invalid_properties = Array.new
+ 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?
+ true
+ 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 &&
+ start == o.start &&
+ _end == o._end &&
+ interval == o.interval &&
+ group == o.group
+ 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
+ [start, _end, interval, group].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object_group_inner.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object_group_inner.rb
new file mode 100644
index 00000000000..88f3a33f92c
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/models/stats_object_group_inner.rb
@@ -0,0 +1,243 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+require 'date'
+require 'time'
+
+module ErrorTrackingOpenAPI
+ class StatsObjectGroupInner
+ attr_accessor :by
+
+ attr_accessor :totals
+
+ attr_accessor :series
+
+ # Attribute mapping from ruby-style variable name to JSON key.
+ def self.attribute_map
+ {
+ :'by' => :'by',
+ :'totals' => :'totals',
+ :'series' => :'series'
+ }
+ end
+
+ # Returns all the JSON keys this model knows about
+ def self.acceptable_attributes
+ attribute_map.values
+ end
+
+ # Attribute type mapping.
+ def self.openapi_types
+ {
+ :'by' => :'Hash<String, Object>',
+ :'totals' => :'Hash<String, Object>',
+ :'series' => :'Hash<String, Object>'
+ }
+ 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 `ErrorTrackingOpenAPI::StatsObjectGroupInner` initialize method"
+ end
+
+ # check to see if the attribute exists and convert string to symbol for hash key
+ attributes = attributes.each_with_object({}) { |(k, v), h|
+ if (!self.class.attribute_map.key?(k.to_sym))
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ErrorTrackingOpenAPI::StatsObjectGroupInner`. 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?(:'by')
+ if (value = attributes[:'by']).is_a?(Hash)
+ self.by = value
+ end
+ end
+
+ if attributes.key?(:'totals')
+ if (value = attributes[:'totals']).is_a?(Hash)
+ self.totals = value
+ end
+ end
+
+ if attributes.key?(:'series')
+ if (value = attributes[:'series']).is_a?(Hash)
+ self.series = value
+ end
+ 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
+ invalid_properties = Array.new
+ 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?
+ true
+ 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 &&
+ by == o.by &&
+ totals == o.totals &&
+ series == o.series
+ 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
+ [by, totals, series].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)
+ new.build_from_hash(attributes)
+ end
+
+ # Builds the object from hash
+ # @param [Hash] attributes Model attributes in the form of hash
+ # @return [Object] Returns the model itself
+ def build_from_hash(attributes)
+ return nil unless attributes.is_a?(Hash)
+ attributes = attributes.transform_keys(&:to_sym)
+ self.class.openapi_types.each_pair do |key, type|
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
+ self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
+ end
+ elsif !attributes[self.class.attribute_map[key]].nil?
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
+ end
+ end
+
+ self
+ end
+
+ # Deserializes the data based on type
+ # @param string type Data type
+ # @param string value Value to be deserialized
+ # @return [Object] Deserialized data
+ def _deserialize(type, value)
+ case type.to_sym
+ when :Time
+ Time.parse(value)
+ when :Date
+ Date.parse(value)
+ when :String
+ value.to_s
+ when :Integer
+ value.to_i
+ when :Float
+ value.to_f
+ when :Boolean
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
+ true
+ else
+ false
+ end
+ when :Object
+ # generic object (usually a Hash), return directly
+ value
+ when /\AArray<(?<inner_type>.+)>\z/
+ inner_type = Regexp.last_match[:inner_type]
+ value.map { |v| _deserialize(inner_type, v) }
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
+ k_type = Regexp.last_match[:k_type]
+ v_type = Regexp.last_match[:v_type]
+ {}.tap do |hash|
+ value.each do |k, v|
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
+ end
+ end
+ else # model
+ # models (e.g. Pet) or oneOf
+ klass = ErrorTrackingOpenAPI.const_get(type)
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
+ end
+ end
+
+ # Returns the string representation of the object
+ # @return [String] String presentation of the object
+ def to_s
+ to_hash.to_s
+ end
+
+ # to_body is an alias to to_hash (backward compatibility)
+ # @return [Hash] Returns the object in the form of hash
+ def to_body
+ to_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
+
+ # Outputs non-array value in the form of hash
+ # For object, use to_hash. Otherwise, just return the value
+ # @param [Object] value Any valid value
+ # @return [Hash] Returns the value in the form of hash
+ def _to_hash(value)
+ if value.is_a?(Array)
+ value.compact.map { |v| _to_hash(v) }
+ elsif value.is_a?(Hash)
+ {}.tap do |hash|
+ value.each { |k, v| hash[k] = _to_hash(v) }
+ end
+ elsif value.respond_to? :to_hash
+ value.to_hash
+ else
+ value
+ end
+ end
+
+ end
+
+end
diff --git a/gems/error_tracking_open_api/lib/error_tracking_open_api/version.rb b/gems/error_tracking_open_api/lib/error_tracking_open_api/version.rb
new file mode 100644
index 00000000000..bb2a661b318
--- /dev/null
+++ b/gems/error_tracking_open_api/lib/error_tracking_open_api/version.rb
@@ -0,0 +1,15 @@
+=begin
+#Error Tracking REST API
+
+#This schema describes the API endpoints for the error tracking feature
+
+The version of the OpenAPI document: 0.0.1
+
+Generated by: https://openapi-generator.tech
+OpenAPI Generator version: 6.0.0
+
+=end
+
+module ErrorTrackingOpenAPI
+ VERSION = '1.0.0'
+end
diff --git a/gems/gem.gitlab-ci.yml b/gems/gem.gitlab-ci.yml
index 10905d8c243..4e91f0cbe44 100644
--- a/gems/gem.gitlab-ci.yml
+++ b/gems/gem.gitlab-ci.yml
@@ -11,11 +11,9 @@ spec:
default: "gems/"
---
workflow:
- name: '$PIPELINE_NAME'
+ name: '[$[[inputs.gem_name]] gem] Ruby $RUBY_VERSION pipeline'
rules:
- - if: $CI_MERGE_REQUEST_ID
- variables:
- PIPELINE_NAME: '[$[[inputs.gem_name]] gem] Ruby $RUBY_VERSION $CI_MERGE_REQUEST_EVENT_TYPE MR pipeline'
+ - when: always
variables:
BUNDLE_PATH: "vendor"
@@ -52,7 +50,7 @@ rubocop:
rules:
- exists: ["$[[inputs.gem_path_prefix]]$[[inputs.gem_name]]/.rubocop.yml"]
script:
- - bundle exec rubocop --config .rubocop.yml
+ - bundle exec rubocop
rspec:
extends: .ruby_matrix
diff --git a/gems/gitlab-safe_request_store/.gitignore b/gems/gitlab-safe_request_store/.gitignore
new file mode 100644
index 00000000000..b04a8c840df
--- /dev/null
+++ b/gems/gitlab-safe_request_store/.gitignore
@@ -0,0 +1,11 @@
+/.bundle/
+/.yardoc
+/_yardoc/
+/coverage/
+/doc/
+/pkg/
+/spec/reports/
+/tmp/
+
+# rspec failure tracking
+.rspec_status
diff --git a/gems/gitlab-safe_request_store/.gitlab-ci.yml b/gems/gitlab-safe_request_store/.gitlab-ci.yml
new file mode 100644
index 00000000000..faf215536e2
--- /dev/null
+++ b/gems/gitlab-safe_request_store/.gitlab-ci.yml
@@ -0,0 +1,4 @@
+include:
+ - local: gems/gem.gitlab-ci.yml
+ inputs:
+ gem_name: "gitlab-safe_request_store" \ No newline at end of file
diff --git a/gems/gitlab-safe_request_store/.rspec b/gems/gitlab-safe_request_store/.rspec
new file mode 100644
index 00000000000..34c5164d9b5
--- /dev/null
+++ b/gems/gitlab-safe_request_store/.rspec
@@ -0,0 +1,3 @@
+--format documentation
+--color
+--require spec_helper
diff --git a/gems/gitlab-safe_request_store/.rubocop.yml b/gems/gitlab-safe_request_store/.rubocop.yml
new file mode 100644
index 00000000000..8c670b439d3
--- /dev/null
+++ b/gems/gitlab-safe_request_store/.rubocop.yml
@@ -0,0 +1,2 @@
+inherit_from:
+ - ../config/rubocop.yml
diff --git a/gems/gitlab-safe_request_store/Gemfile b/gems/gitlab-safe_request_store/Gemfile
new file mode 100644
index 00000000000..667a61d518e
--- /dev/null
+++ b/gems/gitlab-safe_request_store/Gemfile
@@ -0,0 +1,6 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+# Specify your gem's dependencies in gitlab-safe_request_store.gemspec
+gemspec
diff --git a/gems/gitlab-safe_request_store/Gemfile.lock b/gems/gitlab-safe_request_store/Gemfile.lock
new file mode 100644
index 00000000000..50ff694d7d5
--- /dev/null
+++ b/gems/gitlab-safe_request_store/Gemfile.lock
@@ -0,0 +1,103 @@
+PATH
+ remote: .
+ specs:
+ gitlab-safe_request_store (0.1.0)
+ request_store
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ activesupport (7.0.6)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (>= 1.6, < 2)
+ minitest (>= 5.1)
+ tzinfo (~> 2.0)
+ ast (2.4.2)
+ coderay (1.1.3)
+ concurrent-ruby (1.2.2)
+ diff-lcs (1.5.0)
+ gitlab-styles (10.1.0)
+ rubocop (~> 1.50.2)
+ rubocop-graphql (~> 0.18)
+ rubocop-performance (~> 1.15)
+ rubocop-rails (~> 2.17)
+ rubocop-rspec (~> 2.22)
+ i18n (1.12.0)
+ concurrent-ruby (~> 1.0)
+ json (2.6.3)
+ method_source (1.0.0)
+ minitest (5.17.0)
+ parallel (1.22.1)
+ parser (3.2.2.3)
+ ast (~> 2.4.1)
+ racc
+ pry (0.14.2)
+ coderay (~> 1.1)
+ method_source (~> 1.0)
+ racc (1.6.2)
+ rack (3.0.4.1)
+ rainbow (3.1.1)
+ regexp_parser (2.7.0)
+ request_store (1.5.1)
+ rack (>= 1.4)
+ rexml (3.2.5)
+ rspec (3.12.0)
+ rspec-core (~> 3.12.0)
+ rspec-expectations (~> 3.12.0)
+ rspec-mocks (~> 3.12.0)
+ rspec-core (3.12.1)
+ rspec-support (~> 3.12.0)
+ rspec-expectations (3.12.2)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.12.0)
+ rspec-mocks (3.12.3)
+ diff-lcs (>= 1.2.0, < 2.0)
+ rspec-support (~> 3.12.0)
+ rspec-support (3.12.0)
+ rubocop (1.50.2)
+ json (~> 2.3)
+ parallel (~> 1.10)
+ parser (>= 3.2.0.0)
+ rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 1.8, < 3.0)
+ rexml (>= 3.2.5, < 4.0)
+ rubocop-ast (>= 1.28.0, < 2.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 2.4.0, < 3.0)
+ rubocop-ast (1.29.0)
+ parser (>= 3.2.1.0)
+ rubocop-capybara (2.18.0)
+ rubocop (~> 1.41)
+ rubocop-factory_bot (2.23.1)
+ rubocop (~> 1.33)
+ rubocop-graphql (0.19.0)
+ rubocop (>= 0.87, < 2)
+ rubocop-performance (1.18.0)
+ rubocop (>= 1.7.0, < 2.0)
+ rubocop-ast (>= 0.4.0)
+ rubocop-rails (2.20.2)
+ activesupport (>= 4.2.0)
+ rack (>= 1.1)
+ rubocop (>= 1.33.0, < 2.0)
+ rubocop-rspec (2.22.0)
+ rubocop (~> 1.33)
+ rubocop-capybara (~> 2.17)
+ rubocop-factory_bot (~> 2.22)
+ ruby-progressbar (1.11.0)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
+ unicode-display_width (2.4.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ gitlab-safe_request_store!
+ gitlab-styles (~> 10.1.0)
+ pry
+ rspec (~> 3.0)
+ rubocop (~> 1.50)
+ rubocop-rspec (~> 2.22)
+
+BUNDLED WITH
+ 2.4.16
diff --git a/gems/gitlab-safe_request_store/README.md b/gems/gitlab-safe_request_store/README.md
new file mode 100644
index 00000000000..13c20d74364
--- /dev/null
+++ b/gems/gitlab-safe_request_store/README.md
@@ -0,0 +1,42 @@
+# Gitlab::SafeRequestStore
+
+A safer abstraction of `RequestStore` that comes with [`request_store` gem](https://github.com/steveklabnik/request_store).
+
+This gem works as a proxy to `RequestStore` allowing you to use the same interface even when the Request Store
+is not active. In this case a `NullStore` is being used under the hood providing no-ops when the Request Store
+is not active.
+
+## Usage
+
+When request store is active it works the same as `RequestStore`:
+
+```ruby
+Gitlab::SafeRequestStore.active? # => true
+Gitlab::SafeRequestStore[:test] = 123
+Gitlab::SafeRequestStore[:test] # => 123
+```
+
+When request store is not active it does nothing:
+
+```ruby
+Gitlab::SafeRequestStore.active? # => false
+Gitlab::SafeRequestStore[:test] = 123
+Gitlab::SafeRequestStore[:test] # => nil
+```
+
+You can enforce the request store to temporarily be active using:
+
+```ruby
+Gitlab::SafeRequestStore.active? # => false
+
+Gitlab::SafeRequestStore.ensure_request_store do
+ Gitlab::SafeRequestStore.active? # => true
+ # do something...
+end
+
+Gitlab::SafeRequestStore.active? # => false
+```
+
+## Development
+
+Follow the GitLab [gems development guidelines](../../doc/development/gems.md).
diff --git a/gems/gitlab-safe_request_store/gitlab-safe_request_store.gemspec b/gems/gitlab-safe_request_store/gitlab-safe_request_store.gemspec
new file mode 100644
index 00000000000..a685a1eb447
--- /dev/null
+++ b/gems/gitlab-safe_request_store/gitlab-safe_request_store.gemspec
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require_relative "lib/gitlab/safe_request_store/version"
+
+Gem::Specification.new do |spec|
+ spec.name = "gitlab-safe_request_store"
+ spec.version = Gitlab::SafeRequestStore::Version::VERSION
+ spec.authors = ["group::tenant-scale"]
+ spec.email = ["engineering@gitlab.com"]
+
+ spec.summary = "Wrapper for RequestStore"
+ spec.description = "Provides a safe interface for RequestStore even when it is not active."
+ spec.homepage = "https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-safe_request_store"
+ spec.license = 'MIT'
+ spec.required_ruby_version = ">= 3.0"
+ spec.metadata["rubygems_mfa_required"] = "true"
+
+ spec.files = Dir['lib/**/*.rb']
+ spec.require_paths = ["lib"]
+
+ spec.add_runtime_dependency "request_store"
+
+ spec.add_development_dependency "gitlab-styles", "~> 10.1.0"
+ spec.add_development_dependency "pry"
+ spec.add_development_dependency "rspec", "~> 3.0"
+ spec.add_development_dependency "rubocop", "~> 1.50"
+ spec.add_development_dependency "rubocop-rspec", "~> 2.22"
+end
diff --git a/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store.rb b/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store.rb
new file mode 100644
index 00000000000..65594283fb8
--- /dev/null
+++ b/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store.rb
@@ -0,0 +1,73 @@
+# frozen_string_literal: true
+
+require 'forwardable'
+
+require 'request_store'
+
+require_relative "safe_request_store/version"
+require_relative "safe_request_store/null_store"
+
+module Gitlab
+ module SafeRequestStore
+ NULL_STORE = NullStore.new
+
+ class << self
+ extend Forwardable
+
+ # These methods should always run directly against RequestStore
+ def_delegators :RequestStore, :clear!, :begin!, :end!, :active?
+
+ # These methods will run against NullStore if RequestStore is disabled
+ def_delegators :store, :read, :[], :write, :[]=, :exist?, :fetch, :delete
+
+ def store
+ if RequestStore.active?
+ RequestStore
+ else
+ NULL_STORE
+ end
+ end
+
+ # Access to the backing storage of the request store. This returns an object
+ # with `[]` and `[]=` methods that does not discard values.
+ #
+ # This can be useful if storage is needed for a delimited purpose, and the
+ # forgetful nature of the null store is undesirable.
+ def storage
+ store.store
+ end
+
+ # This method accept an options hash to be compatible with
+ # ActiveSupport::Cache::Store#write method. The options are
+ # not passed to the underlying cache implementation because
+ # RequestStore#write accepts only a key, and value params.
+ def write(key, value, _options = nil)
+ store.write(key, value)
+ end
+
+ def delete_if(&_block)
+ return unless RequestStore.active?
+
+ storage.delete_if { |k, _v| yield(k) }
+ end
+
+ def ensure_request_store(&block)
+ # Skip enabling the request store if it was already active. Whatever
+ # instantiated the request store first is responsible for clearing it
+ return yield if RequestStore.active?
+
+ enabling_request_store(&block)
+ end
+
+ private
+
+ def enabling_request_store
+ RequestStore.begin!
+ yield
+ ensure
+ RequestStore.end!
+ RequestStore.clear!
+ end
+ end
+ end
+end
diff --git a/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store/null_store.rb b/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store/null_store.rb
new file mode 100644
index 00000000000..9a75ce6421c
--- /dev/null
+++ b/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store/null_store.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module SafeRequestStore
+ # The methods `begin!`, `clear!`, and `end!` are not defined because they
+ # should only be called directly on `RequestStore`.
+ class NullStore
+ def store
+ {}
+ end
+
+ def active?
+ # no-op
+ end
+
+ def read(_key)
+ # no-op
+ end
+
+ def [](_key)
+ # no-op
+ end
+
+ def write(_key, value)
+ value
+ end
+
+ def []=(_key, value)
+ value
+ end
+
+ def exist?(_key)
+ false
+ end
+
+ def fetch(_key, &_block)
+ yield
+ end
+
+ def delete(key, &block)
+ yield(key) if block
+ end
+ end
+ end
+end
diff --git a/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store/version.rb b/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store/version.rb
new file mode 100644
index 00000000000..c7eecf1efe0
--- /dev/null
+++ b/gems/gitlab-safe_request_store/lib/gitlab/safe_request_store/version.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module SafeRequestStore
+ module Version
+ VERSION = "0.1.0"
+ end
+ end
+end
diff --git a/gems/gitlab-safe_request_store/spec/gitlab/safe_request_store/null_store_spec.rb b/gems/gitlab-safe_request_store/spec/gitlab/safe_request_store/null_store_spec.rb
new file mode 100644
index 00000000000..a6bd4bba50f
--- /dev/null
+++ b/gems/gitlab-safe_request_store/spec/gitlab/safe_request_store/null_store_spec.rb
@@ -0,0 +1,75 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::SafeRequestStore::NullStore do
+ let(:null_store) { described_class.new }
+
+ describe '#store' do
+ it 'returns an empty hash' do
+ expect(null_store.store).to eq({})
+ end
+ end
+
+ describe '#active?' do
+ it 'returns falsey' do
+ expect(null_store.active?).to be_falsey
+ end
+ end
+
+ describe '#read' do
+ it 'returns nil' do
+ expect(null_store.read('foo')).to be nil
+ end
+ end
+
+ describe '#[]' do
+ it 'returns nil' do
+ expect(null_store['foo']).to be nil
+ end
+ end
+
+ describe '#write' do
+ it 'returns the same value' do
+ expect(null_store.write('key', 'value')).to eq('value')
+ end
+ end
+
+ describe '#[]=' do
+ it 'returns the same value' do
+ expect(null_store['key'] = 'value').to eq('value')
+ end
+ end
+
+ describe '#exist?' do
+ it 'returns falsey' do
+ expect(null_store.exist?('foo')).to be_falsey
+ end
+ end
+
+ describe '#fetch' do
+ it 'returns the block result' do
+ expect(null_store.fetch('key') { 'block result' }).to eq('block result') # rubocop:disable Style/RedundantFetchBlock
+ end
+ end
+
+ describe '#delete' do
+ context 'when a block is given' do
+ it 'yields the key to the block' do
+ expect do |b|
+ null_store.delete('foo', &b)
+ end.to yield_with_args('foo')
+ end
+
+ it 'returns the block result' do
+ expect(null_store.delete('foo') { |_key| 'block result' }).to eq('block result')
+ end
+ end
+
+ context 'when a block is not given' do
+ it 'returns nil' do
+ expect(null_store.delete('foo')).to be nil
+ end
+ end
+ end
+end
diff --git a/gems/gitlab-safe_request_store/spec/gitlab/safe_request_store_spec.rb b/gems/gitlab-safe_request_store/spec/gitlab/safe_request_store_spec.rb
new file mode 100644
index 00000000000..a171c50ca3e
--- /dev/null
+++ b/gems/gitlab-safe_request_store/spec/gitlab/safe_request_store_spec.rb
@@ -0,0 +1,281 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::SafeRequestStore do
+ it "has a version number" do
+ expect(described_class::Version::VERSION).not_to be nil
+ end
+
+ describe '.ensure_request_store' do
+ it 'starts a request store and yields control' do
+ expect(RequestStore).to receive(:begin!).ordered
+ expect(RequestStore).to receive(:end!).ordered
+ expect(RequestStore).to receive(:clear!).ordered
+
+ expect { |b| described_class.ensure_request_store(&b) }.to yield_control
+ end
+
+ it 'only starts a request store once when nested' do
+ expect(RequestStore).to receive(:begin!).ordered.once.and_call_original
+ expect(RequestStore).to receive(:end!).ordered.once.and_call_original
+ expect(RequestStore).to receive(:clear!).ordered.once.and_call_original
+
+ described_class.ensure_request_store do
+ expect { |b| described_class.ensure_request_store(&b) }.to yield_control
+ end
+ end
+ end
+
+ describe '.store' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect(described_class.store).to eq(RequestStore)
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'does not use RequestStore' do
+ expect(described_class.store).to be_a(described_class::NullStore)
+ end
+ end
+ end
+
+ describe '.begin!' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect(RequestStore).to receive(:begin!)
+
+ described_class.begin!
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'uses RequestStore' do
+ expect(RequestStore).to receive(:begin!)
+
+ described_class.begin!
+ end
+ end
+ end
+
+ describe '.clear!' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect(RequestStore).to receive(:clear!).once.and_call_original
+
+ described_class.clear!
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'uses RequestStore' do
+ expect(RequestStore).to receive(:clear!).and_call_original
+
+ described_class.clear!
+ end
+ end
+ end
+
+ describe '.end!' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect(RequestStore).to receive(:end!).once.and_call_original
+
+ described_class.end!
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'uses RequestStore' do
+ expect(RequestStore).to receive(:end!).and_call_original
+
+ described_class.end!
+ end
+ end
+ end
+
+ describe '.write' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect do
+ described_class.write('foo', true)
+ end.to change { described_class.read('foo') }.from(nil).to(true)
+ end
+
+ it 'does not pass the options hash to the underlying store implementation' do
+ expect(described_class.store).to receive(:write).with('foo', true)
+
+ described_class.write('foo', true, expires_in: 15)
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'does not use RequestStore' do
+ expect do
+ described_class.write('foo', true)
+ end.not_to change { described_class.read('foo') }.from(nil)
+ end
+
+ it 'does not pass the options hash to the underlying store implementation' do
+ expect(described_class.store).to receive(:write).with('foo', true)
+
+ described_class.write('foo', true, expires_in: 15)
+ end
+ end
+ end
+
+ describe '.[]=' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect do
+ described_class['foo'] = true
+ end.to change { described_class.read('foo') }.from(nil).to(true)
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'does not use RequestStore' do
+ expect do
+ described_class['foo'] = true
+ end.not_to change { described_class.read('foo') }.from(nil)
+ end
+ end
+ end
+
+ describe '.read' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect do
+ RequestStore.write('foo', true)
+ end.to change { described_class.read('foo') }.from(nil).to(true)
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'does not use RequestStore' do
+ expect do
+ RequestStore.write('foo', true)
+ end.not_to change { described_class.read('foo') }.from(nil)
+
+ RequestStore.clear! # Clean up
+ end
+ end
+ end
+
+ describe '.[]' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect do
+ RequestStore.write('foo', true)
+ end.to change { described_class['foo'] }.from(nil).to(true)
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'does not use RequestStore' do
+ expect do
+ RequestStore.write('foo', true)
+ end.not_to change { described_class['foo'] }.from(nil)
+
+ RequestStore.clear! # Clean up
+ end
+ end
+ end
+
+ describe '.exist?' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect do
+ RequestStore.write('foo', 'not nil')
+ end.to change { described_class.exist?('foo') }.from(false).to(true)
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'does not use RequestStore' do
+ expect do
+ RequestStore.write('foo', 'not nil')
+ end.not_to change { described_class.exist?('foo') }.from(false)
+
+ RequestStore.clear! # Clean up
+ end
+ end
+ end
+
+ describe '.fetch' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ expect do
+ described_class.fetch('foo') { 'block result' } # rubocop:disable Style/RedundantFetchBlock
+ end.to change { described_class.read('foo') }.from(nil).to('block result')
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ it 'does not use RequestStore' do
+ RequestStore.clear! # Ensure clean
+
+ expect do
+ described_class.fetch('foo') { 'block result' } # rubocop:disable Style/RedundantFetchBlock
+ end.not_to change { described_class.read('foo') }.from(nil)
+
+ RequestStore.clear! # Clean up
+ end
+ end
+ end
+
+ describe '.delete' do
+ context 'when RequestStore is active', :enable_request_store do
+ it 'uses RequestStore' do
+ described_class.write('foo', true)
+
+ expect do
+ described_class.delete('foo')
+ end.to change { described_class.read('foo') }.from(true).to(nil)
+ end
+
+ context 'when given a block and the key exists' do
+ it 'does not execute the block' do
+ described_class.write('foo', true)
+
+ expect do |b|
+ described_class.delete('foo', &b)
+ end.not_to yield_control
+ end
+ end
+
+ context 'when given a block and the key does not exist' do
+ it 'yields the key and returns the block result' do
+ result = described_class.delete('foo') { |key| "#{key} block result" }
+
+ expect(result).to eq('foo block result')
+ end
+ end
+ end
+
+ context 'when RequestStore is NOT active' do
+ before do
+ RequestStore.write('foo', true)
+ end
+
+ after do
+ RequestStore.clear! # Clean up
+ end
+
+ it 'does not use RequestStore' do
+ expect do
+ described_class.delete('foo')
+ end.not_to change { RequestStore.read('foo') }.from(true)
+ end
+
+ context 'when given a block' do
+ it 'yields the key and returns the block result' do
+ result = described_class.delete('foo') { |key| "#{key} block result" }
+
+ expect(result).to eq('foo block result')
+ end
+ end
+ end
+ end
+end
diff --git a/gems/gitlab-safe_request_store/spec/spec_helper.rb b/gems/gitlab-safe_request_store/spec/spec_helper.rb
new file mode 100644
index 00000000000..08663dd7cb1
--- /dev/null
+++ b/gems/gitlab-safe_request_store/spec/spec_helper.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+require "gitlab/safe_request_store"
+
+RSpec.configure do |config|
+ # Enable flags like --only-failures and --next-failure
+ config.example_status_persistence_file_path = ".rspec_status"
+
+ # Disable RSpec exposing methods globally on `Module` and `main`
+ config.disable_monkey_patching!
+
+ config.expect_with :rspec do |c|
+ c.syntax = :expect
+ end
+
+ config.around(:example, :enable_request_store) do |example|
+ ::Gitlab::SafeRequestStore.ensure_request_store { example.run }
+ end
+end
diff --git a/gems/gitlab-schema-validation/Gemfile.lock b/gems/gitlab-schema-validation/Gemfile.lock
index 5ad804d3660..124e03422e9 100644
--- a/gems/gitlab-schema-validation/Gemfile.lock
+++ b/gems/gitlab-schema-validation/Gemfile.lock
@@ -40,6 +40,7 @@ GEM
parser (3.2.2.3)
ast (~> 2.4.1)
racc
+ pg (1.5.3)
pg_query (4.2.1)
google-protobuf (>= 3.22.3)
proc_to_ast (0.1.0)
@@ -126,6 +127,7 @@ PLATFORMS
DEPENDENCIES
gitlab-schema-validation!
gitlab-styles (~> 10.1.0)
+ pg (~> 1.5.3)
pry
rspec (~> 3.0)
rspec-benchmark (~> 0.6.0)
diff --git a/gems/gitlab-schema-validation/gitlab-schema-validation.gemspec b/gems/gitlab-schema-validation/gitlab-schema-validation.gemspec
index 47ca8b65b5d..513035dac4b 100644
--- a/gems/gitlab-schema-validation/gitlab-schema-validation.gemspec
+++ b/gems/gitlab-schema-validation/gitlab-schema-validation.gemspec
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "pg_query"
spec.add_development_dependency "gitlab-styles", "~> 10.1.0"
+ spec.add_development_dependency "pg", "~> 1.5.3"
spec.add_development_dependency "pry"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rspec-benchmark", "~> 0.6.0"
diff --git a/gems/gitlab-schema-validation/lib/gitlab/schema/validation.rb b/gems/gitlab-schema-validation/lib/gitlab/schema/validation.rb
index 5211358a197..98da37cf16b 100644
--- a/gems/gitlab-schema-validation/lib/gitlab/schema/validation.rb
+++ b/gems/gitlab-schema-validation/lib/gitlab/schema/validation.rb
@@ -28,8 +28,12 @@ require_relative 'validation/validators/different_definition_triggers'
require_relative 'validation/validators/extra_triggers'
require_relative 'validation/validators/missing_triggers'
+require_relative 'validation/sources/connection_adapters/base'
+require_relative 'validation/sources/connection_adapters/active_record_adapter'
+require_relative 'validation/sources/connection_adapters/pg_adapter'
require_relative 'validation/sources/structure_sql'
require_relative 'validation/sources/database'
+require_relative 'validation/sources/connection'
require_relative 'validation/schema_objects/base'
require_relative 'validation/schema_objects/column'
diff --git a/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection.rb b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection.rb
new file mode 100644
index 00000000000..83f282ef56d
--- /dev/null
+++ b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Schema
+ module Validation
+ module Sources
+ class AdapterNotSupportedError < StandardError
+ def initialize(adapter)
+ @adapter = adapter
+ end
+
+ def message
+ "#{adapter} is not supported"
+ end
+
+ private
+
+ attr_reader :adapter
+ end
+
+ class Connection
+ CONNECTION_ADAPTERS = {
+ 'Gitlab::Database::LoadBalancing::ConnectionProxy' => ConnectionAdapters::ActiveRecordAdapter,
+ 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' => ConnectionAdapters::ActiveRecordAdapter,
+ 'PG::Connection' => ConnectionAdapters::PgAdapter
+ }.freeze
+
+ def initialize(connection)
+ @connection_adapter = fetch_adapter(connection)
+ end
+
+ def current_schema
+ connection_adapter.current_schema
+ end
+
+ def select_rows(sql, schemas = [])
+ connection_adapter.select_rows(sql, schemas)
+ end
+
+ def exec_query(sql, schemas = [])
+ connection_adapter.exec_query(sql, schemas)
+ end
+
+ private
+
+ attr_reader :connection_adapter
+
+ def fetch_adapter(connection)
+ CONNECTION_ADAPTERS.fetch(connection.class.name).new(connection)
+ rescue KeyError => e
+ raise AdapterNotSupportedError, e.key
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/active_record_adapter.rb b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/active_record_adapter.rb
new file mode 100644
index 00000000000..10af0fc3647
--- /dev/null
+++ b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/active_record_adapter.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Schema
+ module Validation
+ module Sources
+ module ConnectionAdapters
+ class ActiveRecordAdapter < Base
+ extend Forwardable
+
+ def_delegators :@connection, :current_schema
+
+ def exec_query(sql, schemas)
+ connection.exec_query(sql, nil, schemas)
+ end
+
+ def select_rows(sql, schemas)
+ connection.select_rows(sql, nil, schemas)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/base.rb b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/base.rb
new file mode 100644
index 00000000000..713cbbe0a6d
--- /dev/null
+++ b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/base.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Schema
+ module Validation
+ module Sources
+ module ConnectionAdapters
+ class Base
+ def initialize(connection)
+ @connection = connection
+ end
+
+ def current_schema
+ raise NotImplementedError, "#{self.class} does not implement #{__method__}"
+ end
+
+ def select_rows(sql, schemas = [])
+ raise NotImplementedError, "#{self.class} does not implement #{__method__}"
+ end
+
+ def exec_query(sql, schemas = [])
+ raise NotImplementedError, "#{self.class} does not implement #{__method__}"
+ end
+
+ private
+
+ attr_reader :connection
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/pg_adapter.rb b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/pg_adapter.rb
new file mode 100644
index 00000000000..4dcaf15be71
--- /dev/null
+++ b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/connection_adapters/pg_adapter.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Schema
+ module Validation
+ module Sources
+ module ConnectionAdapters
+ class PgAdapter < Base
+ def initialize(connection)
+ @connection = connection
+ @connection.type_map_for_results = PG::BasicTypeMapForResults.new(connection)
+ end
+
+ def current_schema
+ connection.exec('SELECT current_schema').first['current_schema']
+ end
+
+ def exec_query(sql, schemas)
+ connection.exec(sql, schemas)
+ end
+
+ def select_rows(sql, schemas)
+ exec_query(sql, schemas).values
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/database.rb b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/database.rb
index 8505d1f149a..45ce4d8ebfe 100644
--- a/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/database.rb
+++ b/gems/gitlab-schema-validation/lib/gitlab/schema/validation/sources/database.rb
@@ -8,7 +8,7 @@ module Gitlab
STATIC_PARTITIONS_SCHEMA = 'gitlab_partitions_static'
def initialize(connection)
- @connection = connection
+ @connection = Connection.new(connection)
end
def fetch_index_by_name(index_name)
@@ -102,7 +102,7 @@ module Gitlab
SQL
# rubocop:enable Rails/SquishedSQLHeredocs
- connection.select_rows(sql, nil, schemas).to_h
+ connection.select_rows(sql, schemas).to_h
end
def table_map
@@ -136,7 +136,7 @@ module Gitlab
SQL
# rubocop:enable Rails/SquishedSQLHeredocs
- connection.exec_query(sql, nil, schemas).group_by { |row| row['table_name'] }
+ connection.exec_query(sql, schemas).group_by { |row| row['table_name'] }
end
def fetch_indexes
@@ -148,7 +148,7 @@ module Gitlab
SQL
# rubocop:enable Rails/SquishedSQLHeredocs
- connection.select_rows(sql, nil, schemas).to_h
+ connection.select_rows(sql, schemas).to_h
end
def index_map
@@ -183,7 +183,7 @@ module Gitlab
SQL
# rubocop:enable Rails/SquishedSQLHeredocs
- connection.exec_query(sql, nil, [connection.current_schema])
+ connection.exec_query(sql, [connection.current_schema])
end
end
end
diff --git a/gems/gitlab-schema-validation/spec/lib/gitlab/schema/validation/sources/connection_spec.rb b/gems/gitlab-schema-validation/spec/lib/gitlab/schema/validation/sources/connection_spec.rb
new file mode 100644
index 00000000000..f3469665d57
--- /dev/null
+++ b/gems/gitlab-schema-validation/spec/lib/gitlab/schema/validation/sources/connection_spec.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Gitlab::Schema::Validation::Sources::Connection, feature_category: :database do
+ let(:sql) { 'SELECT column_one, column_two FROM my_table WHERE schema_name IN ($1);' }
+ let(:schemas) { ['public'] }
+ let(:query_result) do
+ [
+ { 'name' => 'Person one', 'email' => 'person.one@gitlab.com' },
+ { 'name' => 'Person two', 'email' => 'person.two@gitlab.com' }
+ ]
+ end
+
+ let(:rows) { query_result.map(&:values) }
+
+ context 'when using active record for postgres adapter' do
+ let(:schema) { 'public' }
+ let(:connection_class_name) { 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' }
+ let(:adapter_class) { Gitlab::Schema::Validation::Sources::ConnectionAdapters::ActiveRecordAdapter }
+
+ it_behaves_like 'connection adapter'
+ end
+
+ context 'when using gitlab active record adapter' do
+ let(:schema) { 'gitlab_main' }
+ let(:connection_class_name) { 'Gitlab::Database::LoadBalancing::ConnectionProxy' }
+ let(:adapter_class) { Gitlab::Schema::Validation::Sources::ConnectionAdapters::ActiveRecordAdapter }
+
+ it_behaves_like 'connection adapter'
+ end
+
+ context 'when using postgres adapter' do
+ let(:schema) { 'public' }
+ let(:connection_class_name) { 'PG::Connection' }
+ let(:adapter_class) { Gitlab::Schema::Validation::Sources::ConnectionAdapters::PgAdapter }
+
+ before do
+ allow(connection_object).to receive(:exec)
+ allow(connection_object).to receive(:type_map_for_results=)
+ end
+
+ it_behaves_like 'connection adapter'
+ end
+
+ context 'when using an unsupported connection adapter' do
+ subject(:connection) { described_class.new(connection_object) }
+
+ let(:connection_class_name) { 'ActiveRecord::ConnectionAdapters::InvalidAdapter' }
+ let(:connection_class) { class_double(Class, name: connection_class_name) }
+ let(:connection_object) { instance_double(connection_class_name, class: connection_class) }
+ let(:error_class) { Gitlab::Schema::Validation::Sources::AdapterNotSupportedError }
+ let(:error_message) { 'ActiveRecord::ConnectionAdapters::InvalidAdapter is not supported' }
+
+ it { expect { connection }.to raise_error(error_class, error_message) }
+ end
+end
diff --git a/gems/gitlab-schema-validation/spec/spec_helper.rb b/gems/gitlab-schema-validation/spec/spec_helper.rb
index c11c5021e3b..4eee709dc67 100644
--- a/gems/gitlab-schema-validation/spec/spec_helper.rb
+++ b/gems/gitlab-schema-validation/spec/spec_helper.rb
@@ -2,6 +2,7 @@
require "gitlab/schema/validation"
require 'rspec-parameterized'
+require 'pg'
RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
diff --git a/gems/gitlab-schema-validation/spec/support/shared_examples/connection_adapter_shared_examples.rb b/gems/gitlab-schema-validation/spec/support/shared_examples/connection_adapter_shared_examples.rb
new file mode 100644
index 00000000000..f2b1ee7a934
--- /dev/null
+++ b/gems/gitlab-schema-validation/spec/support/shared_examples/connection_adapter_shared_examples.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.shared_examples 'connection adapter' do
+ subject(:connection) { described_class.new(connection_object) }
+
+ let(:connection_class) { class_double(Class, name: connection_class_name) }
+ let(:connection_object) { instance_double(connection_class_name, class: connection_class) }
+ let(:adapter) do
+ instance_double(
+ described_class::CONNECTION_ADAPTERS[connection_class_name],
+ current_schema: schema,
+ exec_query: query_result,
+ select_rows: rows
+ )
+ end
+
+ before do
+ allow(connection).to receive(:connection_adapter).and_return(adapter)
+ end
+
+ context 'when using a valid connection adapter' do
+ describe '#current_schema' do
+ it { expect(connection.current_schema).to eq(schema) }
+ end
+
+ describe '#select_rows' do
+ it { expect(connection.select_rows(sql, schemas)).to eq(rows) }
+ end
+
+ describe '#exec_query' do
+ it { expect(connection.exec_query(sql, schemas)).to eq(query_result) }
+ end
+ end
+end
diff --git a/gems/gitlab-schema-validation/spec/support/shared_examples/foreign_key_validators_shared_examples.rb b/gems/gitlab-schema-validation/spec/support/shared_examples/foreign_key_validators_shared_examples.rb
index 1f33c8bd760..8de9c165f8a 100644
--- a/gems/gitlab-schema-validation/spec/support/shared_examples/foreign_key_validators_shared_examples.rb
+++ b/gems/gitlab-schema-validation/spec/support/shared_examples/foreign_key_validators_shared_examples.rb
@@ -10,8 +10,11 @@ RSpec.shared_examples 'foreign key validators' do |validator, expected_result|
let(:inconsistency_type) { validator.to_s }
let(:database_name) { 'main' }
let(:schema) { 'public' }
+ let(:connection_class) { class_double(Class, name: 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter') }
# rubocop:disable RSpec/VerifiedDoubleReference
- let(:connection) { instance_double('connection', exec_query: database_query, current_schema: 'public') }
+ let(:connection) do
+ instance_double('connection', class: connection_class, exec_query: database_query, current_schema: 'public')
+ end
# rubocop:enable RSpec/VerifiedDoubleReference
let(:database) { Gitlab::Schema::Validation::Sources::Database.new(connection) }
diff --git a/gems/gitlab-schema-validation/spec/support/shared_examples/index_validators_shared_examples.rb b/gems/gitlab-schema-validation/spec/support/shared_examples/index_validators_shared_examples.rb
index cc20c0dc765..36a621ffb35 100644
--- a/gems/gitlab-schema-validation/spec/support/shared_examples/index_validators_shared_examples.rb
+++ b/gems/gitlab-schema-validation/spec/support/shared_examples/index_validators_shared_examples.rb
@@ -13,9 +13,12 @@ RSpec.shared_examples 'index validators' do |validator, expected_result|
end
let(:inconsistency_type) { validator.name }
+ let(:connection_class) { class_double(Class, name: 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter') }
# rubocop:disable RSpec/VerifiedDoubleReference
- let(:connection) { instance_double('connection', select_rows: database_indexes, current_schema: 'public') }
+ let(:connection) do
+ instance_double('connection', class: connection_class, select_rows: database_indexes, current_schema: 'public')
+ end
# rubocop:enable RSpec/VerifiedDoubleReference
let(:schema) { 'public' }
diff --git a/gems/gitlab-schema-validation/spec/support/shared_examples/table_validators_shared_examples.rb b/gems/gitlab-schema-validation/spec/support/shared_examples/table_validators_shared_examples.rb
index d2a51a9b202..5c5a67c4628 100644
--- a/gems/gitlab-schema-validation/spec/support/shared_examples/table_validators_shared_examples.rb
+++ b/gems/gitlab-schema-validation/spec/support/shared_examples/table_validators_shared_examples.rb
@@ -7,9 +7,13 @@ RSpec.shared_examples "table validators" do |validator, expected_result|
let(:structure_file_path) { 'spec/fixtures/structure.sql' }
let(:inconsistency_type) { validator.to_s }
+ let(:connection_class) { class_double(Class, name: 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter') }
# rubocop:disable RSpec/VerifiedDoubleReference
- let(:connection) { instance_double('connection', exec_query: database_tables, current_schema: 'public') }
+ let(:connection) do
+ instance_double('connection', class: connection_class, exec_query: database_tables, current_schema: 'public')
+ end
# rubocop:enable RSpec/VerifiedDoubleReference
+
let(:schema) { 'public' }
let(:database) { Gitlab::Schema::Validation::Sources::Database.new(connection) }
let(:structure_file) { Gitlab::Schema::Validation::Sources::StructureSql.new(structure_file_path, schema) }
diff --git a/gems/gitlab-schema-validation/spec/support/shared_examples/trigger_validators_shared_examples.rb b/gems/gitlab-schema-validation/spec/support/shared_examples/trigger_validators_shared_examples.rb
index 45ed87082bb..36eedcde280 100644
--- a/gems/gitlab-schema-validation/spec/support/shared_examples/trigger_validators_shared_examples.rb
+++ b/gems/gitlab-schema-validation/spec/support/shared_examples/trigger_validators_shared_examples.rb
@@ -11,9 +11,12 @@ RSpec.shared_examples 'trigger validators' do |validator, expected_result|
let(:database_name) { 'main' }
let(:schema) { 'public' }
let(:database) { Gitlab::Schema::Validation::Sources::Database.new(connection) }
+ let(:connection_class) { class_double(Class, name: 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter') }
# rubocop:disable RSpec/VerifiedDoubleReference
- let(:connection) { instance_double('connection', select_rows: database_triggers, current_schema: 'public') }
+ let(:connection) do
+ instance_double('connection', class: connection_class, select_rows: database_triggers, current_schema: 'public')
+ end
# rubocop:enable RSpec/VerifiedDoubleReference
let(:database_triggers) do