Skip to content

Commit 12ba988

Browse files
authored
fix job history result mapping; add Stringer to ModzyTime (#22)
1 parent dd9217c commit 12ba988

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

jobs_client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (c *standardJobsClient) GetJobDetails(ctx context.Context, input *GetJobDet
6060
func (c *standardJobsClient) ListJobsHistory(ctx context.Context, input *ListJobsHistoryInput) (*ListJobsHistoryOutput, error) {
6161
input.Paging = input.Paging.withDefaults()
6262

63-
var items []model.JobSummary
63+
var items []model.JobDetails
6464
url := "/api/jobs/history"
6565
_, links, err := c.baseClient.requestor.List(ctx, url, input.Paging, &items)
6666
if err != nil {

jobs_params.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (i *ListJobsHistoryInput) WithSort(sortDirection SortDirection, sortBy ...L
8282
}
8383

8484
type ListJobsHistoryOutput struct {
85-
Jobs []model.JobSummary `json:"jobs"`
85+
Jobs []model.JobDetails `json:"jobs"`
8686
NextPage *ListJobsHistoryInput `json:"nextPage"`
8787
}
8888

model/job.go

-6
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ type SubmitJobResponse struct {
5252
ImageClassificationModel bool `json:"imageClassificationModel"`
5353
}
5454

55-
type JobSummary struct {
56-
JobIdentifier string `json:"jobIdentifier"`
57-
Status string `json:"status"`
58-
Model ModelNamedIdentifier `json:"model"`
59-
}
60-
6155
type JobDetails struct {
6256
JobIdentifier string `json:"jobIdentifier"`
6357
SubmittedBy string `json:"submittedBy"`

model/time.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ func (mt ModzyTime) MarshalJSON() ([]byte, error) {
4242
if mt.IsZero() {
4343
return []byte("null"), nil
4444
}
45-
formatted := mt.Time.Format(DateFormat)
46-
return []byte(fmt.Sprintf(`"%s"`, formatted)), nil
45+
return []byte(fmt.Sprintf(`"%s"`, mt)), nil
46+
}
47+
48+
func (mt ModzyTime) String() string {
49+
return mt.Time.Format(DateFormat)
4750
}

0 commit comments

Comments
 (0)