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(backend-core): Add public_metadata to invitation create API #85

Conversation

deriegle
Copy link
Contributor

@deriegle deriegle commented Mar 4, 2022

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/types
  • @clerk/clerk-expo
  • @clerk/backend-core
  • @clerk/clerk-sdk-node
  • @clerk/edge
  • build/tooling/chore

Description

  • npm test runs as expected.
  • npm run build runs as expected.

The invitation creation API supports sending public_metadata that will be attached to the user upon sign up. This PR adds the type definition to allow that metadata to be used when creating an invitation. I've also added publicMetadata to the Invitation class.

Invitations can optionally carry metadata that will eventually end up in the created user once they sign up.
The metadata must be a well-formed JSON object. In order to add metadata to an invitation, you can use the public_metadata property when the invitation is created:

Clerk Invitation Documentation

Additional Testing using curl

curl https://api.clerk.dev/v1/invitations -X POST -d '{"email_address": "devin@example.com"}' -H "Authorization:Bearer $API_KEY" -H 'Content-Type:application/json'
curl https://api.clerk.dev/v1/invitations -X GET -H "Authorization:Bearer $API_KEY" -H 'Content-Type:application/json'
[{"object":"invitation","id":"inv_test","email_address":"devin@example.com","public_metadata":{},"created_at":1646430671575,"updated_at":1646430671575}]

Invitations can optionally carry metadata that will eventually end up in the created user once they sign up.
The metadata must be a well-formed JSON object. In order to add metadata to an invitation, you can use the
public_metadata property when the invitation is created:

https://docs.clerk.dev/popular-guides/invitations#invitation-metadata
@deriegle deriegle force-pushed the devin/add-public-metadata-to-invitation-api branch from c64d1f4 to ae74b90 Compare March 4, 2022 21:53
Copy link
Contributor

@SokratisVidros SokratisVidros left a comment

Choose a reason for hiding this comment

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

🥇 Thanks for the contribution!

@SokratisVidros SokratisVidros merged commit 3c0724a into clerk:main Mar 6, 2022
nikosdouvlis added a commit that referenced this pull request Mar 8, 2022
* feat(clerk-js): Add organization basic resources

* feat(clerk-js): Basic organization data shape tests

* feat(clerk-js): Invitation flow draft

* feat(clerk-js): SignUp with organization invitation flow draft

* feat(clerk-js): Sign up next draft and fixes

* feat(clerk-js): Add more attributes on organization models

Type fixes and sign-in loading screen

* chore(release): Publish

 - @clerk/clerk-js@2.15.0
 - @clerk/clerk-expo@0.8.7
 - @clerk/nextjs@2.11.5
 - @clerk/clerk-react@2.11.5
 - @clerk/shared@0.0.6
 - @clerk/types@1.26.0

* feat(clerk-js): Add useOrganization hook

* fix(clerk-js): Clear invalid invitation token value

* feat(clerk-react,clerk-js): Add useOrganization hook using __unstable attribute

