# Interface ActorAccessor<AD>

Represents a actor accessor that provides methods to interact with a specific actor.

interface ActorAccessor<AD extends AnyActorDefinition> {
create(
key?: string | string[],
opts?: CreateOptions,
): Promise<ActorHandle<AD>>;
get(key?: string | string[], opts?: GetWithIdOptions): ActorHandle<AD>;
getForId(actorId: string, opts?: GetWithIdOptions): ActorHandle<AD>;
getOrCreate(
key?: string | string[],
opts?: GetOrCreateOptions,
): ActorHandle<AD>;
}

#### Type Parameters

- AD extends AnyActorDefinition

- Defined in rivetkit-typescript/packages/rivetkit/src/client/client.ts:30

##### Index

### Methods

create
get
getForId
getOrCreate

## Methods

### create

- create(key?: string | string[], opts?: CreateOptions): Promise<ActorHandle<AD>>

  Creates a new actor with the name automatically injected from the property accessor, and returns a stateless handle to it with the actor ID resolved.

  #### Parameters

  - `Optional` key: string | string[]

    The key to identify the actor. Can be a single string or an array of strings.

  - `Optional` opts: CreateOptions

    Options for creating the actor (excluding name and key).

  #### Returns Promise<ActorHandle<AD>>

  - A promise that resolves to a handle to the actor.
  - Defined in rivetkit-typescript/packages/rivetkit/src/client/client.ts:75

### get

- get(key?: string | string[], opts?: GetWithIdOptions): ActorHandle<AD>

  Gets a stateless handle to a actor by its key, but does not create the actor if it doesn't exist. The actor name is automatically injected from the property accessor.

  #### Parameters

  - `Optional` key: string | string[]

    The key to identify the actor. Can be a single string or an array of strings.

  - `Optional` opts: GetWithIdOptions

    Options for getting the actor.

  #### Returns ActorHandle<AD>

  - A handle to the actor.
  - Defined in rivetkit-typescript/packages/rivetkit/src/client/client.ts:40

### getForId

- getForId(actorId: string, opts?: GetWithIdOptions): ActorHandle<AD>

  Gets a stateless handle to a actor by its ID.

  #### Parameters

  - actorId: string

    The ID of the actor.

  - `Optional` opts: GetWithIdOptions

    Options for getting the actor.

  #### Returns ActorHandle<AD>

  - A handle to the actor.
  - Defined in rivetkit-typescript/packages/rivetkit/src/client/client.ts:64

### getOrCreate

- getOrCreate(key?: string | string[], opts?: GetOrCreateOptions): ActorHandle<AD>

  Gets a stateless handle to a actor by its key, creating it if necessary. The actor name is automatically injected from the property accessor.

  #### Parameters

  - `Optional` key: string | string[]

    The key to identify the actor. Can be a single string or an array of strings.

  - `Optional` opts: GetOrCreateOptions

    Options for getting the actor.

  #### Returns ActorHandle<AD>

  - A handle to the actor.
  - Defined in rivetkit-typescript/packages/rivetkit/src/client/client.ts:51