Skip to content

Commit

Permalink
Cleanup extensions API docs
Browse files Browse the repository at this point in the history
- Use the specified query variables instead of inlining
- Refine `InsertExtension` to use the `_one` form instead of the "many" form
- Remove the "advanced" tag from the API docs
  • Loading branch information
Mythicaeda committed Oct 17, 2023
1 parent e0214ea commit 3b0e428
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
54 changes: 38 additions & 16 deletions docs/api/examples/advanced-extensions.mdx
Original file line number Diff line number Diff line change
@@ -1,36 +1,58 @@
# Advanced - Extensions
# Extensions

## Creating an Extension
## Adding an Extension

```graphql
mutation InsertExtensions($object: extensions_insert_input!) {
insert_extensions(
objects: { description: "", label: "My External Application", url: "https://externalapp/api/test" }
) {
returning {
id
}
mutation InsertExtension($extension: extensions_insert_input!) {
insert_extensions_one(object: $extension) {
id
label
url
description
}
}
```

## Creating an Extension Role
Below is an example query variable that creates an extension called "My External Application".

```json
{
"extension": {
"label": "My External Application",
"url": "https://externalapp/api/test",
"description": "An application that exists outside of Aerie."
}
}
```

This is an example query that would allow the `viewer` role the ability to execute the extension with id `1`. Only defined roles will be able to call the extension through the UI.
## Permitting Roles to run Extensions

```graphql
mutation InsertExtensionRoles($object: extension_roles_insert_input!) {
insert_extension_roles(objects: { extension_id: 1, role: "viewer" }) {
mutation InsertExtensionRoles($roles: [extension_roles_insert_input!]! ) {
insert_extension_roles(objects: $roles) {
returning {
id
extension {
id
label
}
role
}
}
}
```

## Deleting an Extension
Below is an example query variable that grants the `aerie_admin` and `user` roles to run the extension with an ID of 1.

The following query will delete an extension and cascade to delete any assigned roles for that extension as well.
```json
{
"roles": [
{ "extension_id": 1, "role": "aerie_admin" },
{ "extension_id": 1, "role": "user" }
]
}
```

## Deleting an Extension

```graphql
mutation DeleteExtension($extension_id: Int!) {
Expand Down
2 changes: 1 addition & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ const sidebars = {
items: [
'api/examples/planning/collaboration',
'api/examples/planning/anchors',
'api/examples/advanced-extensions',
],
},
'api/examples/simulation',
'api/examples/constraints',
'api/examples/scheduling',
'api/examples/activity-presets',
'api/examples/advanced-extensions',
],
},
],
Expand Down

0 comments on commit 3b0e428

Please sign in to comment.