Back to Content Management API
schedulesByContentId
Returns a list of schedules that contain a content ID paginated by a cursor.
Arguments
- Name
contentId
- Type
- ID!
- Description
Content ID to look for in schedules.
- Name
after
- Type
- String
- Description
Returns the elements that come after the specified cursor.
- Name
before
- Type
- String
- Description
Returns the elements that come before the specified cursor.
- Name
first
- Type
- Int
- Description
Returns up to the first
n
elements from the list.
- Name
last
- Type
- Int
- Description
Returns up to the last
n
elements from the list.
Returns
- Name
SectionConnection.edges
- Type
- [ScheduleEdge!]!
- Description
A list of edges.
- Name
SectionConnection.nodes
- Type
- [Schedule!]!
- Description
A list of the nodes contained in ScheduleEdge.
- Name
SectionConnection.pageInfo
- Type
- PageInfo!
- Description
Information to aid in pagination.
- Name
SectionConnection.totalCount
- Type
- Int
- Description
The total count of items.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
query GetSchedulesByContentId($contentId: ID!, $after: String, $before: String, $first: Int, $last: Int) {
schedulesByContentId(contentId: $contentId, after: $after, before: $before, first: $first, last: $last) {
edges {
cursor
node {
title
description
}
}
nodes {
title
description
}
pageInfo {
hasNextPage
hasPreviousPage
startCursor
endCursor
}
totalCount
}
}
`
const variables = {
contentId: 'content-id',
after: 'cursor',
first: 10
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"schedulesByContentId": {
"edges": [
{
"cursor": "cursor",
"node": {
"title": "Schedule Title",
"description": "Schedule Description"
}
}
],
"nodes": [
{
"title": "Schedule Title",
"description": "Schedule Description"
}
],
"pageInfo": {
"hasNextPage": true,
"hasPreviousPage": false,
"startCursor": "cursor",
"endCursor": "cursor"
},
"totalCount": 1
}
}
}