define endpoints as constants
This commit is contained in:
@@ -27,7 +27,7 @@ type roleAssignmentData struct {
|
||||
|
||||
// AssignRole assigns the provided member ID to the given role ID.
|
||||
func (c *client) AssignRole(ctx context.Context, roleID gidx.PrefixedID, memberID gidx.PrefixedID) error {
|
||||
path := fmt.Sprintf("/api/v1/roles/%s/assignments", roleID.String())
|
||||
path := fmt.Sprintf(permsPathRoleAssignmentsFormat, roleID.String())
|
||||
|
||||
body, err := encodeJSON(RoleAssign{
|
||||
SubjectID: memberID.String(),
|
||||
@@ -51,7 +51,7 @@ func (c *client) AssignRole(ctx context.Context, roleID gidx.PrefixedID, memberI
|
||||
|
||||
// UnassignRole removes the provided member ID from the given role ID.
|
||||
func (c *client) UnassignRole(ctx context.Context, roleID gidx.PrefixedID, memberID gidx.PrefixedID) error {
|
||||
path := fmt.Sprintf("/api/v1/roles/%s/assignments", roleID.String())
|
||||
path := fmt.Sprintf(permsPathRoleAssignmentsFormat, roleID.String())
|
||||
|
||||
body, err := encodeJSON(RoleAssign{
|
||||
SubjectID: memberID.String(),
|
||||
@@ -75,7 +75,7 @@ func (c *client) UnassignRole(ctx context.Context, roleID gidx.PrefixedID, membe
|
||||
|
||||
// ListRoleAssignments lists all assignments for the given role.
|
||||
func (c *client) ListRoleAssignments(ctx context.Context, roleID gidx.PrefixedID) ([]gidx.PrefixedID, error) {
|
||||
path := fmt.Sprintf("/api/v1/roles/%s/assignments", roleID.String())
|
||||
path := fmt.Sprintf(permsPathRoleAssignmentsFormat, roleID.String())
|
||||
|
||||
var response roleAssignmentData
|
||||
|
||||
|
||||
Reference in New Issue
Block a user