Categorygithub.com/peakle/go-vimeo
modulepackage
1.2.0
Repository: https://github.com/peakle/go-vimeo.git
Documentation: pkg.go.dev

# README

Build Status GoDoc codecov Go Report Card

go-vimeo

go-vimeo is a Go client library for accessing the Vimeo API.

Basic usage

import "github.com/silentsokolov/go-vimeo"


func main() {
	client := vimeo.NewClient(nil)

	// Specific optional parameters
	opt := &vimeo.ListCategoryOptions{
		ListOptions: vimeo.ListOptions{Page: 1, PerPage: 2},
	}

	cats, _, err := client.Categories.List(opt)
}

Authentication

The go-vimeo library does not directly handle authentication. Instead, when creating a new client, pass an http.Client that can handle authentication for you, for example the oauth2.

import (
	"golang.org/x/oauth2"
	"github.com/silentsokolov/go-vimeo"
)

func main() {
	ts := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: "... your access token ..."},
	)
	tc := oauth2.NewClient(oauth2.NoContext, ts)

	client := vimeo.NewClient(tc)

	cats, _, err := client.Categories.List(nil)
}

Pagination

func main() {
	client := ...

	// Specific optional parameters
	opt := &vimeo.ListCategoryOptions{
		ListOptions: vimeo.ListOptions{Page: 2, PerPage: 2},
	}

	// Any "List" request
	_, resp, _ := client.Categories.List(opt)

	fmt.Printf("Current page: %d\n", resp.Page)
	fmt.Printf("Next page: %s\n", resp.NextPage)
	fmt.Printf("Prev page: %s\n", resp.PrevPage)
	fmt.Printf("Total pages: %d\n", resp.TotalPages)
}

Created/Updated request

func main() {
	client := ...

	// Specific request instance
	req := &vimeo.ChannelRequest{
		Name:        "My Channel",
		Description: "Awesome",
		Privacy:     "anybody",
	}

	ch, _, _ := client.Channels.Create(req)

	fmt.Println(ch)
}

Where "Me" service?

The "Me" service repeats the "Users" service, passing the empty string will authenticated user.

func main() {
	client := ...

	// Call /me API method.
	// Return current authenticated user.
	me, _, _ := client.Users.Get("")

	fmt.Println(me)


	// Call /me/videos API method.
	// Return videos for current authenticated user.
	videos, _, _ := client.Users.ListVideo("", nil)

	fmt.Println(videos)
}

Upload video

import (
	"os"

	"golang.org/x/oauth2"
	"github.com/silentsokolov/go-vimeo"
)

func main() {
	client := ...
	filePath := "/Users/user/Videos/Awesome.mp4"

	f, _ := os.Open(filePath)

	video, resp, _ := client.Users.UploadVideo("", f)

	fmt.Println(video, resp)
}

# Functions

CheckResponse checks the API response for errors, and returns them if present.
NewClient returns a new Vimeo API client.

# Structs

Album represents a album.
AlbumRequest represents a request to create/edit an album.
App internal object provides access to specific app.
Buttons internal object embed settings.
Category represents a category.
Channel represents a channel.
ChannelRequest represents a request to create/edit an channel.
Client manages communication with Vimeo API.
Comment represents a comment.
CommentRequest represents a request to create/edit an comment.
ContentRating represents a content rating.
CreativeCommon represents a creative common.
Credit represents a creadit.
CreditRequest represents a request to create/edit an creadit.
Domain represents a domain.
Embed internal object provides access to HTML embed code.
EmbedPresets internal object present settings.
EmbedRequest a request to edit an embed settings.
EmbedSettings internal object provides access to embed settings.
ErrorResponse is a Vimeo error response.
ExtraLinksRequest a request to edit video.
Feed represents a feed.
File internal object provides access to video file information.
Group represents a group.
GroupRequest represents a request to create/edit an group.
Header internal object provides access to header pictures.
Language represents a language.
ListAlbumOptions specifies the optional parameters to the ListAlbum method.
ListCategoryOptions specifies the optional parameters to the CategoriesService.List method.
ListChannelOptions specifies the optional parameters to the CategoriesService.ListChannel method.
ListCommentOptions specifies the optional parameters to the ListCommentOptions.VideoListComment method.
ListContentRatingOptions specifies the optional parameters to the ContentRatingsService.List method.
ListCreativeCommonOptions specifies the optional parameters to the CreativeCommonsService.List method.
ListCreditOptions specifies the optional parameters to the ListCredit method.
ListFeedOptions specifies the optional parameters to the Feed method.
ListGroupOptions specifies the optional parameters to ListGroup method.
ListLanguageOptions specifies the optional parameters to the LanguagesService.List method.
ListOptions specifies the optional parameters to various List methods that support pagination.
ListPortfolioOptions specifies the optional parameters to the ListPortfolio method.
ListPresetOptions specifies the optional parameters to the ListPreset method.
ListRepliesOptions specifies the optional parameters to the ListRepliesOptions.ListReplies method.
ListUserOptions specifies the optional parameters to the ListUser method.
ListVideoOptions specifies the optional parameters to the CategoriesService.ListVideo method.
Logos internal object embed settings.
Pictures internal object provides access to pictures.
PictureSize internal object provides access to picture size.
PicturesRequest represents a request to create/edit an pictures.
Portfolio represents a portfolio.
Preset represents a preset.
Privacy internal object provides access to privacy.
RatingMPAARequest a request to edit video.
RatingsRequest a request to edit an embed settings.
RatingTVRequest a request to edit video.
Response is a Vimeo response.
Stats internal object provides access to video statistic.
SubCategory internal object provides access to subcategory in category.
Tag represents a tag.
TextTrack represents a text track.
TextTrackRequest represents a request to create/edit text track.
TitleRequest a request to edit an embed settings.
UploadVideo represents a video.
UploadVideoOptions specifies the optional parameters to the uploadVideo method.
User represents a user.
UserRequest represents a request to create/edit an user.
Video represents a video.
VideoRequest represents a request to edit an video.
WebSite represents a web site.

# Type aliases

CategoriesService handles communication with the categories related methods of the Vimeo API.
ChannelsService handles communication with the channels related methods of the Vimeo API.
ContentRatingsService handles communication with the content ratings related methods of the Vimeo API.
CreativeCommonsService handles communication with the creative commons related methods of the Vimeo API.
GroupsService handles communication with the group related methods of the Vimeo API.
LanguagesService handles communication with the languages related methods of the Vimeo API.
TagsService handles communication with the tag related methods of the Vimeo API.
UsersService handles communication with the users related methods of the Vimeo API.
VideosService handles communication with the videos related methods of the Vimeo API.