iTwin / itwins-client

https://developer.bentley.com/apis/iTwins/
MIT License
1 stars 2 forks source link

Feature Request: Support API endpoint to get iTwin Account #27

Closed ben-bartholomew closed 1 month ago

ben-bartholomew commented 2 months ago

The current iTwins REST API has an endpoint to retrieve the Account for an iTwin which is missing from the iTwinAccessClient:

https://qa-developer.bentley.com/apis/itwins/operations/get-itwin-account/

As it works now you would have to make two calls, one to getAsync to get the actual iTwin (and thus the iTwinAccountId), and then another getAsync with the iTwinAccountId to get the properties on the Account.

Was this deliberately left out of the iTwinsAccessClient? If not I would be happy to submit a PR.

davidhjones commented 2 months ago

It was not deliberately left out, feel free to submit a PR if you'd like!

With that being said, there is a method which might work for your purpose: getPrimaryAccountAsync. This will retrieve the user's (user in the access token) primary account. Assuming the iTwin is in the same organization as the user, this is likely the same Account.

ben-bartholomew commented 2 months ago

Thanks for the details David, we have a niche case where we need to get the account of the iTwin where it can be different from what the user's primary account is, so I put up a PR.