hamilton icon indicating copy to clipboard operation
hamilton copied to clipboard

add OData cast to OData query.

Open mathiaac opened this issue 2 years ago • 4 comments

Would it be possible (or is there already a way to do it?) to add casting as part of constructing the OData query, as per example 3 and 4 from the official docs? https://docs.microsoft.com/en-us/graph/api/group-list-members?view=graph-rest-1.0&tabs=http

Because if I now for instance want to list all users that are members of a group I have to list all members, iterate through them and calling get on the user client and then I will of course get a bunch of 404 errs which I have to handle. Whereas if I could cast ListMembers to users then I would be set with that one call. Think this would also solve this issue. https://github.com/manicminer/hamilton/issues/20

Thanks for the SDK btw, replaced graphrbac with the official sdk only to discover build time went up an absurd amount.

mathiaac avatar Sep 14 '22 13:09 mathiaac

@mathiaac Thanks for the compliment, and the suggestion. We'll definitely look into supporting this.

manicminer avatar Sep 14 '22 20:09 manicminer

@manicminer Thanks! Do you have a rough estimation of when that feature potentially will be in place?

mathiaac avatar Sep 15 '22 07:09 mathiaac

We're working on a pretty big refactor at the moment that will make this sort of change much easier, so I hesitate to give an estimate however it's not something I have time for right now. PRs always welcome in the meantime however, even if for an reference/interim implementation :)

manicminer avatar Sep 15 '22 08:09 manicminer

FYI, this would enable something I was considering downstream, which was for terraform's AD provider to allow listing all members of a group who are of a given type.

Without this, when getting the group members, we just get the list of object_ids and then one has to use azuread_directory_object for every one of those (sending an extra call to the graph API) to get its type and finally filter to the ones that you are interested.

DaniJG avatar Jul 09 '24 09:07 DaniJG