YouTubePHP Documentation

LiveChatMessagesApi extends AbstractApi
in package

FinalYes

This file is generated from spec/discovery.json (YouTube Data API v3, revision 20260924) by tools/generate.php. Do not edit it by hand - run `composer spec:build` instead.

Live chat: reading it, posting to it, and deleting from it.

Reach it as $youtube->liveChatMessages. Every method takes the parameters Google documents, by the same names: use named arguments for the optional ones.

Tags
link
https://developers.google.com/youtube/v3/live/docs/liveChatMessages
since
1.0.0

Table of Contents

Properties

$youtube  : YouTube

Methods

__construct()  : mixed
delete()  : PromiseInterface<string|int, null>
Deletes a chat message.
insert()  : PromiseInterface<string|int, LiveChatMessage>
Inserts a new resource into this collection.
list()  : PromiseInterface<string|int, LiveChatMessageListResponse>
Retrieves a list of resources, possibly filtered.
stream()  : PromiseInterface<string|int, ResponseStream>
Allows a user to load live chat through a server-streamed RPC.
transition()  : PromiseInterface<string|int, LiveChatMessage>
Transition a durable chat event.
call()  : PromiseInterface<string|int, mixed>
streamed()  : PromiseInterface<string|int, ResponseStream>
Opens a server-streamed call and reads its body as it arrives.

Properties

Methods

insert()

Inserts a new resource into this collection.

public insert(array<int, string>|string $part, LiveChatMessage|array<string, mixed> $body) : PromiseInterface<string|int, LiveChatMessage>

Costs 50 units of quota.

Parameters
$part : array<int, string>|string

The part parameter serves two purposes. It identifies the properties that the write operation will set as well as the properties that the API response will include. Set the parameter value to snippet.

$body : LiveChatMessage|array<string, mixed>

The LiveChatMessage to send.

Tags
link
https://developers.google.com/youtube/v3/live/docs/liveChatMessages/insert
since
1.0.0
Return values
PromiseInterface<string|int, LiveChatMessage>

list()

Retrieves a list of resources, possibly filtered.

public list(string $liveChatId, array<int, string>|string $part[, string|null $hl = null ][, int|null $maxResults = null ][, string|null $pageToken = null ][, int|null $profileImageSize = null ]) : PromiseInterface<string|int, LiveChatMessageListResponse>

Costs 1 unit of quota.

Parameters
$liveChatId : string

The id of the live chat for which comments should be returned.

$part : array<int, string>|string

The part parameter specifies the liveChatComment resource parts that the API response will include. Supported values are id, snippet, and authorDetails.

$hl : string|null = null

Specifies the localization language in which the system messages should be returned.

$maxResults : int|null = null

The maxResults parameter specifies the maximum number of items that should be returned in the result set. Not used in the streaming RPC. From 200 to 2000. YouTube assumes 500 when it is left out.

$pageToken : string|null = null

The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identify other pages that could be retrieved.

$profileImageSize : int|null = null

Specifies the size of the profile image that should be returned for each user. From 16 to 720.

Tags
link
https://developers.google.com/youtube/v3/live/docs/liveChatMessages/list
since
1.0.0
Return values
PromiseInterface<string|int, LiveChatMessageListResponse>

stream()

Allows a user to load live chat through a server-streamed RPC.

public stream(string $liveChatId, array<int, string>|string $part[, string|null $hl = null ][, int|null $maxResults = null ][, string|null $pageToken = null ][, int|null $profileImageSize = null ]) : PromiseInterface<string|int, ResponseStream>

Costs 1 unit of quota, by estimate: Google does not publish it, so each connection is counted as one list call.

The response keeps arriving for as long as the server has more to send, as a stream of LiveChatMessageListResponse parts. The stream ends when the server closes it; open another with the last nextPageToken to carry on.

Parameters
$liveChatId : string

The id of the live chat for which comments should be returned.

$part : array<int, string>|string

The part parameter specifies the liveChatComment resource parts that the API response will include. Supported values are id, snippet, and authorDetails.

$hl : string|null = null

Specifies the localization language in which the system messages should be returned.

$maxResults : int|null = null

The maxResults parameter specifies the maximum number of items that should be returned in the result set. Not used in the streaming RPC. From 200 to 2000. YouTube assumes 500 when it is left out.

$pageToken : string|null = null

The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identify other pages that could be retrieved.

$profileImageSize : int|null = null

Specifies the size of the profile image that should be returned for each user. From 16 to 720.

Tags
link
https://developers.google.com/youtube/v3/live/docs/liveChatMessages/streamList
since
1.0.0
Return values
PromiseInterface<string|int, ResponseStream>

transition()

Transition a durable chat event.

public transition([string|null $id = null ][, string|null $status = null ]) : PromiseInterface<string|int, LiveChatMessage>

Costs 50 units of quota.

Parameters
$id : string|null = null

The ID that uniquely identify the chat message event to transition.

$status : string|null = null

The status to which the chat event is going to transition. One of statusUnspecified, closed.

Tags
link
https://developers.google.com/youtube/v3/live/docs/liveChatMessages/transition
since
1.0.0
Return values
PromiseInterface<string|int, LiveChatMessage>

call()

protected call(string $endpoint, string $method, string $path[, array<string, mixed> $query = [] ][, array<string, mixed>|JsonSerializable|null $body = null ][, string|null $returns = null ][, ?Media $media = null ][, ?string $uploadPath = null ][, bool $download = false ]) : PromiseInterface<string|int, mixed>
Parameters
$endpoint : string

The API method, e.g. liveChatMessages.list.

$method : string
$path : string
$query : array<string, mixed> = []
$body : array<string, mixed>|JsonSerializable|null = null
$returns : string|null = null

The type token the result hydrates as; null leaves it raw.

$media : ?Media = null
$uploadPath : ?string = null
$download : bool = false
Return values
PromiseInterface<string|int, mixed>

streamed()

Opens a server-streamed call and reads its body as it arrives.

protected streamed(string $endpoint, string $path, array<string, mixed> $query, string $returns) : PromiseInterface<string|int, ResponseStream>
Parameters
$endpoint : string
$path : string
$query : array<string, mixed>
$returns : string

The type token each element hydrates as.

Return values
PromiseInterface<string|int, ResponseStream>
On this page

Search results