Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new platform api package #357

Merged
merged 9 commits into from
Nov 29, 2022
Merged

feat: add new platform api package #357

merged 9 commits into from
Nov 29, 2022

Conversation

fpdrozd
Copy link
Contributor

@fpdrozd fpdrozd commented Nov 18, 2022

This PR adds a new SDK package dedicated to the Spree platform api.
Platform SDK docs.

The monorepo directory structure (packages/) looks like this:

  • sdk-core
  • sdk-storefront
  • sdk-platform
  • sdk-fetcher-axios
  • sdk-fetcher-node

The npm packages names look like this:

  • @spree/core-api-v2-sdk (local)
  • @spree/storefront-api-v2-sdk
  • @spree/platform-api-v2-sdk
  • @spree/axios-fetcher
  • @spree/node-fetcher

sdk-core

The platform sdk in huge part uses the same helper functions, error handlers and interfaces as the storefront sdk. In order to avoid code redundancy, all the common parts have been extracted to the sdk-core package. It is configured as a local dependency that doesn't have to be published to npm meaning that storefront and platform sdks include it in their build bundles.

Example

Before:

import squashAndPreparePositionalArguments from '../helpers/squashAndPreparePositionalArguments'
import Http from '../Http'
import type { NoContentResponse, NoContentResult } from '../interfaces/NoContent'
import type { IQuery } from '../interfaces/Query'
import type { IToken } from '../interfaces/Token'
...

With the sdk-core package:

import {
  Http,
  squashAndPreparePositionalArguments
} from '@spree/core-api-v2-sdk'
import type {
  IQuery,
  IToken,
  NoContentResponse,
  NoContentResult
} from '@spree/core-api-v2-sdk'

sdk-platform

Below is a checklist of completed endpoints:

  • Addresses
  • Adjustments
  • Classifications
  • Countries
  • CMS Pages
  • CMS Sections
  • Digital Assets
  • Digital Links
  • Line Items
  • Menus
  • Menu Items
  • Option Types
  • Option Values
  • Orders
  • Payments
  • Payment Methods
  • Products
  • Promotions
  • Promotion Actions
  • Promotion Categories
  • Promotion Rules
  • Roles
  • Shipments
  • Shipping Categories
  • Shipping Methods
  • States
  • Stock Items
  • Stock Locations
  • Store Credit Categories
  • Store Credit Types
  • Store Credits
  • Tax Categories
  • Tax Rates
  • Taxons
  • Taxonomies
  • Users
  • Variants
  • Webhook Events
  • Webhook Subscribers
  • Wishlists
  • Wished Items
  • Zones

@fpdrozd fpdrozd changed the title feat: add a feat: add new platform api package Nov 18, 2022
@fpdrozd fpdrozd force-pushed the platform-package branch 2 times, most recently from b78fe6c to 0b7983c Compare November 25, 2022 15:17
@fpdrozd fpdrozd force-pushed the platform-package branch 18 times, most recently from 974d5bd to f03f810 Compare November 28, 2022 12:59
@fpdrozd fpdrozd marked this pull request as ready for review November 29, 2022 14:16
@rafalcymerys rafalcymerys merged commit ce04ee8 into main Nov 29, 2022
@delete-merged-branch delete-merged-branch bot deleted the platform-package branch November 29, 2022 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants