Class: OpenAI::Resources::Videos

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/videos.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Videos

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Videos.

Parameters:



160
161
162
# File 'lib/openai/resources/videos.rb', line 160

def initialize(client:)
  @client = client
end

Instance Method Details

#create(prompt: , input_reference: nil, model: nil, seconds: nil, size: nil, request_options: {}) ⇒ OpenAI::Models::Video

Create a video

Parameters:

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/openai/resources/videos.rb', line 25

def create(params)
  parsed, options = OpenAI::VideoCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "videos",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: OpenAI::Video,
    options: options
  )
end

#delete(video_id, request_options: {}) ⇒ OpenAI::Models::VideoDeleteResponse

Delete a video

Parameters:

  • video_id (String)

    The identifier of the video to delete.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



98
99
100
101
102
103
104
105
# File 'lib/openai/resources/videos.rb', line 98

def delete(video_id, params = {})
  @client.request(
    method: :delete,
    path: ["videos/%1$s", video_id],
    model: OpenAI::Models::VideoDeleteResponse,
    options: params[:request_options]
  )
end

#download_content(video_id, variant: nil, request_options: {}) ⇒ StringIO

Download video content

Parameters:

Returns:

  • (StringIO)

See Also:



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/openai/resources/videos.rb', line 120

def download_content(video_id, params = {})
  parsed, options = OpenAI::VideoDownloadContentParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["videos/%1$s/content", video_id],
    query: parsed,
    headers: {"accept" => "application/binary"},
    model: StringIO,
    options: options
  )
end

#list(after: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Video>

Some parameter documentations has been truncated, see Models::VideoListParams for more details.

List videos

Parameters:

  • after (String)

    Identifier for the last item from the previous pagination request

  • limit (Integer)

    Number of items to retrieve

  • order (Symbol, OpenAI::Models::VideoListParams::Order)

    Sort order of results by timestamp. Use ‘asc` for ascending order or `desc` for

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/openai/resources/videos.rb', line 75

def list(params = {})
  parsed, options = OpenAI::VideoListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "videos",
    query: parsed,
    page: OpenAI::Internal::ConversationCursorPage,
    model: OpenAI::Video,
    options: options
  )
end

#remix(video_id, prompt: , request_options: {}) ⇒ OpenAI::Models::Video

Create a video remix

Parameters:

  • video_id (String)

    The identifier of the completed video to remix.

  • prompt (String)

    Updated text prompt that directs the remix generation.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



145
146
147
148
149
150
151
152
153
154
155
# File 'lib/openai/resources/videos.rb', line 145

def remix(video_id, params)
  parsed, options = OpenAI::VideoRemixParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["videos/%1$s/remix", video_id],
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: OpenAI::Video,
    options: options
  )
end

#retrieve(video_id, request_options: {}) ⇒ OpenAI::Models::Video

Retrieve a video

Parameters:

  • video_id (String)

    The identifier of the video to retrieve.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



48
49
50
51
52
53
54
55
# File 'lib/openai/resources/videos.rb', line 48

def retrieve(video_id, params = {})
  @client.request(
    method: :get,
    path: ["videos/%1$s", video_id],
    model: OpenAI::Video,
    options: params[:request_options]
  )
end