Documentation
CodeMaker AI
  • Quick start
    • Overview
    • Getting Started
      • Visual Studio Code
      • JetBrains
      • GitHub Action
      • CodeMaker CLI
  • Features
    • Coding Assistant
    • Interactive
      • Autocompletion
      • Inline code generation
      • Code Actions
      • Syntax Autocorrection
    • Batch
      • Code generation
      • Documentation generation
      • Predictive code generation
    • Source Context
    • Source Graph
  • Models
    • Fine-Tunning
  • Knowledge Base
    • Indexes
  • Source Code
    • Repositories
  • Integrations
    • IDE
      • Visual Studio Code
      • JetBrains
    • GitHub
      • GitHub Action
        • Continous Integration
        • Pull Requests
      • GitHub App
    • CLI
    • SDK
      • Go
      • JavaScript
Powered by GitBook
On this page
  • Installation
  • Usage
  1. Integrations
  2. SDK

JavaScript

Installation

CodeMaker AI JavaScript SDK can be added to NPM package using npm or yarn command.

npm install codemaker-sdk --save

Usage

Next in code instantiate API Client and pass the API Key:

const client = new Client(() => "<API_KEY>");

To trigger the code generation process invoke the CreateProcess API:

const task = await client.createProcess({
    process: {
        mode: Mode.code,
        language: Language.java,
        input: {
            source: source,
        },
        options: {
            // optional code generation options
        },
    }
});

This will create a new code generation task. The return response contains a unique task id, which can be used for checking the task status and retrieving the generated output. The status of the task can be checked afterward using GetProcessStatus API.

const status = await client.getProcessStatus({
    id: task.data.id,
});

Once the task will be COMPLETED the generated result can be retrieved using GetProcessOutput API.

const output = await client.getProcessOutput({
    id: task.data.id,
});
PreviousGo

Last updated 1 year ago