Uploads the trailer preview
 @param app_version (AppVersion): The version of your app
 @param upload_trailer_preview (UploadFile): The trailer preview to upload
 @param device (string): The target device
 @return [JSON] the response
508323
def upload_trailer_preview(app_version, upload_trailer_preview, device)
      raise "app_version is required" unless app_version
      raise "upload_trailer_preview is required" unless upload_trailer_preview
      raise "device is required" unless device

      du_client.upload_trailer_preview(app_version, upload_trailer_preview, content_provider_id, sso_token_for_image, device)
    end
353062
def update_device(self, device_obj):
        
        rid = device_obj['rid']
        device_obj['info']['description']['meta'] = \
                json.dumps(device_obj['info']['description']['meta'])
        headers = {
                'User-Agent': self.user_agent(),
        }
        headers.update(self.headers())

        r = requests.put(   self.portals_url()+'/devices/'+rid, 
                            data=json.dumps(device_obj),
                            headers=headers,
                            auth=self.auth())
        if HTTP_STATUS.OK == r.status_code:
            # fix the 'meta' to be dictionary instead of string
            updated_dev_obj = r.json()
            updated_dev_obj['info']['description']['meta'] =\
                            json.loads(device_obj['info']['description']['meta'])
            return updated_dev_obj
        else:
            print("update_device: Something went wrong: <{0}>: {1}".format(
                        r.status_code, r.reason))
            r.raise_for_status()
200267
def version_already_uploaded(project_name, version_str, index_url, requests_verify=True):
    
    all_versions = _get_uploaded_versions(project_name, index_url, requests_verify)
    return version_str in all_versions
1326054
def _create_or_update_version(app_name, version, app_spec, try_update=True):
    
    # This has a race condition since the app could have been created or
    # published since we last looked.
    try:
        app_id = dxpy.api.app_new(app_spec)["id"]
        return app_id
    except dxpy.exceptions.DXAPIError as e:
        # TODO: detect this error more reliably
        if e.name == 'InvalidInput' and e.msg == 'Specified name and version conflict with an existing alias':
            print('App %s/%s already exists' % (app_spec["name"], version), file=sys.stderr)
            # The version number was already taken, so app/new doesn't work.
            # However, maybe it hasn't been published yet, so we might be able
            # to app-xxxx/update it.
            app_describe = dxpy.api.app_describe("app-" + app_name, alias=version)
            if app_describe.get("published", 0) > 0:
                return None
            return _update_version(app_name, version, app_spec, try_update=try_update)
        raise e
148079
function(app/*, parentAddon*/) {
    this._super.included.apply(this, arguments);
    this._options = app.options.newVersion || {};

    if (this._options.enabled === true) {
      this._options.fileName = this._options.fileName || 'VERSION.txt';
      this._options.prepend  = this._options.prepend  || '';
      this._options.useAppVersion = this._options.useAppVersion || false;
    }
  }
