codegyan
v0.1.3
Published
The official TypeScript library for the Codegyan API
Downloads
17
Readme
Codegyan Node API Library
This library provides convenient access to the Codegyan REST API from TypeScript or JavaScript.
To learn how to use the Codegyan API, check out our and Documentation.
Installation
You can install PHP Compiler Node via npm or yarn:
# via npm
npm install codegyan
# via yarn
yarn add codegyan
Usage
Before using the Pakage, you need to obtain an API key and client ID from Codegyan. Follow these steps to get your API credentials:
Sign Up/Login: If you don't have an account, sign up for a Codegyan account. If you already have an account, log in to your dashboard.
Get Credentials: Once logged in, navigate to the Developer Console or API settings in your account dashboard. Here, you will find your API key and client ID. Copy these credentials and use them when initializing the Pakage in your code.
Here's an example of how to initialize the npm pakage with your API key and Client ID:
import { Codegyan } from 'codegyan';
const API_KEY = "<YOUR_API_KEY>";
const CLIENT_ID = "<YOUR_CLIENT_ID>";
// Initialize the Codegyan with your API key and client ID
const client = new Codegyan(API_KEY, CLIENT_ID);
async function main() {
// Example usage of the CompilerApiClient to compile code
// Example JavaScript code to compile
const lang = 'python';
const code = 'print("Hello, World!")';
// Call the compile method of the CompilerApiClient with JavaScript as the language
client.compilerApiClient.compile(lang, code)
.then(result => {
// Log the compilation result
console.log(result.data);
})
.catch(error => {
// Handle any errors
console.error('Error:', error);
});
}
main();
Replace <YOUR_API_KEY> and <YOUR_CLIENT_ID> with your actual API key and Client ID provided by Codegyan. Pass the code you want to compile to the compile function.
Semantic versioning
This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:
- Changes that only affect static types, without breaking runtime behavior.
- Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals).
- Changes that we do not expect to impact the vast majority of users in practice.
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
We are keen for your feedback; please open an issue with questions, bugs, or suggestions.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT license. See the LICENSE file for details.