-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from nextcloud/chore/readme
chore: Add README and document API
- Loading branch information
Showing
2 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Files download limit | ||
|
||
[![Node GitHub Action](https://github.com/nextcloud/files_downloadlimit/workflows/Node/badge.svg)](https://github.com/nextcloud/files_downloadlimit/actions?query=workflow%3ANode) | ||
[![Lint GitHub Action](https://github.com/nextcloud/files_downloadlimit/workflows/Lint/badge.svg)](https://github.com/nextcloud/files_downloadlimit/actions?query=workflow%3ALint) | ||
|
||
This app allows limitng the number of downloads for external link shares. | ||
|
||
--- | ||
|
||
## API | ||
|
||
The examples below can be run using [hurl](https://github.com/Orange-OpenSource/hurl). | ||
|
||
### External share limit | ||
|
||
An external share limit may be queried by its token. | ||
|
||
#### Get | ||
|
||
```sh | ||
hurl get.hurl --variable token='2Nyq27RKT7Jw9q3' | ||
``` | ||
|
||
> get.hurl | ||
```hurl | ||
GET https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit | ||
OCS-APIRequest: true | ||
Accept: application/json | ||
[BasicAuth] | ||
alice: alice | ||
``` | ||
|
||
#### Set | ||
|
||
```sh | ||
hurl set.hurl --variable token='2Nyq27RKT7Jw9q3' --variable limit=5 | ||
``` | ||
|
||
> set.hurl | ||
```hurl | ||
PUT https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit | ||
OCS-APIRequest: true | ||
Accept: application/json | ||
[BasicAuth] | ||
alice: alice | ||
{ | ||
"limit": {{limit}} | ||
} | ||
``` | ||
|
||
#### Remove | ||
|
||
```sh | ||
hurl remove.hurl --variable token='2Nyq27RKT7Jw9q3' | ||
``` | ||
|
||
> remove.hurl | ||
```hurl | ||
DELETE https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit | ||
OCS-APIRequest: true | ||
Accept: application/json | ||
[BasicAuth] | ||
alice: alice | ||
``` | ||
|
||
### Default limit | ||
|
||
Admins may set a default limit. | ||
|
||
```sh | ||
hurl set-default.hurl --variable limit=1 | ||
``` | ||
|
||
> set-default.hurl | ||
```hurl | ||
PUT https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/limit | ||
OCS-APIRequest: true | ||
Accept: application/json | ||
[BasicAuth] | ||
admin: admin | ||
{ | ||
"limit": {{limit}} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters