JSPM

northfork-sdk

0.4.28
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q28193F
  • License ISC

SDK for Northfork APIs

Package Exports

  • northfork-sdk
  • northfork-sdk/build/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (northfork-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Northfork Javascript SDK

SDK for accessing Northfork APIs avaliable for client-side (running in browser) as well as backend (running on node.js)

Code Example

import { initialize, getRecipe } from 'northfork-sdk'

//wait until initialization will finish
await initialize({ username: 'my-username', stage: 'development' })

//get recipe by id
const recipe = await getRecipe('recipe-id')

console.log('Got recipe', recipe.title)

API Reference:

Data Types:

initialize Props (returns Promise<InitResponse>)

Initialized an instance of sdk. No need to save InitResponse, sdk will save and authorize user by itself after calling initialize (see code examples above)

Name Description Type Required Default Value
username Username used for authorization string Yes -
stage Specify if test or prod environment should be used "production" | "development" No "production"

getRecipe Props (returns Promise<Recipe>)

Name Description Type Required Default Value
recipeId RecipeId to search for string Yes -

Data Types

Recipe

Name Description Type
id Unique Recipe id string
title Name of the recipe string
portions Number of serves (people to feed). By default 4. Range: 1 - 20. number
cookingTime Cooking time in minutes number
imageUrl Url to a recipe image string
ingredients A list of ingredients Ingredient[]
published If this recipe was published (accessible online) boolean

InitResponse

Name Description Type
accessToken Token used to access API via HTTP Authorization header string
refreshToken Token used to refresh accessToken string
type Authorization type. Usually just 'Bearer' string