{"id":20666196,"url":"https://github.com/hazcod/go-intigriti","last_synced_at":"2025-04-19T16:41:49.824Z","repository":{"id":39895991,"uuid":"270930352","full_name":"hazcod/go-intigriti","owner":"hazcod","description":"Go library to interact with the intigriti API.","archived":false,"fork":false,"pushed_at":"2024-05-13T04:38:29.000Z","size":310,"stargazers_count":9,"open_issues_count":7,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-06-19T00:50:13.416Z","etag":null,"topics":["go","intigriti","library"],"latest_commit_sha":null,"homepage":"https://github.com/hazcod/go-intigriti","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/hazcod.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":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-09T07:14:14.000Z","updated_at":"2023-09-28T11:16:28.000Z","dependencies_parsed_at":"2023-12-11T14:30:49.869Z","dependency_job_id":"0f3c3326-2743-4e4a-82cc-3f8121765f90","html_url":"https://github.com/hazcod/go-intigriti","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazcod%2Fgo-intigriti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazcod%2Fgo-intigriti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazcod%2Fgo-intigriti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazcod%2Fgo-intigriti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hazcod","download_url":"https://codeload.github.com/hazcod/go-intigriti/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224964369,"owners_count":17399433,"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":["go","intigriti","library"],"created_at":"2024-11-16T19:35:47.828Z","updated_at":"2025-04-19T16:41:49.812Z","avatar_url":"https://github.com/hazcod.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-intigriti\n\nGo library and commandline client for interacting with the [Intigriti](https://www.intigriti.com/) external API.\n\nCheckout the autogenerated [SDK docs on pkg.go.dev](https://pkg.go.dev/github.com/hazcod/go-intigriti).\n\n## Commandline client\n\nUsage:\n```shell\n# list out all company programs\n# also try: inti c list\n% inti company list-programs\n\n# list out all company submissions across all programs\n# also try: inti c sub\n% inti company list-submissions\n\n# verify if a specific IP address is linked to an Intigriti user\n# also try: inti c ip 1.1.1.1\n% inti company check-ip 1.1.1.1\n```\n\n### Setup\n\nEnsure the external API enabled on your company account and an integration is created with a redirect URI value of `http://localhost:1337/`.\nAfterwards create the following local configuration file:\n\n```yaml\nlog.level: info\nauth:\n    client_id: YOUR-CLIENT-ID\n    client_secret: YOUR-CLIENT-SECRET\n```\n\nFor the first call it will ask you to perform browser interaction to authenticate. \u003cbr/\u003e\nFuture calls will not need to since your token will be cached in your configuration file. \u003cbr/\u003e\n\nIf you selected 'non-expiring access tokens in the Intigriti administration panel, this code will only need interactive authentication once.\u003cbr/\u003e\nAfterwards, it will re-use the access token in your YAML configuration file.\n\n## Library \n\nAPI Swagger documentation is available on the [ReadMe](https://intigriti.readme.io/reference/introduction).\n\n### Usage\n\n```go\npackage main\n\nimport (\n\t\"flag\"\n\t\"github.com/hazcod/go-intigriti/cmd/cli/company\"\n\t\"github.com/hazcod/go-intigriti/cmd/config\"\n\tintigriti \"github.com/hazcod/go-intigriti/pkg/api\"\n\tapiConfig \"github.com/hazcod/go-intigriti/pkg/config\"\n\t\"github.com/sirupsen/logrus\"\n\t\"strings\"\n)\n\nfunc main() {\n\tlogger := logrus.New()\n\n\tconfigPath := flag.String(\"config\", \"inti.yml\", \"Path to your config file.\")\n\tlogLevelStr := flag.String(\"log\", \"\", \"Log level.\")\n\tflag.Parse()\n\n\tif *logLevelStr != \"\" {\n\t\tlogLevel, err := logrus.ParseLevel(*logLevelStr)\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).Fatal(\"could not parse log level\")\n\t\t}\n\n\t\tlogger.SetLevel(logLevel)\n\t\tlogger.WithField(\"level\", logLevel.String()).Debugf(\"log level set\")\n\t}\n\n\tcfg, err := config.Load(logger, *configPath)\n\tif err != nil {\n\t\tlogger.Fatalf(\"could not load configuration: %s\", err)\n\t}\n\n\tif err := cfg.Validate(); err != nil {\n\t\tlogger.WithError(err).Fatal(\"invalid configuration\")\n\t}\n\n\tif cfg.Log.Level != \"\" \u0026\u0026 *logLevelStr == \"\" {\n\t\tlogLevel, err := logrus.ParseLevel(cfg.Log.Level)\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).Fatal(\"could not parse log level\")\n\t\t}\n\n\t\tlogger.SetLevel(logLevel)\n\t\tlogger.WithField(\"level\", logLevel.String()).Debugf(\"log level set\")\n\t}\n\n\t//browser := ui.SystemBrowser{}\n\tapiScopes := []string{\"company_external_api\", \"core_platform:read\"}\n\n\tinti, err := intigriti.New(apiConfig.Config{\n\t\t// our Intigriti API credentials\n\t\tCredentials: struct {\n\t\t\tClientID     string\n\t\t\tClientSecret string\n\t\t}{ClientID: cfg.Auth.ClientID, ClientSecret: cfg.Auth.ClientSecret},\n\t\tAPIScopes: apiScopes,\n\n\t\t// cache tokens as much as possible to reduce times we have to authenticate\n\t\tTokenCache: \u0026apiConfig.CachedToken{\n\t\t\tRefreshToken: cfg.Cache.RefreshToken,\n\t\t\tAccessToken:  cfg.Cache.AccessToken,\n\t\t\tExpiryDate:   cfg.Cache.ExpiryDate,\n\t\t\tType:         cfg.Cache.Type,\n\t\t},\n\n\t\t// use our logger and our logging levels\n\t\tLogger: logger,\n\t})\n\tif err != nil {\n\t\tlogger.WithError(err).Fatal(\"could not initialize client\")\n\t}\n\n\ttoken, err := inti.GetToken()\n\tif err != nil {\n\t\tlogger.Fatalf(\"failed to cache token: %v\", err)\n\t}\n\n\tif err := cfg.CacheAuth(logger, *configPath, token); err != nil {\n\t\tlogger.Fatalf(\"failed to cache token: %v\", err)\n\t}\n\n\tlogger.WithField(\"authenticated\", inti.IsAuthenticated()).Debug(\"initialized client\")\n\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tprograms, err := inti.GetPrograms()\n\tif err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\tfor _, program := range programs {\n\t\tlogger.Println(program.Name)\n\t}\n}\n```\n\n### Testing\n```shell script\n# test on production using inti.yml\ngo test -tags integration -v ./...\n\n# test on staging using inti.yml\nINTI_TOKEN_URL==\"testing.api.com\" INTI_AUTH_URL==\"subs.testing.api.com\" INTI_API_URL=\"api.testing.com\" go test -tags integration -v ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazcod%2Fgo-intigriti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhazcod%2Fgo-intigriti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazcod%2Fgo-intigriti/lists"}