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

feat: Add organization roles endpoints #173

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

mzhong9723
Copy link
Member

Type of change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • 🌟 New feature (non-breaking change which adds functionality)
  • 🔨 Breaking change (fix or feature that would cause existing functionality)
  • 📖 Docs change / refactoring / dependency upgrade to change)

Description

Add support for organization roles backend API endpoints

@mzhong9723 mzhong9723 requested review from chanioxaris and a team November 6, 2023 18:32
@mzhong9723 mzhong9723 force-pushed the core-385-org-role-endpoints branch 2 times, most recently from 63a7ef1 to ea23bde Compare November 6, 2023 23:06
clerk/clerk.go Outdated
@@ -309,6 +313,10 @@ func (c *client) Organizations() *OrganizationsService {
return c.organizations
}

func (c *client) OrganizationRoles() *OrganizationRolesService {
Copy link
Member

@chanioxaris chanioxaris Nov 7, 2023

Choose a reason for hiding this comment

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

I am thinking that we probably need to differentiate between organization roles on the instance level and on the organization level. If in the future we are looking to add endpoints dedicated to the organization endpoints (e.g. /v1/organizations/:id/roles) we will have a name conflict here

A solution to that is to move the roles methods on the instance service and do something like that

clerk.Instances().CreateOrganizationRole()
....

Let's discuss offline as well!

Copy link
Member

Choose a reason for hiding this comment

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

I would also expect these methods to go into different services.

clerk.Instances().CreateOrganizationRole()
clerk.Organizations.CreateRole()

We could have one type for roles type Role struct but ideally the two methods above should accept different type of parameters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, I will refactor this! And yes I agree, let’s start with different types for now

const dummyOrgRoleID = "role_1mebQggrD3xO5JfuHk7clQ94ysA"

const dummyOrgRoleJson = `{
"object": "organization_role",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"object": "organization_role",
"object": "role",

}`

const dummyUpdateOrgRoleJson = `{
"object": "organization_role",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"object": "organization_role",
"object": "role",


type OrganizationRolesService service

type OrganizationRole struct {
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to have separate types for each role context or make it a generic one Role? Whatever we think is the best, let's make sure to align the Permission struct name as well

Copy link
Member Author

Choose a reason for hiding this comment

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

Let’s keep it separate for now - I think it’s easier to understand this way what the struct is for!

@mzhong9723 mzhong9723 force-pushed the core-385-org-role-endpoints branch from ea23bde to bf08cdc Compare November 7, 2023 18:30
@mzhong9723 mzhong9723 merged commit a4a6bbc into main Nov 7, 2023
1 check passed
@mzhong9723 mzhong9723 deleted the core-385-org-role-endpoints branch November 7, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants