Skip to content

Commit

Permalink
Add README.md listing samples in php directory
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyDiamondstein authored Nov 22, 2016
1 parent 42a6da6 commit 7af4255
Showing 1 changed file with 225 additions and 0 deletions.
225 changes: 225 additions & 0 deletions php/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
## Samples in this directory:

### [Add a channel section](/youtube/api-samples/blob/master/php/add_channel_section.php)

Method: youtube.channelSections.insert<br>
Description: This sample calls the API's <code>channelSections.insert</code> method to create channel sections.
The code accepts a number of command line arguments that let you specify the section's type, display style, title, position,
and content.<br><br>
This sample also updates the channel's
<code><a href="/youtube/v3/docs/channels#brandingSettings.channel.showBrowseView">brandingSettings.channel.showBrowseView</a></code>
property so that the channel displays content in a browse view (rather than a feed view). A channel's sections are only
visible if the channel displays content in a browse view.</p><p>More information on channel sections is available in the
<a href="https://support.google.com/youtube/answer/3027787">YouTube Help Center</a>.

### [Add a channel subscription](/youtube/api-samples/blob/master/php/add_subscription.php)

Method: youtube.subscriptions.insert<br>
Description: This sample calls the API's <code>subscriptions.insert</code> method to add a subscription to a specified
channel.

### [Create and manage YouTube video caption tracks](/youtube/api-samples/blob/master/php/captions.php)

Method: youtube.captions.insert, youtube.captions.list, youtube.captions.update, youtube.captions.download,
youtube.captions.delete<br>
Description: This sample demonstrates how to use the following API methods to create and manage YouTube video caption
tracks:<br>
<ul>
<li>It calls the <code>captions.insert</code> method with the <code>isDraft</code> parameter set to <code>true</code>
to upload a caption track in draft status.</li>
<li>It calls the <code>captions.list</code> method with the <code>videoId</code> parameter to retrieve video caption
tracks.</li>
<li>It calls the <code>captions.update</code> method with the caption in the request body to update a caption track.</li>
<li>It calls the <code>captions.download</code> method to download the caption track.</li>
<li>It calls the <code>captions.delete</code> method to delete the caption track, using the <code>id</code> parameter to
identify the caption track.</li>
</ul>

### [Set and retrieve localized metadata for a channel](/youtube/api-samples/blob/master/php/channel_localizations.php)

Method: youtube.channels.update, youtube.channels.list<br>
Description: This sample demonstrates how to use the following API methods to set and retrieve localized metadata for a
channel:<br>
<ul>
<li>It calls the <code>channels.update</code> method to update the default language of a channel's metadata and to add a
localized version of this metadata in a selected language. Note that to set the default language for a channel resource,
you actually need to update the <code>brandingSettings.channel.defaultLanguage</code> property.</li>
<li>It calls the <code>channels.list</code> method with the <code>hl</code> parameter set to a specific language to
retrieve localized metadata in that language.</li>
<li>It calls the <code>channels.list</code> method and includes <code>localizations</code> in the <code>part</code>
parameter value to retrieve all of the localized metadata for that channel.</li>
</ul>

### [Set and retrieve localized metadata for a channel section](/youtube/api-samples/blob/master/php/channel_section_localizations.php)

Method: youtube.channelSections.update, youtube.channelSections.list<br>
Description: This sample demonstrates how to use the following API methods to set and retrieve localized metadata for a
channel section:<br>
<ul>
<li>It calls the <code>channelSections.update</code> method to update the default language of a channel section's
metadata and to add a localized version of this metadata in a selected language.</li>
<li>It calls the <code>channelSections.list</code> method with the <code>hl</code> parameter set to a specific language
to retrieve localized metadata in that language.</li>
<li>It calls the <code>channelSections.list</code> method and includes <code>localizations</code> in the
<code>part</code> parameter value to retrieve all of the localized metadata for that channel section.</li>
</ul>

### [Create and manage comments](/youtube/api-samples/blob/master/php/comment_handling.php)