* feat(types,clerk-js): Introduce Notion OAuth (#72)

Introduce declarations for supporting Notion OAuth

* chore(release): Publish

 - @clerk/clerk-js@2.16.0
 - @clerk/clerk-expo@0.8.8
 - @clerk/nextjs@2.11.6
 - @clerk/clerk-react@2.11.6
 - @clerk/shared@0.0.7
 - @clerk/types@1.27.0

* chore(repo): Stop CHANGELOG generation for staging releases

* fix(types): Consolidate oauth provider types

* fix(clerk-js): Don't use ResizeObserver on old browsers

* chore(release): Publish

 - @clerk/clerk-js@2.16.1
 - @clerk/clerk-expo@0.8.9
 - @clerk/nextjs@2.11.7
 - @clerk/clerk-react@2.11.7
 - @clerk/shared@0.0.8
 - @clerk/types@1.27.1

* feat(clerk-js,clerk-react): GetOrganization/s hook methods, fetching mechanism alignment

Fix state clearing of organizationInvitationToken

* fix(types): Guarantee elements not in oauth sorting array will be sorted last

* fix(clerk-expo): Add guard clause for tokenCache methods

* fix(clerk-expo): Add early return if tokenCache is not provided

* chore(types): Add license

* chore(types): Add contribution docs

* chore(types): Update README

* chore(release): Publish

 - @clerk/clerk-js@2.17.0
 - @clerk/clerk-expo@0.8.10
 - @clerk/nextjs@2.11.8
 - @clerk/clerk-react@2.12.0
 - @clerk/shared@0.0.9
 - @clerk/types@1.28.0

* fix(clerk-react,clerk-js,types): Crate of API feedback fixes

* fix(types): Change type import from dot

* feat(backend-core): Organizations API

Added support for managing organizations through the OrganizationApi.
Currently, the only method that is supported can be used to create a new
organization and it's named createOrganization().
Added the Organization resource, along with types for organization
properties and JSON serialization.

* fix(types): Add OrganizationMembership methods on types

* chore(release): Publish

 - @clerk/backend-core@0.5.0
 - @clerk/clerk-js@2.17.1
 - @clerk/edge@0.3.5
 - @clerk/clerk-expo@0.8.11
 - @clerk/nextjs@2.11.9
 - @clerk/clerk-react@2.12.1
 - @clerk/clerk-sdk-node@2.9.5
 - @clerk/shared@0.0.10
 - @clerk/types@1.28.1

* feat(types,backend-core,clerk-js): Add external account properties username, publicMetadata & label

* fix(backend-core): Add JWTPayload orgs claim type

* chore(release): Publish

 - @clerk/backend-core@0.5.1
 - @clerk/edge@0.3.6
 - @clerk/nextjs@2.11.10
 - @clerk/clerk-sdk-node@2.9.6

* fix(types): Revoke typing on organizationInvitation

* feat(backend-core): Add public_metadata to invitation create API (#85)

Invitations can optionally carry metadata that will eventually end up in the created user once they sign up.
The metadata must be a well-formed JSON object. In order to add metadata to an invitation, you can use the
public_metadata property when the invitation is created:

https://docs.clerk.dev/popular-guides/invitations#invitation-metadata

* Revert "fix(clerk-js,clerk-react): Revert user settings work"

This reverts commit 9a70576.

* chore(release): Publish

 - @clerk/clerk-js@2.16.1-staging.0
 - @clerk/clerk-expo@0.8.9-staging.0
 - @clerk/nextjs@2.11.7-staging.0
 - @clerk/clerk-react@2.11.7-staging.0
 - @clerk/shared@0.0.8-staging.0
 - @clerk/types@1.27.1-staging.0

* chore(release): Publish

 - @clerk/clerk-js@2.16.2-staging.0
 - @clerk/clerk-expo@0.8.10-staging.0
 - @clerk/nextjs@2.11.8-staging.0
 - @clerk/clerk-react@2.11.8-staging.0
 - @clerk/shared@0.0.9-staging.0
 - @clerk/types@1.27.2-staging.0

* chore(release): Publish

 - @clerk/clerk-js@2.16.3-staging.0
 - @clerk/clerk-expo@0.8.11-staging.0
 - @clerk/nextjs@2.11.9-staging.0
 - @clerk/clerk-react@2.11.9-staging.0
 - @clerk/shared@0.0.10-staging.0
 - @clerk/types@1.27.3-staging.0

* chore(release): Publish

 - @clerk/backend-core@0.4.5-staging.0
 - @clerk/clerk-js@2.17.1-staging.0
 - @clerk/edge@0.3.5-staging.0
 - @clerk/clerk-expo@0.8.11-staging.0
 - @clerk/nextjs@2.11.9-staging.0
 - @clerk/clerk-react@2.12.1-staging.0
 - @clerk/clerk-sdk-node@2.9.5-staging.0
 - @clerk/shared@0.0.10-staging.0
 - @clerk/types@1.28.1-staging.0

* fixup! chore(release): Publish

* chore(release): Publish

 - @clerk/backend-core@0.5.2-staging.0
 - @clerk/clerk-js@2.17.2-staging.0
 - @clerk/edge@0.3.7-staging.0
 - @clerk/clerk-expo@0.8.12-staging.0
 - @clerk/nextjs@2.11.11-staging.0
 - @clerk/clerk-react@2.12.2-staging.0
 - @clerk/clerk-sdk-node@2.9.7-staging.0
 - @clerk/shared@0.0.11-staging.0
 - @clerk/types@1.28.2-staging.0

* chore(repo): Bump turbo dependency

Fix vercel/turborepo#820

* chore(repo): Fix merge conflicts

Co-authored-by: Peter Perlepes <p.perlepes@gmail.com>
Co-authored-by: Sokratis Vidros <sokratis.vidros@gmail.com>
Co-authored-by: Haris Chaniotakis <chanioxaris@gmail.com>
Co-authored-by: Mark Pitsilos <mark.pitsilos@gmail.com>
Co-authored-by: Ian McPhail <ian@clerk.dev>
Co-authored-by: Giannis Katsanos <giannis@clerk.dev>
Co-authored-by: Giannis Katsanos <gkats@fastmail.com>
Co-authored-by: Ian McPhail <97047001+devchampian@users.noreply.github.com>
Co-authored-by: Devin Riegle <riegledevin@gmail.com>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants