Skip to content

Commit

Permalink
(feat): introduce fern for docs + sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Jul 26, 2024
1 parent d03f6b7 commit 90b71fa
Show file tree
Hide file tree
Showing 14 changed files with 316 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/fern-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Fern Check

on:
pull_request:
push:
branches: [main]

jobs:
fern-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install fern
run: npm install -g fern-api
- name: fern check
run: fern check
30 changes: 30 additions & 0 deletions .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Preview Docs

on: pull_request

jobs:
run:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Fern
run: npm install -g fern-api

- name: Generate preview URL
id: generate-docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
OUTPUT=$(fern generate --docs --preview 2>&1) || true
echo "$OUTPUT"
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()')
echo "Preview URL: $URL"
echo "🌿 Preview your docs: $URL" > preview_url.txt
- name: Comment URL in PR
uses: thollander/[email protected]
with:
filePath: preview_url.txt
22 changes: 22 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish Docs

on:
push:
branches:
- main

jobs:
run:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/heads/main') && github.run_number > 1 }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Fern
run: npm install -g fern-api

- name: Publish Docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: fern generate --docs
35 changes: 35 additions & 0 deletions .github/workflows/release-typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release TypeScript SDK

on:
workflow_dispatch:
inputs:
version:
description: "The version of the Typescript SDK that you would like to release"
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3

- name: Download Fern
run: npm install -g fern-api

- name: Release TypeScript SDK
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
fern generate --group ts-sdk --version ${{ inputs.version }} --log-level debug
- name: Update Code Snippets
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
fern generate --docs
Binary file added fern/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fern/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fern/assets/matter-bold.woff2
Binary file not shown.
Binary file added fern/assets/matter.woff2
Binary file not shown.
15 changes: 15 additions & 0 deletions fern/assets/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* :not(.dark) body {
color: #240642 !important;
}
:is(.dark) body {
color: #ffffff !important;
}
:not(.dark) .prose {
color: #240642 !important;
}
:is(.dark) .prose {
color: #ffffff !important;
} */
49 changes: 49 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
instances:
- url: https://chariot.docs.buildwithfern.com
title: Chariot Documentation

navigation:
- section: Documentation
contents:
- section: Get Started
contents:
- page: Overview
slug: overview
path: ./pages/overview.mdx
- api: API Reference
snippets:
typescript: chariot

colors:
accentPrimary:
light: "#35BBF4"
dark: "#35BBF4"
background:
light: "#f8f9fb"
dark: "#004676"
sidebar-background:
light: "#ffffff"
dark: "#000000"
header-background:
light: '#ffffff'
dark: "#000000"
logo:
light: assets/logo.png
dark: assets/logo.png
height: 40
favicon: assets/favicon.png
css: assets/styles.css
layout:
page-width: full
disable-header: false
header-height: 73px
searchbar-placement: header
typography:
bodyFont:
name: OpenSans
path: ./assets/matter.woff2
weight: "400"
headingsFont:
name: OpenSans
path: ./assets/matter-bold.woff2
weight: "600"
4 changes: 4 additions & 0 deletions fern/fern.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"organization": "chariot",
"version": "0.35.0"
}
24 changes: 24 additions & 0 deletions fern/generators.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
api:
path: ../specs/v1.yaml
overrides: ./openapi-overrides.yml
settings:
use-title: false
groups:
ts-sdk:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.36.1
output:
location: npm
package-name: "chariot"
# token: ${NPM_TOKEN}
github:
repository: "chariot-giving/typescript-sdk"
# mode: push
# branch: main
mode: pull-request
config:
namespaceExport: Chariot
allowCustomFetcher: true
skipResponseValidation: true
smart-casing: true
96 changes: 96 additions & 0 deletions fern/openapi-overrides.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
paths:
/v1/nonprofit/{ein}:
get:
x-fern-sdk-group-name:
- nonprofits
x-fern-sdk-method-name: getByEin
/v1/nonprofits:
post:
x-fern-sdk-group-name:
- nonprofits
x-fern-sdk-method-name: create
/v1/nonprofits/{id}:
get:
x-fern-sdk-group-name:
- nonprofits
x-fern-sdk-method-name: getById
/v1/connects:
post:
x-fern-sdk-group-name:
- connects
x-fern-sdk-method-name: create
/v1/connects/{id}:
get:
x-fern-sdk-group-name:
- connects
x-fern-sdk-method-name: get
/v1/grants:
get:
x-fern-sdk-group-name:
- grants
x-fern-sdk-method-name: list
post:
x-fern-sdk-group-name:
- grants
x-fern-sdk-method-name: create
/v1/grants/{id}:
get:
x-fern-sdk-group-name:
- grants
x-fern-sdk-method-name: get
patch:
x-fern-sdk-group-name:
- grants
x-fern-sdk-method-name: update
/v1/unintegrated_grants:
get:
x-fern-sdk-group-name:
- grants
x-fern-sdk-method-name: list
/v1/unintegrated_grants/{id}:
get:
x-fern-sdk-group-name:
- grants
x-fern-sdk-method-name: get
patch:
x-fern-sdk-group-name:
- grants
x-fern-sdk-method-name: update
/v1/dafs:
get:
x-fern-sdk-group-name:
- daFs
x-fern-sdk-method-name: list
/v1/dafs/{id}:
get:
x-fern-sdk-group-name:
- daFs
x-fern-sdk-method-name: get
/v1/events:
get:
x-fern-sdk-group-name:
- events
x-fern-sdk-method-name: list
/v1/events/{id}:
get:
x-fern-sdk-group-name:
- events
x-fern-sdk-method-name: get
/v1/event_subscriptions:
get:
x-fern-sdk-group-name:
- eventSubscriptions
x-fern-sdk-method-name: list
post:
x-fern-sdk-group-name:
- eventSubscriptions
x-fern-sdk-method-name: create
/v1/event_subscriptions/{id}:
get:
x-fern-sdk-group-name:
- eventSubscriptions
x-fern-sdk-method-name: get
patch:
x-fern-sdk-group-name:
- eventSubscriptions
x-fern-sdk-method-name: update
24 changes: 24 additions & 0 deletions fern/pages/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Overview
subtitle: A comprehensive reference for integrating with Chariot API endpoints
---
The Chariot API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.

<Info title="Issues, Ideas or Feedback">
If you feel like something is missing from our API docs, feel free to create an Issue on our [OpenAPI GitHub repo](https://github.com/chariot-giving/chariot-openapi).
</Info>

## API protocols and headers

The Chariot API uses standard HTTP response codes to indicate status and errors. All responses come in standard JSON. The Chariot API is served over HTTPS TLS v1.2+ to ensure data privacy; HTTP and HTTPS with TLS versions below 1.2 are not supported. All requests with a payload must include a Content-Type of application/JSON and the body must be valid JSON.

Every Chariot API response includes a request_id as the `X-Request-Id` header. The request_id is included whether the API request succeeded or failed. For faster support, include the request_id when contacting support regarding a specific API call.

## API host

```js Server.js
https://sandboxapi.givechariot.com (Sandbox)
https://api.givechariot.com (Production)
```

Chariot has two environments: Sandbox and Production. The Sandbox environment supports only test data. All activity in the Production environment is real. When you’re getting ready to launch into production, please let us know by emailing [[email protected]]([email protected]) to get your production credentials.

0 comments on commit 90b71fa

Please sign in to comment.