636364
public ApiResponse<DeviceEnvelope> addDeviceWithHttpInfo(Device device) throws ApiException {
        com.squareup.okhttp.Call call = addDeviceValidateBeforeCall(device, null, null);
        Type localVarReturnType = new TypeToken<DeviceEnvelope>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
62657
def upload_scan(self, application_id, file_path):
        
        return self._request(
            'POST', 'rest/applications/' + str(application_id) + '/upload',
            files={'file': open(file_path, 'rb')}
        )
319096
def version
      send_message!(Protocol::Device::GetVersion.new,
         wait_for: Protocol::Device::StateVersion) do |payload|
        {
          vendor: payload.vendor,
          product: payload.product,
          version: payload.version
        }
      end
    end
941509
def post(self, request, *args, **kwargs):
        
        self.init_attachment_cache()

        # Stores a boolean indicating if we are considering a preview
        self.preview = 'preview' in self.request.POST

        # Initializes the forms
        post_form_class = self.get_post_form_class()
        post_form = self.get_post_form(post_form_class)
        attachment_formset_class = self.get_attachment_formset_class()
        attachment_formset = self.get_attachment_formset(attachment_formset_class)

        self.attachment_preview = (
            self.preview if attachment_formset and attachment_formset.is_valid() else None
        )

        post_form_valid = post_form.is_valid()
        if (
            (post_form_valid and attachment_formset is None) or
            (post_form_valid and attachment_formset.is_valid())
        ):
            return self.form_valid(post_form, attachment_formset)
        else:
            return self.form_invalid(post_form, attachment_formset)
718755
def upload_file(file_name, file_path, callback_method='parse')
      status = {}
      upload_config
      @file_name          = file_name
      @file_path          = file_path      
      @original_zip_file  = "#{@file_path}/#{@file_name}"
      @csv_file_name      = @file_name.gsub(/\.zip/,'')

      begin
        if @zipped
          delete_csv_if_present
          unzip_file
        end
        
        status = self.send(callback_method)
      rescue Exception =>  e
        error_in_upload([[invalid_file_message]]) if @error_file_needed
        Rails.logger.error e.formatted_exception("Uploading file #{@file_name} failed!")
        status = { errors: 1, status: 500}
      ensure
        File.delete @original_zip_file if File.exists?(@original_zip_file)
      end
      status
    end
1207022
def upload_vcl(self, service_id, version_number, name, content, main=None, comment=None):
		""""""
		body = self._formdata({
			"name": name,
			"content": content,
			"comment": comment,
			"main": main,
		}, FastlyVCL.FIELDS)
		content = self._fetch("/service/%s/version/%d/vcl" % (service_id, version_number), method="POST", body=body)
		return FastlyVCL(self, content)
679848
def _update_version(app_name, version, app_spec, try_update=True):
    
    if not try_update:
        return None
    try:
        app_id = dxpy.api.app_update("app-" + app_name, version, app_spec)["id"]
        return app_id
    except dxpy.exceptions.DXAPIError as e:
        if e.name == 'InvalidState':
            print('App %s/%s has already been published' % (app_spec["name"], version), file=sys.stderr)
            return None
        raise e
167913
def update_product_version(id, **kwargs):
    
    content = update_product_version_raw(id, **kwargs)
    if content:
        return utils.format_json(content)
614217
def post(self, request, *args, **kwargs):
        
        self.init_attachment_cache()

        # Stores a boolean indicating if we are considering a preview
        self.preview = 'preview' in self.request.POST

        # Initializes the forms
        post_form_class = self.get_post_form_class()
        post_form = self.get_post_form(post_form_class)
        attachment_formset_class = self.get_attachment_formset_class()
        attachment_formset = self.get_attachment_formset(attachment_formset_class)
        poll_option_formset_class = self.get_poll_option_formset_class()
        poll_option_formset = self.get_poll_option_formset(poll_option_formset_class)

        post_form_valid = post_form.is_valid()
        attachment_formset_valid = (
            attachment_formset.is_valid() if attachment_formset else None
        )
        poll_option_formset_valid = (
            poll_option_formset.is_valid()
            if poll_option_formset and len(post_form.cleaned_data['poll_question']) else None
        )

        self.attachment_preview = self.preview if attachment_formset_valid else None
        self.poll_preview = self.preview if poll_option_formset_valid else None

        poll_options_validated = poll_option_formset_valid is not None
        if (
            post_form_valid and
            attachment_formset_valid is not False and
            poll_option_formset_valid is not False
        ):
            return self.form_valid(
                post_form, attachment_formset, poll_option_formset,
                poll_options_validated=poll_options_validated,
            )
        else:
            return self.form_invalid(
                post_form, attachment_formset, poll_option_formset,
                poll_options_validated=poll_options_validated,
            )
1004520
def apps_upload_create(self, data, **kwargs):
        ""
        api_path = "/api/v2/apps/uploads.json"
        return self.call(api_path, method="POST", data=data, **kwargs)
1200553
def upload_purchase_review_screenshot(app_id, upload_image)
      data = du_client.upload_purchase_review_screenshot(app_id, upload_image, content_provider_id, sso_token_for_image)
      {
          "value" => {
              "assetToken" => data["token"],
              "sortOrder" => 0,
              "type" => du_client.get_picture_type(upload_image),
              "originalFileName" => upload_image.file_name,
              "size" => data["length"],
              "height" => data["height"],
              "width" => data["width"],
              "checksum" => data["md5"]
          }
      }
    end
70900
def show_version_queue(a_device, output_q):
    
    output_dict = {}
    remote_conn = ConnectHandler(**a_device)
    hostname = remote_conn.base_prompt
    output = ("#" * 80) + "\n"
    output += remote_conn.send_command("show version") + "\n"
    output += ("#" * 80) + "\n"
    output_dict[hostname] = output
    output_q.put(output_dict)