Title: | Lite Wrapper for the 'Zamzar File Conversion' API |
---|---|
Description: | A minor collection of HTTP wrappers for the 'Zamzar File Conversion' API. The wrappers makes it easy to utilize the API and thus convert between more than 100 different file formats (ranging from audio files, images, movie formats, etc., etc.) through an R session. For specifics regarding the API, please see <https://developers.zamzar.com/>. |
Authors: | Frederik Kok Hansen |
Maintainer: | Frederik Kok Hansen <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2025-02-08 04:53:03 UTC |
Source: | https://github.com/fkoh111/zzlite |
Delete file from Zamzar account provided a file id.
zz_delete(id = NULL, usr = NULL, verbose = FALSE)
zz_delete(id = NULL, usr = NULL, verbose = FALSE)
id |
The target id for a file you wish to delete. Most likely returned from ‘zz get info()‘. |
usr |
The username/API key you are using. If not set, the function will check if a key exists as a 'ZAMZAR_USR' variable in '.Renviron' and use that. |
verbose |
Boolean deciding whether or not verbose status messages should be returned. Defaults to 'FALSE'. |
Please note that a Zamzar key passed as argument to 'usr' takes precedence over a Zamzar key extracted from an '.Renviron'.
A status message indicating either success or failure.
## Not run: # An example of zz_delete() with a hardcoded file id zz_get(id = 12345678) ## End(Not run)
## Not run: # An example of zz_delete() with a hardcoded file id zz_get(id = 12345678) ## End(Not run)
Get dataframe of all the formats accepted by Zamzar. Alternatively, a dataframe of formats you can convert an origin to.
zz_format(origin = NULL, usr = NULL)
zz_format(origin = NULL, usr = NULL)
origin |
The origin format you want to convert from.
If a valid argument is passed to
See also: https://developers.zamzar.com/formats If no argument has been passed to |
usr |
The username/API key you are using. If not set, the function
will check if a key exists as a |
Please note that a Zamzar key passed as argument to usr
takes precedence over a
Zamzar key extracted from an .Renviron
.
Either a dataframe of formats that you can convert to, or a dataframe of accepted origin formats.
## Not run: # Returns a single column dataframe of all the accepted formats # for the origin param. zz_format(usr = "key") # Same as above (assuming a valid key in .Renviron). zz_format() # Returns an error since the origin argument isn't recognized by the Zamzar API. zz_format(origin = "invalid_origin") # Returns a dataframe of targets that origin can be converted to, # and of the cost of converting to a given target. zz_format(origin = "emf") ## End(Not run)
## Not run: # Returns a single column dataframe of all the accepted formats # for the origin param. zz_format(usr = "key") # Same as above (assuming a valid key in .Renviron). zz_format() # Returns an error since the origin argument isn't recognized by the Zamzar API. zz_format(origin = "invalid_origin") # Returns a dataframe of targets that origin can be converted to, # and of the cost of converting to a given target. zz_format(origin = "emf") ## End(Not run)
Get file from Zamzar account provided a file id. Per default ‘zz_get()' assumes that you’re doing development, thus using a development endpoint. Set prod boolean to 'TRUE' to change this behavior.
zz_get( id = NULL, usr = NULL, name = NULL, extension = NULL, overwrite = FALSE, prod = FALSE )
zz_get( id = NULL, usr = NULL, name = NULL, extension = NULL, overwrite = FALSE, prod = FALSE )
id |
The target id for a previously passed file. Most likely returned from 'zz_get_info()'. |
usr |
The username/API key you are using. If not set, the function will check if a key exists as a 'ZAMZAR_USR' variable in '.Renviron' and use that. |
name |
The name of the file you are fetching from Zamzar. If a name is not assigned to the file, then the id of the file will be used as file name. |
extension |
The extension of the file you are fetching from Zamzar. |
overwrite |
Should 'zz_get()' overwrite if a file with the same name already exists in directory. Defaults to 'FALSE'. |
prod |
Boolean deciding whether to use a production endpoint or a development endpoint. Defaults to FALSE (That is, development endpoint). |
On differences between endpoints, see: https://developers.zamzar.com/docs#section-Next_steps and https://developers.zamzar.com/docs#section-Rate_Limits
Please note that a Zamzar key passed as argument to 'usr' takes precedence over a Zamzar key extracted from an '.Renviron'.
A file written to disk.
## Not run: # An example of zz_get() utilized with hardcoded arguments zz_get(id = 12345678, usr = "key", name = "my_avatar", extension = "png") # An example of zz_get() used in conjunction with zz_get_info() # Please note this example assumes a valid key in .Renviron response <- zz_get_info(latest = TRUE) zz_get(id = response$id, extension = response$extension, prod = TRUE) ## End(Not run)
## Not run: # An example of zz_get() utilized with hardcoded arguments zz_get(id = 12345678, usr = "key", name = "my_avatar", extension = "png") # An example of zz_get() used in conjunction with zz_get_info() # Please note this example assumes a valid key in .Renviron response <- zz_get_info(latest = TRUE) zz_get(id = response$id, extension = response$extension, prod = TRUE) ## End(Not run)
Get info on files submitted to Zamzar by account.
zz_get_info(usr = NULL, latest = TRUE)
zz_get_info(usr = NULL, latest = TRUE)
usr |
The username/API key you are using. If not set, the function
will check if a key exists as a |
latest |
Boolean deciding whether or not metadata on all files that have been submitted within a reasonable time frame should be returned. If switched to Defaults to The returned dataframe contains the following columns:
|
Per default zz_get_info()
assumes you want information for the last
submitted file. To get information on all the files that have been submitted
within a reasonable time frame, set parameter latest
to FALSE
.
Please note: objects returned from zz_get_info()
doesn't differentiate
between development or production endpoint. You have to keep track of
this yourself.
Please note that a Zamzar key passed as argument to usr
takes precedence over a
Zamzar key extracted from an .Renviron
.
A dataframe.
## Not run: # Provided a valid token in .Renvirion, a dataframe of metadata for the last # submitted file will be returned. zz_get_info() # Same as above, we're just passing the key in a variable. zz_get_info(usr = "key") # Provided a valid token, will return metadata for all files # submitted to the API within a reasonable time frame. zz_get_info(usr = "key", latest = FALSE) # Same as above, we're just utilizing .Renviron. zz_get_info(latest = FALSE) ## End(Not run)
## Not run: # Provided a valid token in .Renvirion, a dataframe of metadata for the last # submitted file will be returned. zz_get_info() # Same as above, we're just passing the key in a variable. zz_get_info(usr = "key") # Provided a valid token, will return metadata for all files # submitted to the API within a reasonable time frame. zz_get_info(usr = "key", latest = FALSE) # Same as above, we're just utilizing .Renviron. zz_get_info(latest = FALSE) ## End(Not run)
Per default ‘zz_post()' assumes that you’re doing development, thus using a development endpoint. Set parameter 'prod' to 'TRUE' to change this behavior.
zz_post( file = NULL, extension = NULL, usr = NULL, prod = FALSE, verbose = FALSE )
zz_post( file = NULL, extension = NULL, usr = NULL, prod = FALSE, verbose = FALSE )
file |
The path to the file you want to convert. |
extension |
The file type you want to convert to. E.g., 'png'. |
usr |
The username/API key you are using. If not set, the function will check if a key exists as a 'ZAMZAR_USR' variable in '.Renviron' and use that. |
prod |
Boolean deciding whether to use production or development endpoint. Defaults to 'FALSE'. |
verbose |
Boolean deciding whether or not verbose status messages should be returned. Defaults to 'FALSE'. |
On differences between endpoints, see: https://developers.zamzar.com/docs#section-Next_steps and https://developers.zamzar.com/docs#section-Rate_Limits
Please note that a Zamzar key passed as argument to 'usr' takes precedence over a Zamzar key extracted from an '.Renviron'.
A status message indicating either success or failure.
zz_format
for a list of formats you can convert to.
## Not run: # Per default zz_post uses the development endpoint. zz_post(file = "avatar.emf", extension = "png") # Setting prod parameter to FALSE is the same as above. zz_post(file = "avatar.emf", extension = "png", prod = FALSE) # You need to flip prod to TRUE if you want to use the production endpoint. zz_post(file = "avatar.emf", extension = "png", prod = TRUE) # Remember you can always pass a Zamzar key to the usr parameter if you don't # want to use an .Renviron file. zz_post(file = "avatar.emf", usr = "key", extension = "png", prod = TRUE) ## End(Not run)
## Not run: # Per default zz_post uses the development endpoint. zz_post(file = "avatar.emf", extension = "png") # Setting prod parameter to FALSE is the same as above. zz_post(file = "avatar.emf", extension = "png", prod = FALSE) # You need to flip prod to TRUE if you want to use the production endpoint. zz_post(file = "avatar.emf", extension = "png", prod = TRUE) # Remember you can always pass a Zamzar key to the usr parameter if you don't # want to use an .Renviron file. zz_post(file = "avatar.emf", usr = "key", extension = "png", prod = TRUE) ## End(Not run)