package bunny
import "git.sr.ht/~pingoo/stdx/bunny"
Index ¶
- Constants
- type APIError
- type AddCustomHostnameInput
- type Client
- func NewClient(acountApiKey, streamApiKey string, httpClient *http.Client) *Client
- func (client *Client) AddCustomHostname(ctx context.Context, pullZone, hostname string) (err error)
- func (client *Client) CreateVideo(ctx context.Context, input CreateVideoInput) (output Video, err error)
- func (client *Client) DeleteVideo(ctx context.Context, libraryID, videoID string) (err error)
- func (client *Client) FetchVideo(ctx context.Context, libraryID, videoUrl string) (output FetchVideoOutput, err error)
- func (client *Client) GenerateIframeVideoUrl(libraryID string, videoID string, options *GenerateIframeVideoUrlOptions) (videoUrl string)
- func (client *Client) GetVideo(ctx context.Context, libraryID, videoID string) (video Video, err error)
- func (client *Client) LoadFreeCertificate(ctx context.Context, hostname string) (err error)
- func (client *Client) ReencodeVideo(ctx context.Context, libraryID, videoID string) (video Video, err error)
- func (client *Client) RemoveCustomHostname(ctx context.Context, pullZone, hostname string) (err error)
- func (client *Client) SignVideoUrl(videoId string, expiresAt time.Time) (token, expiresAtStr string)
- func (client *Client) UpdateVideo(ctx context.Context, input UpdateVideoInput) (err error)
- func (client *Client) UploadVideo(ctx context.Context, input UploadVideoInput) (output UploadVideoOutput, err error)
- type CreateVideoInput
- type FetchVideoInput
- type FetchVideoOutput
- type GenerateIframeVideoUrlOptions
- type RemoveCustomHostnameInput
- type UpdateVideoInput
- type UploadVideoInput
- type UploadVideoOutput
- type Video
- type VideoChapter
- type VideoMetaTag
- type VideoMoment
- type VideoStatus
Constants ¶
const ( VideoStatusCreated = iota VideoStatusUploaded VideoStatusProcessing VideoStatusTranscoding // Video is ready VideoStatusFinished VideoStatusError VideoStatusUploadFailed )
Types ¶
type APIError ¶
type APIError struct { Message string }
func (APIError) Error ¶
type AddCustomHostnameInput ¶
type AddCustomHostnameInput struct { Hostname string `json:"Hostname"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func (*Client) AddCustomHostname ¶
func (*Client) CreateVideo ¶
func (client *Client) CreateVideo(ctx context.Context, input CreateVideoInput) (output Video, err error)
https://docs.bunny.net/reference/video_createvideo
func (*Client) DeleteVideo ¶
https://docs.bunny.net/reference/video_deletevideo
func (*Client) FetchVideo ¶
func (client *Client) FetchVideo(ctx context.Context, libraryID, videoUrl string) (output FetchVideoOutput, err error)
https://docs.bunny.net/reference/video_fetchnewvideo
func (*Client) GenerateIframeVideoUrl ¶
func (client *Client) GenerateIframeVideoUrl(libraryID string, videoID string, options *GenerateIframeVideoUrlOptions) (videoUrl string)
GenerateIframeVideoUrl generates the URL of the given video to be embeded with an iframe See https://docs.bunny.net/docs/stream-embedding-videos for more information See https://docs.bunny.net/docs/stream-embed-token-authentication for documentation about authentication
func (*Client) GetVideo ¶
func (client *Client) GetVideo(ctx context.Context, libraryID, videoID string) (video Video, err error)
https://docs.bunny.net/reference/video_getvideo
func (*Client) LoadFreeCertificate ¶
func (*Client) ReencodeVideo ¶
func (client *Client) ReencodeVideo(ctx context.Context, libraryID, videoID string) (video Video, err error)
https://docs.bunny.net/reference/video_reencodevideo
func (*Client) RemoveCustomHostname ¶
func (client *Client) RemoveCustomHostname(ctx context.Context, pullZone, hostname string) (err error)
func (*Client) SignVideoUrl ¶
func (client *Client) SignVideoUrl(videoId string, expiresAt time.Time) (token, expiresAtStr string)
See https://docs.bunny.net/docs/stream-embed-token-authentication
func (*Client) UpdateVideo ¶
func (client *Client) UpdateVideo(ctx context.Context, input UpdateVideoInput) (err error)
https://docs.bunny.net/reference/video_updatevideo
func (*Client) UploadVideo ¶
func (client *Client) UploadVideo(ctx context.Context, input UploadVideoInput) (output UploadVideoOutput, err error)
https://docs.bunny.net/reference/video_createvideo
type CreateVideoInput ¶
type CreateVideoInput struct { LibraryID string `json:"-"` Title string `json:"title"` CollectionID *string `json:"collectionId,omitempty"` ThumbnailTime *int64 `json:"thumbnailTime,omitempty"` }
type FetchVideoInput ¶
type FetchVideoInput struct { Url string `json:"url"` }
type FetchVideoOutput ¶
type FetchVideoOutput struct { Success bool `json:"success"` Message string `json:"message"` StatusCode int64 `json:"statusCode"` ID string `json:"id"` }
type GenerateIframeVideoUrlOptions ¶
type GenerateIframeVideoUrlOptions struct { Signed bool // If Signed is true and Expires is nil we use a default value of 24 hours Expires *time.Time Autoplay *bool // We recommend to set to false TrackView *bool // We recommend to set to true Preload *bool Captions *string VideoStartTime *uint64 Refresh *bool }
See here for the avilable options: https://docs.bunny.net/docs/stream-embedding-videos#parameters
type RemoveCustomHostnameInput ¶
type RemoveCustomHostnameInput struct { Hostname string `json:"Hostname"` }
type UpdateVideoInput ¶
type UpdateVideoInput struct { LibraryID string `json:"-"` VideoID string `json:"-"` Title *string `json:"title,omitempty"` CollectionID *string `json:"collectionId,omitempty"` Chapters []VideoChapter `json:"chapters,omitempty"` Moments []VideoMoment `json:"moments,omitempty"` MetaTags []VideoMetaTag `json:"metaTags,omitempty"` }
type UploadVideoInput ¶
type UploadVideoOutput ¶
type UploadVideoOutput struct { Success bool `json:"success"` Message string `json:"message"` StatusCode int64 `json:"statusCode"` }
type Video ¶
type Video struct { VideoLibraryID int64 `json:"videoLibraryId"` Guid string `json:"guid"` Title string `json:"title"` // "dateUploaded": "2023-08-17T12:45:11.381", Views int64 `json:"views"` IsPublic bool `json:"isPublic"` // Length is the duration of the video in seconds Length int64 `json:"length"` Status VideoStatus `json:"status"` Framerate float64 `json:"framerate"` // "rotation": 0, Width int64 `json:"width"` Height int64 `json:"height"` // The available resolutions of the video. "360p,720p,1080p" for example AvailableResolutions string `json:"availableResolutions"` ThumbnailCount int64 `json:"thumbnailCount"` // The current encode progress of the video EncodeProgress int64 `json:"encodeProgress"` // The amount of storage used by this video StorageSize int64 `json:"storageSize"` // "captions": [], HasMP4Fallback bool `json:"hasMP4Fallback"` // The ID of the collection where the video belongs. Can be empty. CollectionID string `json:"collectionId"` // The file name of the thumbnail inside of the storage ThumbnailFileName string `json:"thumbnailFileName"` // The average watch time of the video in seconds AverageWatchTime int64 `json:"averageWatchTime"` // The total video watch time in seconds TotalWatchTime int64 `json:"totalWatchTime"` // The automatically detected category of the video. Default: "unknown" Category string `json:"category"` Chapters []VideoChapter `json:"chapters"` Moments []VideoMoment `json:"moments"` MetaTags []VideoMetaTag `json:"metaTags"` }
See https://docs.bunny.net/reference/video_getvideo for details
type VideoChapter ¶
type VideoChapter struct { Title string `json:"title"` Start int64 `json:"start"` End int64 `json:"end"` }
type VideoMetaTag ¶
type VideoMoment ¶
type VideoStatus ¶
type VideoStatus int64
Source Files ¶
client.go hostnames.go stream.go
- Version
- v0.0.0-20240218134121-094174641f6e (latest)
- Published
- Feb 18, 2024
- Platform
- linux/amd64
- Imports
- 12 packages
- Last checked
- 4 months ago –
Tools for package owners.