speakeasy_client_sdk_ruby 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/sdk/apiendpoints.rb +338 -0
- data/lib/sdk/apis.rb +264 -0
- data/lib/sdk/embeds.rb +128 -0
- data/lib/sdk/metadata.rb +144 -0
- data/lib/sdk/models/operations/deleteapi.rb +52 -0
- data/lib/sdk/models/operations/deleteapiendpoint.rb +55 -0
- data/lib/sdk/models/operations/deleteschema.rb +55 -0
- data/lib/sdk/models/operations/deleteversionmetadata.rb +58 -0
- data/lib/sdk/models/operations/downloadschema.rb +55 -0
- data/lib/sdk/models/operations/downloadschemarevision.rb +58 -0
- data/lib/sdk/models/operations/findapiendpoint.rb +59 -0
- data/lib/sdk/models/operations/generateopenapispec.rb +56 -0
- data/lib/sdk/models/operations/generateopenapispecforapiendpoint.rb +59 -0
- data/lib/sdk/models/operations/generatepostmancollection.rb +55 -0
- data/lib/sdk/models/operations/generatepostmancollectionforapiendpoint.rb +58 -0
- data/lib/sdk/models/operations/generaterequestpostmancollection.rb +52 -0
- data/lib/sdk/models/operations/getallapiendpoints.rb +52 -0
- data/lib/sdk/models/operations/getallapiversions.rb +72 -0
- data/lib/sdk/models/operations/getallforversionapiendpoints.rb +55 -0
- data/lib/sdk/models/operations/getapiendpoint.rb +59 -0
- data/lib/sdk/models/operations/getapis.rb +69 -0
- data/lib/sdk/models/operations/getembedaccesstoken.rb +60 -0
- data/lib/sdk/models/operations/getplugins.rb +38 -0
- data/lib/sdk/models/operations/getrequestfromeventlog.rb +53 -0
- data/lib/sdk/models/operations/getschema.rb +56 -0
- data/lib/sdk/models/operations/getschemadiff.rb +62 -0
- data/lib/sdk/models/operations/getschemarevision.rb +59 -0
- data/lib/sdk/models/operations/getschemas.rb +55 -0
- data/lib/sdk/models/operations/getvalidembedaccesstokens.rb +38 -0
- data/lib/sdk/models/operations/getversionmetadata.rb +55 -0
- data/lib/sdk/models/operations/insertversionmetadata.rb +60 -0
- data/lib/sdk/models/operations/queryeventlog.rb +53 -0
- data/lib/sdk/models/operations/registerschema.rb +86 -0
- data/lib/sdk/models/operations/revokeembedaccesstoken.rb +49 -0
- data/lib/sdk/models/operations/runplugin.rb +56 -0
- data/lib/sdk/models/operations/upsertapi.rb +57 -0
- data/lib/sdk/models/operations/upsertapiendpoint.rb +63 -0
- data/lib/sdk/models/operations/upsertplugin.rb +39 -0
- data/lib/sdk/models/operations/validateapikey.rb +35 -0
- data/lib/sdk/models/shared/api.rb +69 -0
- data/lib/sdk/models/shared/apiendpoint.rb +84 -0
- data/lib/sdk/models/shared/boundedrequest.rb +64 -0
- data/lib/sdk/models/shared/embedaccesstokenresponse.rb +25 -0
- data/lib/sdk/models/shared/embedtoken.rb +52 -0
- data/lib/sdk/models/shared/error.rb +28 -0
- data/lib/sdk/models/shared/filter.rb +31 -0
- data/lib/sdk/models/shared/filters.rb +34 -0
- data/lib/sdk/models/shared/generateopenapispecdiff.rb +28 -0
- data/lib/sdk/models/shared/plugin.rb +43 -0
- data/lib/sdk/models/shared/requestmetadata.rb +28 -0
- data/lib/sdk/models/shared/schema.rb +40 -0
- data/lib/sdk/models/shared/schemadiff.rb +48 -0
- data/lib/sdk/models/shared/security.rb +25 -0
- data/lib/sdk/models/shared/unboundedrequest.rb +37 -0
- data/lib/sdk/models/shared/versionmetadata.rb +57 -0
- data/lib/sdk/plugins.rb +140 -0
- data/lib/sdk/requests.rb +136 -0
- data/lib/sdk/schemas.rb +334 -0
- data/lib/sdk/sdk.rb +173 -0
- data/lib/sdk/utils/metadata_fields.rb +154 -0
- data/lib/sdk/utils/retries.rb +130 -0
- data/lib/sdk/utils/utils.rb +769 -0
- data/lib/speakeasy_client_sdk_ruby.rb +70 -0
- metadata +206 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'sorbet-runtime'
|
7
|
+
require 'faraday'
|
8
|
+
|
9
|
+
module SpeakeasyClientSDK
|
10
|
+
module Shared
|
11
|
+
# OK
|
12
|
+
class GenerateOpenApiSpecDiff < SpeakeasyClientSDK::Utils::FieldAugmented
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
|
16
|
+
field :current_schema, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('current_schema') } }
|
17
|
+
|
18
|
+
field :new_schema, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('new_schema') } }
|
19
|
+
|
20
|
+
|
21
|
+
sig { params(current_schema: String, new_schema: String).void }
|
22
|
+
def initialize(current_schema: nil, new_schema: nil)
|
23
|
+
@current_schema = current_schema
|
24
|
+
@new_schema = new_schema
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'sorbet-runtime'
|
7
|
+
require 'faraday'
|
8
|
+
|
9
|
+
module SpeakeasyClientSDK
|
10
|
+
module Shared
|
11
|
+
# A plugin is a short script that is run against ingested requests
|
12
|
+
class Plugin < SpeakeasyClientSDK::Utils::FieldAugmented
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
|
16
|
+
field :code, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('code') } }
|
17
|
+
|
18
|
+
field :plugin_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('plugin_id') } }
|
19
|
+
|
20
|
+
field :title, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('title') } }
|
21
|
+
|
22
|
+
field :workspace_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('workspace_id') } }
|
23
|
+
|
24
|
+
field :created_at, T.nilable(DateTime), { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('created_at'), 'decoder': Utils.datetime_from_iso_format(true) } }
|
25
|
+
|
26
|
+
field :eval_hash, T.nilable(String), { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('eval_hash') } }
|
27
|
+
|
28
|
+
field :updated_at, T.nilable(DateTime), { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('updated_at'), 'decoder': Utils.datetime_from_iso_format(true) } }
|
29
|
+
|
30
|
+
|
31
|
+
sig { params(code: String, plugin_id: String, title: String, workspace_id: String, created_at: T.nilable(DateTime), eval_hash: T.nilable(String), updated_at: T.nilable(DateTime)).void }
|
32
|
+
def initialize(code: nil, plugin_id: nil, title: nil, workspace_id: nil, created_at: nil, eval_hash: nil, updated_at: nil)
|
33
|
+
@code = code
|
34
|
+
@plugin_id = plugin_id
|
35
|
+
@title = title
|
36
|
+
@workspace_id = workspace_id
|
37
|
+
@created_at = created_at
|
38
|
+
@eval_hash = eval_hash
|
39
|
+
@updated_at = updated_at
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'sorbet-runtime'
|
7
|
+
require 'faraday'
|
8
|
+
|
9
|
+
module SpeakeasyClientSDK
|
10
|
+
module Shared
|
11
|
+
# Key-Value pairs associated with a request
|
12
|
+
class RequestMetadata < SpeakeasyClientSDK::Utils::FieldAugmented
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
|
16
|
+
field :key, T.nilable(String), { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('key') } }
|
17
|
+
|
18
|
+
field :value, T.nilable(String), { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('value') } }
|
19
|
+
|
20
|
+
|
21
|
+
sig { params(key: T.nilable(String), value: T.nilable(String)).void }
|
22
|
+
def initialize(key: nil, value: nil)
|
23
|
+
@key = key
|
24
|
+
@value = value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'sorbet-runtime'
|
7
|
+
require 'faraday'
|
8
|
+
|
9
|
+
module SpeakeasyClientSDK
|
10
|
+
module Shared
|
11
|
+
# A Schema represents an API schema for a particular Api and Version.
|
12
|
+
class Schema < SpeakeasyClientSDK::Utils::FieldAugmented
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
# The ID of the Api this Schema belongs to.
|
16
|
+
field :api_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('api_id') } }
|
17
|
+
# Creation timestamp.
|
18
|
+
field :created_at, DateTime, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('created_at'), 'decoder': Utils.datetime_from_iso_format(false) } }
|
19
|
+
# A detailed description of the Schema.
|
20
|
+
field :description, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('description') } }
|
21
|
+
# An ID referencing this particular revision of the Schema.
|
22
|
+
field :revision_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('revision_id') } }
|
23
|
+
# The version ID of the Api this Schema belongs to.
|
24
|
+
field :version_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('version_id') } }
|
25
|
+
# The workspace ID this Schema belongs to.
|
26
|
+
field :workspace_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('workspace_id') } }
|
27
|
+
|
28
|
+
|
29
|
+
sig { params(api_id: String, created_at: DateTime, description: String, revision_id: String, version_id: String, workspace_id: String).void }
|
30
|
+
def initialize(api_id: nil, created_at: nil, description: nil, revision_id: nil, version_id: nil, workspace_id: nil)
|
31
|
+
@api_id = api_id
|
32
|
+
@created_at = created_at
|
33
|
+
@description = description
|
34
|
+
@revision_id = revision_id
|
35
|
+
@version_id = version_id
|
36
|
+
@workspace_id = workspace_id
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'sorbet-runtime'
|
7
|
+
require 'faraday'
|
8
|
+
|
9
|
+
module SpeakeasyClientSDK
|
10
|
+
module Shared
|
11
|
+
|
12
|
+
class SchemaDiffValueChange < SpeakeasyClientSDK::Utils::FieldAugmented
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
# Represents the previous value of the element.
|
16
|
+
field :from, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('From') } }
|
17
|
+
# Represents the current value of the element.
|
18
|
+
field :to, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('To') } }
|
19
|
+
|
20
|
+
|
21
|
+
sig { params(from: String, to: String).void }
|
22
|
+
def initialize(from: nil, to: nil)
|
23
|
+
@from = from
|
24
|
+
@to = to
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# A SchemaDiff represents a diff of two Schemas.
|
29
|
+
class SchemaDiff < SpeakeasyClientSDK::Utils::FieldAugmented
|
30
|
+
extend T::Sig
|
31
|
+
|
32
|
+
# Holds every addition change in the diff.
|
33
|
+
field :additions, T::Array[String], { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('additions') } }
|
34
|
+
# Holds every deletion change in the diff.
|
35
|
+
field :deletions, T::Array[String], { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('deletions') } }
|
36
|
+
# Holds every modification change in the diff.
|
37
|
+
field :modifications, T::Hash[Symbol, Shared::SchemaDiffValueChange], { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('modifications') } }
|
38
|
+
|
39
|
+
|
40
|
+
sig { params(additions: T::Array[String], deletions: T::Array[String], modifications: T::Hash[Symbol, Shared::SchemaDiffValueChange]).void }
|
41
|
+
def initialize(additions: nil, deletions: nil, modifications: nil)
|
42
|
+
@additions = additions
|
43
|
+
@deletions = deletions
|
44
|
+
@modifications = modifications
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'sorbet-runtime'
|
7
|
+
require 'faraday'
|
8
|
+
|
9
|
+
module SpeakeasyClientSDK
|
10
|
+
module Shared
|
11
|
+
|
12
|
+
class Security < SpeakeasyClientSDK::Utils::FieldAugmented
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
|
16
|
+
field :api_key, String, { 'security': { 'scheme': true, 'type': 'apiKey', 'sub_type': 'header', 'field_name': 'x-api-key' } }
|
17
|
+
|
18
|
+
|
19
|
+
sig { params(api_key: String).void }
|
20
|
+
def initialize(api_key: nil)
|
21
|
+
@api_key = api_key
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'sorbet-runtime'
|
7
|
+
require 'faraday'
|
8
|
+
|
9
|
+
module SpeakeasyClientSDK
|
10
|
+
module Shared
|
11
|
+
# An UnboundedRequest represents the HAR content capture by Speakeasy when logging a request.
|
12
|
+
class UnboundedRequest < SpeakeasyClientSDK::Utils::FieldAugmented
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
# Creation timestamp.
|
16
|
+
field :created_at, DateTime, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('created_at'), 'decoder': Utils.datetime_from_iso_format(false) } }
|
17
|
+
# The HAR content of the request.
|
18
|
+
field :har, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('har') } }
|
19
|
+
# The size of the HAR content in bytes.
|
20
|
+
field :har_size_bytes, Integer, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('har_size_bytes') } }
|
21
|
+
# The ID of this request.
|
22
|
+
field :request_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('request_id') } }
|
23
|
+
# The workspace ID this request was made to.
|
24
|
+
field :workspace_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('workspace_id') } }
|
25
|
+
|
26
|
+
|
27
|
+
sig { params(created_at: DateTime, har: String, har_size_bytes: Integer, request_id: String, workspace_id: String).void }
|
28
|
+
def initialize(created_at: nil, har: nil, har_size_bytes: nil, request_id: nil, workspace_id: nil)
|
29
|
+
@created_at = created_at
|
30
|
+
@har = har
|
31
|
+
@har_size_bytes = har_size_bytes
|
32
|
+
@request_id = request_id
|
33
|
+
@workspace_id = workspace_id
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'sorbet-runtime'
|
7
|
+
require 'faraday'
|
8
|
+
|
9
|
+
module SpeakeasyClientSDK
|
10
|
+
module Shared
|
11
|
+
# A set of keys and associated values, attached to a particular version of an Api.
|
12
|
+
class VersionMetadataInput < SpeakeasyClientSDK::Utils::FieldAugmented
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
# The key for this metadata.
|
16
|
+
field :meta_key, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('meta_key') } }
|
17
|
+
# One of the values for this metadata.
|
18
|
+
field :meta_value, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('meta_value') } }
|
19
|
+
|
20
|
+
|
21
|
+
sig { params(meta_key: String, meta_value: String).void }
|
22
|
+
def initialize(meta_key: nil, meta_value: nil)
|
23
|
+
@meta_key = meta_key
|
24
|
+
@meta_value = meta_value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# A set of keys and associated values, attached to a particular version of an Api.
|
29
|
+
class VersionMetadata < SpeakeasyClientSDK::Utils::FieldAugmented
|
30
|
+
extend T::Sig
|
31
|
+
|
32
|
+
# The ID of the Api this Metadata belongs to.
|
33
|
+
field :api_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('api_id') } }
|
34
|
+
# Creation timestamp.
|
35
|
+
field :created_at, DateTime, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('created_at'), 'decoder': Utils.datetime_from_iso_format(false) } }
|
36
|
+
# The key for this metadata.
|
37
|
+
field :meta_key, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('meta_key') } }
|
38
|
+
# One of the values for this metadata.
|
39
|
+
field :meta_value, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('meta_value') } }
|
40
|
+
# The version ID of the Api this Metadata belongs to.
|
41
|
+
field :version_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('version_id') } }
|
42
|
+
# The workspace ID this Metadata belongs to.
|
43
|
+
field :workspace_id, String, { 'format_json': { 'letter_case': OpenApiSDK::Utils.field_name('workspace_id') } }
|
44
|
+
|
45
|
+
|
46
|
+
sig { params(api_id: String, created_at: DateTime, meta_key: String, meta_value: String, version_id: String, workspace_id: String).void }
|
47
|
+
def initialize(api_id: nil, created_at: nil, meta_key: nil, meta_value: nil, version_id: nil, workspace_id: nil)
|
48
|
+
@api_id = api_id
|
49
|
+
@created_at = created_at
|
50
|
+
@meta_key = meta_key
|
51
|
+
@meta_value = meta_value
|
52
|
+
@version_id = version_id
|
53
|
+
@workspace_id = workspace_id
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/sdk/plugins.rb
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'sorbet-runtime'
|
9
|
+
|
10
|
+
module SpeakeasyClientSDK
|
11
|
+
extend T::Sig
|
12
|
+
class Plugins
|
13
|
+
extend T::Sig
|
14
|
+
sig { params(sdk: SpeakeasyClientSDK::SDK, client: Faraday::Connection, server_url: String, language: String, sdk_version: String, gen_version: String).void }
|
15
|
+
def initialize(sdk, client, server_url, language, sdk_version, gen_version)
|
16
|
+
@sdk = sdk
|
17
|
+
@client = client
|
18
|
+
@server_url = server_url
|
19
|
+
@language = language
|
20
|
+
@sdk_version = sdk_version
|
21
|
+
@gen_version = gen_version
|
22
|
+
end
|
23
|
+
|
24
|
+
sig { returns(Utils::FieldAugmented) }
|
25
|
+
def get_plugins
|
26
|
+
# get_plugins - Get all plugins for the current workspace.
|
27
|
+
base_url = @server_url
|
28
|
+
url = "#{base_url.delete_suffix('/')}/v1/plugins"
|
29
|
+
headers = {}
|
30
|
+
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
31
|
+
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version}"
|
32
|
+
|
33
|
+
r = @client.get(url) do |req|
|
34
|
+
req.headers = headers
|
35
|
+
Utils.configure_request_security(req, @sdk.security) if !@sdk.nil? && !@sdk.security.nil?
|
36
|
+
end
|
37
|
+
|
38
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
39
|
+
|
40
|
+
res = Operations::GetPluginsResponse.new(
|
41
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
42
|
+
)
|
43
|
+
if r.status == 200
|
44
|
+
if Utils.match_content_type(content_type, 'application/json')
|
45
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::Plugin])
|
46
|
+
res.plugins = out
|
47
|
+
end
|
48
|
+
else
|
49
|
+
if Utils.match_content_type(content_type, 'application/json')
|
50
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Error)
|
51
|
+
res.error = out
|
52
|
+
end
|
53
|
+
end
|
54
|
+
res
|
55
|
+
end
|
56
|
+
|
57
|
+
sig { params(request: Operations::RunPluginRequest).returns(Utils::FieldAugmented) }
|
58
|
+
def run_plugin(request)
|
59
|
+
# run_plugin - Run a plugin
|
60
|
+
base_url = @server_url
|
61
|
+
url = Utils.generate_url(
|
62
|
+
Operations::RunPluginRequest,
|
63
|
+
base_url,
|
64
|
+
'/v1/plugins/{pluginID}',
|
65
|
+
request
|
66
|
+
)
|
67
|
+
headers = {}
|
68
|
+
query_params = Utils.get_query_params(Operations::RunPluginRequest, request)
|
69
|
+
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
70
|
+
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version}"
|
71
|
+
|
72
|
+
r = @client.post(url) do |req|
|
73
|
+
req.headers = headers
|
74
|
+
req.params = query_params
|
75
|
+
Utils.configure_request_security(req, @sdk.security) if !@sdk.nil? && !@sdk.security.nil?
|
76
|
+
end
|
77
|
+
|
78
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
79
|
+
|
80
|
+
res = Operations::RunPluginResponse.new(
|
81
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
82
|
+
)
|
83
|
+
if r.status == 200
|
84
|
+
if Utils.match_content_type(content_type, 'application/json')
|
85
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::BoundedRequest])
|
86
|
+
res.bounded_requests = out
|
87
|
+
end
|
88
|
+
else
|
89
|
+
if Utils.match_content_type(content_type, 'application/json')
|
90
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Error)
|
91
|
+
res.error = out
|
92
|
+
end
|
93
|
+
end
|
94
|
+
res
|
95
|
+
end
|
96
|
+
|
97
|
+
sig { params(request: Shared::Plugin).returns(Utils::FieldAugmented) }
|
98
|
+
def upsert_plugin(request)
|
99
|
+
# upsert_plugin - Upsert a plugin
|
100
|
+
base_url = @server_url
|
101
|
+
url = "#{base_url.delete_suffix('/')}/v1/plugins"
|
102
|
+
headers = {}
|
103
|
+
req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
|
104
|
+
headers['content-type'] = req_content_type
|
105
|
+
raise StandardError, 'request body is required' if data.nil? && form.nil?
|
106
|
+
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
107
|
+
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version}"
|
108
|
+
|
109
|
+
r = @client.put(url) do |req|
|
110
|
+
req.headers = headers
|
111
|
+
Utils.configure_request_security(req, @sdk.security) if !@sdk.nil? && !@sdk.security.nil?
|
112
|
+
if form
|
113
|
+
req.body = Utils.encode_form(form)
|
114
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
115
|
+
req.body = URI.encode_www_form(data)
|
116
|
+
else
|
117
|
+
req.body = data
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
122
|
+
|
123
|
+
res = Operations::UpsertPluginResponse.new(
|
124
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
125
|
+
)
|
126
|
+
if r.status == 200
|
127
|
+
if Utils.match_content_type(content_type, 'application/json')
|
128
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Plugin)
|
129
|
+
res.plugin = out
|
130
|
+
end
|
131
|
+
else
|
132
|
+
if Utils.match_content_type(content_type, 'application/json')
|
133
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Error)
|
134
|
+
res.error = out
|
135
|
+
end
|
136
|
+
end
|
137
|
+
res
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
data/lib/sdk/requests.rb
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
2
|
+
|
3
|
+
# typed: true
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
require 'faraday'
|
7
|
+
require 'faraday/multipart'
|
8
|
+
require 'sorbet-runtime'
|
9
|
+
|
10
|
+
module SpeakeasyClientSDK
|
11
|
+
extend T::Sig
|
12
|
+
class Requests
|
13
|
+
extend T::Sig
|
14
|
+
sig { params(sdk: SpeakeasyClientSDK::SDK, client: Faraday::Connection, server_url: String, language: String, sdk_version: String, gen_version: String).void }
|
15
|
+
def initialize(sdk, client, server_url, language, sdk_version, gen_version)
|
16
|
+
@sdk = sdk
|
17
|
+
@client = client
|
18
|
+
@server_url = server_url
|
19
|
+
@language = language
|
20
|
+
@sdk_version = sdk_version
|
21
|
+
@gen_version = gen_version
|
22
|
+
end
|
23
|
+
|
24
|
+
sig { params(request: Operations::GenerateRequestPostmanCollectionRequest).returns(Utils::FieldAugmented) }
|
25
|
+
def generate_request_postman_collection(request)
|
26
|
+
# generate_request_postman_collection - Generate a Postman collection for a particular request.
|
27
|
+
# Generates a Postman collection for a particular request.
|
28
|
+
# Allowing it to be replayed with the same inputs that were captured by the SDK.
|
29
|
+
base_url = @server_url
|
30
|
+
url = Utils.generate_url(
|
31
|
+
Operations::GenerateRequestPostmanCollectionRequest,
|
32
|
+
base_url,
|
33
|
+
'/v1/eventlog/{requestID}/generate/postman',
|
34
|
+
request
|
35
|
+
)
|
36
|
+
headers = {}
|
37
|
+
headers['Accept'] = 'application/json;q=1, application/octet-stream;q=0'
|
38
|
+
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version}"
|
39
|
+
|
40
|
+
r = @client.get(url) do |req|
|
41
|
+
req.headers = headers
|
42
|
+
Utils.configure_request_security(req, @sdk.security) if !@sdk.nil? && !@sdk.security.nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
46
|
+
|
47
|
+
res = Operations::GenerateRequestPostmanCollectionResponse.new(
|
48
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
49
|
+
)
|
50
|
+
if r.status == 200
|
51
|
+
res.postman_collection = r.env.response_body if Utils.match_content_type(content_type, 'application/octet-stream')
|
52
|
+
else
|
53
|
+
if Utils.match_content_type(content_type, 'application/json')
|
54
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Error)
|
55
|
+
res.error = out
|
56
|
+
end
|
57
|
+
end
|
58
|
+
res
|
59
|
+
end
|
60
|
+
|
61
|
+
sig { params(request: Operations::GetRequestFromEventLogRequest).returns(Utils::FieldAugmented) }
|
62
|
+
def get_request_from_event_log(request)
|
63
|
+
# get_request_from_event_log - Get information about a particular request.
|
64
|
+
base_url = @server_url
|
65
|
+
url = Utils.generate_url(
|
66
|
+
Operations::GetRequestFromEventLogRequest,
|
67
|
+
base_url,
|
68
|
+
'/v1/eventlog/{requestID}',
|
69
|
+
request
|
70
|
+
)
|
71
|
+
headers = {}
|
72
|
+
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
73
|
+
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version}"
|
74
|
+
|
75
|
+
r = @client.get(url) do |req|
|
76
|
+
req.headers = headers
|
77
|
+
Utils.configure_request_security(req, @sdk.security) if !@sdk.nil? && !@sdk.security.nil?
|
78
|
+
end
|
79
|
+
|
80
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
81
|
+
|
82
|
+
res = Operations::GetRequestFromEventLogResponse.new(
|
83
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
84
|
+
)
|
85
|
+
if r.status == 200
|
86
|
+
if Utils.match_content_type(content_type, 'application/json')
|
87
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::UnboundedRequest)
|
88
|
+
res.unbounded_request = out
|
89
|
+
end
|
90
|
+
else
|
91
|
+
if Utils.match_content_type(content_type, 'application/json')
|
92
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Error)
|
93
|
+
res.error = out
|
94
|
+
end
|
95
|
+
end
|
96
|
+
res
|
97
|
+
end
|
98
|
+
|
99
|
+
sig { params(request: Operations::QueryEventLogRequest).returns(Utils::FieldAugmented) }
|
100
|
+
def query_event_log(request)
|
101
|
+
# query_event_log - Query the event log to retrieve a list of requests.
|
102
|
+
# Supports retrieving a list of request captured by the SDK for this workspace.
|
103
|
+
# Allows the filtering of requests on a number of criteria such as ApiID, VersionID, Path, Method, etc.
|
104
|
+
base_url = @server_url
|
105
|
+
url = "#{base_url.delete_suffix('/')}/v1/eventlog/query"
|
106
|
+
headers = {}
|
107
|
+
query_params = Utils.get_query_params(Operations::QueryEventLogRequest, request)
|
108
|
+
headers['Accept'] = 'application/json;q=1, application/json;q=0'
|
109
|
+
headers['user-agent'] = "speakeasy-sdk/#{@language} #{@sdk_version} #{@gen_version}"
|
110
|
+
|
111
|
+
r = @client.get(url) do |req|
|
112
|
+
req.headers = headers
|
113
|
+
req.params = query_params
|
114
|
+
Utils.configure_request_security(req, @sdk.security) if !@sdk.nil? && !@sdk.security.nil?
|
115
|
+
end
|
116
|
+
|
117
|
+
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
118
|
+
|
119
|
+
res = Operations::QueryEventLogResponse.new(
|
120
|
+
status_code: r.status, content_type: content_type, raw_response: r
|
121
|
+
)
|
122
|
+
if r.status == 200
|
123
|
+
if Utils.match_content_type(content_type, 'application/json')
|
124
|
+
out = Utils.unmarshal_complex(r.env.response_body, T::Array[Shared::BoundedRequest])
|
125
|
+
res.bounded_requests = out
|
126
|
+
end
|
127
|
+
else
|
128
|
+
if Utils.match_content_type(content_type, 'application/json')
|
129
|
+
out = Utils.unmarshal_complex(r.env.response_body, Shared::Error)
|
130
|
+
res.error = out
|
131
|
+
end
|
132
|
+
end
|
133
|
+
res
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|