Skip to content

Commit

Permalink
feat: Finished final setup and package configurations, added examples…
Browse files Browse the repository at this point in the history
… too :)
  • Loading branch information
SpiffGreen committed Jul 20, 2023
1 parent f03dbd5 commit 9a2a07f
Show file tree
Hide file tree
Showing 18 changed files with 4,058 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/hungry-buckets-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"flincap-sdk": patch
---

Finished final setup and package configurations, added examples too :)
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Flincap SDK

[![npm shield](https://img.shields.io/npm/v/@ravenapp/raven)](https://www.npmjs.com/package/@ravenapp/raven)
[![npm shield](https://img.shields.io/npm/v/flincap-sdk)](https://www.npmjs.com/package/flincap-sdk)

The Flincap library provides access to the Flincap API from JavaScript/TypeScript.

## Installation
To install run
To install see the lines below.

```sh
# using npm
Expand All @@ -17,10 +17,11 @@ yarn add flincap-sdk

## Usage

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/raven-typescript-example-yrzyda?file=app.ts&view=editor)
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/Flincap/flincap-sdk/tree/main/examples/backend)
<!-- [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/raven-typescript-example-yrzyda?file=app.ts&view=editor) -->

```js
const baseURL = 'https://flincap.app';
const baseURL = 'https://flincap.app/api';
const authToken = 'YOUR_AUTH_TOKEN'; // Optional, only if the API requires authentication

const apiClient = new FlincapApiClient(baseURL, authToken);
Expand Down
13 changes: 13 additions & 0 deletions examples/backend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Import dependencies
const {FlincapApiClient} = require("flincap-sdk");

const baseURL = 'https://flincap.app/api';
const authToken = 'FLINCAP_API_KEY'; // Optional, only if the API requires authentication
const apiClient = new FlincapApiClient(baseURL, authToken);

// Get rate
apiClient.getRate('USDT', 'NGN').then((response) => {
console.log(response.data); // Process the rate data here
}).catch((error) => {
console.error(error.message, error.code);
});
114 changes: 114 additions & 0 deletions examples/backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions examples/backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "sdk-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"flincap-sdk": "^0.0.1"
}
}
20 changes: 20 additions & 0 deletions examples/frontend-project/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions examples/frontend-project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
8 changes: 8 additions & 0 deletions examples/frontend-project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
13 changes: 13 additions & 0 deletions examples/frontend-project/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

0 comments on commit 9a2a07f

Please sign in to comment.