{"id":41082050,"url":"https://github.com/neticdk/go-bitbucket","last_synced_at":"2026-01-22T13:41:37.241Z","repository":{"id":65211374,"uuid":"585827907","full_name":"neticdk/go-bitbucket","owner":"neticdk","description":"Go library for accessing Bitbucket REST API","archived":false,"fork":false,"pushed_at":"2026-01-19T07:39:33.000Z","size":96,"stargazers_count":3,"open_issues_count":6,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-01-19T16:26:33.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/neticdk.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-06T07:22:42.000Z","updated_at":"2025-11-18T07:21:09.000Z","dependencies_parsed_at":"2025-05-05T09:54:06.183Z","dependency_job_id":"1cf7ec3d-0284-41b2-b3cb-e333ca41f5ac","html_url":"https://github.com/neticdk/go-bitbucket","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"673407f9c167adad0eeee416bcc001e0a4c03460"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/neticdk/go-bitbucket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neticdk%2Fgo-bitbucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neticdk%2Fgo-bitbucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neticdk%2Fgo-bitbucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neticdk%2Fgo-bitbucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neticdk","download_url":"https://codeload.github.com/neticdk/go-bitbucket/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neticdk%2Fgo-bitbucket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28663844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"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":[],"created_at":"2026-01-22T13:41:36.606Z","updated_at":"2026-01-22T13:41:37.228Z","avatar_url":"https://github.com/neticdk.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n# go-bitbucket\n\ngo-bitbucket is a Go client library for accessing the [Bitbucket REST API](https://developer.atlassian.com/server/bitbucket/rest).\n\n## Features\n\n*   Comprehensive coverage of the Bitbucket Server API.\n*   Easy-to-use interface for managing projects, repositories, pull requests, users, and more.\n*   Supports authentication with basic authentication.\n*   Provides a mock server for testing.\n*   Includes webhook parsing and validation.\n   \n## Installation\n\n```bash\ngo get github.com/neticdk/go-bitbucket\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/neticdk/go-bitbucket/bitbucket\"\n)\n\nfunc main() {\n\t// If using basic authentication, set the credentials - could also use standard OAuth 2 library.\n\thc := (\u0026bitbucket.BasicAuthTransport{\n\t\tUsername: \"your_username\",\n\t\tPassword: \"your_password\",\n\t}).Client()\n\n    // Create a new Bitbucket client.  Replace with your Bitbucket URL and credentials.\n\tclient, err := bitbucket.NewClient(\"https://your-bitbucket-server.com\", hc)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Create a context.\n\tctx := context.Background()\n\n    // Example: List repositories.\n\topts := \u0026bitbucket.RepositorySearchOptions{Permission: bitbucket.PermissionRepoWrite, ListOptions: bitbucket.ListOptions{Limit: 10}}\n\tall := make([]*model.Repo, 0)\n\tfor {\n\t\trepos, resp, err := client.Projects.SearchRepositories(ctx, opts)\n\t\tif err != nil {\n            log.Fatal(err)\n\t\t}\n\t\tfor _, r := range repos {\n\t\t\tall = append(all, convertRepo(r, perms, \"\"))\n\t\t}\n\t\tif resp.LastPage {\n\t\t\tbreak\n\t\t}\n\t\topts.Start = resp.NextPageStart\n\t}\n\n\tfmt.Println(\"Repositories:\")\n\tfor _, repo := range all {\n\t\tfmt.Printf(\"- %s (%s)\\n\", repo.Name, repo.Key)\n\t}\n}\n```\n\nReplace placeholders:\n\n* `https://your-bitbucket-server.com`: Your Bitbucket Server URL.\n* `your_username`: Your Bitbucket username.\n* `your_password`: Your Bitbucket password.\n\n## Mock Server\n\nThe library includes a mock server for testing your applications without needing a real Bitbucket Server instance.\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/neticdk/go-bitbucket/bitbucket\"\n\t\"github.com/neticdk/go-bitbucket/mock\"\n)\n\nfunc main() {\n\t// Create a mock server.\n\tmockServer := mock.NewMockServer(\n\t\tmock.WithRequestMatch(mock.ListProjects, bitbucket.ProjectList{\n\t\t\tProjects: []*bitbucket.Project{\n\t\t\t\t{\n\t\t\t\t\tID:   1,\n\t\t\t\t\tKey:  \"PRJ1\",\n\t\t\t\t\tName: \"Project 1\",\n\t\t\t\t},\n\t\t\t},\n\t\t}),\n\t)\n\tdefer mockServer.Close()\n\n\t// Create a client using the mock server's URL.\n\tclient, err := bitbucket.NewClient(mockServer.URL, nil)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Use the client as you would with a real Bitbucket Server.\n\tctx := context.Background()\n\tprojects, _, err := client.Projects.ListProjects(ctx, \u0026bitbucket.ListOptions{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(\"Projects (from mock server):\")\n\tfor _, project := range projects {\n\t\tfmt.Printf(\"- %s (%s)\\n\", project.Name, project.Key)\n\t}\n}\n```\n\n## Webhooks\n\nThe library provides functions for parsing and validating Bitbucket Server webhook payloads.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net/http\"\n\n\t\"github.com/neticdk/go-bitbucket/bitbucket\"\n)\n\nfunc main() {\n\thttp.HandleFunc(\"/webhook\", handleWebhook)\n\tlog.Fatal(http.ListenAndServe(\":8080\", nil))\n}\n\nfunc handleWebhook(w http.ResponseWriter, r *http.Request) {\n\t// Replace with your webhook secret.\n\tsecret := []byte(\"your_webhook_secret\")\n\n\tevent, payload, err := bitbucket.ParsePayload(r, secret)\n\tif err != nil {\n\t\tlog.Printf(\"Error parsing webhook: %v\", err)\n\t\thttp.Error(w, \"Invalid webhook\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tswitch ev := event.(type) {\n\tcase *bitbucket.RepositoryPushEvent:\n\t\tfmt.Printf(\"Repository push event for %s\\n\", ev.Repository.Slug)\n\t\t// Process the push event...\n\tcase *bitbucket.PullRequestEvent:\n\t\tfmt.Printf(\"Pull request event: %s\\n\", ev.EventKey)\n\t\t// Process the pull request event...\n\tdefault:\n\t\tfmt.Printf(\"Unhandled event type: %T\\n\", ev)\n\t\tfmt.Printf(\"Payload: %s\\n\", string(payload))\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n}\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request on GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneticdk%2Fgo-bitbucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneticdk%2Fgo-bitbucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneticdk%2Fgo-bitbucket/lists"}