1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3package openai
4
5import (
6 "context"
7 "errors"
8 "fmt"
9 "net/http"
10
11 "github.com/openai/openai-go/internal/requestconfig"
12 "github.com/openai/openai-go/option"
13)
14
15// ContainerFileContentService contains methods and other services that help with
16// interacting with the openai API.
17//
18// Note, unlike clients, this service does not read variables from the environment
19// automatically. You should not instantiate this service directly, and instead use
20// the [NewContainerFileContentService] method instead.
21type ContainerFileContentService struct {
22 Options []option.RequestOption
23}
24
25// NewContainerFileContentService generates a new service that applies the given
26// options to each request. These options are applied after the parent client's
27// options (if there is one), and before any request-specific options.
28func NewContainerFileContentService(opts ...option.RequestOption) (r ContainerFileContentService) {
29 r = ContainerFileContentService{}
30 r.Options = opts
31 return
32}
33
34// Retrieve Container File Content
35func (r *ContainerFileContentService) Get(ctx context.Context, containerID string, fileID string, opts ...option.RequestOption) (res *http.Response, err error) {
36 opts = append(r.Options[:], opts...)
37 opts = append([]option.RequestOption{option.WithHeader("Accept", "application/binary")}, opts...)
38 if containerID == "" {
39 err = errors.New("missing required container_id parameter")
40 return
41 }
42 if fileID == "" {
43 err = errors.New("missing required file_id parameter")
44 return
45 }
46 path := fmt.Sprintf("containers/%s/files/%s/content", containerID, fileID)
47 err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
48 return
49}