mongodb / go-client-mongodb-atlas

Go Client for MongoDB Atlas
https://www.mongodb.com/docs/atlas/reference/api-resources-spec/
Apache License 2.0
79 stars 34 forks source link

Add "Name" ListOption for filtering list results #143

Closed sunny-b closed 4 years ago

sunny-b commented 4 years ago

The Mongo Atlas API supports filtering list results based on a name parameter.

Link: https://docs.atlas.mongodb.com/reference/api/organization-get-all/#resource

It would be really useful to have this supported in the Go Client as well. At the moment, it looks like the only ListOptions that are supported are PageNum, and ItemsPerPage https://github.com/mongodb/go-client-mongodb-atlas/blob/a663e096685c8ae03b9970767287550593f2e6ba/mongodbatlas/mongodbatlas.go#L130-L138

We use Ops Manager at work and we depend on this feature in the API. We want to use this Go client but we would need this feature to be supported.

It is a pretty small change and I could easily make a PR for it. I've already made the change in my own fork: https://github.com/sunny-b/go-client-mongodb-atlas/commit/c581130f09a4a26c3a538c0777d4f768cce96c7b

sunny-b commented 4 years ago

Ah I see it might be better to create an OrganizationListOptions struct similar to ContainerListOptions https://github.com/mongodb/go-client-mongodb-atlas/blob/d1f10b2b037bf8a783bada68f9c40f9d56a05a1f/mongodbatlas/containers.go#L30-L33

sunny-b commented 4 years ago

I'm closing this as it was fixed by #144