Go

Use the Cells HTTP API directly from Go. No published Go module exists yet.

Note
No Go client package has been published. The example below calls the REST API with the standard net/http package. For a fully typed client, generate one from the OpenAPI spec.

HTTP example

Go (net/http)
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "os"
)

func main() {
    body, _ := json.Marshal(map[string]interface{}{
        "language":        "go",
        "languageVersion": "1.23",
        "timeoutSeconds":  300,
    })
    req, _ := http.NewRequest("POST",
        "https://api.mudbase.dev/api/sandboxes/projects/"+os.Getenv("CELLS_PROJECT_ID"),
        bytes.NewBuffer(body))
    req.Header.Set("x-api-key", os.Getenv("CELLS_API_KEY"))
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
    defer resp.Body.Close()
    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)
    fmt.Println(result["sessionId"])
}
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "os"
)

func main() {
    body, _ := json.Marshal(map[string]interface{}{
        "language":        "go",
        "languageVersion": "1.23",
        "timeoutSeconds":  300,
    })
    req, _ := http.NewRequest("POST",
        "https://api.mudbase.dev/api/sandboxes/projects/"+os.Getenv("CELLS_PROJECT_ID"),
        bytes.NewBuffer(body))
    req.Header.Set("x-api-key", os.Getenv("CELLS_API_KEY"))
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        fmt.Fprintln(os.Stderr, err)
        os.Exit(1)
    }
    defer resp.Body.Close()
    var result map[string]interface{}
    json.NewDecoder(resp.Body).Decode(&result)
    fmt.Println(result["sessionId"])
}

Generate a typed client

Use openapi-generator to produce a typed Go client from the published spec:

openapi-generator
openapi-generator-cli generate \
  -i https://docs.cells.mudbase.dev/openapi.yaml \
  -g go \
  -o ./cells-client
openapi-generator-cli generate \
  -i https://docs.cells.mudbase.dev/openapi.yaml \
  -g go \
  -o ./cells-client