-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfiles_test.go
50 lines (42 loc) · 900 Bytes
/
files_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package minimax_test
import (
"context"
"fmt"
"testing"
"github.com/Twacqwq/go-minimax"
)
func TestCreateFile(t *testing.T) {
res, err := client.CreateFile(context.Background(), &minimax.FileRequest{
Purpose: minimax.Retrieval,
FilePath: "test.txt",
})
if err != nil {
t.Fatal(err)
}
fmt.Printf("%+v\n", res)
}
func TestListFiles(t *testing.T) {
res, err := client.ListFiles(context.Background(), minimax.Retrieval)
if err != nil {
t.Fatal(err)
}
for _, v := range res.Files {
fmt.Printf("%+v\n", v)
}
}
func TestRetrieveFile(t *testing.T) {
res, err := client.RetrieveFile(context.Background(), -1)
if err != nil {
t.Fatal(err)
}
fmt.Printf("%+v\n", res.File)
}
func TestDeleteFile(t *testing.T) {
res, err := client.DeleteFile(context.Background(), &minimax.DeleteFileRequest{
FileId: -1,
})
if err != nil {
t.Fatal(err)
}
fmt.Printf("%+v\n", res)
}