Skip to Content

ManufacturerConnection

A connection object for paginating through a list of manufacturers. This connection follows the cursor-based pagination model, enabling efficient and flexible navigation through large datasets of manufacturers.

Connection Structure

{ edges: [ManufacturerEdge!]! pageInfo: PageInfo! }

Pagination Arguments

ArgumentTypeDescription
firstIntReturns the first n elements from the list. Must be a positive integer.
lastIntReturns the last n elements from the list. Must be a positive integer.
beforeStringReturns elements in the list that come before the specified cursor.
afterStringReturns elements in the list that come after the specified cursor.

These arguments allow clients to request specific slices of the manufacturer list, supporting both forward and backward pagination.

PageInfo Structure

{ hasNextPage: Boolean! hasPreviousPage: Boolean! startCursor: String endCursor: String }
  • hasNextPage: Indicates if there are more items after the current page.
  • hasPreviousPage: Indicates if there are items before the current page.
  • startCursor: The cursor corresponding to the first item in the current page.
  • endCursor: The cursor corresponding to the last item in the current page.

These fields help clients determine whether to fetch additional pages and how to navigate through the dataset.

Usage Examples

Basic Pagination

Fetch the first 5 manufacturers:

{ manufacturers(first: 5) { edges { node { id name } cursor } pageInfo { hasNextPage endCursor } } }

Forward Pagination

Fetch the next 5 manufacturers after a given cursor:

{ manufacturers(first: 5, after: "Y3Vyc29yMQ==") { edges { node { id name } cursor } pageInfo { hasNextPage endCursor } } }

Backward Pagination

Fetch the previous 5 manufacturers before a given cursor:

{ manufacturers(last: 5, before: "Y3Vyc29yMTA=") { edges { node { id name } cursor } pageInfo { hasPreviousPage startCursor } } }

Cursor-based Navigation

Navigate pages using cursors to move forward and backward efficiently:

{ manufacturers(first: 3) { edges { node { id name } cursor } pageInfo { hasNextPage endCursor } } }

Use the endCursor from this response as the after argument in the next query to fetch the following page.

Combined with Filtering

If the API supports filtering by manufacturer name (example only if supported):

{ manufacturers(first: 5, after: "Y3Vyc29yMQ==", filter: { name_contains: "Acme" }) { edges { node { id name } cursor } pageInfo { hasNextPage endCursor } } }

Note: Replace filter with actual filtering arguments supported by the API.

Edge Type

type ManufacturerEdge { node: Manufacturer cursor: String! }
  • node: The manufacturer object at the end of the edge. This field is optional and may be null.
  • cursor: A required opaque string used for pagination to identify the position of this edge in the connection.

The ManufacturerEdge connects the Manufacturer nodes to the pagination system, allowing clients to traverse through the list efficiently.

Pagination Best Practices

  • Use the first argument with a reasonable page size (e.g., 10-50) to avoid large payloads.
  • Always check pageInfo.hasNextPage and pageInfo.hasPreviousPage before attempting to fetch additional pages.
  • Use the cursors provided in edges.cursor to navigate pages rather than relying on offset-based pagination.
  • Handle empty results gracefully by checking if edges is an empty array.
  • Avoid requesting very large page sizes to maintain API performance and reduce latency.

Performance Considerations

  • Cursor-based pagination is more performant and reliable than offset-based pagination, especially for large datasets.
  • The API may impose rate limits on paginated queries; consider caching results where appropriate.
  • Combining pagination with filtering and sorting can reduce the amount of data transferred and improve response times.
  • Avoid deep pagination (very high after or before cursors) as it may increase response time.
  • Manufacturer: The main entity representing a manufacturer.
  • ManufacturerEdge: The edge type connecting manufacturers with pagination cursors.
  • PageInfo: Contains pagination metadata such as cursors and page availability flags.

Notes

  • The API currently requires no authentication for querying manufacturers, but this may change in future versions.
  • Always validate cursor values before using them in queries to avoid errors.
  • Handle errors gracefully, such as invalid cursors or exceeding rate limits.
  • When no manufacturers match the query, the edges array will be empty, and pageInfo.hasNextPage and hasPreviousPage will be false.
  • For single-page results, hasNextPage and hasPreviousPage will both be false, indicating no further navigation is possible.
Last updated on