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(VTEX): Implement Session related APIs #1020

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

vitoUwu
Copy link
Contributor

@vitoUwu vitoUwu commented Feb 21, 2025

What is this Contribution About?

This PR adds a bunch of APIs related to session management, such as create, delete, edit and list

@vitoUwu vitoUwu added the vtex VTEX App label Feb 21, 2025
Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.64.36 update
  • 🎉 for Minor 0.65.0 update
  • 🚀 for Major 1.0.0 update

@vitoUwu vitoUwu changed the title Feat(VTEX): Implement Session APIs Feat(VTEX): Implement Session related APIs Feb 21, 2025
import type { CreateEditSessionResponse } from "../../utils/openapi/vcs.openapi.gen.ts";

interface Props {
publicProperties: Record<string, unknown>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

change type to Record<string, { value: string }>

import { parseCookie } from "../../utils/vtexId.ts";

interface Props {
publicProperties: Record<string, unknown>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

change type to Record<string, { value: string }>

Comment on lines 21 to 39
const { vcs } = ctx;
const { cookie } = parseCookie(req.headers, ctx.account);

try {
const response = await vcs["GET /api/sessions"]({
items: props.items.join(","),
}, {
headers: { cookie },
});

if (!response.ok) {
throw new Error(`Failed to get session: ${response.status}`);
}

return await response.json();
} catch (error) {
console.error("Error getting VTEX session:", error);
return null;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

test if I can get sessions from other users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vtex VTEX App
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant