diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1b9be02..fc1a9fe 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: f5719c92-1297-4aa0-bc5f-37116859d1e3 management: - docChecksum: f5cf06d8d5f2ec68226ab161d7a73cba + docChecksum: 638dbecd668cc1d7818c3b5aefd2d3e1 docVersion: 0.4.0 . - speakeasyVersion: 1.331.0 - generationVersion: 2.365.0 - releaseVersion: 4.2.11 - configChecksum: 0cb11c6e585150ad6e89e8e5988f0380 + speakeasyVersion: 1.332.1 + generationVersion: 2.366.1 + releaseVersion: 4.2.12 + configChecksum: b52068dd46ae167fdcc67c6034e39cfe repoURL: https://github.com/speakeasy-api/speakeasy-client-sdk-ruby.git repoSubDirectory: . installationURL: https://github.com/speakeasy-api/speakeasy-client-sdk-ruby @@ -33,6 +33,7 @@ generatedFiles: - lib/speakeasy_client_sdk/github.rb - lib/speakeasy_client_sdk/organizations.rb - lib/speakeasy_client_sdk/reports.rb + - lib/speakeasy_client_sdk/shorturls.rb - lib/speakeasy_client_sdk/suggest.rb - lib/speakeasy_client_sdk/embeds.rb - lib/speakeasy_client_sdk/events.rb @@ -191,6 +192,8 @@ generatedFiles: - lib/speakeasy_client_sdk/models/operations/uploadreport_requestbody.rb - lib/speakeasy_client_sdk/models/operations/uploadreport_uploadedreport.rb - lib/speakeasy_client_sdk/models/operations/uploadreport_response.rb + - lib/speakeasy_client_sdk/models/operations/create_requestbody.rb + - lib/speakeasy_client_sdk/models/operations/create_response.rb - lib/speakeasy_client_sdk/models/operations/applyoperationids_requestbody.rb - lib/speakeasy_client_sdk/models/operations/applyoperationids_request.rb - lib/speakeasy_client_sdk/models/operations/applyoperationids_response.rb @@ -273,6 +276,7 @@ generatedFiles: - lib/speakeasy_client_sdk/models/shared/organization.rb - lib/speakeasy_client_sdk/models/shared/type.rb - lib/speakeasy_client_sdk/models/shared/report.rb + - lib/speakeasy_client_sdk/models/shared/shorturl.rb - lib/speakeasy_client_sdk/models/shared/suggestedoperationids.rb - lib/speakeasy_client_sdk/models/shared/depth_style.rb - lib/speakeasy_client_sdk/models/shared/style.rb @@ -394,6 +398,8 @@ generatedFiles: - docs/models/operations/uploadreportrequestbody.md - docs/models/operations/uploadreportuploadedreport.md - docs/models/operations/uploadreportresponse.md + - docs/models/operations/createrequestbody.md + - docs/models/operations/createresponse.md - docs/models/operations/applyoperationidsrequestbody.md - docs/models/operations/applyoperationidsrequest.md - docs/models/operations/applyoperationidsresponse.md @@ -476,6 +482,7 @@ generatedFiles: - docs/models/shared/organization.md - docs/models/shared/type.md - docs/models/shared/report.md + - docs/models/shared/shorturl.md - docs/models/shared/suggestedoperationids.md - docs/models/shared/depthstyle.md - docs/models/shared/style.md @@ -499,6 +506,7 @@ generatedFiles: - docs/sdks/github/README.md - docs/sdks/organizations/README.md - docs/sdks/reports/README.md + - docs/sdks/shorturls/README.md - docs/sdks/suggest/README.md - docs/sdks/embeds/README.md - docs/sdks/events/README.md diff --git a/Gemfile.lock b/Gemfile.lock index 7efcf57..7379bbb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - speakeasy_client_sdk_ruby (4.2.11) + speakeasy_client_sdk_ruby (4.2.12) faraday faraday-multipart rack diff --git a/README.md b/README.md index 828fad9..e18d885 100755 --- a/README.md +++ b/README.md @@ -122,6 +122,10 @@ end * [get_linting_report_signed_url](docs/sdks/reports/README.md#get_linting_report_signed_url) - Get the signed access url for the linting reports for a particular document. * [upload_report](docs/sdks/reports/README.md#upload_report) - Upload a report. +### [ShortURLs](docs/sdks/shorturls/README.md) + +* [create](docs/sdks/shorturls/README.md#create) - Shorten a URL. + ### [Suggest](docs/sdks/suggest/README.md) * [apply_operation_i_ds](docs/sdks/suggest/README.md#apply_operation_i_ds) - Apply operation ID suggestions and download result. diff --git a/RELEASES.md b/RELEASES.md index 371665e..d1a0e55 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -988,4 +988,14 @@ Based on: ### Generated - [ruby v4.2.11] . ### Releases -- [Ruby Gems v4.2.11] https://rubygems.org/gems/speakeasy_client_sdk_ruby/versions/4.2.11 - . \ No newline at end of file +- [Ruby Gems v4.2.11] https://rubygems.org/gems/speakeasy_client_sdk_ruby/versions/4.2.11 - . + +## 2024-07-12 00:03:13 +### Changes +Based on: +- OpenAPI Doc 0.4.0 . https://docs.speakeasyapi.dev/openapi.yaml +- Speakeasy CLI 1.332.1 (2.366.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [ruby v4.2.12] . +### Releases +- [Ruby Gems v4.2.12] https://rubygems.org/gems/speakeasy_client_sdk_ruby/versions/4.2.12 - . \ No newline at end of file diff --git a/docs/models/operations/createrequestbody.md b/docs/models/operations/createrequestbody.md new file mode 100644 index 0000000..ca820f2 --- /dev/null +++ b/docs/models/operations/createrequestbody.md @@ -0,0 +1,8 @@ +# CreateRequestBody + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `url` | *::String* | :heavy_check_mark: | URL to shorten | \ No newline at end of file diff --git a/docs/models/operations/createresponse.md b/docs/models/operations/createresponse.md new file mode 100644 index 0000000..1cb4fcc --- /dev/null +++ b/docs/models/operations/createresponse.md @@ -0,0 +1,11 @@ +# CreateResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `content_type` | *::String* | :heavy_check_mark: | HTTP response content type for this operation | +| `short_url` | [T.nilable(::SpeakeasyClientSDK::Shared::ShortURL)](../../models/shared/shorturl.md) | :heavy_minus_sign: | OK | +| `status_code` | *::Integer* | :heavy_check_mark: | HTTP response status code for this operation | +| `raw_response` | [Faraday::Response](https://www.rubydoc.info/gems/faraday/Faraday/Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/shared/shorturl.md b/docs/models/shared/shorturl.md new file mode 100644 index 0000000..29a593e --- /dev/null +++ b/docs/models/shared/shorturl.md @@ -0,0 +1,9 @@ +# ShortURL + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `full_url` | *::String* | :heavy_check_mark: | N/A | +| `short_url` | *::String* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdks/shorturls/README.md b/docs/sdks/shorturls/README.md new file mode 100644 index 0000000..50becf6 --- /dev/null +++ b/docs/sdks/shorturls/README.md @@ -0,0 +1,52 @@ +# ShortURLs + + +## Overview + +REST APIs for managing short URLs + +### Available Operations + +* [create](#create) - Shorten a URL. + +## create + +Shorten a URL. + +### Example Usage + +```ruby +require 'speakeasy_client_sdk_ruby' + + +s = ::SpeakeasyClientSDK::SDK.new +s.config_security( + ::SpeakeasyClientSDK::Shared::Security.new( + api_key: "", + ) +) + + +req = ::SpeakeasyClientSDK::Operations::CreateRequestBody.new( + url: "http://limp-pastry.org", +) + +res = s.short_ur_ls.create(req) + +if ! res.short_url.nil? + # handle response +end + +``` + +### Parameters + +| Parameter | Type | Required | Description | +| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | +| `request` | [::SpeakeasyClientSDK::Operations::CreateRequestBody](../../models/operations/createrequestbody.md) | :heavy_check_mark: | The request object to use for the request. | + + +### Response + +**[T.nilable(::SpeakeasyClientSDK::Operations::CreateResponse)](../../models/operations/createresponse.md)** + diff --git a/gen.yaml b/gen.yaml index 3664997..8f73b3a 100755 --- a/gen.yaml +++ b/gen.yaml @@ -10,7 +10,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false ruby: - version: 4.2.11 + version: 4.2.12 author: Speakeasy description: Ruby Client SDK Generated by Speakeasy imports: diff --git a/lib/speakeasy_client_sdk/models/operations.rb b/lib/speakeasy_client_sdk/models/operations.rb index f2d007b..086f70f 100644 --- a/lib/speakeasy_client_sdk/models/operations.rb +++ b/lib/speakeasy_client_sdk/models/operations.rb @@ -111,6 +111,8 @@ module Operations autoload :UploadReportRequestBody, 'speakeasy_client_sdk/models/operations/uploadreport_requestbody.rb' autoload :UploadReportUploadedReport, 'speakeasy_client_sdk/models/operations/uploadreport_uploadedreport.rb' autoload :UploadReportResponse, 'speakeasy_client_sdk/models/operations/uploadreport_response.rb' + autoload :CreateRequestBody, 'speakeasy_client_sdk/models/operations/create_requestbody.rb' + autoload :CreateResponse, 'speakeasy_client_sdk/models/operations/create_response.rb' autoload :ApplyOperationIDsRequestBody, 'speakeasy_client_sdk/models/operations/applyoperationids_requestbody.rb' autoload :ApplyOperationIDsRequest, 'speakeasy_client_sdk/models/operations/applyoperationids_request.rb' autoload :ApplyOperationIDsResponse, 'speakeasy_client_sdk/models/operations/applyoperationids_response.rb' diff --git a/lib/speakeasy_client_sdk/models/operations/create_requestbody.rb b/lib/speakeasy_client_sdk/models/operations/create_requestbody.rb new file mode 100644 index 0000000..d39afc3 --- /dev/null +++ b/lib/speakeasy_client_sdk/models/operations/create_requestbody.rb @@ -0,0 +1,24 @@ +# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +# typed: true +# frozen_string_literal: true + + +module SpeakeasyClientSDK + module Operations + + + class CreateRequestBody < ::SpeakeasyClientSDK::Utils::FieldAugmented + extend T::Sig + + # URL to shorten + field :url, ::String, { 'format_json': { 'letter_case': ::SpeakeasyClientSDK::Utils.field_name('url') } } + + + sig { params(url: ::String).void } + def initialize(url: nil) + @url = url + end + end + end +end diff --git a/lib/speakeasy_client_sdk/models/operations/create_response.rb b/lib/speakeasy_client_sdk/models/operations/create_response.rb new file mode 100644 index 0000000..1b1ea1e --- /dev/null +++ b/lib/speakeasy_client_sdk/models/operations/create_response.rb @@ -0,0 +1,33 @@ +# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +# typed: true +# frozen_string_literal: true + + +module SpeakeasyClientSDK + module Operations + + + class CreateResponse < ::SpeakeasyClientSDK::Utils::FieldAugmented + extend T::Sig + + # HTTP response content type for this operation + field :content_type, ::String + # Raw HTTP response; suitable for custom response parsing + field :raw_response, ::Faraday::Response + # HTTP response status code for this operation + field :status_code, ::Integer + # OK + field :short_url, T.nilable(::SpeakeasyClientSDK::Shared::ShortURL) + + + sig { params(content_type: ::String, raw_response: ::Faraday::Response, status_code: ::Integer, short_url: T.nilable(::SpeakeasyClientSDK::Shared::ShortURL)).void } + def initialize(content_type: nil, raw_response: nil, status_code: nil, short_url: nil) + @content_type = content_type + @raw_response = raw_response + @status_code = status_code + @short_url = short_url + end + end + end +end diff --git a/lib/speakeasy_client_sdk/models/shared.rb b/lib/speakeasy_client_sdk/models/shared.rb index bbb49ac..17ea8ba 100644 --- a/lib/speakeasy_client_sdk/models/shared.rb +++ b/lib/speakeasy_client_sdk/models/shared.rb @@ -65,6 +65,7 @@ module Shared autoload :Organization, 'speakeasy_client_sdk/models/shared/organization.rb' autoload :Type, 'speakeasy_client_sdk/models/shared/type.rb' autoload :Report, 'speakeasy_client_sdk/models/shared/report.rb' + autoload :ShortURL, 'speakeasy_client_sdk/models/shared/shorturl.rb' autoload :SuggestedOperationIDs, 'speakeasy_client_sdk/models/shared/suggestedoperationids.rb' autoload :DepthStyle, 'speakeasy_client_sdk/models/shared/depth_style.rb' autoload :Style, 'speakeasy_client_sdk/models/shared/style.rb' diff --git a/lib/speakeasy_client_sdk/models/shared/shorturl.rb b/lib/speakeasy_client_sdk/models/shared/shorturl.rb new file mode 100644 index 0000000..ea674fe --- /dev/null +++ b/lib/speakeasy_client_sdk/models/shared/shorturl.rb @@ -0,0 +1,27 @@ +# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +# typed: true +# frozen_string_literal: true + + +module SpeakeasyClientSDK + module Shared + + + class ShortURL < ::SpeakeasyClientSDK::Utils::FieldAugmented + extend T::Sig + + + field :full_url, ::String, { 'format_json': { 'letter_case': ::SpeakeasyClientSDK::Utils.field_name('full_url') } } + + field :short_url, ::String, { 'format_json': { 'letter_case': ::SpeakeasyClientSDK::Utils.field_name('short_url') } } + + + sig { params(full_url: ::String, short_url: ::String).void } + def initialize(full_url: nil, short_url: nil) + @full_url = full_url + @short_url = short_url + end + end + end +end diff --git a/lib/speakeasy_client_sdk/sdk.rb b/lib/speakeasy_client_sdk/sdk.rb index f9efc33..4dddd29 100644 --- a/lib/speakeasy_client_sdk/sdk.rb +++ b/lib/speakeasy_client_sdk/sdk.rb @@ -13,7 +13,7 @@ module SpeakeasyClientSDK class SDK extend T::Sig - attr_accessor :apis, :api_endpoints, :metadata, :schemas, :artifacts, :auth, :requests, :github, :organizations, :reports, :suggest, :embeds, :events + attr_accessor :apis, :api_endpoints, :metadata, :schemas, :artifacts, :auth, :requests, :github, :organizations, :reports, :short_ur_ls, :suggest, :embeds, :events sig do params(client: Faraday::Request, @@ -99,6 +99,7 @@ def init_sdks @github = Github.new(@sdk_configuration) @organizations = Organizations.new(@sdk_configuration) @reports = Reports.new(@sdk_configuration) + @short_ur_ls = ShortURLs.new(@sdk_configuration) @suggest = Suggest.new(@sdk_configuration) @embeds = Embeds.new(@sdk_configuration) @events = Events.new(@sdk_configuration) diff --git a/lib/speakeasy_client_sdk/sdkconfiguration.rb b/lib/speakeasy_client_sdk/sdkconfiguration.rb index d7586db..2467aac 100644 --- a/lib/speakeasy_client_sdk/sdkconfiguration.rb +++ b/lib/speakeasy_client_sdk/sdkconfiguration.rb @@ -41,9 +41,9 @@ def initialize(client, security, server_url, server, globals) @globals = globals.nil? ? {} : globals @language = 'ruby' @openapi_doc_version = '0.4.0 .' - @sdk_version = '4.2.11' - @gen_version = '2.365.0' - @user_agent = 'speakeasy-sdk/ruby 4.2.11 2.365.0 0.4.0 . speakeasy_client_sdk_ruby' + @sdk_version = '4.2.12' + @gen_version = '2.366.1' + @user_agent = 'speakeasy-sdk/ruby 4.2.12 2.366.1 0.4.0 . speakeasy_client_sdk_ruby' end sig { returns([String, T::Hash[Symbol, String]]) } diff --git a/lib/speakeasy_client_sdk/shorturls.rb b/lib/speakeasy_client_sdk/shorturls.rb new file mode 100644 index 0000000..93eda99 --- /dev/null +++ b/lib/speakeasy_client_sdk/shorturls.rb @@ -0,0 +1,61 @@ +# Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +# typed: true +# frozen_string_literal: true + +require 'faraday' +require 'faraday/multipart' +require 'sorbet-runtime' + +module SpeakeasyClientSDK + extend T::Sig + class ShortURLs + extend T::Sig + # REST APIs for managing short URLs + + sig { params(sdk_config: SDKConfiguration).void } + def initialize(sdk_config) + @sdk_configuration = sdk_config + end + + + sig { params(request: ::SpeakeasyClientSDK::Operations::CreateRequestBody).returns(::SpeakeasyClientSDK::Operations::CreateResponse) } + def create(request) + # create - Shorten a URL. + url, params = @sdk_configuration.get_server_details + base_url = Utils.template_url(url, params) + url = "#{base_url}/v1/short_urls" + headers = {} + req_content_type, data, form = Utils.serialize_request_body(request, :request, :json) + headers['content-type'] = req_content_type + raise StandardError, 'request body is required' if data.nil? && form.nil? + headers['Accept'] = 'application/json' + headers['user-agent'] = @sdk_configuration.user_agent + + r = @sdk_configuration.client.post(url) do |req| + req.headers = headers + Utils.configure_request_security(req, @sdk_configuration.security) if !@sdk_configuration.nil? && !@sdk_configuration.security.nil? + if form + req.body = Utils.encode_form(form) + elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded') + req.body = URI.encode_www_form(data) + else + req.body = data + end + end + + content_type = r.headers.fetch('Content-Type', 'application/octet-stream') + + res = ::SpeakeasyClientSDK::Operations::CreateResponse.new( + status_code: r.status, content_type: content_type, raw_response: r + ) + if r.status == 200 + if Utils.match_content_type(content_type, 'application/json') + out = Utils.unmarshal_complex(r.env.response_body, ::SpeakeasyClientSDK::Shared::ShortURL) + res.short_url = out + end + end + res + end + end +end diff --git a/lib/speakeasy_client_sdk_ruby.rb b/lib/speakeasy_client_sdk_ruby.rb index a1d60e8..a20992b 100644 --- a/lib/speakeasy_client_sdk_ruby.rb +++ b/lib/speakeasy_client_sdk_ruby.rb @@ -17,6 +17,7 @@ module SpeakeasyClientSDK autoload :Github, 'speakeasy_client_sdk/github' autoload :Organizations, 'speakeasy_client_sdk/organizations' autoload :Reports, 'speakeasy_client_sdk/reports' + autoload :ShortURLs, 'speakeasy_client_sdk/shorturls' autoload :Suggest, 'speakeasy_client_sdk/suggest' autoload :Embeds, 'speakeasy_client_sdk/embeds' autoload :Events, 'speakeasy_client_sdk/events' diff --git a/speakeasy_client_sdk_ruby.gemspec b/speakeasy_client_sdk_ruby.gemspec index e2a137f..e10e74a 100644 --- a/speakeasy_client_sdk_ruby.gemspec +++ b/speakeasy_client_sdk_ruby.gemspec @@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__) Gem::Specification.new do |s| s.name = 'speakeasy_client_sdk_ruby' - s.version = '4.2.11' + s.version = '4.2.12' s.platform = Gem::Platform::RUBY s.licenses = ['Apache-2.0'] s.summary = ''