Skip to content

Commit

Permalink
Convert API reference to markdoc (#1137)
Browse files Browse the repository at this point in the history
Test plan:
- Confirm no visual regressions
  • Loading branch information
tom-blake authored Dec 8, 2024
1 parent 1170553 commit 1f18077
Show file tree
Hide file tree
Showing 54 changed files with 3,881 additions and 4,135 deletions.
1 change: 1 addition & 0 deletions markdoc.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default defineMarkdocConfig({
property: {
render: component('./src/components/Property.astro'),
attributes: {
deprecated: { type: Boolean },
experimental: { type: Boolean },
name: { type: String },
required: { type: Boolean },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ nav:
path: Accounts
order: 2
---
import Properties from '../../components/Properties.astro';
import Property from '../../components/Property.astro';
import Error from '../../components/Error.astro';
import Endpoint from '../../components/Endpoint.astro';
import Badge from '../../components/Badge.astro';

An Account Membership represents a user having access to a Centrapay
[Account](/api/accounts/). An Account Membership has a role which grants the user access to
some or all of the operations and resources within the account.
Expand All @@ -20,131 +14,131 @@ some or all of the operations and resources within the account.
A Member contains extended information about a user's access to an account.


<Properties>
<Property name="accountId" type="string">
{% properties %}
{% property name="accountId" type="string" %}
The id of the [Account](/api/accounts/) the Membership is scoped to.
</Property>
{% /property %}

<Property name="accountType" type="string">
{% property name="accountType" type="string" %}
The type of the [Account](/api/accounts/) the Membership is scoped to.
</Property>
{% /property %}

<Property name="accountName" type="string">
{% property name="accountName" type="string" %}
The name of the [Account](/api/accounts/) the Membership is scoped to.
</Property>
{% /property %}

<Property name="userId" type="string">
{% property name="userId" type="string" %}
The id of the user the Membership belongs to.
</Property>
{% /property %}

<Property name="role" type="string">
{% property name="role" type="string" %}
The role governing Membership permissions.
</Property>
{% /property %}

<Property name="subject" type="crn">
{% property name="subject" type="crn" %}
User or API key resource name for the membership.
</Property>
{% /property %}

<Property name="createdAt" type="timestamp">
{% property name="createdAt" type="timestamp" %}
When the Membership was created.
</Property>
{% /property %}

<Property name="createdBy" type="crn">
{% property name="createdBy" type="crn" %}
Resource that created the member.
</Property>
{% /property %}

<Property name="modifiedAt" type="timestamp">
{% property name="modifiedAt" type="timestamp" %}
When the Membership was last modified.
</Property>
{% /property %}

<Property name="modifiedBy" type="crn">
{% property name="modifiedBy" type="crn" %}
Resource that last modified the account member.
</Property>
{% /property %}

<Property name="testAccount" type="boolean">
{% property name="testAccount" type="boolean" %}
A flag which is present if the [Account](/api/accounts/) is test.
</Property>
{% /property %}

<Property name="firstName" type="string">
{% property name="firstName" type="string" %}
First name of the user the membership belongs to.
</Property>
{% /property %}

<Property name="lastName" type="string">
{% property name="lastName" type="string" %}
Last name of the user the membership belongs to.
</Property>
{% /property %}

<Property name="email" type="string">
{% property name="email" type="string" %}
Email of the user the membership belongs to.
</Property>
</Properties>
{% /property %}
{% /properties %}

---

<Endpoint
{% endpoint
path="/api/accounts/{accountId}/members"
filename="account-memberships-create"
>
## Add Member <Badge type="experimental"/>
%}
## Add Member {% badge type="experimental" /%}

This endpoint allows you to add or update the membership of a user to an account.

<Properties>
<Property name="userId" type="string" required>
{% properties %}
{% property name="userId" type="string" required=true %}
The id of the user the Membership belongs to.
</Property>
{% /property %}

<Property name="role" type="string" required>
{% property name="role" type="string" required=true %}
The role governing Membership permissions.
</Property>
</Properties>
</Endpoint>
{% /property %}
{% /properties %}
{% /endpoint %}

---

<Endpoint
{% endpoint
path="/api/accounts/{accountId}/members"
filename="account-memberships-list-by-accountId"
>
%}
## List members

This endpoint allows you to retrieve the list memberships to an account.
</Endpoint>
{% /endpoint %}

---

<Endpoint
{% endpoint
path="/api/accounts/{accountId}/members/{userId}"
filename="account-memberships-delete"
>
%}
## Revoke Member

This endpoint allows you to revoke a users membership to an account.

<Properties heading="Errors">
<Error code="403" message="LAST_OWNER_NOT_REVOKABLE">
{% properties heading="Errors" %}
{% error code="403" message="LAST_OWNER_NOT_REVOKABLE" %}
The last remaining membership to an account cannot be revoked.
</Error>
</Properties>
</Endpoint>
{% /error %}
{% /properties %}
{% /endpoint %}

---

<Endpoint
{% endpoint
path="/api/account-memberships"
filename="account-memberships-list"
>
%}
## List Account Memberships for Authenticated Subject

This endpoint allows you to retrieve the accounts that the authenticated subject is a member of.
</Endpoint>
{% /endpoint %}

---

<Endpoint
{% endpoint
path="/api/users/{userId}/account-memberships"
filename="account-memberships-list-by-user"
>
%}
## List Account Memberships for a User

This endpoint allows you to retrieve the accounts that a user is a member of.
</Endpoint>
{% /endpoint %}
Loading

0 comments on commit 1f18077

Please sign in to comment.