AdminApi
TypeScript SDK: the Admin operations, 3 methods, each with its parameters, result and a complete example.
TypeScript SDK · @bimworks/sdk · class · 3 methods
The administration of an organization: its accounts and features
Construct it with the client of the connect step: new AdminApi(client). Each method is one operation of the API part, where it runs on its page.
| Method | Operation | Description |
|---|---|---|
listAccountUserFeatures | ListAccountUserFeatures | The user features of an account |
listAccounts | ListAccounts | List the accounts of the organization |
listOrganizations | ListOrganizations | The caller's organization |
listAccountUserFeatures#
listAccountUserFeatures(requestParameters: { listAccountUserFeaturesRequest: ListAccountUserFeaturesRequest }): Promise<Array<UserFeatureState>>The user features of an account. Every user feature with whether the account has it: what the account may do in BIM.works. The caller's own account when account_uuid is absent; another account's needs SuperAdmin.
| Operation | ListAccountUserFeatures · POST /openapi/admin/ListAccountUserFeatures |
|---|---|
| Scope | account:read |
Parameters#
| Name | Type | Description |
|---|---|---|
listAccountUserFeaturesRequest | ListAccountUserFeaturesRequestoptional | The request: its properties are those of the model, its JSON that of ListAccountUserFeatures's request body. |
Returns#
Array<UserFeatureState> — The features, by name
Example#
import { AdminApi, AuthApi, Configuration, ListAccountUserFeaturesRequestFromJSON, UserFeatureStateToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = ListAccountUserFeaturesRequestFromJSON({
"account_uuid": "00000000-0000-0000-0000-000000000000"
});
// 3. The call
const result = await new AdminApi(client).listAccountUserFeatures({ listAccountUserFeaturesRequest: request });
// 4. The result
console.log(JSON.stringify(result.map(UserFeatureStateToJSON), null, 2));listAccounts#
listAccounts(requestParameters: { listAccountsRequest: ListAccountsRequest }): Promise<Array<AccountEntry>>List the accounts of the organization. The accounts of the caller's organization, newest first, each with its user and how it signs in. With include_invites the open invites follow the accounts. Removed accounts are left out unless show_deleted. Only a super admin or the organization's creator lists them, with a session or an API token; for any other member the answer is 403 NON_AUTHORIZED_TASK.
| Operation | ListAccounts · POST /openapi/admin/ListAccounts |
|---|---|
| Scope | admin:read |
Parameters#
| Name | Type | Description |
|---|---|---|
listAccountsRequest | ListAccountsRequestoptional | The request: its properties are those of the model, its JSON that of ListAccounts's request body. |
Returns#
Array<AccountEntry> — The accounts, then the invites
Example#
import { AccountEntryToJSON, AdminApi, AuthApi, Configuration, ListAccountsRequestFromJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
const request = ListAccountsRequestFromJSON({
"include_invites": false,
"show_deleted": false
});
// 3. The call
const result = await new AdminApi(client).listAccounts({ listAccountsRequest: request });
// 4. The result
console.log(JSON.stringify(result.map(AccountEntryToJSON), null, 2));listOrganizations#
listOrganizations(): Promise<Array<Organization>>The caller's organization. The organization of the caller's account (an empty list when it has none).
| Operation | ListOrganizations · POST /openapi/admin/ListOrganizations |
|---|---|
| Scope | admin:read |
Parameters#
None: the operation takes no request.
Returns#
Array<Organization> — The organization
Example#
import { AdminApi, AuthApi, Configuration, OrganizationToJSON } from "@bimworks/sdk";
// 1. Connect to BIM.works and log in with your API token
const basePath = "https://bim.works/openapi";
const auth = await new AuthApi(new Configuration({ basePath }))
.loginWithApiToken({ loginWithApiTokenRequest: { token: "<your API token>" } });
const client = new Configuration({ basePath, accessToken: typeof auth === "string" ? auth : auth.base64 });
// 2. The request
// (ListOrganizations takes no request)
// 3. The call
const result = await new AdminApi(client).listOrganizations();
// 4. The result
console.log(JSON.stringify(result.map(OrganizationToJSON), null, 2));