npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shopify-api-types

v0.0.5-alpha

Published

typings for Shopify Admin API

Downloads

268

Readme

GitHub npm Testing docs

Simple type definitions for the Shopify Admin API.

Installation

Install with npm / yarn / pnpm:

npm install shopify-api-types
yarn add shopify-api-types
pnpm add shopify-api-types

Project Structure

The exports of each API version is split into three main parts:

  • Endpoint options will follow the following structure: <HTTP Method><Type><Query|JSONBody|Result> where the type represents what it will return.

    • For example, GetProductsResult or GetProductsQuery.
  • If a type ends with Result, then it represents the expected result by calling its accompanying route.

    • Types that are exported as never usually mean the result will be a 204 No Content, so you can safely ignore it. This does not account for errors.
  • Anything else that is miscellaneous will be exported based on what it represents (for example the REST route object).

  • There may be types exported that are identical for all versions. These will be exported as is and can be found in the common directory. They will still be prefixed accordingly as described above.

Usage

You can require / import the module directly, which will give you the latest types as of the current API version. This is considered the default version and will be updated according to Shopify's default API version; this means it may break at any point in time.

We strongly recommend you use a version when importing this module! This will prevent breaking changes when updating the module.

const { Customer } = require('shopify-api-types');
// TypeScript/ES Module support
import { Customer } from 'shopify-api-types';

You should instead consider adding the API version you want to target by appending /20**/**, where the first ** represents the API year version and the second ** represents the API month version (ask Shopify why they version their API like this).

const { Customer } = require('shopify-api-types/2020/01');
// TypeScript/ES Module support
import { Customer } from 'shopify-api-types/2020/01';

Utilizing built-in routes

All routes returned by the Routes object do not include the /api/admin/20**/** path. To do so, you must run the route through the buildRoute function.

import { Routes, buildRoute } from 'shopify-api-types/2020/01';

const customersRoute = buildRoute(Routes.customers());

Honorable Mentions

Thanks to Vlad's discord-api-types over at Discord.js for the file structure/flow/etc.