@@ -730,6 +730,8 @@ def create_spoken_terms(
730730 self ,
731731 name : str ,
732732 term_lists : List [SpokenTermsEntries ],
733+ * ,
734+ extra_body_parameters : Optional [Dict [str , Any ]] = None ,
733735 ) -> SpokenTerms :
734736 """Creates a spoken-terms collection with the given name and term
735737 lists, one per language. Spoken terms improve the transcription of
@@ -738,18 +740,22 @@ def create_spoken_terms(
738740 :param name: User-defined name to attach to the collection.
739741 :param term_lists: List of SpokenTermsEntries, each containing the
740742 terms of one language.
743+ :param extra_body_parameters: (Optional) Additional key/value pairs
744+ to send in the JSON request body; they replace fields the library
745+ sets with the same key.
741746 :return: SpokenTerms containing information about the created
742747 collection.
743748 :raises ValueError: If a term, after stripping leading and trailing
744749 whitespace, is empty or contains a control character, as
745750 validate_glossary_term() checks.
746751 """
747- request_data = {
752+ request_data : Dict [ str , Any ] = {
748753 "name" : name ,
749754 "term_lists" : [
750755 self ._spoken_terms_json (entries ) for entries in term_lists
751756 ],
752757 }
758+ request_data .update (extra_body_parameters or {})
753759 status , content , json = self ._api_call (
754760 "v3/spoken-terms" , json = request_data
755761 )
@@ -795,6 +801,7 @@ def update_spoken_terms(
795801 * ,
796802 name : Optional [str ] = None ,
797803 term_lists : Optional [List [SpokenTermsEntries ]] = None ,
804+ extra_body_parameters : Optional [Dict [str , Any ]] = None ,
798805 ) -> SpokenTerms :
799806 """Updates a spoken-terms collection: renames it and/or merges the
800807 given terms into the existing term list of each given language.
@@ -803,6 +810,9 @@ def update_spoken_terms(
803810 :param name: (Optional) New name of the collection.
804811 :param term_lists: (Optional) List of SpokenTermsEntries whose terms
805812 are merged into the term list of the same language.
813+ :param extra_body_parameters: (Optional) Additional key/value pairs
814+ to send in the JSON request body; they replace fields the library
815+ sets with the same key.
806816 :return: SpokenTerms containing information about the updated
807817 collection.
808818 :raises ValueError: If a term, after stripping leading and trailing
@@ -817,6 +827,7 @@ def update_spoken_terms(
817827 request_data ["term_lists" ] = [
818828 self ._spoken_terms_json (entries ) for entries in term_lists
819829 ]
830+ request_data .update (extra_body_parameters or {})
820831 status , content , json = self ._api_call (
821832 f"v3/spoken-terms/{ spoken_terms_id } " ,
822833 method = "PATCH" ,
@@ -849,23 +860,30 @@ def replace_spoken_terms_list(
849860 self ,
850861 spoken_terms : Union [str , SpokenTerms ],
851862 entries : SpokenTermsEntries ,
863+ * ,
864+ extra_body_parameters : Optional [Dict [str , Any ]] = None ,
852865 ) -> SpokenTermsList :
853866 """Replaces the term list of one language in a spoken-terms
854867 collection, or adds it if the collection has no list for the
855868 language.
856869
857870 :param spoken_terms: SpokenTerms or ID of the collection.
858871 :param entries: SpokenTermsEntries with the language and its terms.
872+ :param extra_body_parameters: (Optional) Additional key/value pairs
873+ to send in the JSON request body; they replace fields the library
874+ sets with the same key.
859875 :return: SpokenTermsList containing information about the term list.
860876 :raises ValueError: If a term, after stripping leading and trailing
861877 whitespace, is empty or contains a control character, as
862878 validate_glossary_term() checks.
863879 """
864880 spoken_terms_id = self ._spoken_terms_id (spoken_terms )
881+ request_data = self ._spoken_terms_json (entries )
882+ request_data .update (extra_body_parameters or {})
865883 status , content , json = self ._api_call (
866884 f"v3/spoken-terms/{ spoken_terms_id } /term-lists" ,
867885 method = "PUT" ,
868- json = self . _spoken_terms_json ( entries ) ,
886+ json = request_data ,
869887 )
870888 self ._raise_for_status (status , content , json )
871889 return self ._parse_spoken_terms_response (
0 commit comments