> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Interface: Commands<Model>

> One shared method contract keeps command identity invariant in both query and mutation contexts, including after declaration emission.

[server](https://docs.bijection.com/api/modules/server).Commands

One shared method contract keeps command identity invariant in both query
and mutation contexts, including after declaration emission.

## Type parameters

| Name | Type |
| :- | :- |
| `Model` | extends [`GenericDataModel`](https://docs.bijection.com/api/modules/server#genericdatamodel) = [`GenericDataModel`](https://docs.bijection.com/api/modules/server#genericdatamodel) |

## Hierarchy

* [`CommandReader`](https://docs.bijection.com/api/interfaces/server.CommandReader)\<`Model`>

  ↳ **`Commands`**

## Methods

### getTarget

▸ **getTarget**\<`C`, `Name`>(`command`, `options`): `Promise`\<`null` | `Readonly`\<\{ `command`: [`CommandReference`](https://docs.bijection.com/api/modules/server#commandreference) ; `target`: `string` ; `expectedVersion`: `string` ; `observedAtMs`: `number` ; `__commandTarget?`: (`command`: [`CommandIdentity`](https://docs.bijection.com/api/modules/server#commandidentity)\<`C`>) => [`CommandIdentity`](https://docs.bijection.com/api/modules/server#commandidentity)\<`C`>  }>>

#### Type parameters

| Name | Type |
| :- | :- |
| `C` | extends [`CommandHandle`](https://docs.bijection.com/api/modules/server#commandhandle)\<`any`, `"record"`> |
| `Name` | extends [`RecordTargetTable`](https://docs.bijection.com/api/modules/server#recordtargettable)\<`C`, `Model`> |

#### Parameters

| Name | Type |
| :- | :- |
| `command` | `C` |
| `options` | `Object` |
| `options.table` | `Name` |
| `options.id` | [`GenericId`](https://docs.bijection.com/api/modules/values#genericid)\<`NoInfer<Name>`> |
| `options.maximumAgeMs?` | `number` |

#### Returns

`Promise`\<`null` | `Readonly`\<\{ `command`: [`CommandReference`](https://docs.bijection.com/api/modules/server#commandreference) ; `target`: `string` ; `expectedVersion`: `string` ; `observedAtMs`: `number` ; `__commandTarget?`: (`command`: [`CommandIdentity`](https://docs.bijection.com/api/modules/server#commandidentity)\<`C`>) => [`CommandIdentity`](https://docs.bijection.com/api/modules/server#commandidentity)\<`C`>  }>>

#### Inherited from

[CommandReader](https://docs.bijection.com/api/interfaces/server.CommandReader.md).[getTarget](https://docs.bijection.com/api/interfaces/server.CommandReader.md#gettarget)

***

### request

▸ **request**\<`C`>(`command`, `input`): `Promise`\<[`CommandRequest`](https://docs.bijection.com/api/modules/server#commandrequest)\<`C`>>

#### Type parameters

| Name | Type |
| :- | :- |
| `C` | extends [`CommandHandle`](https://docs.bijection.com/api/modules/server#commandhandle)\<`any`, `any`> |

#### Parameters

| Name | Type |
| :- | :- |
| `command` | `C` |
| `input` | [`CommandRequestInput`](https://docs.bijection.com/api/modules/server#commandrequestinput)\<`NoInfer`\<`C`>, `Model`> |

#### Returns

`Promise`\<[`CommandRequest`](https://docs.bijection.com/api/modules/server#commandrequest)\<`C`>>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.