Skip to content

Latest commit

 

History

History
348 lines (218 loc) · 10.3 KB

Captions.md

File metadata and controls

348 lines (218 loc) · 10.3 KB

\Captions

All URIs are relative to https://ws.api.video

Method HTTP request Description
Delete Delete /videos/{videoId}/captions/{language} Delete a caption
List Get /videos/{videoId}/captions List video captions
Get Get /videos/{videoId}/captions/{language} Show a caption
Update Patch /videos/{videoId}/captions/{language} Update caption
Upload Post /videos/{videoId}/captions/{language} Upload a caption

Delete

Delete(videoId string, language string) (error)

DeleteWithContext(ctx context.Context, videoId string, language string) (error)

Delete a caption

Example

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_TOKEN").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOU_SANDBOX_API_TOKEN").Build()
        
    videoId := "vi4k0jvEUuaTdRAEjQ4Prklgc" // string | The unique identifier for the video you want to delete a caption from.
    language := "en" // string | A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation.

    
    err := client.Captions.Delete(videoId, language)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.Delete``: %v\n", err)
    }
}

Path Parameters

Name Type Description Notes
videoId string The unique identifier for the video you want to delete a caption from.
language string A valid BCP 47 language representation.

Other Parameters

Name Type Description Notes

Return type

(empty response body)

[Back to top] [Back to API list] [Back to Model list] [Back to README]

List

List(videoId string, r CaptionsApiListRequest) (*CaptionsListResponse, error)

ListWithContext(ctx context.Context, videoId string, r CaptionsApiListRequest) (*CaptionsListResponse, error)

List video captions

Example

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_TOKEN").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOU_SANDBOX_API_TOKEN").Build()
    req := apivideosdk.CaptionsApiListRequest{}
    
    req.VideoId("vi4k0jvEUuaTdRAEjQ4Prklg") // string | The unique identifier for the video you want to retrieve a list of captions for.
    req.CurrentPage(int32(2)) // int32 | Choose the number of search results to return per page. Minimum value: 1 (default to 1)
    req.PageSize(int32(30)) // int32 | Results per page. Allowed values 1-100, default is 25. (default to 25)

    res, err := client.Captions.List(videoId string, req)
    

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.List``: %v\n", err)
    }
    // response from `List`: CaptionsListResponse
    fmt.Fprintf(os.Stdout, "Response from `Captions.List`: %v\n", res)
}

Path Parameters

Name Type Description Notes
videoId string The unique identifier for the video you want to retrieve a list of captions for.

Other Parameters

Name Type Description Notes
currentPage int32 Choose the number of search results to return per page. Minimum value: 1 [default to 1]
pageSize int32 Results per page. Allowed values 1-100, default is 25. [default to 25]

Return type

CaptionsListResponse

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Get

Get(videoId string, language string) (*Caption, error)

GetWithContext(ctx context.Context, videoId string, language string) (*Caption, error)

Show a caption

Example

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_TOKEN").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOU_SANDBOX_API_TOKEN").Build()
        
    videoId := "vi4k0jvEUuaTdRAEjQ4Prklg" // string | The unique identifier for the video you want captions for.
    language := "en" // string | A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation

    
    res, err := client.Captions.Get(videoId, language)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.Get``: %v\n", err)
    }
    // response from `Get`: Caption
    fmt.Fprintf(os.Stdout, "Response from `Captions.Get`: %v\n", res)
}

Path Parameters

Name Type Description Notes
videoId string The unique identifier for the video you want captions for.
language string A valid BCP 47 language representation

Other Parameters

Name Type Description Notes

Return type

Caption

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Update

Update(videoId string, language string, captionsUpdatePayload CaptionsUpdatePayload) (*Caption, error)

UpdateWithContext(ctx context.Context, videoId string, language string, captionsUpdatePayload CaptionsUpdatePayload) (*Caption, error)

Update caption

Example

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_TOKEN").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOU_SANDBOX_API_TOKEN").Build()
        
    videoId := "vi4k0jvEUuaTdRAEjQ4Prklg" // string | The unique identifier for the video you want to have automatic captions for.
    language := "en" // string | A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation.
    captionsUpdatePayload := *apivideosdk.NewCaptionsUpdatePayload() // CaptionsUpdatePayload | 

    
    res, err := client.Captions.Update(videoId, language, captionsUpdatePayload)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.Update``: %v\n", err)
    }
    // response from `Update`: Caption
    fmt.Fprintf(os.Stdout, "Response from `Captions.Update`: %v\n", res)
}

Path Parameters

Name Type Description Notes
videoId string The unique identifier for the video you want to have automatic captions for.
language string A valid BCP 47 language representation.

Other Parameters

Name Type Description Notes
captionsUpdatePayload CaptionsUpdatePayload

Return type

Caption

[Back to top] [Back to API list] [Back to Model list] [Back to README]

Upload

UploadFile(videoId string, language string, file *os.File) (*Caption, error) Upload(videoId string, language string, fileName string, fileReader io.Reader) UploadFileWithContext(ctx context.Context, videoId string, language string, file *os.File) (*Caption, error) UploadWithContext(ctx context.Context, videoId string, language string, fileName string, fileReader io.Reader)

Upload a caption

Example

package main

import (
    "context"
    "fmt"
    "os"
    apivideosdk "github.com/apivideo/api.video-go-client"
)

func main() {
    client := apivideosdk.ClientBuilder("YOUR_API_TOKEN").Build()
    // if you rather like to use the sandbox environment:
    // client := apivideosdk.SandboxClientBuilder("YOU_SANDBOX_API_TOKEN").Build()
        
    videoId := "vi4k0jvEUuaTdRAEjQ4Prklg" // string | The unique identifier for the video you want to add a caption to.
    language := "en" // string | A valid BCP 47 language representation.
    file := os.NewFile(1234, "some_file") // *os.File | The video text track (VTT) you want to upload.

    
    res, err := client.Captions.UploadFile(videoId, language, file)

    // you can also use a Reader instead of a File:
    // client.Captions.Upload(videoId, language, fileName, fileReader)

    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `Captions.Upload``: %v\n", err)
    }
    // response from `Upload`: Caption
    fmt.Fprintf(os.Stdout, "Response from `Captions.Upload`: %v\n", res)
}

Path Parameters

Name Type Description Notes
videoId string The unique identifier for the video you want to add a caption to.
language string A valid BCP 47 language representation.

Other Parameters

Name Type Description Notes
file *os.File The video text track (VTT) you want to upload.

Return type

Caption

[Back to top] [Back to API list] [Back to Model list] [Back to README]