6.4.2 • Published 2 years ago

@pod-point/api3-js v6.4.2

Weekly downloads
150
License
MIT
Repository
github
Last release
2 years ago

Pod Point Network API SDK (JS)

Build Status npm

A JavaScript wrapper for the Pod Point Network API (v3 onward) built with TypeScript.

Installation

To install this package, run the following command:

npm install --save @pod-point/api3-js

Usage

This package contains a client, repositories, services, models and factories.

Client

First, you will want to create a new client instance.

// path/to/client.js
import { Client } from '@pod-point/api3-js';

const client = new Client(accessKey, secretKey, userAgent, domain, prefix);

Repositories & Services

Next, you can start creating and using repository and service instances with the client you have just created.

// path/to/anywhere.js
import { UserRepository } from '@pod-point/api3-js';
import client from 'path/to/client';

const userRepository = new UserRepository(client);

Models & Factories

Lastly, you can use the model factories to create:

  • fake model instances
  • fake objects representing a models attributes
  • fake objects representing a models payload
import { UserFactory } from '@pod-point/api3-js';

const userFactory = new UserFactory();
const fakeUserPayload = userFactory.payload();
const fakeUserAttributes = userFactory.attributes();
const fakeUser = userFactory.model();

Overrides can be passed into all of these methods, and there is also a method available to generate any of these objects in a pre-defined "state".

This is styled on the Laravel factories.

Example:

import { ChargeFactory } from '@pod-point/api3-js';

const chargeFactory = new ChargeFactory();
const charge = chargeFactory.states(['single']).model();

In the example above we have applied the "single" state before generating the model, this basically applies some pre-defined overrides to the fake payload/attributes.

Development

Prerequisites

  • Node 12.x - run nvm use to use the required version
  • TypeScript
    • Version: v3.9.10
    • Javascript Support: >= es2020
    • Compiler Target: es2015 (Higher level features will be downleveled)

Building with TypeScript

npm run build

Testing

This package uses jest. To run the test suites for this project, run the following command:

npm run test

Releases

This package is distributed via NPM and published automatically by Travis when creating a tagged commit.

Once your PR has been opened, run the following commands to update the package version and create a new release/tag. Now, your changes will accessible by any service before merging to master.

npm version <major|minor|patch|prerelease>
git push && git push --tags

"Whoops, I already merged..."

If you forget to do this before merging, this is not a problem, just

  1. Create a new branch from master
  2. Run these same commands above
  3. Open and merge a PR back to master so that the package.json file is updated.

Travis will run on this new branch and publish the package to NPM.


Travel shouldn't damage the earth 🌍

Made with ❤️  at Pod Point

6.4.2-0

2 years ago

6.4.2

2 years ago

6.4.2-alpha.1

2 years ago

6.4.2-alpha.2

2 years ago

6.4.2-alpha.3

2 years ago

6.4.2-alpha.0

2 years ago

6.3.5

2 years ago

6.3.5-3

2 years ago

6.3.5-4

2 years ago

6.3.5-5

2 years ago

6.3.5-0

2 years ago

6.3.5-1

2 years ago

6.3.5-alpha12

2 years ago

6.3.5-alpha13

2 years ago

6.3.5-alpha14

2 years ago

6.3.5-alpha10

2 years ago

6.3.5-alpha11

2 years ago

6.4.1

2 years ago

6.4.0

2 years ago

6.3.5-alpha9

2 years ago

6.3.4

2 years ago

6.3.5-alpha1

2 years ago

6.3.5-alpha2

2 years ago

6.3.4-alpha1

3 years ago

6.3.5-alpha7

2 years ago

6.3.5-alpha5

2 years ago

6.3.5-alpha3

2 years ago

6.3.5-alpha4

2 years ago

6.3.4-alpha2

3 years ago

6.3.3

3 years ago

6.1.0

3 years ago

6.2.1

3 years ago

6.2.0

3 years ago

6.2.3

3 years ago

6.2.2

