Skip to content

Commit

Permalink
Merge branch 'dsinghvi/patch-sdk' of github.com:OnedocLabs/fileforge-…
Browse files Browse the repository at this point in the history
…node-sdk into dsinghvi/patch-sdk
  • Loading branch information
pierredge committed May 28, 2024
2 parents 5437996 + c22e3b9 commit 2e9c428
Show file tree
Hide file tree
Showing 32 changed files with 496 additions and 468 deletions.
6 changes: 4 additions & 2 deletions .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ src/core/helper.ts
src/core/fetcher/Fetcher.ts
src/core/form-data-utils/FormData.ts
src/core/form-data-utils/index.ts
src/core/index.ts

tests/custom.test.ts

README.md
package.json

108 changes: 58 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,61 @@ name: ci
on: [push]

jobs:
compile:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3

- name: Compile
run: yarn && yarn build

test:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3

- name: Compile
run: yarn && yarn test

publish:
needs: [compile, test]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Publish to npm
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
compile:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 20

- name: Compile
run: yarn && yarn build

test:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 20

- name: Run tests
run: yarn && yarn test
env:
FILEFORGE_API_KEY: ${{ secrets.FILEFORGE_API_KEY }}

publish:
needs: [ compile, test ]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Publish to npm
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# FileForge TypeScript Library
# Fileforge TypeScript Library

[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://buildwithfern.com/)

The FileForge TypeScript library provides convenient access to the FileForge API from JavaScript/TypeScript.
The Fileforge TypeScript library provides convenient access to the Fileforge API from JavaScript/TypeScript.

## Documentation

Expand All @@ -19,10 +19,10 @@ yarn add fileforge
## Usage

```typescript
import { FileForgeClient, FileForge } from "guesty";
import { FileforgeClient, Fileforge } from "guesty";
import * as fs from "fs";

const fileforge = new FileForgeClient({
const fileforge = new FileforgeClient({
apiKey: "...",
});

Expand All @@ -37,15 +37,15 @@ await fileforge.generate({
## Exception Handling

When the API returns a non-success status code (4xx or 5xx response),
a subclass of [FileForgeError](./src/errors/FileForgeError.ts) will be thrown:
a subclass of [FileforgeError](./src/errors/FileforgeError.ts) will be thrown:

```ts
import { FileForgeError } from 'fileforge';
import { FileforgeError } from 'fileforge';

try {
await fileforge.generate(...);
} catch (err) {
if (err instanceof FileForgeError) {
if (err instanceof FileforgeError) {
console.log(err.statusCode);
console.log(err.message);
console.log(err.body);
Expand Down Expand Up @@ -105,9 +105,9 @@ running in an unsupported environment, this provides a way for you to break the
ensure the SDK works.

```ts
import { FileForge } from 'fileforge';
import { Fileforge } from 'fileforge';

const guesty = new FileForge({
const guesty = new Fileforge({
apiKey: "...",
fetcher: // provide your implementation here
});
Expand Down
Loading

0 comments on commit 2e9c428

Please sign in to comment.