{"id":24452603,"url":"https://github.com/hyperonecom/h1-client-go","last_synced_at":"2025-10-03T14:48:09.470Z","repository":{"id":57479863,"uuid":"165047575","full_name":"hyperonecom/h1-client-go","owner":"hyperonecom","description":null,"archived":false,"fork":false,"pushed_at":"2022-04-20T15:51:47.000Z","size":3488,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-20T23:57:25.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/hyperonecom.png","metadata":{"files":{"readme":"README.auth.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}},"created_at":"2019-01-10T11:25:21.000Z","updated_at":"2022-04-12T10:53:08.000Z","dependencies_parsed_at":"2022-09-26T17:41:31.701Z","dependency_job_id":null,"html_url":"https://github.com/hyperonecom/h1-client-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperonecom%2Fh1-client-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperonecom%2Fh1-client-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperonecom%2Fh1-client-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperonecom%2Fh1-client-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperonecom","download_url":"https://codeload.github.com/hyperonecom/h1-client-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234878719,"owners_count":18900681,"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":[],"created_at":"2025-01-21T01:16:09.058Z","updated_at":"2025-10-01T15:31:06.917Z","avatar_url":"https://github.com/hyperonecom.png","language":"Shell","readme":"# h1-client-go\n\nh1-client-go is an automatically generated library used to interact with\n[HyperOne API](https://www.hyperone.com/tools/api/).\n\n## Usage\n\nExample library usage:\n\n```go\npackage somepackage\n\nimport (\n    \"context\"\n\n    \"github.com/hyperonecom/h1-client-go\"\n)\n\nfunc main() {\n    cfg := h1.NewConfiguration() // create new Configuration struct\n    c := h1.NewAPIClient(cfg) // create new client\n\n    p, err := h1.GetPassportContextProvider(\"\", context.Background()) // get authentication helper\n    if err != nil {\n        // handle error with getting passport provider\n    }\n    projects, response, err := c.IamProjectApi.IamProjectList(p.Ctx()).Execute() // getting IamProjectList using IamProjectApi struct\n\n    if err != nil {\n        // handle error with request\n    }\n\n    for _, project := range projects {\n        // do something with projects\n    }\n}\n```\n\nTo use this library import `github.com/hyperonecom/h1-client-go` in your code.\n**Important**: the package is named `h1`, so it's not the same as last part of import path.\n\nThen you are able to create it's client.\n\n```go\ncfg := h1.NewConfiguration()\nc := h1.NewAPIClient(cfg)\n```\n\nIf you want to pass custom options into configuration object instead of using\n`NewConfiguration` function you have to create `Configuration` struct yourself.\nCode responsible for its definition can be found in [configuration.go](./configuration.go).\n\n### Auth\n\nThere is a built-in auth helper in this library. It utilizes HyperOne passport files\nusing [h1-credentials-helper-go library](https://github.com/hyperonecom/h1-credentials-helper-go).\nTo use it in code to create authorization context get passport context provider:\n\n```go\n// empty string means that passport file is located under ~/.h1\n// nil as second value is replaced with context.Background() if not given\np, err := h1.GetPassportContextProvider(\"\", context.Background())\nif err != nil {\n    log.Panic(err)\n}\n```\n\nThen use `Ctx`, or `CtxWithError` method.\n\n`Ctx` method usage:\n\n```go\nprojects, response, err := c.IamProjectApi.IamProjectList(p.Ctx()).Execute()\n// [...]\n```\n\n`CtxWithError` method usage:\n\n```go\nctx, err := p.CtxWithError()\nif err != nil {\n    log.panic(err)\n}\n\nprojects, response, err := c.IamProjectApi.IamProjectList(p.Ctx()).Execute()\n```\n\nThe difference between `Ctx` method and `CtxWithError` is that `Ctx` does not\nreturn error, neither checks it. It creates a little risk, however generating\ntoken is already tested when getting passport context provider, so you\nshould be able to catch misbehaviors on this stage. Also checking HTTP errors\nreturned as third value with each request may be helpful for debugging this\nkind of issues.\n\n**Important**: remember to call context providing function every request-\ntoken generated as result is valid only for 5 minutes.\n\n#### Invalid usage\n\n```go\nfunc main() {\n    // [...]\n    ctx := provider.Ctx()\n\n    for {\n        time.Sleep(5 * time.Minute)\n        // this will not work, since token will be invalid after 5 minutes\n        projects, _, err := client.IamProjectApi.IamProjectList(ctx).Execute()\n        // [...]\n    }\n}\n```\n\n#### Valid usage\n\n```go\n// [...]\nprojects, _, err := client.IamProjectApi.IamProjectList(provider.Ctx()).Execute()\n```\n\n### \"Prefer\" header\n\nSome operations on API may be time-consuming. In this case server\nmay return [HTTP Status 202](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202)\nwith `x-event-id` header containing request ID, and handle the operation asynchronously.\nIf you want to avoid this behavior, you can send `prefer` header [RFC7240](https://tools.ietf.org/html/rfc7240)\nwith your request, which will cause returning the operation result as response to this request.\n\nTo use this header from sdk simply use `AddDefaultHeader` method on `Configuration` object.\n\nExample:\n\n```go\ncfg := h1.NewConfiguration()\ncfg.AddDefaultHeader(\"prefer\", \"respond-async,wait=86400\")\nc := h1.NewAPIClient(cfg)\n```\n\nYou can get more information about `prefer` usage in HyperOne API\n[in its documentation](https://www.hyperone.com/tools/api/concepts/headers.html#naglowek-prefer).\n\n## Documentation\n\nFor full documentation of this library check [docs directory](docs/).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperonecom%2Fh1-client-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperonecom%2Fh1-client-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperonecom%2Fh1-client-go/lists"}