Skip to content

Commit

Permalink
Make WithSort arg field names public (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
trotterdylan committed Dec 23, 2021
1 parent 3bd1ace commit da64a18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions get-records.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func (grc *GetRecordsConfig) WithFilterFormula(filterFormula string) *GetRecords

// WithSort add sorting to request.
func (grc *GetRecordsConfig) WithSort(sortQueries ...struct {
fieldName string
direction string
FieldName string
Direction string
}) *GetRecordsConfig {
for queryNum, sortQuery := range sortQueries {
grc.params.Set(fmt.Sprintf("sort[%v][field]", queryNum), sortQuery.fieldName)
grc.params.Set(fmt.Sprintf("sort[%v][direction]", queryNum), sortQuery.direction)
grc.params.Set(fmt.Sprintf("sort[%v][field]", queryNum), sortQuery.FieldName)
grc.params.Set(fmt.Sprintf("sort[%v][direction]", queryNum), sortQuery.Direction)
}
return grc
}
Expand Down
8 changes: 4 additions & 4 deletions get-records_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ func TestGetRecordsConfig_Do(t *testing.T) {
table := testTable(t)
table.client.baseURL = mockResponse("get_records_with_filter.json").URL
sortQuery1 := struct {
fieldName string
direction string
FieldName string
Direction string
}{"Field1", "desc"}
sortQuery2 := struct {
fieldName string
direction string
FieldName string
Direction string
}{"Field2", "asc"}

records, err := table.GetRecords().
Expand Down

0 comments on commit da64a18

Please sign in to comment.