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

Go

Installation

CodeMaker AI Golang SDK can be added to Go module using go get command:

go get github.com/codemakerai/codemaker-sdk-go

Usage

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

c := client.NewClient(&client.Config{
     ApiKey: "<API_KEY>" 
})

To trigger the code generation process invoke the CreateProcess API:

process, err := cl.CreateProcess(&client.CreateProcessRequest{
    Process: client.Process{
       Mode:     client.ModeCode,
       Language: client.LanguageGo,
       Input: client.Input{
          Source: source,
       },
       Options: &client.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.

status, err := cl.GetProcessStatus(&client.GetProcessStatusRequest{
    Id: process.Id,
})

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

output, err := cl.GetProcessOutput(&client.GetProcessOutputRequest{
    Id: process.Id,
})
PreviousSDKNextJavaScript

Last updated 1 year ago