Skip to content
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

RSDK-7188: add app wrappers #614

Conversation

purplenicole730
Copy link
Member

No description provided.

@purplenicole730 purplenicole730 changed the title Rsdk 7188 add app wrappers RSDK-7188: add app wrappers May 14, 2024
@purplenicole730 purplenicole730 marked this pull request as ready for review May 14, 2024 18:54
@purplenicole730 purplenicole730 requested a review from a team as a code owner May 14, 2024 18:54
Copy link
Member

@stuqdog stuqdog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is looking good overall! Just a couple nits and one slight "gotcha" of a refactor request

Comment on lines 400 to 401
self.created_at = registry_item.created_at.ToDatetime()
self.updated_at = registry_item.updated_at.ToDatetime()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is the only value we're changing and the ToDatetime method is already provided by proto, I'm inclined to think we don't need this shadow type at all and are fine to just let users interact with the proto object directly.


::

id = await cloud.get_user_id_by_email("youremail@email.com")`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(minor) probably should get rid of the "`)" at the end

Args:
org_id (Optional[str]): The ID of the organization. Defaults to None.
"""
org_id = org_id if org_id is not None else await self._get_organization_id()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... this is definitely correct given the state of main now, but it won't be correct once v0.21.0 is merged (we've gotten rid of the _get_organization_id() method and will require users to track and pass org ids themselves).

I think it's a bit unfortunate for us to introduce new methods that rely on _get_organization_id now only to have to change them so soon. (we just released v0.20.0 so the next release will be changing this). Sorry to ask for the refactor, but can we have this fork off of v0.21.0 instead and ask people to pass org_id to the appropriate methods directly?

Comment on lines 1698 to 1699
resource_type (Union[Literal["organization"], Literal["location"], Literal["robot"]]): Type of the resource the role is added
to. Must match `resource_id`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch here on the mistaken comment here 🎉! But, I think we'd want to update the resource_type comment to say that the role is being "removed from" a resource rather than "added to"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense. I was just thinking about the fact that it was added to the resource_type previously, but we are removing it so "being removed from" makes a lot of sense!

old_identity_id (str): ID of the entity the role belongs to (e.g., a user ID).
old_role (Union[Literal["owner"], Literal["operator"]]): The role to be changed.
old_resource_type (Union[Literal["organization"], Literal["location"], Literal["robot"]]): Type of the resource the role is
added to. Must match `resource_id`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) s/resource_id/old_resource_id

new_identity_id (str): New ID of the entity the role blongs to (e.g., a user ID).
new_role (Union[Literal["owner"], Literal["operator"]]): The new role.
new_resource_type (Union[Literal["organization"], Literal["location"], Literal["robot"]]): Type of the resource to add role to.
Must match `resource_id`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) s/resource_id/new_resource_id

@purplenicole730 purplenicole730 changed the base branch from main to rc-0.21.0 May 15, 2024 14:20
@purplenicole730 purplenicole730 changed the base branch from rc-0.21.0 to main May 15, 2024 14:20
@purplenicole730 purplenicole730 changed the base branch from main to rc-0.21.0 May 15, 2024 14:23
Copy link
Member

@stuqdog stuqdog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, one nit otherwise looks great! Thanks for also going back and updating docstring comments from previously implemented methods, much appreciated :)

src/viam/app/app_client.py Outdated Show resolved Hide resolved

async def list_organization_members(self, org_id: str) -> Tuple[List[OrganizationMember], List[OrganizationInvite]]:
"""List the members and invites of the currently authed-to organization.

::

member_list, invite_list = await cloud.list_organization_members()
member_list, invite_list = await cloud.list_organization_members("org-id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for updating all these docstring comments! I appreciate you catching and fixing 🎉

@purplenicole730 purplenicole730 merged commit 2cc7f79 into viamrobotics:rc-0.21.0 May 16, 2024
11 checks passed
@purplenicole730 purplenicole730 deleted the RSDK-7188-add-app-wrappers branch May 16, 2024 16:27
njooma pushed a commit that referenced this pull request May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants