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: Actor token API operations #209

Merged
merged 1 commit into from
Feb 1, 2024
Merged

feat: Actor token API operations #209

merged 1 commit into from
Feb 1, 2024

Conversation

gkats
Copy link
Member

@gkats gkats commented Jan 31, 2024

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

Added the types and operations for actor tokens. Create and Revoke are supported.

Related Issue (optional)

@gkats gkats requested a review from a team as a code owner January 31, 2024 19:34
@gkats gkats force-pushed the core-1512-actor-tokens branch from 7b8c3a9 to 960ad16 Compare February 1, 2024 10:53
req := clerk.NewAPIRequest(http.MethodPost, path)
token := &clerk.ActorToken{}
err = clerk.GetBackend().Call(ctx, req, token)
return token, err
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ Do you want to return nil or error or a pointer to empty struct? Because as it is now, it seems more suitable to return the empty value instead of a pointer.

Copy link
Member Author

Choose a reason for hiding this comment

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

You mean because we return either nil or the pointer and we should be consistent and always return one or the other in case of error?

Copy link
Contributor

Choose a reason for hiding this comment

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

Usually with pointers as return values we see in the code something like:

if err != nil {
  return nil, err
}

Here we return a pointer to empty struct which is not nil. Technically, non-nil error values should always take precedence at the call site. I am personally in favor for returning values not pointers:

return clerk.ActorToken{}, err

Added the types and operations for actor tokens. Create and Revoke are
supported.
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.

2 participants