From 2dcb22fb3f1673862faea9c2a2327a70578a48ab Mon Sep 17 00:00:00 2001 From: Virgil Date: Thu, 2 Apr 2026 07:09:36 +0000 Subject: [PATCH] docs(forge): add usage examples to option types Co-Authored-By: Virgil --- admin.go | 8 ++++++++ issues.go | 12 ++++++++++++ milestones.go | 4 ++++ notifications.go | 12 ++++++++++++ orgs.go | 4 ++++ releases.go | 4 ++++ repos.go | 12 ++++++++++++ users.go | 8 ++++++++ 8 files changed, 64 insertions(+) diff --git a/admin.go b/admin.go index 9974a44..779f73e 100644 --- a/admin.go +++ b/admin.go @@ -23,6 +23,10 @@ type AdminService struct { } // AdminActionsRunListOptions controls filtering for admin Actions run listings. +// +// Usage: +// +// opts := forge.AdminActionsRunListOptions{Event: "push", Status: "success"} type AdminActionsRunListOptions struct { Event string Branch string @@ -55,6 +59,10 @@ func (o AdminActionsRunListOptions) queryParams() map[string]string { } // AdminUnadoptedListOptions controls filtering for unadopted repository listings. +// +// Usage: +// +// opts := forge.AdminUnadoptedListOptions{Pattern: "core/*"} type AdminUnadoptedListOptions struct { Pattern string } diff --git a/issues.go b/issues.go index 450b0eb..3d56461 100644 --- a/issues.go +++ b/issues.go @@ -22,12 +22,20 @@ type IssueService struct { } // AttachmentUploadOptions controls metadata sent when uploading an attachment. +// +// Usage: +// +// opts := forge.AttachmentUploadOptions{Name: "screenshot.png"} type AttachmentUploadOptions struct { Name string UpdatedAt *time.Time } // RepoCommentListOptions controls filtering for repository-wide issue comment listings. +// +// Usage: +// +// opts := forge.RepoCommentListOptions{Page: 1, Limit: 50} type RepoCommentListOptions struct { Since *time.Time Before *time.Time @@ -56,6 +64,10 @@ func newIssueService(c *Client) *IssueService { } // SearchIssuesOptions controls filtering for the global issue search endpoint. +// +// Usage: +// +// opts := forge.SearchIssuesOptions{State: "open"} type SearchIssuesOptions struct { State string Labels string diff --git a/milestones.go b/milestones.go index aa55f51..e560f6a 100644 --- a/milestones.go +++ b/milestones.go @@ -8,6 +8,10 @@ import ( ) // MilestoneListOptions controls filtering for repository milestone listings. +// +// Usage: +// +// opts := forge.MilestoneListOptions{State: "open"} type MilestoneListOptions struct { State string Name string diff --git a/notifications.go b/notifications.go index 720a727..5e84dc7 100644 --- a/notifications.go +++ b/notifications.go @@ -12,6 +12,10 @@ import ( ) // NotificationListOptions controls filtering for notification listings. +// +// Usage: +// +// opts := forge.NotificationListOptions{All: true, StatusTypes: []string{"unread"}} type NotificationListOptions struct { All bool StatusTypes []string @@ -54,6 +58,10 @@ type NotificationService struct { } // NotificationRepoMarkOptions controls how repository notifications are marked. +// +// Usage: +// +// opts := forge.NotificationRepoMarkOptions{All: true, ToStatus: "read"} type NotificationRepoMarkOptions struct { All bool StatusTypes []string @@ -62,6 +70,10 @@ type NotificationRepoMarkOptions struct { } // NotificationMarkOptions controls how authenticated-user notifications are marked. +// +// Usage: +// +// opts := forge.NotificationMarkOptions{All: true, ToStatus: "read"} type NotificationMarkOptions struct { All bool StatusTypes []string diff --git a/orgs.go b/orgs.go index d963fe4..0b655b1 100644 --- a/orgs.go +++ b/orgs.go @@ -20,6 +20,10 @@ type OrgService struct { } // OrgActivityFeedListOptions controls filtering for organisation activity feeds. +// +// Usage: +// +// opts := forge.OrgActivityFeedListOptions{Date: &day} type OrgActivityFeedListOptions struct { Date *time.Time } diff --git a/releases.go b/releases.go index 872aabb..d530305 100644 --- a/releases.go +++ b/releases.go @@ -20,6 +20,10 @@ type ReleaseService struct { } // ReleaseAttachmentUploadOptions controls metadata sent when uploading a release attachment. +// +// Usage: +// +// opts := forge.ReleaseAttachmentUploadOptions{Name: "release.zip"} type ReleaseAttachmentUploadOptions struct { Name string ExternalURL string diff --git a/repos.go b/repos.go index 5686ced..a266285 100644 --- a/repos.go +++ b/repos.go @@ -22,6 +22,10 @@ type RepoService struct { } // RepoKeyListOptions controls filtering for repository key listings. +// +// Usage: +// +// opts := forge.RepoKeyListOptions{Fingerprint: "AB:CD"} type RepoKeyListOptions struct { KeyID int64 Fingerprint string @@ -42,6 +46,10 @@ func (o RepoKeyListOptions) queryParams() map[string]string { } // ActivityFeedListOptions controls filtering for repository activity feeds. +// +// Usage: +// +// opts := forge.ActivityFeedListOptions{Date: &day} type ActivityFeedListOptions struct { Date *time.Time } @@ -56,6 +64,10 @@ func (o ActivityFeedListOptions) queryParams() map[string]string { } // RepoTimeListOptions controls filtering for repository tracked times. +// +// Usage: +// +// opts := forge.RepoTimeListOptions{User: "alice"} type RepoTimeListOptions struct { User string Since *time.Time diff --git a/users.go b/users.go index a9d3609..3f90f12 100644 --- a/users.go +++ b/users.go @@ -21,6 +21,10 @@ type UserService struct { } // UserSearchOptions controls filtering for user searches. +// +// Usage: +// +// opts := forge.UserSearchOptions{UID: 1001} type UserSearchOptions struct { UID int64 } @@ -35,6 +39,10 @@ func (o UserSearchOptions) queryParams() map[string]string { } // UserKeyListOptions controls filtering for authenticated user public key listings. +// +// Usage: +// +// opts := forge.UserKeyListOptions{Fingerprint: "AB:CD"} type UserKeyListOptions struct { Fingerprint string }