lib/phrase/api/uploads_api.rb in phrase-2.26.0 vs lib/phrase/api/uploads_api.rb in phrase-3.0.0

- old
+ new

@@ -8,64 +8,76 @@ @api_client = api_client end # Upload a new file # Upload a new language file. Creates necessary resources in your project. # @param project_id [String] Project ID + # @param file [File] File to be imported + # @param file_format [String] File format. Auto-detected when possible and not specified. + # @param locale_id [String] Locale of the file&#39;s content. Can be the name or id of the locale. Preferred is id. # @param [Hash] opts the optional parameters # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) # @option opts [String] :branch specify the branch to use - # @option opts [File] :file File to be imported - # @option opts [String] :file_format File format. Auto-detected when possible and not specified. - # @option opts [String] :locale_id Locale of the file&#39;s content. Can be the name or public id of the locale. Preferred is the public id. # @option opts [String] :tags List of tags separated by comma to be associated with the new keys contained in the upload. # @option opts [Boolean] :update_translations Indicates whether existing translations should be updated with the file content. # @option opts [Boolean] :update_descriptions Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions. # @option opts [Boolean] :convert_emoji This option is obsolete. Providing the option will cause a bad request error. # @option opts [Boolean] :skip_upload_tags Indicates whether the upload should not create upload tags. # @option opts [Boolean] :skip_unverification Indicates whether the upload should unverify updated translations. # @option opts [String] :file_encoding Enforces a specific encoding on the file contents. Valid options are \\\&quot;UTF-8\\\&quot;, \\\&quot;UTF-16\\\&quot; and \\\&quot;ISO-8859-1\\\&quot;. - # @option opts [Object] :locale_mapping Optional, format specific mapping between locale names and the columns the translations to those locales are contained in. + # @option opts [Object] :locale_mapping Mapping between locale names and translation columns. Required in some formats like CSV or XLSX. # @option opts [Object] :format_options Additional options available for specific formats. See our format guide for complete list. # @option opts [Boolean] :autotranslate If set, translations for the uploaded language will be fetched automatically. # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project. # @option opts [Boolean] :tag_only_affected_keys Indicates whether only keys affected (created or updated) by the upload should be tagged. The default is &#x60;false&#x60; (default to false) # @return [Upload] - def upload_create(project_id, opts = {}) - data, _status_code, _headers = upload_create_with_http_info(project_id, opts) + def upload_create(project_id, file, file_format, locale_id, opts = {}) + data, _status_code, _headers = upload_create_with_http_info(project_id, file, file_format, locale_id, opts) data end # Upload a new file # Upload a new language file. Creates necessary resources in your project. # @param project_id [String] Project ID + # @param file [File] File to be imported + # @param file_format [String] File format. Auto-detected when possible and not specified. + # @param locale_id [String] Locale of the file&#39;s content. Can be the name or id of the locale. Preferred is id. # @param [Hash] opts the optional parameters # @option opts [String] :x_phrase_app_otp Two-Factor-Authentication token (optional) # @option opts [String] :branch specify the branch to use - # @option opts [File] :file File to be imported - # @option opts [String] :file_format File format. Auto-detected when possible and not specified. - # @option opts [String] :locale_id Locale of the file&#39;s content. Can be the name or public id of the locale. Preferred is the public id. # @option opts [String] :tags List of tags separated by comma to be associated with the new keys contained in the upload. # @option opts [Boolean] :update_translations Indicates whether existing translations should be updated with the file content. # @option opts [Boolean] :update_descriptions Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions. # @option opts [Boolean] :convert_emoji This option is obsolete. Providing the option will cause a bad request error. # @option opts [Boolean] :skip_upload_tags Indicates whether the upload should not create upload tags. # @option opts [Boolean] :skip_unverification Indicates whether the upload should unverify updated translations. # @option opts [String] :file_encoding Enforces a specific encoding on the file contents. Valid options are \\\&quot;UTF-8\\\&quot;, \\\&quot;UTF-16\\\&quot; and \\\&quot;ISO-8859-1\\\&quot;. - # @option opts [Object] :locale_mapping Optional, format specific mapping between locale names and the columns the translations to those locales are contained in. + # @option opts [Object] :locale_mapping Mapping between locale names and translation columns. Required in some formats like CSV or XLSX. # @option opts [Object] :format_options Additional options available for specific formats. See our format guide for complete list. # @option opts [Boolean] :autotranslate If set, translations for the uploaded language will be fetched automatically. # @option opts [Boolean] :mark_reviewed Indicated whether the imported translations should be marked as reviewed. This setting is available if the review workflow is enabled for the project. # @option opts [Boolean] :tag_only_affected_keys Indicates whether only keys affected (created or updated) by the upload should be tagged. The default is &#x60;false&#x60; # @return [Array<(Response<(Upload)>, Integer, Hash)>] Response<(Upload)> data, response status code and response headers - def upload_create_with_http_info(project_id, opts = {}) + def upload_create_with_http_info(project_id, file, file_format, locale_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: UploadsApi.upload_create ...' end # verify the required parameter 'project_id' is set if @api_client.config.client_side_validation && project_id.nil? fail ArgumentError, "Missing the required parameter 'project_id' when calling UploadsApi.upload_create" end + # verify the required parameter 'file' is set + if @api_client.config.client_side_validation && file.nil? + fail ArgumentError, "Missing the required parameter 'file' when calling UploadsApi.upload_create" + end + # verify the required parameter 'file_format' is set + if @api_client.config.client_side_validation && file_format.nil? + fail ArgumentError, "Missing the required parameter 'file_format' when calling UploadsApi.upload_create" + end + # verify the required parameter 'locale_id' is set + if @api_client.config.client_side_validation && locale_id.nil? + fail ArgumentError, "Missing the required parameter 'locale_id' when calling UploadsApi.upload_create" + end # resource path local_var_path = '/projects/{project_id}/uploads'.sub('{' + 'project_id' + '}', CGI.escape(project_id.to_s)) # query parameters query_params = opts[:query_params] || {} @@ -78,13 +90,13 @@ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil? # form parameters form_params = opts[:form_params] || {} + form_params['file'] = file + form_params['file_format'] = file_format + form_params['locale_id'] = locale_id form_params['branch'] = opts[:'branch'] if !opts[:'branch'].nil? - form_params['file'] = opts[:'file'] if !opts[:'file'].nil? - form_params['file_format'] = opts[:'file_format'] if !opts[:'file_format'].nil? - form_params['locale_id'] = opts[:'locale_id'] if !opts[:'locale_id'].nil? form_params['tags'] = opts[:'tags'] if !opts[:'tags'].nil? form_params['update_translations'] = opts[:'update_translations'] if !opts[:'update_translations'].nil? form_params['update_descriptions'] = opts[:'update_descriptions'] if !opts[:'update_descriptions'].nil? form_params['convert_emoji'] = opts[:'convert_emoji'] if !opts[:'convert_emoji'].nil? form_params['skip_upload_tags'] = opts[:'skip_upload_tags'] if !opts[:'skip_upload_tags'].nil?