Method: youtube.commentThreads.list, youtube.comments.insert, youtube.comments.list, youtube.comments.update,
youtube.comments.setModerationStatus, youtube.comments.markAsSpam, youtube.comments.delete<br>
Description: The following code sample demonstrates how to use the following API methods to create and manage comments:<br>
<ul>
<li>It calls the <code>commentThreads.list</code> method with the <code>videoId</code> parameter set to retrieve comments
for a video.</li>
<li>It calls the <code>comments.insert</code> method with the <code>parentId</code> parameter set to reply to an existing
comment.</li>
<li>It calls the <code>comments.list</code> method with the <code>parentId</code> parameter to retrieve the comments in the
thread.</li>
<li>It calls the <code>comments.update</code> method with comment in the request body to update a comment.</li>
<li>It calls the <code>comments.setModerationStatus</code> method to set the moderation status of the comment, the
<code>comments.markAsSpam</code> method to mark the comment as spam, and the <code>comments.delete</code> method to
delete the comment, using the <code>id</code> parameter to identify the comment.</li>
</ul>

### [Create and manage comment threads](/youtube/api-samples/blob/master/php/comment_threads.php)

Method: youtube.commentThreads.insert, youtube.commentThreads.list, youtube.commentThreads.update<br>
Description: This sample demonstrates how to use the following API methods to create and manage top-level comments:<br>
<ul>
<li>It calls the <code>commentThreads.insert</code> method once with the <code>channelId</code> parameter to create a
channel comment and once with the <code>videoId</code> parameter to create a video comment.</li>
<li>It calls the <code>commentThreads.list</code> method once with the <code>channelId</code> parameter to retrieve
channel comments and once with the <code>videoId</code> parameter to retrieve video comments.</li>
<li>It calls the <code>commentThreads.update</code> method once to update a video comment and then again to update a
channel comment. In each case, the request body contains the <code>comment</code> resource being updated.</li>
</ul>

### [Create a broadcast](/youtube/api-samples/blob/master/php/create_broadcast.php)

Method: youtube.liveBroadcasts.bind,youtube.liveBroadcasts.insert,youtube.liveStreams.insert<br>
Description: This sample calls the API's <code>liveBroadcasts.insert</code> method to create a broadcast.

### [Create a reporting job](/youtube/api-samples/blob/master/php/create_reporting_job.php)

Method: youtubeReporting.reportTypes.list, youtubeReporting.jobs.create<br>
Description: This sample demonstrates how to create a reporting job. It calls the <code>reportTypes.list</code> method
to retrieve a list of available report types. It then calls the <code>jobs.create</code> method to create a new reporting
job.

### [Search by geolocation](/youtube/api-samples/blob/master/php/geolocation_search.php)

Method: youtube.search.list, youtube.videos.list<br>
Description: This sample calls the API's <code>search.list</code> method with <code>q</code>, <code>location</code> and
<code>locationRadius</code> parameters to retrieve search results matching the provided keyword within the radius centered
at a particular location. Using the video IDs from the search result, the sample calls the API's <code>videos.list</code>
method to retrieve location details of each video.

### [Retrieve a channel's broadcasts](/youtube/api-samples/blob/master/php/list_broadcasts.php)

Method: youtube.liveBroadcasts.list<br>
Description: This sample calls the API's <code>liveBroadcasts.list</code> method to retrieve a list of broadcasts for
the channel associated with the request. By default, the request retrieves all broadcasts for the channel, but you can
also specify a value for the <code>--broadcast-status</code> option to only retrieve broadcasts with a particular status.

### [Retrieve a channel's live video streams](/youtube/api-samples/blob/master/php/list_streams.php)

Method: youtube.liveStreams.list<br>
Description: This sample calls the API's <code>liveStreams.list</code> method to retrieve a list of video stream settings
that a channel can use to broadcast live events on YouTube.

### [Retrieve my uploads](/youtube/api-samples/blob/master/php/my_uploads.php)

Method: youtube.playlistItems.list<br>
Description: This sample calls the API's <code>playlistItems.list</code> method to retrieve a list of videos uploaded
to the channel associated with the request. The code also calls the <code>channels.list</code> method with the
<code>mine</code> parameter set to <code>true</code> to retrieve the playlist ID that identifies the channel's uploaded
videos.

### [Set and retrieve localized metadata for a playlist](/youtube/api-samples/blob/master/php/playlist_localizations.php)

Method: youtube.playlists.update, youtube.playlists.list<br>
Description: This sample demonstrates how to use the following API methods to set and retrieve localized metadata for a
playlist:<br>
<ul>
<li>It calls the <code>playlists.update</code> method to update the default language of a playlist's metadata and to add
a localized version of this metadata in a selected language.</li>
<li>It calls the <code>playlists.list</code> method with the <code>hl</code> parameter set to a specific language to
retrieve localized metadata in that language.</li>
<li>It calls the <code>playlists.list</code> method and includes <code>localizations</code> in the <code>part</code>
parameter value to retrieve all of the localized metadata for that playlist.</li>
</ul>

