Implement verified lightdash api client

From ubie-oss/terraform-provider-lightdash · View interactive version

Implement verified lightdash api client is an AI agent skill from the GitHub repository ubie-oss/terraform-provider-lightdash. Implement verified Lightdash API clients with documentation research and live schema verification.

How to use this skill

Skill file

Implement Verified Lightdash API Client

Description

This skill implements a new Lightdash API operation in the internal/lightdash/api directory, along with necessary models in internal/lightdash/models. It relies on the research-lightdash-api skill for researching and verifying the API schema before implementation.

Input

The user should provide:

  1. HTTP Method: (GET, POST, PUT, DELETE, PATCH)
  2. API Endpoint: (e.g., /api/v1/projects/:projectUuid/spaces)
  3. Function Name: (e.g., GetSpaceV1, CreateDashboardV1)
  4. Documentation URL: (Optional) Link to the official Lightdash API docs.

Workflow

1. Research & Verification

2. Model Analysis & Generation

3. API Client Implementation

4. Verification

Example Pattern

Ref: internal/lightdash/api/get_space_v1.go

package api

import (
 "encoding/json"
 "fmt"
 "net/http"
 "strings"

 "github.com/ubie-oss/terraform-provider-lightdash/internal/lightdash/models"
)

type GetResourceV1Response struct {
 Results models.Resource `json:"results"`
 Status  string          `json:"status"`
}

func (c *Client) GetResourceV1(id string) (*models.Resource, error) {
    if len(strings.TrimSpace(id)) == 0 {
        return nil, fmt.Errorf("id is empty")
    }

    path := fmt.Sprintf("%s/api/v1/resource/%s", c.HostUrl, id)
    req, err := http.NewRequest("GET", path, nil)
    if err != nil {
        return nil, fmt.Errorf("error creating request: %w", err)
    }

    body, err := c.doRequest(req)
    if err != nil {
        return nil, fmt.Errorf("error performing request: %w", err)
    }

    var response GetResourceV1Response
    if err := json.Unmarshal(body, &response); err != nil {
        return nil, fmt.Errorf("error unmarshaling response: %w", err)
    }

    return &response.Results, nil
}

Reference

Assets

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.