Skip to content

Latest commit

 

History

History
268 lines (169 loc) · 11.5 KB

File metadata and controls

268 lines (169 loc) · 11.5 KB

Apis

Overview

REST APIs for managing Api entities

Available Operations

get_all

Get a list of all Apis and their versions for a given workspace. Supports filtering the APIs based on metadata attributes.

Example Usage

require 'speakeasy_client_sdk_ruby'


s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
  ::OpenApiSDK::Shared::Security.new(
    api_key: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.apis.get_all(op=::OpenApiSDK::Operations::Op.new(
  and_: false,
), metadata={
  "key": [
    "<value>",
  ],
})

if ! res.apis.nil?
  # handle response
end

Parameters

Parameter Type Required Description
op T.nilable(::OpenApiSDK::Operations::Op) Configuration for filter operations
metadata T::Hash[Symbol, T::Array<::String>] Metadata to filter Apis on

Response

T.nilable(::OpenApiSDK::Operations::GetApisResponse)

get_all_versions

Get all Api versions for a particular ApiEndpoint. Supports filtering the versions based on metadata attributes.

Example Usage

require 'speakeasy_client_sdk_ruby'


s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
  ::OpenApiSDK::Shared::Security.new(
    api_key: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.apis.get_all_versions(api_id="<id>", op=::OpenApiSDK::Operations::QueryParamOp.new(
  and_: false,
), metadata={
  "key": [
    "<value>",
  ],
})

if ! res.apis.nil?
  # handle response
end

Parameters

Parameter Type Required Description
api_id ::String ✔️ The ID of the Api to retrieve.
op T.nilable(::OpenApiSDK::Operations::QueryParamOp) Configuration for filter operations
metadata T::Hash[Symbol, T::Array<::String>] Metadata to filter Apis on

Response

T.nilable(::OpenApiSDK::Operations::GetAllApiVersionsResponse)

upsert

Upsert an Api. If the Api does not exist, it will be created. If the Api exists, it will be updated.

Example Usage

require 'speakeasy_client_sdk_ruby'


s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
  ::OpenApiSDK::Shared::Security.new(
    api_key: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.apis.upsert(api_id="<id>", api=::OpenApiSDK::Shared::ApiInput.new(
  api_id: "<id>",
  description: "curiously painfully proliferate awful bump without fly",
  version_id: "<id>",
))

if ! res.api.nil?
  # handle response
end

Parameters

Parameter Type Required Description
api_id ::String ✔️ The ID of the Api to upsert.
api ::OpenApiSDK::Shared::ApiInput ✔️ A JSON representation of the Api to upsert

Response

T.nilable(::OpenApiSDK::Operations::UpsertApiResponse)

delete

Delete a particular version of an Api. The will also delete all associated ApiEndpoints, Metadata, Schemas & Request Logs (if using a Postgres datastore).

Example Usage

require 'speakeasy_client_sdk_ruby'


s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
  ::OpenApiSDK::Shared::Security.new(
    api_key: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.apis.delete(api_id="<id>", version_id="<id>")

if res.status_code == 200
  # handle response
end

Parameters

Parameter Type Required Description
api_id ::String ✔️ The ID of the Api to delete.
version_id ::String ✔️ The version ID of the Api to delete.

Response

T.nilable(::OpenApiSDK::Operations::DeleteApiResponse)

generate_open_api

This endpoint will generate any missing operations in any registered OpenAPI document if the operation does not already exist in the document. Returns the original document and the newly generated document allowing a diff to be performed to see what has changed.

Example Usage

require 'speakeasy_client_sdk_ruby'


s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
  ::OpenApiSDK::Shared::Security.new(
    api_key: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.apis.generate_open_api(api_id="<id>", version_id="<id>")

if ! res.generate_open_api_spec_diff.nil?
  # handle response
end

Parameters

Parameter Type Required Description
api_id ::String ✔️ The ID of the Api to generate an OpenAPI specification for.
version_id ::String ✔️ The version ID of the Api to generate an OpenAPI specification for.

Response

T.nilable(::OpenApiSDK::Operations::GenerateOpenApiSpecResponse)

generate_postman

Generates a postman collection containing all endpoints for a particular API. Includes variables produced for any path/query/header parameters included in the OpenAPI document.

Example Usage

require 'speakeasy_client_sdk_ruby'


s = ::OpenApiSDK::SpeakeasyClientSDK.new
s.config_security(
  ::OpenApiSDK::Shared::Security.new(
    api_key: "<YOUR_API_KEY_HERE>",
  )
)

    
res = s.apis.generate_postman(api_id="<id>", version_id="<id>")

if ! res.postman_collection.nil?
  # handle response
end

Parameters

Parameter Type Required Description
api_id ::String ✔️ The ID of the Api to generate a Postman collection for.
version_id ::String ✔️ The version ID of the Api to generate a Postman collection for.

Response

T.nilable(::OpenApiSDK::Operations::GeneratePostmanCollectionResponse)