### [Create a playlist](/youtube/api-samples/blob/master/php/playlist_updates.php)

Method: youtube.playlists.insert<br>
Description: This sample calls the API's <code>playlists.insert</code> method to create a private playlist owned by the
channel authorizing the request.

### [Upload a video](/youtube/api-samples/blob/master/php/resumable_upload.php)

Method: youtube.videos.insert<br>
Description: The following code sample calls the API's <code>videos.insert</code> method to add a video to user's
channel. The code also utilizes <code>Google_MediaFileUpload</code> class with the <code>resumable upload</code>
parameter set to <code>true</code> to be able to to upload the video in chunks.

### [Retrieve reports](/youtube/api-samples/blob/master/php/retrieve_reports.php)

Method: youtubeReporting.jobs.list, youtubeReporting.reports.list<br>
Description: This sample demonstrates how to retrieve reports created by a specific job. It calls the
<code>jobs.list</code> method to retrieve reporting jobs. It then calls the <code>reports.list</code> method with the
<code>jobId</code> parameter set to a specific job id to retrieve reports created by that job. Finally, the sample
prints out the download URL for each report.

### [Search by keyword](/youtube/api-samples/blob/master/php/search.php)

Method: youtube.search.list<br>
Description: This sample calls the API's <code>search.list</code> method to retrieve search results associated with
a particular keyword.

### [Shuffle existing channel sections](/youtube/api-samples/blob/master/php/shuffle_channel_sections.php)

Method: youtube.channelSections.list,youtube.channelSections.update<br>
Description: This sample calls the API's <code>channelSections.list</code> method to get the list of current channel
sections, shuffles them, and then calls <code>channelSections.update</code> to change the position of each.<br><br>
More information on channel sections is available in the
<a href="https://support.google.com/youtube/answer/3027787">YouTube Help Center</a>.

### [Update a video](/youtube/api-samples/blob/master/php/update_video.php)

Method: youtube.videos.update<br>
Description: This code sample demonstrates how to add tags into an existing video.<br><br>The following code
sample calls the API's <code>youtube.videos.list</code> method with <code>id</code> parameter set to videoId
to get the video object. Using this video object, the sample gets the list of tags and appends new tags at the
end of this list. Finally, the code calls <code>youtube.videos.update</code> method with updated video object
to persist these changes on YouTube.

### [Upload a banner image and set as channel's banner](/youtube/api-samples/blob/master/php/upload_banner.php)

Method: youtube.channelBanners.insert, youtube.channels.update<br>
Description: This sample calls the API's <code>channelBanners.insert</code> method to upload an image. With the
returned URL, the sample calls <code>channels.update</code> method to update channel's banner to this image.

### [Upload a video thumbnail image](/youtube/api-samples/blob/master/php/upload_thumbnail.php)

Method: youtube.thumbnails.set<br>
Description: This sample demonstrates how to upload a custom video thumbnail to YouTube and set it for a video.
It calls the API's <code>youtube.thumbnails.set</code> method with <code>videoId</code> parameter set to a video
ID to use a custom image as a thumbnail to the video. For the image upload, the program utilizes the
<code>Google_MediaFileUpload</code> class with the <code>resumable</code> parameter set to
<code>true</code> to upload the image piece-by-piece, allowing for subsequent retries to resume uploading from
a point close to where the previous retry failed, a feature useful for programs that need to upload large files.

### [Set and retrieve localized metadata for a video](/youtube/api-samples/blob/master/php/video_localizations.php)

Method: youtube.videos.update, youtube.videos.list<br>
Description: This sample demonstrates how to use the following API methods to set and retrieve localized metadata
for a video:<br>
<ul>
<li>It calls the <code>videos.update</code> method to update the default language of a video's metadata and to add
a localized version of this metadata in a selected language.</li>
<li>It calls the <code>videos.list</code> method with the <code>hl</code> parameter set to a specific language to
retrieve localized metadata in that language.</li>
<li>It calls the <code>videos.list</code> method and includes <code>localizations</code> in the <code>part</code>
parameter value to retrieve all of the localized metadata for that video.</li>
</ul>

0 comments on commit 7af4255

Please sign in to comment.