{"id":20434098,"url":"https://github.com/komminarlabs/cratedb","last_synced_at":"2025-03-05T06:24:46.885Z","repository":{"id":257803513,"uuid":"855317392","full_name":"komminarlabs/cratedb","owner":"komminarlabs","description":"CrateDB Cloud API Client Go Library","archived":false,"fork":false,"pushed_at":"2024-10-07T21:30:03.000Z","size":99,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-15T19:23:11.015Z","etag":null,"topics":["api","cratedb","cratedb-client","cratedb-cloud","golang"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/komminarlabs/cratedb","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/komminarlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-10T17:10:54.000Z","updated_at":"2024-10-17T11:32:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"83af6f4a-174b-4722-a5b4-97c134076ff7","html_url":"https://github.com/komminarlabs/cratedb","commit_stats":null,"previous_names":["komminarlabs/cratedb"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komminarlabs%2Fcratedb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komminarlabs%2Fcratedb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komminarlabs%2Fcratedb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komminarlabs%2Fcratedb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/komminarlabs","download_url":"https://codeload.github.com/komminarlabs/cratedb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241976688,"owners_count":20051689,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cratedb","cratedb-client","cratedb-cloud","golang"],"created_at":"2024-11-15T08:24:01.988Z","updated_at":"2025-03-05T06:24:46.851Z","avatar_url":"https://github.com/komminarlabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CrateDB Cloud API Client Go Library\n\nThe CrateDB Cloud API client Go library to allow programmatic access to the Cloud products.\n\n## Generated types and API client\n\nThis library is generated using [oapi-codegen](https://github.com/oapi-codegen/oapi-codegen) from this [OpenAPI spec](https://console.cratedb.cloud/api/cloud-api-openapi-v1.0.0.json)\n\n### Generate\n\n```go\ngo generate ./...\n```\n\n## Usage\n\n### Environment variables\n\n```bash\nexport CRATEDB_BASE_URL=\"https://console.cratedb.cloud/\"\nexport CRATEDB_API_KEY=\"crate_09NZV-SXkpX3feMJWXxnSNY2AAa98RlKkxqvqdQBlfC\"\nexport CRATEDB_API_SECRET=\"S5ChS_eQHoUxzplSOv11xQrFRD8W_G-I5Z43w56RIqn\"\n```\n\n### Sample code to list database tokens\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"io\"\n\t\"net/http\"\n\n\t\"github.com/caarlos0/env/v11\"\n\t\"github.com/komminarlabs/cratedb\"\n)\n\ntype CratedbConfig struct {\n\tBaseURL   string `env:\"CRATEDB_BASE_URL\"`\n\tApiKey    string `env:\"CRATEDB_API_KEY\"`\n\tApiSecret string `env:\"CRATEDB_API_SECRET\"`\n}\n\nfunc main() {\n\tcfg := CratedbConfig{}\n\topts := env.Options{RequiredIfNoDef: true}\n\n\terr := env.ParseWithOptions(\u0026cfg, opts)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tctx := context.Background()\n\tclient, err := cratedb.NewClient(cfg.BaseURL, cratedb.WithRequestEditorFn(func(ctx context.Context, req *http.Request) error {\n\t\treq.SetBasicAuth(cfg.ApiKey, cfg.ApiSecret)\n\t\treturn nil\n\t}))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tresp, err := client.GetApiV2UsersMe(ctx)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == http.StatusOK {\n\t\tbodyBytes, err := io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tbodyString := string(bodyBytes)\n\t\tprintln(bodyString)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomminarlabs%2Fcratedb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkomminarlabs%2Fcratedb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomminarlabs%2Fcratedb/lists"}