Skip to content

Commit 8705a7d

Browse files
committed
Add prettier
1 parent 4ae3298 commit 8705a7d

34 files changed

+2083
-1884
lines changed

Diff for: .github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
node: ['10', '12', '14']
13+
node: ["10", "12", "14"]
1414
name: Node ${{ matrix.node }} Test
1515
steps:
1616
- name: Check out code

Diff for: .prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

Diff for: .prettierrc.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Diff for: README.md

+36-22
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,55 @@
11
# Patch Javascript SDK
2+
23
![Test](https://github.com/patch-technology/patch-node/workflows/Test/badge.svg)
34
[![Discord](https://img.shields.io/discord/733029448558837792)](https://discord.gg/M23NnGR)
45

56
The official Javascript package for the [Patch API](https://www.usepatch.com)
67

78
## Documentation
9+
810
For a complete API reference, check out [Patch's API Reference.](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml)
911

1012
## Installation
1113

1214
### NPM
15+
1316
```shell
1417
npm install @patch-technology/patch --save
1518
```
1619

1720
### Yarn
21+
1822
```shell
1923
yarn add @patch-technology/patch
2024
```
2125

2226
### Requirements
23-
* Node 10 +
27+
28+
- Node 10 +
2429

2530
## Usage
2631

2732
### Configuration
2833

2934
After installing the package, you'll have to configure it with your API key which is available from the API key page in the Patch dashboard:
35+
3036
```javascript
3137
// ES6+
32-
import Patch from '@patch-technology/patch'
33-
const patch = Patch('key_test_1234')
38+
import Patch from "@patch-technology/patch";
39+
const patch = Patch("key_test_1234");
3440

3541
// ES5
36-
var patch = require('@patch-technology/patch')('key_test_1234')
42+
var patch = require("@patch-technology/patch")("key_test_1234");
3743
```
3844

3945
### Orders
46+
4047
In Patch, orders represent a purchase of carbon offsets or negative emissions by mass. Place orders directly if you know the amount of carbon dioxide you would like to sequester. If you do not know how much to purchase, use an estimate.
4148

4249
[API Reference](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml/paths/~1v1~1orders/get)
4350

4451
#### Examples
52+
4553
```javascript
4654
// Create an order
4755
const mass = 1000000 // Pass in the mass in grams (i.e. 1 metric tonne)
@@ -65,61 +73,67 @@ patch.orders.retrieveOrders({ page })
6573
```
6674

6775
### Estimates
76+
6877
Estimates allow API users to get a quote for the cost of compensating a certain amount of CO2. When creating an estimate, an order in the `draft` state will also be created, reserving the allocation of a project for 5 minutes. If you don't place your draft order within those 5 minutes, the order will automatically be cancelled.
6978

7079
[API Reference](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml/paths/~1v1~1estimates/get)
7180

7281
#### Examples
82+
7383
```javascript
7484
// Create an estimate
75-
const mass = 1000000 // Pass in the mass in grams (i.e. 1 metric tonne)
76-
patch.estimates.createMassEstimate({ mass_g: mass })
85+
const mass = 1000000; // Pass in the mass in grams (i.e. 1 metric tonne)
86+
patch.estimates.createMassEstimate({ mass_g: mass });
7787

7888
// Retrieve an estimate
79-
const estimateId = 'est_test_1234'
80-
patch.estimates.retrieveEstimate(estimate_id)
89+
const estimateId = "est_test_1234";
90+
patch.estimates.retrieveEstimate(estimate_id);
8191

8292
// Retrieve a list of estimates
83-
const page = 1 // Pass in which page of estimates you'd like
84-
patch.estimates.retrieveEstimates({ page })
93+
const page = 1; // Pass in which page of estimates you'd like
94+
patch.estimates.retrieveEstimates({ page });
8595
```
8696

8797
### Projects
98+
8899
Projects are the ways Patch takes CO2 out of the air. They can represent reforestation, enhanced weathering, direct air carbon capture, etc. When you place an order via Patch, it is allocated to a project.
89100

90101
[API Reference](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml/paths/~1v1~1projects/get)
91102

92103
#### Examples
104+
93105
```javascript
94106
// Retrieve a project
95-
const project_id = 'pro_test_1234' // Pass in the project's ID
96-
patch.projects.retrieveProject(project_id)
107+
const project_id = "pro_test_1234"; // Pass in the project's ID
108+
patch.projects.retrieveProject(project_id);
97109

98110
// Retrieve a list of projects
99-
const page = 1 // Pass in which page of projects you'd like
100-
patch.projects.retrieve_projects({ page })
111+
const page = 1; // Pass in which page of projects you'd like
112+
patch.projects.retrieve_projects({ page });
101113
```
102114

103115
### Preferences
116+
104117
Preferences are how you route your orders in Patch. If you don't have a preference, Patch will allocate your order to the least expensive option. If you do have a preference, all of your orders will be sent to that project. You can set your preferences via API, or through the [Patch Dashboard](https://dashboard.usepatch.com/projects).
105118

106119
[API Reference](https://docs.usepatch.com/docs/patch/openapi/v1/swagger.yaml/paths/~1v1~1preferences/post)
107120

108121
#### Examples
122+
109123
```javascript
110124
// Create a preference
111-
const projectId = 'pro_test_1234' // Pass in the project_id for your preference
112-
patch.preferences.create_preference(project_id: projectId)
125+
const projectId = "pro_test_1234"; // Pass in the project_id for your preference
126+
patch.preferences.create_preference((project_id: projectId));
113127

114128
// Retrieve a preference
115-
const preferenceId = 'pre_test_1234' // Pass in the preferences's id
116-
patch.preferences.retrieve_preference(preferenceId)
129+
const preferenceId = "pre_test_1234"; // Pass in the preferences's id
130+
patch.preferences.retrieve_preference(preferenceId);
117131

118132
// Delete a preference
119-
const preferenceId = 'pre_test_1234' // Pass in the preferences's id
120-
patch.preferences.delete_preference(preferenceId)
133+
const preferenceId = "pre_test_1234"; // Pass in the preferences's id
134+
patch.preferences.delete_preference(preferenceId);
121135

122136
// Retrieve a list of preferences
123-
const page = 1 // Pass in which page of preferences you'd like
124-
patch.preferences.retrieve_preferences({ page })
137+
const page = 1; // Pass in which page of preferences you'd like
138+
patch.preferences.retrieve_preferences({ page });
125139
```

0 commit comments

Comments
 (0)