Represents an authenticated connection to the USGS/EROS M2M API. Create one with [m2m_session()] rather than calling `M2MSession$new()` directly.
Methods
M2MSession$new()
Authenticate and open a session. Both arguments are required; [m2m_session()] is the documented way in and is what supplies the `M2M_USERNAME` / `M2M_TOKEN` defaults.
Usage
M2MSession$new(username, token)M2MSession$dataset()
Look up a dataset by alias or id. This is the usual starting point for a search.
M2MSession$find_datasets()
Search the catalog for datasets matching a name pattern. Use this when you don't yet know a dataset's alias; wildcards are applied automatically around `pattern`.
M2MSession$download_queue()
Reconnect to an existing download order by its label, for example to resume collecting a large order in a later R session.
M2MSession$remove_items()
Remove individual downloads from the queue, across any label. Use this to clear out completed or unwanted entries without dropping a whole order the way `M2MDownloadQueue$cancel()` does.
Ids come from the `downloadId` column of `$downloads()`:
“` done <- dplyr::filter(sess$downloads(), statusText == "Complete") sess$remove_items(done$downloadId) “`
The API removes one item per request and answers the same way for an id that does not exist, so a successful call is not evidence that anything was removed - check `$downloads()` afterwards.
M2MSession$download_labels()
List the distinct order labels in the download queue, one row each. Use this to find an order to reconnect to with `$download_queue()` when you no longer remember its label.
M2MSession$eula()
Retrieve the text of one or more End User License Agreements. Some datasets require a EULA to be accepted (once, through the EarthExplorer website) before downloads will succeed.
M2MSession$scene_list()
Attach to a scene list that already exists server-side.
M2MSession$ers_session()
Return the small session value used by the package's internal HTTP functions. This method is intended for package internals.
M2MSession$logout()
End the session, invalidating its API key. M2M sessions also expire on their own after a period of inactivity.