-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Add getAll to devices #1411
Comments
Hi @Chaosflo , We would love to hear more on what your use case is, and help you use a method that exactly matches your use case. Kind regards, |
Hej @thgreasi ! I will explain a bit my use case so that you can make a picture in your head! We want to show the user all devices in a table, show tags (which were applied to the devices) as columns to filter on. Yeah that should be it =) Greetings |
Let me give you a pine query that does exactly what you described which you can use right away (until we extend the await sdk.pine.get({
resource: 'device',
options: {
$filter: {
belongs_to__application: {
$any: {
$alias: 'bta',
$expr: {
bta: {
organization: {
$any: {
$alias: 'o',
$expr: {
o: {
handle: { $in: ['org1handle', 'org1handle']}
},
},
},
},
},
},
},
},
},
},
}); In my opinion, the org handles should be a parameter for your application, and that way allow you to scope the results. To be clear, this is not just for performance reasons, but it also avoid future surprises:
Something similar has happened in the past with users that were retrieving all As a result it is always suggested to avoid unfiltered queries, since what you currently have access to might change, and in most cases does not precisely match what you want to present. |
Hej!
I have seen that you already defined a getAll in the device, but you did not export it into the type.
For my application use I need this desperately, for now I copied the method and modified it a bit.
Thank you in advance =)
Greetings
balena-sdk/src/models/device.ts
Line 322 in e62c741
The text was updated successfully, but these errors were encountered: