v1.0.0 #28

Merged
bizcochito merged 147 commits from develop into main 2024-01-14 19:49:34 +00:00
1 changed files with 22 additions and 2 deletions
Showing only changes of commit 81373528c0 - Show all commits

View File

@ -14,7 +14,16 @@ Allows to get a list of image documents.
- `status`: an optional parameter, which accepts the values `consumed`, `available` and `unavailable`. It filters the documents that have only the `status` attribute equal to that indicated in the parameter's value. If the parameter is missing, no filter will be applied to the document. - `status`: an optional parameter, which accepts the values `consumed`, `available` and `unavailable`. It filters the documents that have only the `status` attribute equal to that indicated in the parameter's value. If the parameter is missing, no filter will be applied to the document.
#### Example #### Example
- `GET /images?limit=5&status=available`: will return 5 documents that have the `available` value in their `status` attribute. - `GET /images?limit=5&status=available` will return 5 documents that have the `available` value in their `status` attribute.
### GET `/images/<id>`
Allows to get an image document.
#### Params
- `id`: the id of the document to be modified.
#### Example
`GET /images/61f7e48f0c651345677b7775` will get the document referenced by the `id` param.
### PUT `/images/<id>` ### PUT `/images/<id>`
Modifies an existing image document. The request must provide a JSON-formatted body, with one or more valid document attributes. The existing document attributes will be replaced with the provided new ones. Modifies an existing image document. The request must provide a JSON-formatted body, with one or more valid document attributes. The existing document attributes will be replaced with the provided new ones.
@ -23,10 +32,20 @@ Modifies an existing image document. The request must provide a JSON-formatted b
- `id`: the id of the document to be modified. - `id`: the id of the document to be modified.
#### Example #### Example
- `PUT /images/61f7e48f0c651345677b7775` with body `{ "status": "consumed" }`: will modify the document referenced by the `id` param, changing their `status` value to `consumed`. - `PUT /images/61f7e48f0c651345677b7775` with body `{ "status": "consumed" }` will modify the document referenced by the `id` param, changing their `status` value to `consumed`.
### POST `/images` ### POST `/images`
Allows to insert a new image document.
#### Example
`POST /images` with body `{ "url": "https://my-images.com/foo.jpg", "status": "available", "tags": ["foo", "bar"] }` will insert the image passed on the request body into the database.
### POST `/login` ### POST `/login`
Generates an access token to use in future requests to authenticated endpoints if a valid App and Secret are provided.
#### Example
`POST /login` with body `{ "app": "example", "secret": "badsecret" }` will return `{ "token": "x.y.z" }` "x.y.z" being a JWT token to use on further requests if the App and Secret are valid.
## Installation ## Installation
To install dependencies: To install dependencies:
@ -41,6 +60,7 @@ bun run dev
``` ```
For testing, remember: For testing, remember:
```bash ```bash
bun run test bun run test
``` ```