Skip to content

upload_tiles doesn't return the 'response' #64

Description

@viniciusoike

Currently, upload_tiles has no return and just prints out a message with the upload ID (in case the upload was successful).

Current behavior

The function ends (in case it was successful) with:

message(sprintf("Your upload ID is %s", response$id))

The response object (which contains id, progress, complete, etc.) is never returned. This makes it difficult, for instance, to check the upload status programatically.

Suggested fix

The parsed API response could be returned invisibly, so that:

  • Existing code that calls upload_tiles() without assignment is unaffected (the message still prints).
  • Users who assign the result can pass response$id to check_upload_status().

This could be made by adding invisible(response) at the end of the function.

message(sprintf("Your upload ID is %s", response$id))
invisible(response)

Which would allow something like this to work:

res <- mapboxapi::upload_tiles(
  shape,
  username = "username",
  tileset_id = "cities_sao_paulo",
  tileset_name = "sao_paulo"
)

mapboxapi::check_upload_status(res$id, "username")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions