u
This commit is contained in:
115
API.printeragent.md
Normal file
115
API.printeragent.md
Normal file
@@ -0,0 +1,115 @@
|
||||
# printeragent
|
||||
|
||||
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
||||
|
||||
## `printeragent.create`
|
||||
|
||||
*Source: `src/store/printeragent/create.js`*
|
||||
|
||||
Creates an unpaired printer agent for the user's selected company. The agent registers itself later using the pairing pin.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | The printer agent input. |
|
||||
| `input.name` | `string` | The display name. |
|
||||
| `input.pairingpin` | `string` | The pairing pin the agent uses to register. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, companyId: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, clientmodel: string|null, clientstate: string|null, agentversion: string|null, lastseenAt: string|null, updatedAt: string}>` — The created printer agent.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — 'Invalid printeragent' if name or pairingpin is missing/blank.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const agent = await store.printeragent.create(42, { name: 'Bar printer', pairingpin: '123456' });
|
||||
```
|
||||
|
||||
## `printeragent.delete`
|
||||
|
||||
*Source: `src/store/printeragent/delete.js`*
|
||||
|
||||
Deletes a printer agent of the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `id` | `number` | The printer agent id. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — 'Printeragent not found' if the id is unknown in the company.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
await store.printeragent.delete(42, 5);
|
||||
```
|
||||
|
||||
## `printeragent.list`
|
||||
|
||||
*Source: `src/store/printeragent/list.js`*
|
||||
|
||||
Lists the printer agents of the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, companyId: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, clientmodel: string|null, clientstate: string|null, agentversion: string|null, lastseenAt: string|null, updatedAt: string}>>` — The printer agents.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const agents = await store.printeragent.list(42);
|
||||
// => [{ id, companyId, name, token, pairingpin, pairedAt, clientserial, clientmodel, clientstate, agentversion, lastseenAt, updatedAt }]
|
||||
```
|
||||
|
||||
## `printeragent.update`
|
||||
|
||||
*Source: `src/store/printeragent/update.js`*
|
||||
|
||||
Renames a printer agent of the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | The update input. |
|
||||
| `input.id` | `number` | The printer agent id. |
|
||||
| `input.name` | `string` | The new display name. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, companyId: number, name: string, token: string|null, pairingpin: string|null, pairedAt: string|null, clientserial: string|null, clientmodel: string|null, clientstate: string|null, agentversion: string|null, lastseenAt: string|null, updatedAt: string}>` — The updated printer agent.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — 'Invalid printeragent' if name is blank; 'Printeragent not found' if id is unknown in the company.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const agent = await store.printeragent.update(42, { id: 5, name: 'Kitchen printer' });
|
||||
```
|
||||
Reference in New Issue
Block a user