import { API } from "./API" ; import { APIUtils } from "./APIUtils" ; export interface ILanguageConfig { id : string ; type : string ; attributes : { id : string ; language_id : string ; language_code : string ; } ; } export interface IGetLanguageConfigsResponse { data : ILanguageConfig [ ] ; } const LanguageConfigsAPI = { getLanguageConfigs : async ( options ) : Promise < IGetLanguageConfigsResponse > => { return API . getRequest ( `projects/${ options . projectId }/export_configs/${ options . exportConfigId }/language_configs` , true ) . then ( APIUtils . handleErrors ) . catch ( APIUtils . handleErrors ) ; } , createLanguageConfig : async ( options ) => { return API . postRequest ( `projects/${ options . projectId }/export_configs/${ options . exportConfigId }/language_configs` , true , { language_id : options . languageId , language_code : options . languageCode } ) . then ( APIUtils . handleErrors ) . catch ( APIUtils . handleErrors ) ; } , updateLanguageConfig : async ( options ) => { return API . putRequest ( `projects/${ options . projectId }/export_configs/${ options . exportConfigId }/language_configs/${ options . languageConfigId }` , true , { language_id : options . languageId , language_code : options . languageCode } ) . then ( APIUtils . handleErrors ) . catch ( APIUtils . handleErrors ) ; } , deleteLanguageConfig : async ( options ) => { return API . deleteRequest ( `projects/${ options . projectId }/export_configs/${ options . exportConfigId }/language_configs/${ options . languageConfigId }` , true ) . then ( APIUtils . handleErrors ) . catch ( APIUtils . handleErrors ) ; } } ; export { LanguageConfigsAPI } ;