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

add getProfile API #33

Merged
merged 2 commits into from
Oct 3, 2023
Merged

add getProfile API #33

merged 2 commits into from
Oct 3, 2023

Conversation

chrisradek
Copy link
Contributor

This PR adds an API to get a user's profile from a request.

It reads the ajs_user_id cookie from an incoming request, then checks the KV to see if a matching profile already exists. If one doesn't, it will call the profiles API to and cache the profile in the KV.

Tested in a cloudflare web worker.

@changeset-bot
Copy link

changeset-bot bot commented Oct 2, 2023

🦋 Changeset detected

Latest commit: 2f6fe98

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@segment/edge-sdk Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

}

async function getProfileFromSegment(segment: Segment, userId: string) {
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
async function getProfileFromSegment(segment: Segment, userId: string) {
async getProfileFromSegment(segment: Segment, userId: string) {

equivalent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nah - this is outside of the class (so no one pokes at it)

@chrisradek chrisradek merged commit 7ed1219 into main Oct 3, 2023
1 check passed
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