Metadata-Version: 2.1
Name: fmo-cli
Version: 1.2.0
Summary: Command Line Interface to access and upload FindMyOyster data
Author: Gudjon Magnusson
Author-email: gmagnusson@fraunhofer.org
Keywords: FindMyOyster,CLI
Requires-Python: >=3.7, <4
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: requests>=2.28.2
Requires-Dist: python_dotenv>=1.0.0
Requires-Dist: geojson>=3.0.1

# FindMyOyster Command Line Interface

This CLI tool allows you to interact with the [FindMyOyster](https://findmyoyster.com) backend to upload or access data. You can also use it as a library in your own scripts.

## Installation

```
pip install fmo-cli
```

## Authenticate 

Before making any requests to the API you must authenticate. API requests are authenticated using a token.

To get a token to must use the `authenticate` command.

```
fmo authenticate
```
The command will ask for 4 values
- URL: Where is the FMO server? The default value is most likely OK
- Farm: FMO isolates all data per farm. Before doing anything you need to know what farm you are working with. For experiments you can probably use the "demo" farm, which is basically open to anyone.
- Username: The username you would use in the app
- Password: The password you would use in the app

If authentication is successful, then a token will be saved in a `.env` file. FMO will look for the token there for all subsequent request. 

If you already have a token, you are welcome to create the file by hand and skip the authentication step. The file should look like this:
```
FMO_TOKEN=<my-token>
FMO_API_URL=https://api.findmyoyster.com/v1
```


## Example commands

Get a list of oyster beds at the farm
```
fmo beds list
```

Generate a sample path on a given oyster bed. Generated paths are useful for test and demos.
```
fmo simulator spiral-path --bed <bed-id> -o my-path.json --preview
```

Upload a path as a new substrate log
```
fmo logs upload --file my-path.json --type substrate
```

Find a list of logs on a oyster bed
```
fmo logs find --bed <bed-id> --type substrate
```

View and download a specific log
```
fmo logs geometry <log-id> --preview -o output.json
```
