Class: Telnyx::Resources::PronunciationDicts
- Inherits:
-
Object
- Object
- Telnyx::Resources::PronunciationDicts
- Defined in:
- lib/telnyx/resources/pronunciation_dicts.rb
Overview
Manage pronunciation dictionaries for text-to-speech synthesis. Dictionaries contain alias items (text replacement) and phoneme items (IPA pronunciation notation) that control how specific words are spoken.
Instance Method Summary collapse
-
#create(items:, name:, request_options: {}) ⇒ Telnyx::Models::PronunciationDictCreateResponse
Some parameter documentations has been truncated, see Models::PronunciationDictCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ nil
Permanently delete a pronunciation dictionary.
-
#initialize(client:) ⇒ PronunciationDicts
constructor
private
A new instance of PronunciationDicts.
-
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::PronunciationDictData>
List all pronunciation dictionaries for the authenticated organization.
-
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::PronunciationDictRetrieveResponse
Retrieve a single pronunciation dictionary by ID.
-
#update(id, items: nil, name: nil, request_options: {}) ⇒ Telnyx::Models::PronunciationDictUpdateResponse
Update the name and/or items of an existing pronunciation dictionary.
Constructor Details
#initialize(client:) ⇒ PronunciationDicts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PronunciationDicts.
151 152 153 |
# File 'lib/telnyx/resources/pronunciation_dicts.rb', line 151 def initialize(client:) @client = client end |
Instance Method Details
#create(items:, name:, request_options: {}) ⇒ Telnyx::Models::PronunciationDictCreateResponse
Some parameter documentations has been truncated, see Models::PronunciationDictCreateParams for more details.
Create a new pronunciation dictionary for the authenticated organization. Each dictionary contains a list of items that control how specific words are spoken. Items can be alias type (text replacement) or phoneme type (IPA pronunciation notation).
As an alternative to providing items directly as JSON, you can upload a dictionary file (PLS/XML or plain text format, max 1MB) using multipart/form-data. PLS files use the standard W3C Pronunciation Lexicon Specification XML format. Text files use a line-based format: ‘word=alias` for aliases, `word:/phoneme/` for IPA phonemes.
Limits:
-
Maximum 50 dictionaries per organization
-
Maximum 100 items per dictionary
-
Text: max 200 characters
-
Alias/phoneme value: max 500 characters
-
File upload: max 1MB (1,048,576 bytes)
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/telnyx/resources/pronunciation_dicts.rb', line 42 def create(params) parsed, = Telnyx::PronunciationDictCreateParams.dump_request(params) @client.request( method: :post, path: "pronunciation_dicts", body: parsed, model: Telnyx::Models::PronunciationDictCreateResponse, options: ) end |
#delete(id, request_options: {}) ⇒ nil
Permanently delete a pronunciation dictionary.
139 140 141 142 143 144 145 146 |
# File 'lib/telnyx/resources/pronunciation_dicts.rb', line 139 def delete(id, params = {}) @client.request( method: :delete, path: ["pronunciation_dicts/%1$s", id], model: NilClass, options: params[:request_options] ) end |
#list(page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::PronunciationDictData>
List all pronunciation dictionaries for the authenticated organization. Results are paginated using offset-based pagination.
115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/telnyx/resources/pronunciation_dicts.rb', line 115 def list(params = {}) parsed, = Telnyx::PronunciationDictListParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "pronunciation_dicts", query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"), page: Telnyx::Internal::DefaultFlatPagination, model: Telnyx::PronunciationDictData, options: ) end |
#retrieve(id, request_options: {}) ⇒ Telnyx::Models::PronunciationDictRetrieveResponse
Retrieve a single pronunciation dictionary by ID.
64 65 66 67 68 69 70 71 |
# File 'lib/telnyx/resources/pronunciation_dicts.rb', line 64 def retrieve(id, params = {}) @client.request( method: :get, path: ["pronunciation_dicts/%1$s", id], model: Telnyx::Models::PronunciationDictRetrieveResponse, options: params[:request_options] ) end |
#update(id, items: nil, name: nil, request_options: {}) ⇒ Telnyx::Models::PronunciationDictUpdateResponse
Update the name and/or items of an existing pronunciation dictionary. Uses optimistic locking — if the dictionary was modified concurrently, the request returns 409 Conflict.
90 91 92 93 94 95 96 97 98 99 |
# File 'lib/telnyx/resources/pronunciation_dicts.rb', line 90 def update(id, params = {}) parsed, = Telnyx::PronunciationDictUpdateParams.dump_request(params) @client.request( method: :patch, path: ["pronunciation_dicts/%1$s", id], body: parsed, model: Telnyx::Models::PronunciationDictUpdateResponse, options: ) end |