Skip to content

(feat): get sdk working #4

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d74779f
Merge pull request #1 from OnedocLabs/dsinghvi/patch-sdk
pierredge May 18, 2024
c26b40f
Generates tests for SDK and changes generate function to return Promi…
pierredge May 22, 2024
d90ad99
Changes the generate function to return a Promise<FileForgeClient.Res…
pierredge May 22, 2024
9d217a1
Removes client from fernignore
pierredge May 23, 2024
7769f85
Merge pull request #2 from OnedocLabs/dsinghvi/patch-sdk
pierredge May 23, 2024
1a23cbf
Release 0.0.10
fern-api[bot] May 23, 2024
18b679f
Release 0.0.12
fern-api[bot] May 26, 2024
e5c9c74
Adds valid tests
pierredge May 26, 2024
0817cbf
Modifies Fetcher to return something else than a stream, writes helpe…
pierredge May 26, 2024
5be9995
Updates fernignore
pierredge May 26, 2024
a866307
Adds merge + test case for merging
pierredge May 26, 2024
4551db3
Adds Client.ts to fernignore
pierredge May 26, 2024
2c6305e
Bases fetcher response type on header content-type
pierredge May 27, 2024
29e907c
Revert "Release 0.0.12"
fern-support May 27, 2024
faea737
Changes merge function return type
pierredge May 27, 2024
558cfb0
Returns appropriate stream type depending on web or node environment
pierredge May 27, 2024
2118941
Changes method response types
pierredge May 27, 2024
06e167b
Adds content of helper.ts to module exports
pierredge May 27, 2024
8a158e5
Fixes typo in import path
pierredge May 27, 2024
39f3fa5
Release 0.0.13
fern-api[bot] May 27, 2024
e4aae06
merge in main
armandobelardo May 27, 2024
eba1e02
return typing to what it was
armandobelardo May 27, 2024
c22e3b9
Revert "Release 0.0.10"
fern-support May 27, 2024
5437996
Adds a few test cases
pierredge May 28, 2024
2e9c428
Merge branch 'dsinghvi/patch-sdk' of github.com:OnedocLabs/fileforge-…
pierredge May 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Specify files that shouldn't be modified by Fern

src/Client.ts
src/core/form-data-utils/FormDataWrapper.ts
src/core/Client.ts
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
Loading