-
Notifications
You must be signed in to change notification settings - Fork 20
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
Conversation
63a7ef1
to
ea23bde
Compare
clerk/clerk.go
Outdated
@@ -309,6 +313,10 @@ func (c *client) Organizations() *OrganizationsService { | |||
return c.organizations | |||
} | |||
|
|||
func (c *client) OrganizationRoles() *OrganizationRolesService { |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
clerk/organization_roles_test.go
Outdated
const dummyOrgRoleID = "role_1mebQggrD3xO5JfuHk7clQ94ysA" | ||
|
||
const dummyOrgRoleJson = `{ | ||
"object": "organization_role", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"object": "organization_role", | |
"object": "role", |
clerk/organization_roles_test.go
Outdated
}` | ||
|
||
const dummyUpdateOrgRoleJson = `{ | ||
"object": "organization_role", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"object": "organization_role", | |
"object": "role", |
clerk/organization_roles.go
Outdated
|
||
type OrganizationRolesService service | ||
|
||
type OrganizationRole struct { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
ea23bde
to
bf08cdc
Compare
Type of change
Description
Add support for organization roles backend API endpoints