Sha256: 89f4cdc200d7900410955c72e76aee9bbdc7142f2e838da22e13d5971cbfa088

Contents?: true

Size: 636 Bytes

Versions: 1

Compression:

Stored size: 636 Bytes

Contents

# frozen_string_literal: true

require_relative 'base'

module BddOpenai
  module Services
    module Files
      class Retrieve < Base
        # @param file_id [String] The id of the file to retrieve
        # @return [BddOpenai::Mapper::File, BddOpenai::ErrorResponse]
        def retrieve_file(file_id)
          uri = URI.parse("#{@openai_api_domain}/files/#{file_id}")
          response = @http_client.call_get(uri, default_headers)
          return BddOpenai::ErrorResponse.from_json(response.body) unless response.code == '200'

          BddOpenai::Mapper::File.from_json(response.body)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bdd_openai-1.1.0 lib/bdd_openai/services/files/retrieve.rb