-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: regenerated with OpenAPI Doc 0.4.0 ., Speakeasy CLI 1.332.1
- Loading branch information
1 parent
6030aa0
commit bc4c2aa
Showing
19 changed files
with
265 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# CreateRequestBody | ||
|
||
|
||
## Fields | ||
|
||
| Field | Type | Required | Description | | ||
| ------------------ | ------------------ | ------------------ | ------------------ | | ||
| `url` | *::String* | :heavy_check_mark: | URL to shorten | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: "<YOUR_API_KEY_HERE>", | ||
) | ||
) | ||
|
||
|
||
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)** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
lib/speakeasy_client_sdk/models/operations/create_requestbody.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
33 changes: 33 additions & 0 deletions
33
lib/speakeasy_client_sdk/models/operations/create_response.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.