Skip to content

Commit

Permalink
add api usage "Initializing the api"
Browse files Browse the repository at this point in the history
  • Loading branch information
Neptnium committed May 15, 2024
1 parent 6681292 commit 208dbf1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/api/reference/v1-x-x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the reference for the version [`v1.x.x`]() of the API.
39 changes: 32 additions & 7 deletions docs/api/usage.md → docs/api/usage/index.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,55 @@
## Intro
Qui aliqua commodo laborum ad consequat pariatur. Amet consequat pariatur ex et nostrud sint laborum duis aute. Cillum consequat amet occaecat id sint. Aliquip consequat do incididunt enim cillum elit reprehenderit incididunt ut in eu qui culpa.

## Versioning
The API uses [Semantic Versioning](https://semver.org). This means that any non-backward compatible change will result in an increment of the major version (`1.x.x` --> `2.x.x`). You can be confident that your integration will remain stable across updates, as long as the major version does not change.
Versions correspond to the [API Reference](reference/index.md).
Versions correspond to the [API Reference](../reference/index.md).

### Changelogs
* Version `1.x.x` represents the initial release of the API.
* Version [`v1.x.x`](../reference/v1-x-x.md) represents the initial release of the API.

---

## Quick Start Guide
* Adding the api to your project
* Irure qui aliquip fugiat consectetur quis.
* Initializing the API
* Amet ex quis magna ullamco amet.
* Ad id quis proident dolore irure nostrud minim labore laboris anim sint.

## Adding the api to your project
### Adding the api to your project
1. Download the [Api file]().
2. Put in your project directory, under `/lua/api`.
3. Do not rename it, or you will need to change `#!lua require("api/BeamPermsAPI")`!


If you did everything correctly, your project should look something like this:
```hl_lines="2-3"
my_plugin/
├── lua/
│ └── api/
│ └── BeamPermsAPI.lua
└── main.lua
```
```

### Initializing the API
1. Requiring the API file
```lua
BP = require("api/BeamPermsAPI")
```
2. Checking if the API is available
```lua
if BP.isDisabled() then
... -- The API is not available, functions will not be registered!
end
```

Which gives us the final code for the API:
```lua linenums="1"
BP = require("api/BeamPermsAPI")

...

if BP.isDisabled() then
print("BeamPermsAPI is disabled, ...")
end
```

**:tada: You can now use the API**
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ You own a [BeamMP](https://beammp.com) server, and want to install the plugin? T

## For **Developers**

You are making a [BeamMP](https://beammp.com) plugin and want to make it compatible with **BeamPerms**? Our [Api Usage Guide](api/usage.md) is made for you!
You are making a [BeamMP](https://beammp.com) plugin and want to make it compatible with **BeamPerms**? Our [Api Usage Guide](api/usage/index.md) is made for you!
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ nav:
- Groups: features/groups.md

- API:
- Usage: api/usage.md
- Usage:
- Usage: api/usage/index.md
- Reference:
- API Reference: api/reference/index.md
- API v1.x.x: api/reference/v1-x-x.md

0 comments on commit 208dbf1

Please sign in to comment.