Giter Club home page Giter Club logo

shopify-api-types's Introduction

Warning

This repository is deprecated and archived. It is reccomended to use Shopify's GraphQL API with generated typings.

Shopify API Types

GitHub npm Testing docs Rate on Openbase

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.

shopify-api-types's People

Contributors

fyko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

shopify-api-types's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.