Skip to content

Commit 3695eb3

Browse files
authored
use int64 timestamps everywhere (#59)
1 parent 8dac940 commit 3695eb3

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

api_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func handleEditEndpoint(w http.ResponseWriter, r *http.Request) {
236236
// create a response
237237
res := EditsResponse{
238238
Object: "test-object",
239-
Created: uint64(time.Now().Unix()),
239+
Created: time.Now().Unix(),
240240
}
241241
// edit and calculate token usage
242242
editString := "edited by mocked OpenAI server :)"
@@ -275,7 +275,7 @@ func handleCompletionEndpoint(w http.ResponseWriter, r *http.Request) {
275275
res := CompletionResponse{
276276
ID: strconv.Itoa(int(time.Now().Unix())),
277277
Object: "test-object",
278-
Created: uint64(time.Now().Unix()),
278+
Created: time.Now().Unix(),
279279
// would be nice to validate Model during testing, but
280280
// this may not be possible with how much upkeep
281281
// would be required / wouldn't make much sense
@@ -334,7 +334,7 @@ func handleImageEndpoint(w http.ResponseWriter, r *http.Request) {
334334
return
335335
}
336336
res := ImageResponse{
337-
Created: uint64(time.Now().Unix()),
337+
Created: time.Now().Unix(),
338338
}
339339
for i := 0; i < imageReq.N; i++ {
340340
imageData := ImageResponseDataInner{}

completion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type LogprobResult struct {
7575
type CompletionResponse struct {
7676
ID string `json:"id"`
7777
Object string `json:"object"`
78-
Created uint64 `json:"created"`
78+
Created int64 `json:"created"`
7979
Model string `json:"model"`
8080
Choices []CompletionChoice `json:"choices"`
8181
Usage Usage `json:"usage"`

edits.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type EditsChoice struct {
2626
// EditsResponse represents a response structure for Edits API.
2727
type EditsResponse struct {
2828
Object string `json:"object"`
29-
Created uint64 `json:"created"`
29+
Created int64 `json:"created"`
3030
Usage Usage `json:"usage"`
3131
Choices []EditsChoice `json:"choices"`
3232
}

files.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type FileRequest struct {
2121
// File struct represents an OpenAPI file.
2222
type File struct {
2323
Bytes int `json:"bytes"`
24-
CreatedAt int `json:"created_at"`
24+
CreatedAt int64 `json:"created_at"`
2525
ID string `json:"id"`
2626
FileName string `json:"filename"`
2727
Object string `json:"object"`

image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type ImageRequest struct {
3030

3131
// ImageResponse represents a response structure for image API.
3232
type ImageResponse struct {
33-
Created uint64 `json:"created,omitempty"`
33+
Created int64 `json:"created,omitempty"`
3434
Data []ImageResponseDataInner `json:"data,omitempty"`
3535
}
3636

models.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
// Model struct represents an OpenAPI model.
99
type Model struct {
10-
CreatedAt int `json:"created_at"`
10+
CreatedAt int64 `json:"created_at"`
1111
ID string `json:"id"`
1212
Object string `json:"object"`
1313
OwnedBy string `json:"owned_by"`
@@ -18,7 +18,7 @@ type Model struct {
1818

1919
// Permission struct represents an OpenAPI permission.
2020
type Permission struct {
21-
CreatedAt int `json:"created_at"`
21+
CreatedAt int64 `json:"created_at"`
2222
ID string `json:"id"`
2323
Object string `json:"object"`
2424
AllowCreateEngine bool `json:"allow_create_engine"`

0 commit comments

Comments
 (0)