All supported fields that can be used in filters:
const result = await client.metaobjects.designer.list({
query: {
id: "1",
displayName: "Designer #1",
handle: "designer-handle",
updatedAt: "2024-01-01",
},
});
Tento is designed to be a thin typed layer on top of Shopify GraphQL Client. We’ve designed in the best way to operate a Shopify from TypeScript and it time to make it better.
Tento Metaobjects represents the Shopify Metaobject GraphQL with all features they have on the moment.
Relational queries are meant to provide you with a great developer experience for querying. You can opt-in to use it based on your needs.
import { tento } from "@drizzle-team/tento";
import * as schema from "./schema";
const client = tento({ schema });
const result = await client.metaobjects.designer.list();
const result = {
items: [
{
_id: "gid://shopify/Metaobject/1",
_handle: "designer-d",
_displayName: "Designer #D",
_updatedAt: "2024-11-19T12:37:37.000Z",
name: "Tento",
description: "Made by Drizzle team",
website: "https://drizzle.team/",
},
],
pageInfo: {
startCursor: "eyJs=",
endCursor: "eyJs=",
hasNextPage: false,
hasPreviousPage: false,
},
}
Tento represents Shopify Metaobjects query
const result = await client.metaobjects.designer.list();
await client.metaobjects.designer.list({
first: 50,
sortKey: "display_name",
query: {
updatedAt: {
$gt: "2024-01-01",
},
},
});
await client.metaobjects.designer.list({
fields: {
_id: true,
name: true,
website: true,
}
});
// result type
const result: {
items: {
name: string;
description: string | null;
website: string | null;
_id: string;
_handle: string;
_displayName: string;
_updatedAt: Date;
}[];
pageInfo: {
startCursor: string;
endCursor: string;
hasNextPage: boolean;
hasPreviousPage: boolean;
};
}
Tento represents Shopify Metaobject query
const result = await client.metaobjects.designer.get("gid://shopify/Metaobject/1");
await client.metaobjects.designer.get("gid://shopify/Metaobject/1", {
_id: true,
name: true,
website: true,
});
// return type
const result: {
name: string;
description: string | null;
website: string | null;
_id: string;
_handle: string;
_displayName: string;
_updatedAt: Date;
} | undefined
fields
parameter lets you include or omit fields you want to get from Shopify, Tento performs partial selects on the query level,
no additional data is transferred from the Shopify.
const result = await client.metaobjects.designer.list({
fields: {
_id: true,
name: true,
},
});
const result = await client.metaobjects.designer.get("gid://shopify/Metaobject/1", {
_id: true,
name: true,
});
Tento supports all pecific filters what Shopify has, see here.
For metaobjects querying Tento supports all Shopify Metaobjects Query filters.
const result = await client.metaobjects.designer.list({
query: {
id: "1"
},
});
Supported fields
All supported fields that can be used in filters:
const result = await client.metaobjects.designer.list({
query: {
id: "1",
displayName: "Designer #1",
handle: "designer-handle",
updatedAt: "2024-01-01",
},
});
Tento supports Shopify pagination
first
Supported pagination options
option | default | description |
---|---|---|
first | 50 | requested number of nodes for each page. |
after | - | cursor to retrieve nodes after in the connection. |
const result = await client.metaobjects.designer.list({
first: 10,
after: "In0="
});
last
Supported pagination options
option | default | description |
---|---|---|
last | - | requested number of nodes for each page. |
before | - | cursor to retrieve nodes after in the connection. |
To provide last
option you must specify before
cursor to prevent exceptions.
const result = await client.metaobjects.designer.list({
last: 10,
before: "In0="
});
Tento supports Shopify Metaobjects query sort keys Supported sort keys
keys | id , type , updated_at , display_name |
reverse | true , false (false as default) |
const result = await client.metaobjects.designer.list({
sortKey: "id",
reverse: true,
});