3 years ago

6.0.2-alpha

3 years ago

6.3.0

3 years ago

6.3.2

3 years ago

6.3.1

3 years ago

6.0.2

3 years ago

6.0.1-alpha2

3 years ago

6.0.1-alpha1

3 years ago

6.0.1

3 years ago

6.0.0

3 years ago

5.4.4-alpha1

3 years ago

5.4.2-alpha

3 years ago

5.4.4-alpha3

3 years ago

5.4.4-alpha2

3 years ago

5.4.4

3 years ago

5.4.3

3 years ago

5.4.2

3 years ago

5.4.3-alpha2

3 years ago

5.4.2-alpha3

3 years ago

5.4.3-alpha3

3 years ago

5.4.1

3 years ago

5.4.2-dev

3 years ago

5.4.2-dev1

3 years ago

5.4.2-dev2

3 years ago

5.4.2-dev3

3 years ago

5.4.3-alpha1

3 years ago

5.3.14-alpha.1

3 years ago

5.3.14-alpha.0

3 years ago

5.4.0-alpha7

3 years ago

5.4.0-alpha8

3 years ago

5.4.0-alpha2

4 years ago

5.4.0-alpha3

3 years ago

5.4.0-alpha4

3 years ago

5.3.15

3 years ago

5.3.14

3 years ago

5.4.0

4 years ago

5.3.11-alpha.0

4 years ago

5.3.13

4 years ago

5.3.12

4 years ago

5.3.11

4 years ago

5.3.11-0

4 years ago

5.3.10

4 years ago

5.3.8

5 years ago

5.3.7

5 years ago

5.3.6

5 years ago

5.3.5

5 years ago

5.3.4

5 years ago

5.3.3-0

5 years ago

5.3.3-1

5 years ago

5.3.2

5 years ago

5.3.1

5 years ago

5.3.0

5 years ago

5.2.3

6 years ago

5.2.2

6 years ago

5.2.1

6 years ago

5.2.0

6 years ago

5.1.3

6 years ago

5.1.2

6 years ago

5.1.1

6 years ago

5.1.0

6 years ago

5.0.6

6 years ago

5.0.5

6 years ago

5.0.4

6 years ago

5.0.3

6 years ago

5.0.2

6 years ago

4.3.4

6 years ago

4.3.3

6 years ago

5.0.1

7 years ago

5.0.1-alpha.3.0

7 years ago

5.0.1-alpha.2

7 years ago

5.0.1-alpha.1

7 years ago

4.3.2

7 years ago

4.3.1

7 years ago

4.3.0

7 years ago

4.2.11

7 years ago

4.2.10

7 years ago

4.2.8

7 years ago

4.2.7

7 years ago

4.2.6

7 years ago

4.2.5

7 years ago

4.2.4

7 years ago

4.2.3

7 years ago

4.2.2

7 years ago

4.2.1

7 years ago

4.2.0

7 years ago

4.1.4

7 years ago

4.1.3

7 years ago

4.1.2

7 years ago

4.1.1

7 years ago

4.1.0

7 years ago

4.0.0

7 years ago

3.0.9

7 years ago

3.0.8

7 years ago

3.0.7

7 years ago

3.0.6

7 years ago

3.0.4

7 years ago

3.0.2

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.4.0

7 years ago

2.3.1

7 years ago

2.2.4

7 years ago

2.2.3

7 years ago

2.2.2

7 years ago

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.8.1

7 years ago

1.8.0

8 years ago

1.7.0

8 years ago

1.6.0

8 years ago

1.5.0

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.3

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.16

9 years ago

1.2.15

9 years ago

1.2.14

9 years ago

1.2.13

9 years ago

1.2.12

9 years ago

1.2.11

9 years ago

1.2.10

9 years ago

1.2.9

9 years ago

1.2.8

9 years ago

1.2.7

10 years ago

1.2.6

10 years ago

1.2.5

10 years ago

1.2.4

10 years ago

1.2.3

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago