---
url: https://docs.moqtail.dev/ts/api/model/classes/FetchObject.md
---
# Class: FetchObject

Payload-bearing fetch object (§11.5, non-End-of-Range form).

FETCH objects carry no Object Status field; a zero-length payload
signals a zero-length Normal object.

## Properties

### endOfRange

> `readonly` **endOfRange**: [`EndOfRangeKind`](../enumerations/EndOfRangeKind.md) | `null`

***

### forwardingPreference

> `readonly` **forwardingPreference**: [`ObjectForwardingPreference`](../enumerations/ObjectForwardingPreference.md)

***

### kind

> `readonly` **kind**: `"object"` | `"end_of_range"`

***

### location

> `readonly` **location**: [`Location`](Location.md)

***

### payload

> `readonly` **payload**: `Uint8Array`<`ArrayBufferLike`> | `null`

***

### properties

> `readonly` **properties**: [`KeyValuePair`](KeyValuePair.md)\[] | `null`

***

### publisherPriority

> `readonly` **publisherPriority**: `number`

***

### subgroupId

> `readonly` **subgroupId**: `bigint`

## Accessors

### groupId

#### Get Signature

> **get** **groupId**(): `bigint`

##### Returns

`bigint`

***

### objectId

#### Get Signature

> **get** **objectId**(): `bigint`

##### Returns

`bigint`

## Methods

### nextContext()

> **nextContext**(`prev?`): [`FetchObjectContext`](../type-aliases/FetchObjectContext.md)

What the entry after this one is encoded against, given what this one was
encoded against (`prev`).

After an Object, that is the Object itself. After an End of Range marker, it is
the marker's Group and Object IDs, with the Subgroup ID and priority still those
of the last Object before the marker, or none if no Object came before it.

#### Parameters

##### prev?

[`FetchObjectContext`](../type-aliases/FetchObjectContext.md)

#### Returns

[`FetchObjectContext`](../type-aliases/FetchObjectContext.md)

***

### serialize()

> **serialize**(`prev?`, `groupOrder?`): [`FrozenByteBuffer`](FrozenByteBuffer.md)

#### Parameters

##### prev?

[`FetchObjectContext`](../type-aliases/FetchObjectContext.md)

##### groupOrder?

[`GroupOrder`](../enumerations/GroupOrder.md) = `GroupOrder.Original`

#### Returns

[`FrozenByteBuffer`](FrozenByteBuffer.md)

***

### deserialize()

> `static` **deserialize**(`buf`, `prev?`, `groupOrder?`): `FetchObject`

#### Parameters

##### buf

[`BaseByteBuffer`](BaseByteBuffer.md)

##### prev?

[`FetchObjectContext`](../type-aliases/FetchObjectContext.md)

##### groupOrder?

[`GroupOrder`](../enumerations/GroupOrder.md) = `GroupOrder.Original`

#### Returns

`FetchObject`

***

### newEndOfRange()

> `static` **newEndOfRange**(`kind`, `groupId`, `objectId`): `FetchObject`

#### Parameters

##### kind

[`EndOfRangeKind`](../enumerations/EndOfRangeKind.md)

##### groupId

`number` | `bigint`

##### objectId

`number` | `bigint`

#### Returns

`FetchObject`

***

### newObject()

> `static` **newObject**(`groupId`, `subgroupId`, `objectId`, `publisherPriority`, `forwardingPreference`, `properties`, `payload`): `FetchObject`

#### Parameters

##### groupId

`number` | `bigint`

##### subgroupId

`number` | `bigint`

##### objectId

`number` | `bigint`

##### publisherPriority

`number`

##### forwardingPreference

[`ObjectForwardingPreference`](../enumerations/ObjectForwardingPreference.md)

##### properties

[`KeyValuePair`](KeyValuePair.md)\[] | `null`

##### payload

`Uint8Array`

#### Returns

`FetchObject`
