Skip to content

Commit

Permalink
JS-SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav-mahadik committed Apr 16, 2024
0 parents commit 6adfa4d
Show file tree
Hide file tree
Showing 53 changed files with 37,077 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/on_merge_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Merge CI

on:
push:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 15.x]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: npm install, npm test
run: |
npm install
npm test
env:
API_KEY: ${{ secrets.API_KEY }}
API_SECRET: ${{ secrets.API_SECRET }}
APP_USERNAME: ${{ secrets.APP_USERNAME }}
PASSWORD: ${{ secrets.PASSWORD }}

- name: Coveralls (Uploading test report)
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Pull Request CI

on:
push:
branches: [ fyndx0 ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 15.x]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: npm install, npm test
run: |
npm install
npm test
env:
API_KEY: ${{ secrets.API_KEY }}
API_SECRET: ${{ secrets.API_SECRET }}
APP_USERNAME: ${{ secrets.APP_USERNAME }}
PASSWORD: ${{ secrets.PASSWORD }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dotenv environment variables file
.env
.env.test
.env.production
node_modules
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Fynd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
79 changes: 79 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# FDK Javascript

![GitHub package.json version](https://img.shields.io/github/package-json/v/gofynd/fdk-client-javascript?style=plastic)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/gofynd/fdk-client-javascript/Node.js%20CI?style=plastic)
![GitHub](https://img.shields.io/github/license/gofynd/fdk-client-javascript?style=plastic)
[![Coverage Status](https://coveralls.io/repos/github/gofynd/fdk-client-javascript/badge.svg)](https://coveralls.io/github/gofynd/fdk-client-javascript)

FDK client for Javascript

## Getting Started

Get started with the Javascript Development SDK for Potlee

### Usage

```
npm install fdk-client-javascript --save
```

Using this method, you can `require` fdk-client-javascript like so:

```js
const {
ApplicationConfig,
ApplicationClient,
} = require("fdk-client-javascript");
```

### Sample Usage - ApplicationClient

```javascript
const config = new ApplicationConfig({
applicationID: "YOUR_APPLICATION_ID",
applicationToken: "YOUR_APPLICATION_TOKEN",
locationDetails: "LOCATION_DETAILS_OBJECT"
});

const applicationClient = new ApplicationClient(config);

```

### Sample Usage - PlatformClient

```javascript
const { PlatformConfig, PlatformClient } = require("fdk-client-javascript");

let platformConfig = new PlatformConfig({
companyId: "COMPANY_ID",
apiKey: "API_KEY",
apiSecret: "API_SECRET",
domain: "DOMAIN",
useAutoRenewTimer: true
});

async function getData() {
try {
// TODO: get token using OAuth
platformConfig.oauthClient.setToken(token.access_token);
const client = new PlatformClient(platformConfig);
} catch (err) {
console.log(err);
}
}

getData();
```

### TypeScript

fdk-client-javascript includes Typescript definitions.

```typescript
import { ApplicationConfig, ApplicationClient } from "fdk-client-javascript";
```

### Documentation

- [Application Front](documentation/application/README.md)
- [Platform Front](documentation/platform/README.md)
4 changes: 4 additions & 0 deletions common.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { fdkAxios } from "./sdk/common/AxiosHelper";
import Utility = require("./sdk/common/Utility");
import Constant = require("./sdk/common/Constant");
export { fdkAxios as FdkAxios, Utility, Constant };
9 changes: 9 additions & 0 deletions common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const {fdkAxios} = require('./sdk/common/AxiosHelper');
const Utility = require('./sdk/common/Utility');
const Constant = require('./sdk/common/Constant');

module.exports = {
FdkAxios: fdkAxios,
Utility,
Constant,
};
Loading

0 comments on commit 6adfa4d

Please sign in to comment.