# Actions sharing

Actions sharing in Prism / Objects / Actions — Micro TypeScript reference.

Reference for TypeScript SDK **0.14.0**.

[Release source](https://github.com/micro-so/micro-sdk-ts/blob/v0.14.0/api.md) · [Setup and client configuration](/docs/reference/typescript)

## update

`PUT /v2/prism/{teamId}/action/{actionId}/grant`

````text
client.prism.objects.actions.grant.update(actionID, { ...params }) -> GrantUpdateResponse
````

Update grant

```ts
const grant =
  await client.prism.objects.actions.grant.update(
    '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  );
```

## get

`GET /v2/prism/{teamId}/action/{actionId}/grant`

````text
client.prism.objects.actions.grant.get(actionID, { ...params }) -> GrantGetResponse
````

Get grant

```ts
const grant = await client.prism.objects.actions.grant.get(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
```

## Parameter and response types

These declarations show the request parameters and response shapes used by the methods above.

### GrantUpdateResponse

[Source](https://github.com/micro-so/micro-sdk-ts/blob/v0.14.0/src/resources/prism/objects/actions/grant.ts)

````text
/**
 * The grants on a record. For `message`, also carries the entity ids of everyone
 * on the message, resolved from its address headers when the grant was written.
 * The id arrays are read-only and are null when participant resolution was
 * unavailable (for example the mailbox had no Gmail token at the time).
 */
export interface GrantUpdateResponse {
  contact_ids?: Array<string> | null;

  group_id?: { [key: string]: 'a' | 'r' | 'w' };

  identity_ids?: Array<string> | null;

  organization_ids?: Array<string> | null;

  /**
   * How much of the record the grant exposes. `metadata` shares only the record's
   * headers and participants; `full` shares its contents. Currently recorded on the
   * access row and returned on read — it is not yet enforced by the read path.
   * Applies to `message` grants; ignored for other object types.
   */
  share_level?: 'metadata' | 'full';

  team_id?: { [key: string]: 'a' | 'r' | 'w' };

  user_id?: { [key: string]: 'a' | 'r' | 'w' };
}
````


### GrantGetResponse

[Source](https://github.com/micro-so/micro-sdk-ts/blob/v0.14.0/src/resources/prism/objects/actions/grant.ts)

````text
/**
 * The grants on a record. For `message`, also carries the entity ids of everyone
 * on the message, resolved from its address headers when the grant was written.
 * The id arrays are read-only and are null when participant resolution was
 * unavailable (for example the mailbox had no Gmail token at the time).
 */
export interface GrantGetResponse {
  contact_ids?: Array<string> | null;

  group_id?: { [key: string]: 'a' | 'r' | 'w' };

  identity_ids?: Array<string> | null;

  organization_ids?: Array<string> | null;

  /**
   * How much of the record the grant exposes. `metadata` shares only the record's
   * headers and participants; `full` shares its contents. Currently recorded on the
   * access row and returned on read — it is not yet enforced by the read path.
   * Applies to `message` grants; ignored for other object types.
   */
  share_level?: 'metadata' | 'full';

  team_id?: { [key: string]: 'a' | 'r' | 'w' };

  user_id?: { [key: string]: 'a' | 'r' | 'w' };
}
````


### GrantUpdateParams

[Source](https://github.com/micro-so/micro-sdk-ts/blob/v0.14.0/src/resources/prism/objects/actions/grant.ts)

````text
export interface GrantUpdateParams {
  /**
   * Path param
   */
  teamId?: string;

  /**
   * Body param: How much of the record the grant exposes. `metadata` shares only the
   * record's headers and participants; `full` shares its contents. Currently
   * recorded on the access row and returned on read — it is not yet enforced by the
   * read path. Applies to `message` grants; ignored for other object types.
   */
  share_level?: 'metadata' | 'full';

  /**
   * Body param
   */
  team_group_id?: Array<{ [key: string]: 'a' | 'r' | 'w' }>;

  /**
   * Body param
   */
  team_id?: { [key: string]: 'a' | 'r' | 'w' };

  /**
   * Body param
   */
  user_id?: Array<{ [key: string]: 'a' | 'r' | 'w' }>;

  /**
   * Header param: A unique key (UUID or any opaque string up to 255 chars) for an
   * authenticated POST, PUT, or PATCH request. The server retains the initial claim
   * for 24 hours and replays a completed non-5xx response only when the method,
   * path, and request body all match. Reusing a non-expired key with a different
   * method, path, or body returns 409 `idempotency_key_mismatch`; reusing it after
   * expiry returns 409 `idempotency_key_stale`, so use a new key. Replays include
   * the `idempotent-replay: true` response header.
   */
  'Idempotency-Key'?: string;
}
````


### GrantGetParams

[Source](https://github.com/micro-so/micro-sdk-ts/blob/v0.14.0/src/resources/prism/objects/actions/grant.ts)

````text
export interface GrantGetParams {
  teamId?: string;
}
````


### Grant

[Source](https://github.com/micro-so/micro-sdk-ts/blob/v0.14.0/src/resources/prism/objects/actions/grant.ts)

````text
export declare namespace Grant {
  export {
    type GrantUpdateResponse as GrantUpdateResponse,
    type GrantGetResponse as GrantGetResponse,
    type GrantUpdateParams as GrantUpdateParams,
    type GrantGetParams as GrantGetParams,
  };
}
````
