Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 0 additions & 5 deletions .fern/metadata.json

This file was deleted.

54 changes: 27 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@ name: ci
on: [push]

jobs:
compile:
runs-on: ubuntu-latest
compile:
runs-on: ubuntu-latest

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

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

- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install
- name: Install dependencies
run: pnpm install

- name: Compile
run: pnpm build
- name: Compile
run: pnpm build

test:
runs-on: ubuntu-latest
test:
runs-on: ubuntu-latest

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

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

- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Set up node
uses: actions/setup-node@v3

- name: Install dependencies
run: pnpm install
- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Test
run: pnpm test
- name: Install dependencies
run: pnpm install

- name: Test
run: pnpm test
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ tests
.github
.fernignore
.prettierrc.yml
biome.json
tsconfig.json
yarn.lock
pnpm-lock.yaml
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dist
*.tsbuildinfo
_tmp_*
*.tmp
.tmp/
*.log
.DS_Store
Thumbs.db

2 changes: 2 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tabWidth: 4
printWidth: 120
133 changes: 0 additions & 133 deletions CONTRIBUTING.md

This file was deleted.

90 changes: 21 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,26 @@

The FernAutopilotTest TypeScript library provides convenient access to the FernAutopilotTest APIs from TypeScript.

## Table of Contents

- [Installation](#installation)
- [Reference](#reference)
- [Usage](#usage)
- [Exception Handling](#exception-handling)
- [Advanced](#advanced)
- [Additional Headers](#additional-headers)
- [Additional Query String Parameters](#additional-query-string-parameters)
- [Retries](#retries)
- [Timeouts](#timeouts)
- [Aborting Requests](#aborting-requests)
- [Access Raw Response Data](#access-raw-response-data)
- [Runtime Compatibility](#runtime-compatibility)
- [Contributing](#contributing)

## Installation

```sh
npm i -s
npm i -s
```

## Reference
Expand All @@ -25,7 +41,9 @@ import { FernAutopilotTestApiClient } from "";
const client = new FernAutopilotTestApiClient({ environment: "YOUR_BASE_URL" });
await client.imdb.createMovie({
title: "title",
rating: 1.1
rating: 1.1,
metadata: "metadata",
more_metadata: "more_metadata",
});
```

Expand Down Expand Up @@ -129,76 +147,10 @@ console.log(data);
console.log(rawResponse.headers['X-My-Header']);
```

### Logging

The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options.

```typescript
import { FernAutopilotTestApiClient, logging } from "FernAutopilotTestApi";

const client = new FernAutopilotTestApiClient({
...
logging: {
level: logging.LogLevel.Debug, // defaults to logging.LogLevel.Info
logger: new logging.ConsoleLogger(), // defaults to ConsoleLogger
silent: false, // defaults to true, set to false to enable logging
}
});
```
The `logging` object can have the following properties:
- `level`: The log level to use. Defaults to `logging.LogLevel.Info`.
- `logger`: The logger to use. Defaults to a `logging.ConsoleLogger`.
- `silent`: Whether to silence the logger. Defaults to `true`.

The `level` property can be one of the following values:
- `logging.LogLevel.Debug`
- `logging.LogLevel.Info`
- `logging.LogLevel.Warn`
- `logging.LogLevel.Error`

To provide a custom logger, you can pass in an object that implements the `logging.ILogger` interface.

<details>
<summary>Custom logger examples</summary>

Here's an example using the popular `winston` logging library.
```ts
import winston from 'winston';

const winstonLogger = winston.createLogger({...});

const logger: logging.ILogger = {
debug: (msg, ...args) => winstonLogger.debug(msg, ...args),
info: (msg, ...args) => winstonLogger.info(msg, ...args),
warn: (msg, ...args) => winstonLogger.warn(msg, ...args),
error: (msg, ...args) => winstonLogger.error(msg, ...args),
};
```

Here's an example using the popular `pino` logging library.

```ts
import pino from 'pino';

const pinoLogger = pino({...});

const logger: logging.ILogger = {
debug: (msg, ...args) => pinoLogger.debug(args, msg),
info: (msg, ...args) => pinoLogger.info(args, msg),
warn: (msg, ...args) => pinoLogger.warn(args, msg),
error: (msg, ...args) => pinoLogger.error(args, msg),
};
```
</details>


### Runtime Compatibility


The SDK works in the following runtimes:



- Node.js 18+
- Vercel
- Cloudflare Workers
Expand Down Expand Up @@ -228,4 +180,4 @@ otherwise they would be overwritten upon the next generated release. Feel free t
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!
On the other hand, contributions to the README are always very welcome!
Loading
Loading