CommentsApi
extends AbstractApi
in package
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.
Single comments and replies, and moderating them.
Reach it as $youtube->comments. Every method takes the parameters Google
documents, by the same names: use named arguments for the optional ones.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- delete() : PromiseInterface<string|int, null>
- Deletes a resource.
- insert() : PromiseInterface<string|int, Comment>
- Inserts a new resource into this collection.
- list() : PromiseInterface<string|int, CommentListResponse>
- Retrieves a list of resources, possibly filtered.
- markAsSpam() : PromiseInterface<string|int, null>
- Expresses the caller's opinion that one or more comments should be flagged as spam.
- setModerationStatus() : PromiseInterface<string|int, null>
- Sets the moderation status of one or more comments.
- update() : PromiseInterface<string|int, Comment>
- Updates an existing resource.
- call() : PromiseInterface<string|int, mixed>
- streamed() : PromiseInterface<string|int, ResponseStream>
- Opens a server-streamed call and reads its body as it arrives.
Properties
$youtube read-only
protected
YouTube
$youtube
Methods
__construct()
public
__construct(YouTube $youtube) : mixed
Parameters
- $youtube : YouTube
delete()
Deletes a resource.
public
delete(string $id) : PromiseInterface<string|int, null>
Costs 50 units of quota.
Parameters
- $id : string
Tags
Return values
PromiseInterface<string|int, null>insert()
Inserts a new resource into this collection.
public
insert(array<int, string>|string $part, Comment|array<string, mixed> $body) : PromiseInterface<string|int, Comment>
Costs 50 units of quota.
Parameters
- $part : array<int, string>|string
-
The part parameter identifies the properties that the API response will include. Set the parameter value to snippet. The snippet part has a quota cost of 2 units.
- $body : Comment|array<string, mixed>
-
The Comment to send.
Tags
Return values
PromiseInterface<string|int, Comment>list()
Retrieves a list of resources, possibly filtered.
public
list(array<int, string>|string $part[, array<int, string>|string|null $id = null ][, int|null $maxResults = null ][, string|null $pageToken = null ][, string|null $parentId = null ][, string|null $textFormat = null ]) : PromiseInterface<string|int, CommentListResponse>
Costs 1 unit of quota.
Parameters
- $part : array<int, string>|string
-
The part parameter specifies a comma-separated list of one or more comment resource properties that the API response will include.
- $id : array<int, string>|string|null = null
-
Returns the comments with the given IDs for One Platform.
- $maxResults : int|null = null
-
The maxResults parameter specifies the maximum number of items that should be returned in the result set. From 1 to 100. YouTube assumes
20when 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 and prevPageToken properties identify other pages that could be retrieved.
- $parentId : string|null = null
-
Returns replies to the specified comment. Note, currently YouTube features only one level of replies (ie replies to top level comments). However replies to replies may be supported in the future.
- $textFormat : string|null = null
-
The requested text format for the returned comments. One of
textFormatUnspecified,html,plainText. YouTube assumeshtmlwhen it is left out.
Tags
Return values
PromiseInterface<string|int, CommentListResponse>markAsSpam()
Expresses the caller's opinion that one or more comments should be flagged as spam.
public
markAsSpam(array<int, string>|string $id) : PromiseInterface<string|int, null>
Costs 50 units of quota, by estimate: Google does not publish it, so it is counted as a write.
Parameters
- $id : array<int, string>|string
-
Flags the comments with the given IDs as spam in the caller's opinion.
Tags
Return values
PromiseInterface<string|int, null>setModerationStatus()
Sets the moderation status of one or more comments.
public
setModerationStatus(array<int, string>|string $id, string $moderationStatus[, bool|null $banAuthor = null ]) : PromiseInterface<string|int, null>
Costs 50 units of quota.
Parameters
- $id : array<int, string>|string
-
Modifies the moderation status of the comments with the given IDs
- $moderationStatus : string
-
Specifies the requested moderation status. Note, comments can be in statuses, which are not available through this call. For example, this call does not allow to mark a comment as 'likely spam'. Valid values: 'heldForReview', 'published' or 'rejected'. One of
published,heldForReview,likelySpam,rejected. - $banAuthor : bool|null = null
-
If set to true the author of the comment gets added to the ban list. This means all future comments of the author will autmomatically be rejected. Only valid in combination with STATUS_REJECTED. YouTube assumes
falsewhen it is left out.
Tags
Return values
PromiseInterface<string|int, null>update()
Updates an existing resource.
public
update(array<int, string>|string $part, Comment|array<string, mixed> $body) : PromiseInterface<string|int, Comment>
Costs 50 units of quota.
Parameters
- $part : array<int, string>|string
-
The part parameter identifies the properties that the API response will include. You must at least include the snippet part in the parameter value since that part contains all of the properties that the API request can update.
- $body : Comment|array<string, mixed>
-
The Comment to send.
Tags
Return values
PromiseInterface<string|int, Comment>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.