1.0.1 • Published 1 year ago

@yumii.saiko/jdoodle-client v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

jdoodle-client

an unofficial typesafe javascript client for the jdoodle compiler API

Usage

Please refer to JDoodle docs for more details

Create a client

import {
  initializeJDoodleApp,
  JDoodleError,
} from "@yumii.saiko/jdoodle-client";

// provided your credentials
const client = initializeJDoodleApp({
  clientId: "EXAMPLE_CLIENT_ID",
  clientSecret: "EXAMPLE_CLIENT_SECRET",
});

Check credit spent in your account

const checkReq = client.checkCreditSpent();

checkReq
  .then((credit) => {
    console.log(credit.used);
  })
  .catch((error: JDoodleError) => {
    // handle error
  });

Execute a script

Refer to Jdoodle compiler API for more info about the supported languages

import { JDoodleError } from "./types";

const execution = client.execute('IO.puts "Hello jdoodle client"', {
  language: "elixir",
  versionIndex: 4,
  /*
  stdin: "your STDIN",
  compileOnly: false 
   */
});

execution
  .then((result) => {
    // do something with result for instance>
    console.log(result.output);
  })
  .catch((error: JDoodleError) => {
    // handle error
  });

Run locally

Clone this repository

git clone https://github.com/YumeT023/JDoodle-API-client

Install the dependencies

npm install

Build

npm build
1.0.1

1 year ago

1.0.0

1 year ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago