Client Configurations + Auto-Retry on HTTP Request Failure #31

Merged
MarciiTheDev merged 3 commits from feature/client-configuration into dev 2024-05-11 15:22:10 +00:00
2 changed files with 29 additions and 0 deletions
Showing only changes of commit 5a0f4f7529 - Show all commits

View File

@ -18,6 +18,24 @@ METHODS
</div>
## CONSTRUCTOR
### .new(`accessToken:` [string](https://www.lua.org/pil/2.4.html), `options:` [ClientOptions?](../types/ClientOptions))
Creates a new MarcSync client.
:::info Info
When creating a new client, you must provide an `accessToken`. This argument can either be the key of the "tokens" table in the client's Class or the actual token itself. If you provide the key, the client will automatically try to fetch the token from the "tokens" table. If you provide the token itself, the client will use that token instead. If no token is found by the key provided, it will use the key as the token itself.
:::
:::info Info
The `options` argument is optional and can be used to specify the options of the client. If you do not provide any options, the client will use the default options. The default options are as follows:
```lua
{
retryCount = 3
}
```
:::
## METHODS
### :getVersion(`clientId:` [number?](https://www.lua.org/pil/2.3.html))

View File

@ -0,0 +1,11 @@
# ClientOptions
ClientOptions is a type which is used to specify the options of a client. It is used in the [Client](../classes/Client) class when creating a new client.
## Type Definition
```typescript
type ClientOptions = {
retryCount: number
}
```