Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Feb 15, 2024
1 parent 8640e6f commit d700366
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 34 deletions.
39 changes: 19 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
name: Publish Ruby Gem
name: Publish

on: [push]

jobs:
build-and-publish:
name: Build and publish Gem to RubyGems
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
publish:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true

- name: Build and Push Gem
env:
GEM_HOST_API_KEY: ${{ secrets.RUBY_GEMS_API_KEY }}
run: |
gem build assemblyai.gemspec
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true

- name: Build and Push Gem
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
gem build assemblyai.gemspec
gem push assemblyai-*.gem --host https://rubygems.org
gem push assemblyai-*.gem --host https://rubygems.org/
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

require "json"

module AssemblyAI
class Realtime
# Configure the threshold for how long to wait before ending an utterance. Default is 700ms.
class ConfigureEndUtteranceSilenceThreshold
attr_reader :end_utterance_silence_threshold, :additional_properties

# @param end_utterance_silence_threshold [Integer] The duration threshold in milliseconds
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
# @return [Realtime::ConfigureEndUtteranceSilenceThreshold]
def initialize(end_utterance_silence_threshold:, additional_properties: nil)
# @type [Integer] The duration threshold in milliseconds
@end_utterance_silence_threshold = end_utterance_silence_threshold
# @type [OpenStruct] Additional properties unmapped to the current class definition
@additional_properties = additional_properties
end

# Deserialize a JSON object to an instance of ConfigureEndUtteranceSilenceThreshold
#
# @param json_object [JSON]
# @return [Realtime::ConfigureEndUtteranceSilenceThreshold]
def self.from_json(json_object:)
struct = JSON.parse(json_object, object_class: OpenStruct)
JSON.parse(json_object)
end_utterance_silence_threshold = struct.end_utterance_silence_threshold
new(end_utterance_silence_threshold: end_utterance_silence_threshold, additional_properties: struct)
end

# Serialize an instance of ConfigureEndUtteranceSilenceThreshold to a JSON object
#
# @return [JSON]
def to_json(*_args)
{ "end_utterance_silence_threshold": @end_utterance_silence_threshold }.to_json
end

# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
#
# @param obj [Object]
# @return [Void]
def self.validate_raw(obj:)
obj.end_utterance_silence_threshold.is_a?(Integer) != false || raise("Passed value for field obj.end_utterance_silence_threshold is not the expected type, validation failed.")
end
end
end
end
48 changes: 48 additions & 0 deletions lib/assemblyai/realtime/types/force_end_utterance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

require "json"

module AssemblyAI
class Realtime
# Manually end an utterance
class ForceEndUtterance
attr_reader :force_end_utterance, :additional_properties

# @param force_end_utterance [Boolean] A boolean value to communicate that you wish to force the end of the utterance
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
# @return [Realtime::ForceEndUtterance]
def initialize(force_end_utterance:, additional_properties: nil)
# @type [Boolean] A boolean value to communicate that you wish to force the end of the utterance
@force_end_utterance = force_end_utterance
# @type [OpenStruct] Additional properties unmapped to the current class definition
@additional_properties = additional_properties
end

# Deserialize a JSON object to an instance of ForceEndUtterance
#
# @param json_object [JSON]
# @return [Realtime::ForceEndUtterance]
def self.from_json(json_object:)
struct = JSON.parse(json_object, object_class: OpenStruct)
JSON.parse(json_object)
force_end_utterance = struct.force_end_utterance
new(force_end_utterance: force_end_utterance, additional_properties: struct)
end

# Serialize an instance of ForceEndUtterance to a JSON object
#
# @return [JSON]
def to_json(*_args)
{ "force_end_utterance": @force_end_utterance }.to_json
end

# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
#
# @param obj [Object]
# @return [Void]
def self.validate_raw(obj:)
obj.force_end_utterance.is_a?(Boolean) != false || raise("Passed value for field obj.force_end_utterance is not the expected type, validation failed.")
end
end
end
end
19 changes: 5 additions & 14 deletions lib/assemblyai/realtime/types/terminate_session.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
# frozen_string_literal: true

require_relative "message_type"
require "json"

module AssemblyAI
class Realtime
class TerminateSession
attr_reader :terminate_session, :message_type, :additional_properties
attr_reader :terminate_session, :additional_properties

# @param terminate_session [Boolean] Set to true to end your real-time session forever
# @param message_type [MESSAGE_TYPE] Describes the type of the message
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
# @return [Realtime::TerminateSession]
def initialize(terminate_session:, message_type:, additional_properties: nil)
def initialize(terminate_session:, additional_properties: nil)
# @type [Boolean] Set to true to end your real-time session forever
@terminate_session = terminate_session
# @type [MESSAGE_TYPE] Describes the type of the message
@message_type = message_type
# @type [OpenStruct] Additional properties unmapped to the current class definition
@additional_properties = additional_properties
end
Expand All @@ -27,20 +23,16 @@ def initialize(terminate_session:, message_type:, additional_properties: nil)
# @return [Realtime::TerminateSession]
def self.from_json(json_object:)
struct = JSON.parse(json_object, object_class: OpenStruct)
parsed_json = JSON.parse(json_object)
JSON.parse(json_object)
terminate_session = struct.terminate_session
message_type = Realtime::MESSAGE_TYPE.key(parsed_json["message_type"]) || parsed_json["message_type"]
new(terminate_session: terminate_session, message_type: message_type, additional_properties: struct)
new(terminate_session: terminate_session, additional_properties: struct)
end

# Serialize an instance of TerminateSession to a JSON object
#
# @return [JSON]
def to_json(*_args)
{
"terminate_session": @terminate_session,
"message_type": Realtime::MESSAGE_TYPE[@message_type] || @message_type
}.to_json
{ "terminate_session": @terminate_session }.to_json
end

# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
Expand All @@ -49,7 +41,6 @@ def to_json(*_args)
# @return [Void]
def self.validate_raw(obj:)
obj.terminate_session.is_a?(Boolean) != false || raise("Passed value for field obj.terminate_session is not the expected type, validation failed.")
obj.message_type.is_a?(Realtime::MESSAGE_TYPE) != false || raise("Passed value for field obj.message_type is not the expected type, validation failed.")
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions lib/types_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
require_relative "assemblyai/realtime/types/final_transcript"
require_relative "assemblyai/realtime/types/word"
require_relative "assemblyai/realtime/types/audio_data"
require_relative "assemblyai/realtime/types/force_end_utterance"
require_relative "assemblyai/realtime/types/configure_end_utterance_silence_threshold"
require_relative "assemblyai/realtime/types/terminate_session"
require_relative "assemblyai/realtime/types/audio_encoding"
require_relative "assemblyai/lemur/types/purge_lemur_request_data_response"
Expand Down

0 comments on commit d700366

Please sign in to comment.