Feat/messages api (#546)

* fix test server setup:
- go map access is not deterministic
- this can lead to a route: /foo/bar/1 matching /foo/bar before matching /foo/bar/1 if the map iteration go through /foo/bar first since the regex match wasn't bound to start and end anchors
- registering handlers now converts * in routes to .* for proper regex matching
- test server route handling now tries to fully match the handler route

* add missing /v1 prefix to fine-tuning job cancel test server handler

* add create message call

* add messages list call

* add get message call

* add modify message call, fix return types for other message calls

* add message file retrieve call

* add list message files call

* code style fixes

* add test for list messages with pagination options

* add beta header to msg calls now that #545 is merged

* Update messages.go

Co-authored-by: Simone Vellei <henomis@gmail.com>

* Update messages.go

Co-authored-by: Simone Vellei <henomis@gmail.com>

* add missing object details for message, fix tests

* fix merge formatting

* minor style fixes

---------

Co-authored-by: Simone Vellei <henomis@gmail.com>
This commit is contained in:
Urjit Singh Bhatia
2023-11-13 08:33:26 -06:00
committed by GitHub
parent 9fefd50e12
commit b7cac703ac
3 changed files with 431 additions and 0 deletions

View File

@@ -301,6 +301,24 @@ func TestClientReturnsRequestBuilderErrors(t *testing.T) {
{"DeleteAssistantFile", func() (any, error) {
return nil, client.DeleteAssistantFile(ctx, "", "")
}},
{"CreateMessage", func() (any, error) {
return client.CreateMessage(ctx, "", MessageRequest{})
}},
{"ListMessage", func() (any, error) {
return client.ListMessage(ctx, "", nil, nil, nil, nil)
}},
{"RetrieveMessage", func() (any, error) {
return client.RetrieveMessage(ctx, "", "")
}},
{"ModifyMessage", func() (any, error) {
return client.ModifyMessage(ctx, "", "", nil)
}},
{"RetrieveMessageFile", func() (any, error) {
return client.RetrieveMessageFile(ctx, "", "", "")
}},
{"ListMessageFiles", func() (any, error) {
return client.ListMessageFiles(ctx, "", "")
}},
{"CreateThread", func() (any, error) {
return client.CreateThread(ctx, ThreadRequest{})
}},