Install
openclaw skills install @psyb0t/go-vercelUnofficial Go client for the Vercel REST API, generated with oapi-codegen from Vercel's OpenAPI spec. Package vercel from github.com/psyb0t/go-vercel gives NewClientWithResponses a typed ...WithResponse method for every endpoint in the spec (projects, deployments, domains, DNS, env vars, teams and more), with typed params structs, JSON200 response bodies and As... methods for oneOf unions. Auth is a bearer token added by a RequestEditorFn, with an optional teamId query parameter. Use when Go code needs to call the Vercel API, or the project already imports go-vercel.
openclaw skills install @psyb0t/go-vercelTyped Go client for the Vercel REST API. Every operation in Vercel's OpenAPI spec is a method on *vercel.ClientWithResponses.
For install, auth details, union responses and error handling, see references/setup.md.
VERCEL_TOKEN. Never hardcode it, commit it or log it, and never print request headers.NewClientWithResponses. Use https://api.vercel.com.github.com/psyb0t/go-vercel.vercel CLI already covers.The examples below cover a few calls. Every operation in the spec has a generated method, and the spec's descriptions are on them as Go doc comments. Look names and fields up instead of guessing. After go get github.com/psyb0t/go-vercel, from inside your module:
go doc github.com/psyb0t/go-vercel ClientWithResponsesInterface # every endpoint method
go doc github.com/psyb0t/go-vercel GetProjectsParams # one method, params type or model
go doc -all github.com/psyb0t/go-vercel # the whole package
The same documentation is at https://pkg.go.dev/github.com/psyb0t/go-vercel. The package is very large, so prefer the targeted go doc lines over -all.
Method names come from the spec's operation IDs. <OperationId>WithResponse takes the context, then the path parameters in order, then *<OperationId>Params when the operation has query or header parameters, then the request body when it has one. The JSON200 field (or JSON201 and so on, per declared status) holds the decoded body; it is nil for any other status.
import (
"context"
"net/http"
"os"
vercel "github.com/psyb0t/go-vercel"
)
auth := vercel.WithRequestEditorFn(func(_ context.Context, req *http.Request) error {
req.Header.Set("Authorization", "Bearer "+os.Getenv("VERCEL_TOKEN"))
// Requests act on your personal account unless they name a team.
if teamID := os.Getenv("VERCEL_TEAM_ID"); teamID != "" {
query := req.URL.Query()
query.Set("teamId", teamID)
req.URL.RawQuery = query.Encode()
}
return nil
})
client, err := vercel.NewClientWithResponses("https://api.vercel.com", auth)
if err != nil {
return err
}
res, err := client.GetAuthUserWithResponse(ctx)
if err != nil {
return err // transport error
}
if res.JSON200 == nil {
return fmt.Errorf("vercel: status %d: %s", res.StatusCode(), res.Body)
}
user, err := res.JSON200.User.AsAuthUser()
if err != nil {
return err
}
fmt.Println(user.Id, user.Username, user.Email)
Listing projects with typed params:
search := "site"
res, err := client.GetProjectsWithResponse(ctx, &vercel.GetProjectsParams{
Search: &search,
})
if err != nil {
return err
}
if res.JSON200 == nil {
return fmt.Errorf("vercel: status %d: %s", res.StatusCode(), res.Body)
}
page, err := res.JSON200.AsGetProjects200JSONResponseBody1()
if err != nil {
return err
}
for _, project := range page.Projects {
fmt.Println(project.Id, project.Name)
}
Method names follow the spec's operationId: getProjects becomes GetProjectsWithResponse. Look the name up with go doc as shown above rather than guessing it.