# Query

Defines a saved Query in a [[Book]].

Queries can be saved on Books by users.

## Extends

- `Resource`\<`bkper.Query`\>

### Constructor

```ts
new Query(book, payload?): Query;
```

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `book` | [`Book`](https://bkper.com/docs/api/bkper-js/classes/book.md) |
| `payload?` | `Query` |

#### Returns

`Query`

#### Overrides

```ts
Resource<bkper.Query>.constructor
```

### payload

```ts
payload: Query;
```

The underlying payload data for this resource

#### Inherited from

```ts
Resource.payload
```

### create()

```ts
create(): Promise;
```

Perform create new Query.

#### Returns

`Promise`\<`Query`\>

This Query, for chaining

***

### getId()

```ts
getId(): string | undefined;
```

Gets the Query universal identifier.

#### Returns

`string` \| `undefined`

The Query universal identifier

***

### getQuery()

```ts
getQuery(): string | undefined;
```

Gets the query string to be executed.

#### Returns

`string` \| `undefined`

This Query string to be executed

***

### getTitle()

```ts
getTitle(): string | undefined;
```

Gets the title of this saved Query.

#### Returns

`string` \| `undefined`

The title of this saved Query

***

### json()

```ts
json(): Query;
```

Gets an immutable copy of the JSON payload for this resource.

#### Returns

`Query`

An immutable copy of the json payload

#### Inherited from

```ts
Resource.json
```

***

### remove()

```ts
remove(): Promise;
```

Perform delete Query.

#### Returns

`Promise`\<`Query`\>

This Query, for chaining

***

### setQuery()

```ts
setQuery(query): Query;
```

Sets the query string associated with this saved Query.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `query` | `string` | The query string to be executed |

#### Returns

`Query`

This Query, for chaining

***

### setTitle()

```ts
setTitle(title): Query;
```

Sets the title of this saved Query.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `title` | `string` | The title of this saved Query |

#### Returns

`Query`

This Query, for chaining

***

### update()

```ts
update(): Promise;
```

Perform update Query, applying pending changes.

#### Returns

`Promise`\<`Query`\>

This Query, for chaining
