-
Notifications
You must be signed in to change notification settings - Fork 3
Systems
Systems can't be instantiated directly; see the API page for getting them
See PK's docs for more info on each property
| key | type | notes |
|---|---|---|
| id | string | |
| uuid | string | |
| name | string? | |
| description | string? | |
| tag | string? | |
| pronouns | string? | |
| avatar_url | string? | validated before patching |
| banner | string? | validated before patching |
| color | string? | validated before patching |
| created | Date | |
| privacy | Object | validated before patching |
Privacy object
| key | type | notes |
|---|---|---|
| description_privacy | string? | for patching, can be set to public, private, or a bool (true = public) |
| pronoun_privacy | string? | see above |
| member_list_privacy | string? | See above |
| group_list_privacy | string? | See above |
| front_privacy | string? | See above |
| front_history_privacy | string? | See above |
Note: While some token arguments are marked as not optional, if the API instance has a token attached then it can be omitted
Patches the system using the object's properties
Arguments
| name | description | optional? |
|---|---|---|
| token | A token to auth the request | no |
Returns
A System object with the updated info
Errors
Throws for the following:
- Invalid data
- Token invalid
Creates a new member
Options
| key | description | optional? |
|---|---|---|
| token | A token to auth the request | yes |
| [member data] | The data to patch the member with. See Members for keys |
yes* |
* = All keys except "name" are optional
Returns
A new Member object. Also adds the member to the members Map
Errors
Throws for the following:
- Token not supplied
- Token incorrect (failed to auth)
- Invalid data
Fetches a member
Arguments
| name | description | optional? |
|---|---|---|
| member | ID of the member to fetch | no |
| token | A token to auth the request | yes |
Returns
A new Member object. Also adds to/updates the member in the members Map on the system
Errors
Throws for the following:
- ID not supplied
- Member not visible (auth failed)
- Member doesn't exist
Fetches the member list
Arguments
| name | description | optional? |
|---|---|---|
| token | A token to auth the request | yes |
Returns
A new Map of Member objects. Also sets the members Map
Errors
Throws for the following:
- ID not supplied
- Member list not visible (auth failed)
Deletes a member
Arguments
| name | description | optional? |
|---|---|---|
| member | ID of the member to delete | no |
| token | A token to auth the request | no |
Returns
Nothing
Errors
Throws for the following:
- Token invalid
- Member ID invalid
FILL THIS OUT FOOL
Creates a new group
Options
| name | description | optional? |
|---|---|---|
| token | A token to auth the request | yes |
| [group data] | The data to patch the group with. See Groups for keys |
yes* |
* = All keys except "name" are optional
Returns
New Group object. Also adds it to the groups Map
Errors
Throws for the following:
- Token invalid
- Data invalid
Fetches the system's groups
Arguments
| name | description | optional? |
|---|---|---|
| token | A token to auth the request | yes |
| with_members | boolean; Option to fetch members with groups | yes |
| raw | boolean; Whether the members returned are raw UUIDs | yes |
Returns
A Map of Group objects, keyed by their ID. Also sets the groups Map
Errors
Throws for the following:
- Token invalid
- Groups hidden (auth failed)
Fetches a specific group
Arguments
| name | description | optional? |
|---|---|---|
| group | ID of the group to get | no |
| token | A token to auth the request | yes |
Returns
New Group object. Also adds it to the groups Map
Errors
Throws for the following:
- Token invalid
- Group ID invalid
Deletes a group
Arguments
| name | description | optional? |
|---|---|---|
| group | ID of the group to delete | no |
| token | A token to auth the request | no |
Returns
Nothing
Errors
Throws for the following:
- Token invalid
- Group ID invalid
Creates a new switch
Options
| key | description | optional? |
|---|---|---|
| token | A token to auth the request | no |
| timestamp | A valid Date for the switch | yes |
| members | An array of Member IDs or objects to switch in | yes* |
* = Uses empty array (no members) if not supplied
Returns
A new Switch object
Errors Throws for the following:
- Token not supplied
- Token invalid (auth failed)
Fetches the system's switches
Arguments
| key | description | optional? |
|---|---|---|
| token | A token to auth the request | yes |
| raw | boolean; Whether members should be resolved or not; true means no member objects | yes |
| before | Date; A timestamp to fetch switches before | yes |
| limit | int; The number of switches to fetch (default 100) | yes |
Returns
An array of Switch objects, including a Map of full member objects (if raw = false). Also updates the switches Map
Errors
- No switches logged
- Switches not visible (auth failed)
- Member list not visible (auth failed; only if
raw = false)
Fetches the system's fronters
Arguments
| key | description | optional? |
|---|---|---|
| token | A token to auth the request | yes |
Returns A Switch object with a Map of the full Member objects
Errors
Throws for the following:
- ID not supplied
- No switches logged
- Fronters not visible (auth failed)
Deletes a switch
Arguments
| name | description | optional? |
|---|---|---|
| switch | ID of the switch to delete | no |
| token | A token to auth the request | no |
Returns
Nothing. Also deletes switch from the switches Map
Errors
Throws for the following:
- Token invalid
- Switch ID invalid
Fetches system config settings
Arguments
| name | description | optional? |
|---|---|---|
| token | A token to auth the request | yes |
Returns
A new SystemSettings object. Also sets the config property
Errors
Throws for the following:
- Token invalid or not supplied
Fetches guild settings
Arguments
| name | description | optional? |
|---|---|---|
| guild | ID of the guild to get settings for | no |
| token | A token to auth the request | no |
Returns
A new SystemGuildSettings object. Also adds to/updates the settings Map
Errors
Throws for the following:
- Token invalid
- Guild ID invalid
Fetches autoproxy settings
Arguments
| name | description | optional? |
|---|---|---|
| guild | ID of the guild to get settings for | no |
| token | A token to auth the request | no |
Returns
A new SystemAutoproxyConfig object. Also adds to/updates the autoproxySettings Map
Errors
Throws for the following:
- Token invalid
- Guild ID invalid
Verifies the system's properties. Intended for internal use
Returns
A plain object with verified and properly transformed props
Errors
Errors for any property that isn't valid- returns all errors as a string when finished verifying
credit to xSke for Pluralkit