Class: Retell::SDK::Unofficial::API::Voice

Inherits:
Object
  • Object
show all
Defined in:
lib/retell/sdk/unofficial/api/voice.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Voice

Returns a new instance of Voice.



6
7
8
# File 'lib/retell/sdk/unofficial/api/voice.rb', line 6

def initialize(client)
  @client = client
end

Instance Method Details

#list(extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/retell/sdk/unofficial/api/voice.rb', line 31

def list(
  extra_headers: nil,
  extra_query: nil,
  extra_body: nil,
  timeout: nil
)
  options = @client.make_request_options(
    extra_headers: extra_headers,
    extra_query: extra_query,
    extra_body: extra_body,
    timeout: timeout
  )

  @client.get('/list-voices', **options)
end

#retrieve(voice_or_id, extra_headers: nil, extra_query: nil, extra_body: nil, timeout: nil) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/retell/sdk/unofficial/api/voice.rb', line 10

def retrieve(
  voice_or_id,
  extra_headers: nil,
  extra_query: nil,
  extra_body: nil,
  timeout: nil
)
  voice_id = voice_or_id.is_a?(Retell::SDK::Unofficial::Voice) ? voice_or_id.voice_id : voice_or_id

  raise ArgumentError, "Expected a non-empty value for `voice_id` but received #{voice_id.inspect}" if voice_id.to_s.empty?

  options = @client.make_request_options(
    extra_headers: extra_headers,
    extra_query: extra_query,
    extra_body: extra_body,
    timeout: timeout
  )

  @client.get("/get-voice/#{voice_id}", **options)
end