{"id":19359116,"url":"https://github.com/opslevel/opslevel-go","last_synced_at":"2025-10-05T17:33:11.861Z","repository":{"id":37480488,"uuid":"316045179","full_name":"OpsLevel/opslevel-go","owner":"OpsLevel","description":"A Go client for interacting with OpsLevel","archived":false,"fork":false,"pushed_at":"2025-09-29T13:19:00.000Z","size":2679,"stargazers_count":6,"open_issues_count":8,"forks_count":13,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-09-29T15:24:06.805Z","etag":null,"topics":["go","graphql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpsLevel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-25T20:20:02.000Z","updated_at":"2025-09-17T13:02:50.000Z","dependencies_parsed_at":"2023-10-04T22:32:06.671Z","dependency_job_id":"239d13b7-5acb-4f52-83a0-18ec431c0703","html_url":"https://github.com/OpsLevel/opslevel-go","commit_stats":{"total_commits":998,"total_committers":26,"mean_commits":38.38461538461539,"dds":0.7014028056112225,"last_synced_commit":"fd943cd80fda72a13580f3a01f6901936cdec791"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"purl":"pkg:github/OpsLevel/opslevel-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpsLevel%2Fopslevel-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpsLevel%2Fopslevel-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpsLevel%2Fopslevel-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpsLevel%2Fopslevel-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpsLevel","download_url":"https://codeload.github.com/OpsLevel/opslevel-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpsLevel%2Fopslevel-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278487438,"owners_count":25995182,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["go","graphql"],"created_at":"2024-11-10T07:14:09.250Z","updated_at":"2025-10-05T17:33:11.828Z","avatar_url":"https://github.com/OpsLevel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/OpsLevel/opslevel-go/blob/main/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/OpsLevel/opslevel-go.svg\" alt=\"License\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://go.dev\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/go-mod/go-version/OpsLevel/opslevel-go\" alt=\"Made With Go\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://GitHub.com/OpsLevel/opslevel-go/releases/\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/v/release/OpsLevel/opslevel-go?include_prereleases\" alt=\"Release\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://GitHub.com/OpsLevel/opslevel-go/issues/\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/issues/OpsLevel/opslevel-go.svg\" alt=\"Issues\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/OpsLevel/opslevel-go/graphs/contributors\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/contributors/OpsLevel/opslevel-go\" alt=\"Contributors\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/OpsLevel/opslevel-go/pulse\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/commit-activity/m/OpsLevel/opslevel-go\" alt=\"Activity\"/\u003e\u003c/a\u003e\n\t\u003ca href=\"https://codecov.io/gh/OpsLevel/opslevel-go\"\u003e\n        \u003cimg src=\"https://codecov.io/gh/OpsLevel/opslevel-go/branch/main/graph/badge.svg?token=GHQHRIJ9UW\" alt=\"CodeCov\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://dependabot.com/\"\u003e\n        \u003cimg src=\"https://badgen.net/badge/Dependabot/enabled/green?icon=dependabot\" alt=\"Dependabot\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://pkg.go.dev/github.com/opslevel/opslevel-go/v2025\"\u003e\n        \u003cimg src=\"https://pkg.go.dev/badge/github.com/opslevel/opslevel.svg\" alt=\"Go Reference\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cimg align=\"right\" src=\"logo.png\" width=\"320\" height=\"160\" alt=\"The OpsLevel Gopher\"\u003e\n\n[![Overall](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fapp.opslevel.com%2Fapi%2Fservice_level%2FOrfRqpiglK-WdxPAHJrUWzwYaweF_gDsmkSKWFYw9LU)](https://app.opslevel.com/services/opslevel_api_clients/maturity-report)\n\n# opslevel-go\n\nPackage `opslevel` provides an OpsLevel API client implementation.\n\n\n# Installation\n\n`opslevel` requires Go version 1.8 or later.\n\n```bash\ngo get -u github.com/opslevel/opslevel-go/v2025\n```\n\n# Usage\n\nConstruct a client, specifying the [API token](https://app.opslevel.com/api_tokens). Then, you can use it to make GraphQL queries and mutations.\n\n```go\nclient := opslevel.NewGQLClient(opslevel.SetAPIToken(\"XXX_API_TOKEN_XXX\"))\n// Use client...\n```\n\nYou can validate the client can successfully talk to the OpsLevel API.\n\n```go\nclient := opslevel.NewGQLClient(opslevel.SetAPIToken(\"XXX_API_TOKEN_XXX\"))\nif err := client.Validate(); err != nil {\n\tpanic(err)\n}\n```\n\nEvery resource (IE: service, lifecycle, tier, etc.) in OpsLevel API has a corresponding data structure in go as well as the graphql query \u0026 mutation inputs.  Additionally, there are also some helper functions that use native go types like `string` and `[]string` to make it easier to work with.  The following are a handful of examples:\n\nFind a service given an alias and print the owning team name:\n\n```go\nfoundService, foundServiceErr := client.GetService(\"MyCoolService\")\nif foundServiceErr != nil {\n\tpanic(foundServiceErr)\n}\nfmt.Println(foundService.Owner.Name)\n```\n\nCreate a new service in OpsLevel and print the ID:\n\n```go\nserviceCreateInput := opslevel.ServiceCreateInput{\n\tName:        \"MyCoolService\",\n\tDescription: opslevel.RefOf(\"The Coolest Service\"),\n\tLanguage:    opslevel.RefOf(\"go\"),\n\tOwnerAlias:  opslevel.RefOf(\"team-platform\"),\n}\nnewService, newServiceErr := client.CreateService(serviceCreateInput)\nif newServiceErr != nil {\n\tpanic(newServiceErr)\n}\nfmt.Println(newService.Id)\n```\n\nAssign the tag `{\"hello\": \"world\"}` to our newly created service and print all the tags currently on it:\n\n```go\nallTagsOnThisService, assignTagsErr := client.AssignTags(string(newService.Id), map[string]string{\"hello\": \"world\"})\nif assignTagsErr != nil {\n\tpanic(assignTagsErr)\n}\nfor _, tagOnService := range allTagsOnThisService {\n\tfmt.Printf(\"Tag '{%s : %s}'\", tagOnService.Id, tagOnService.Value)\n}\n```\n\nList all the tags for a service:\n\n```go\nmyService, foundServiceErr := client.GetService(\"MyCoolService\")\nif foundServiceErr != nil {\n\tpanic(foundServiceErr)\n}\ntags, getTagsErr := myService.GetTags(client, nil)\nif getTagsErr != nil {\n\tpanic(getTagsErr)\n}\nfor _, tag := range tags {\n\tfmt.Printf(\"Tag '{%s : %s}'\\n\", tag.Key, tag.Value)\n}\n```\n\nBuild a lookup table of teams:\n\n```go\nfunc GetTeams(client *opslevel.Client) (map[string]opslevel.Team, error) {\n\tteams := make(map[string]opslevel.Team)\n\tdata, dataErr := client.ListTeams(nil)\n\tif dataErr != nil {\n\t\treturn teams, dataErr\n\t}\n\tfor _, team := range data {\n\t\tteams[string(team.Alias)] = team\n\t}\n\treturn teams, nil\n}\n```\n\n# Advanced Usage\n\nThe client also exposes functions `Query` and `Mutate` for doing custom query or mutations.  We are running on top of this [go graphql library](https://github.com/hasura/go-graphql-client).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopslevel%2Fopslevel-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopslevel%2Fopslevel-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopslevel%2Fopslevel-go/lists"}