This function and all other functions in this graphql sdk are deprecated. Please migrate to the new rest api.
Required Permissions
courses:read
Usage
Copy
Ask AI
import { whopSdk } from "@/lib/whop-sdk";
const result = await whopSdk.courses.listCoursesForCompany({
// ID of the company, either the tag (biz_xxx) or the page route (whop-dev)
companyId: "biz_XXXXXXXX" /* Required! */,
first: 10,
after: "pageInfo.endCursor",
});
Example output
Copy
Ask AI
const result = {
// The courses in the company's experiences
courses: {
// A list of nodes.
nodes: [
{
// The ID of the course. Looks like cors_XXX
id: "xxxxxxxxxxx",
// The title of the course
title: "some string",
// The URL of the course's cover image, which is shown in course preview cards
coverImage: "some string",
// The experience that the course belongs to
experience: {
// The unique ID representing this experience
id: "xxxxxxxxxxx",
// The products that this experience is attached to. This defines which set of
// customers have access and can view this experience. If empty, this experience
// is only visible to authorized users of the company
accessPasses: [
{
// The internal ID of the public product.
id: "xxxxxxxxxxx",
// The title of the product. Use for Whop 4.0.
title: "some string",
},
],
},
},
],
// The total number of items in this connection.
totalCount: 10,
// Information to aid in pagination.
pageInfo: {
// When paginating forwards, are there more items?
hasNextPage: true,
// When paginating forwards, the cursor to continue.
endCursor: "some string",
},
},
};

