diff --git a/correspondent.go b/correspondent.go index 6987f9d..03f7168 100644 --- a/correspondent.go +++ b/correspondent.go @@ -9,7 +9,7 @@ import ( ) type correspondentClient interface { - ListAllCorrespondents(context.Context, *client.ListCorrespondentsOptions, func(context.Context, client.Correspondent) error) error + ListAllCorrespondents(context.Context, client.ListCorrespondentsOptions, func(context.Context, client.Correspondent) error) error } type correspondentCollector struct { @@ -43,7 +43,8 @@ func (c *correspondentCollector) describe(ch chan<- *prometheus.Desc) { } func (c *correspondentCollector) collect(ctx context.Context, ch chan<- prometheus.Metric) error { - opts := &client.ListCorrespondentsOptions{} + var opts client.ListCorrespondentsOptions + opts.Ordering.Field = "name" return c.cl.ListAllCorrespondents(ctx, opts, func(_ context.Context, correspondent client.Correspondent) error { diff --git a/correspondent_test.go b/correspondent_test.go index 6bc7c37..9a710a1 100644 --- a/correspondent_test.go +++ b/correspondent_test.go @@ -18,7 +18,7 @@ type fakeCorrespondentClient struct { err error } -func (c *fakeCorrespondentClient) ListAllCorrespondents(ctx context.Context, opts *client.ListCorrespondentsOptions, handler func(context.Context, client.Correspondent) error) error { +func (c *fakeCorrespondentClient) ListAllCorrespondents(ctx context.Context, opts client.ListCorrespondentsOptions, handler func(context.Context, client.Correspondent) error) error { for _, i := range c.items { if err := handler(ctx, i); err != nil { return err diff --git a/documenttype.go b/documenttype.go index 65fab05..8eaf25a 100644 --- a/documenttype.go +++ b/documenttype.go @@ -9,7 +9,7 @@ import ( ) type documentTypeClient interface { - ListAllDocumentTypes(context.Context, *client.ListDocumentTypesOptions, func(context.Context, client.DocumentType) error) error + ListAllDocumentTypes(context.Context, client.ListDocumentTypesOptions, func(context.Context, client.DocumentType) error) error } type documentTypeCollector struct { @@ -38,7 +38,8 @@ func (c *documentTypeCollector) describe(ch chan<- *prometheus.Desc) { } func (c *documentTypeCollector) collect(ctx context.Context, ch chan<- prometheus.Metric) error { - opts := &client.ListDocumentTypesOptions{} + var opts client.ListDocumentTypesOptions + opts.Ordering.Field = "name" return c.cl.ListAllDocumentTypes(ctx, opts, func(_ context.Context, doctype client.DocumentType) error { diff --git a/documenttype_test.go b/documenttype_test.go index b5c841b..280ff22 100644 --- a/documenttype_test.go +++ b/documenttype_test.go @@ -16,7 +16,7 @@ type fakeDocumentTypeClient struct { err error } -func (c *fakeDocumentTypeClient) ListAllDocumentTypes(ctx context.Context, opts *client.ListDocumentTypesOptions, handler func(context.Context, client.DocumentType) error) error { +func (c *fakeDocumentTypeClient) ListAllDocumentTypes(ctx context.Context, opts client.ListDocumentTypesOptions, handler func(context.Context, client.DocumentType) error) error { for _, i := range c.items { if err := handler(ctx, i); err != nil { return err diff --git a/go.mod b/go.mod index d0c3d9c..e1b7cb5 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/alecthomas/kingpin/v2 v2.3.2 github.com/go-kit/log v0.2.1 github.com/google/go-cmp v0.5.9 - github.com/hansmi/paperhooks v0.0.3 + github.com/hansmi/paperhooks v0.0.4 github.com/prometheus/client_golang v1.16.0 github.com/prometheus/common v0.44.0 github.com/prometheus/exporter-toolkit v0.10.0 diff --git a/go.sum b/go.sum index d157d34..e40a3ca 100644 --- a/go.sum +++ b/go.sum @@ -33,6 +33,8 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/hansmi/paperhooks v0.0.3 h1:0RgPHZaEG790kjtA9iYks+4pxLOkq4UHf2oNquA8aXk= github.com/hansmi/paperhooks v0.0.3/go.mod h1:OQVL9560CVYa3lLVYPQ0WrRzGMs9ibyY3HSPrLRXEz4= +github.com/hansmi/paperhooks v0.0.4 h1:mEBikpMrNt8rQ5VI304r8FzcxH8515F+r9aMT+HfF4s= +github.com/hansmi/paperhooks v0.0.4/go.mod h1:OQVL9560CVYa3lLVYPQ0WrRzGMs9ibyY3HSPrLRXEz4= github.com/jarcoal/httpmock v1.3.0 h1:2RJ8GP0IIaWwcC9Fp2BmVi8Kog3v2Hn7VXM3fTd+nuc= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= diff --git a/storagepath.go b/storagepath.go index d23a4a9..6bd8faf 100644 --- a/storagepath.go +++ b/storagepath.go @@ -9,7 +9,7 @@ import ( ) type storagePathClient interface { - ListAllStoragePaths(context.Context, *client.ListStoragePathsOptions, func(context.Context, client.StoragePath) error) error + ListAllStoragePaths(context.Context, client.ListStoragePathsOptions, func(context.Context, client.StoragePath) error) error } type storagePathCollector struct { @@ -38,7 +38,8 @@ func (c *storagePathCollector) describe(ch chan<- *prometheus.Desc) { } func (c *storagePathCollector) collect(ctx context.Context, ch chan<- prometheus.Metric) error { - opts := &client.ListStoragePathsOptions{} + var opts client.ListStoragePathsOptions + opts.Ordering.Field = "name" return c.cl.ListAllStoragePaths(ctx, opts, func(_ context.Context, sp client.StoragePath) error { diff --git a/storagepath_test.go b/storagepath_test.go index 40aba06..5fb0791 100644 --- a/storagepath_test.go +++ b/storagepath_test.go @@ -16,7 +16,7 @@ type fakeStoragePathClient struct { err error } -func (c *fakeStoragePathClient) ListAllStoragePaths(ctx context.Context, opts *client.ListStoragePathsOptions, handler func(context.Context, client.StoragePath) error) error { +func (c *fakeStoragePathClient) ListAllStoragePaths(ctx context.Context, opts client.ListStoragePathsOptions, handler func(context.Context, client.StoragePath) error) error { for _, i := range c.items { if err := handler(ctx, i); err != nil { return err diff --git a/tag.go b/tag.go index 6f827e2..57991e8 100644 --- a/tag.go +++ b/tag.go @@ -9,7 +9,7 @@ import ( ) type tagClient interface { - ListAllTags(context.Context, *client.ListTagsOptions, func(context.Context, client.Tag) error) error + ListAllTags(context.Context, client.ListTagsOptions, func(context.Context, client.Tag) error) error } type tagCollector struct { @@ -38,7 +38,8 @@ func (c *tagCollector) describe(ch chan<- *prometheus.Desc) { } func (c *tagCollector) collect(ctx context.Context, ch chan<- prometheus.Metric) error { - opts := &client.ListTagsOptions{} + var opts client.ListTagsOptions + opts.Ordering.Field = "name" return c.cl.ListAllTags(ctx, opts, func(_ context.Context, tag client.Tag) error { diff --git a/tag_test.go b/tag_test.go index 3cfa5d8..1554240 100644 --- a/tag_test.go +++ b/tag_test.go @@ -16,7 +16,7 @@ type fakeTagClient struct { err error } -func (c *fakeTagClient) ListAllTags(ctx context.Context, opts *client.ListTagsOptions, handler func(context.Context, client.Tag) error) error { +func (c *fakeTagClient) ListAllTags(ctx context.Context, opts client.ListTagsOptions, handler func(context.Context, client.Tag) error) error { for _, i := range c.items { if err := handler(ctx, i); err != nil { return err