スキル一覧に戻る
gaarutyunov

go-sdk

by gaarutyunov

0🍴 0📅 2025年12月23日
GitHubで見るManusで実行

SKILL.md


name: go-sdk description: Use when writing Go code to interact with Gitea API - automation, bots, integrations, migrations, or programmatic git forge operations

Gitea Go SDK

Overview

The official Go SDK for Gitea provides 332+ API methods with full type safety. Use it for bots, automation, integrations, and complex workflows. For quick CLI operations, use gitea:tea-cli instead.

Quick Setup

import "code.gitea.io/sdk/gitea"

// Create client
client, err := gitea.NewClient(
    "https://gitea.example.com",
    gitea.SetToken("your-token"),
)
go get code.gitea.io/sdk/gitea

See references/authentication.md in tea-cli for token creation.

Quick Reference

TaskMethod
Repos
List my reposclient.ListMyRepos(ListReposOptions{})
Get repoclient.GetRepo(owner, repo)
Create repoclient.CreateRepo(CreateRepoOption{})
Issues
List issuesclient.ListRepoIssues(owner, repo, ListIssueOption{})
Create issueclient.CreateIssue(owner, repo, CreateIssueOption{})
Edit issueclient.EditIssue(owner, repo, index, EditIssueOption{})
PRs
List PRsclient.ListRepoPullRequests(owner, repo, ListPullRequestsOptions{})
Create PRclient.CreatePullRequest(owner, repo, CreatePullRequestOption{})
Merge PRclient.MergePullRequest(owner, repo, index, MergePullRequestOption{})
Releases
List releasesclient.ListReleases(owner, repo, ListReleasesOptions{})
Create releaseclient.CreateRelease(owner, repo, CreateReleaseOption{})

API Categories

See references/api-reference.md for complete method list:

  • Repositories (70+ methods)
  • Issues & comments (50+ methods)
  • Pull requests & reviews (40+ methods)
  • Releases & attachments
  • Organizations & teams
  • Users, webhooks, actions

Common Types

See references/types.md for struct definitions:

  • Repository, Issue, PullRequest, Release
  • User, Organization, Team
  • ListOptions for pagination
  • Option structs for create/edit

Patterns

See references/examples.md for idiomatic patterns:

  • Error handling
  • Pagination
  • Context usage
  • Webhook handlers

Authentication Options

// Token auth (recommended)
client, _ := gitea.NewClient(url, gitea.SetToken(token))

// Basic auth
client, _ := gitea.NewClient(url, gitea.SetBasicAuth(user, pass))

// With 2FA
client, _ := gitea.NewClient(url,
    gitea.SetBasicAuth(user, pass),
    gitea.SetOTP(otp),
)

// SSH key
client, _ := gitea.NewClient(url,
    gitea.UseSSHPubkey(fingerprint, keyPath, passphrase),
)

Common Patterns

// Pagination
opts := gitea.ListOptions{Page: 1, PageSize: 50}
for {
    repos, resp, _ := client.ListMyRepos(gitea.ListReposOptions{ListOptions: opts})
    // process repos...
    if resp.NextPage == 0 {
        break
    }
    opts.Page = resp.NextPage
}

// Context support
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
client.SetContext(ctx)

Common Mistakes

ProblemSolution
Nil pointer panicAlways check error before using result
Missing paginationUse resp.NextPage to get all results
Context timeoutSet appropriate timeout for bulk operations
Rate limitingCheck resp.Header for rate limit info

スコア

総合スコア

45/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です