Skip to content

Commit

Permalink
Merge pull request #238 from nextcloud/chore/readme
Browse files Browse the repository at this point in the history
chore: Add README and document API
  • Loading branch information
Pytal authored Mar 14, 2024
2 parents d824f3a + 8b9d194 commit 7fd1f50
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 1 deletion.
94 changes: 94 additions & 0 deletions README.md
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}}
}
```
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>Files download limit</name>
<summary>File link share download limit</summary>

<description>Allow to limit the number of downloads for link shares</description>
<description>This app allows limitng the number of downloads for external link shares.</description>
<version>2.0.0</version>
<licence>agpl</licence>
<author mail="skjnldsv@protonmail.com">John Molakvoæ</author>
Expand Down

0 comments on commit 7fd1f50

Please sign in to comment.