Skip to content

support for async call to repo sync using options pattern#75

Closed
3choBoomer wants to merge 1 commit into
drone:masterfrom
3choBoomer:Nathan-Cooke/Support-Async-call-to-Repo-Sync-v1
Closed

support for async call to repo sync using options pattern#75
3choBoomer wants to merge 1 commit into
drone:masterfrom
3choBoomer:Nathan-Cooke/Support-Async-call-to-Repo-Sync-v1

Conversation

@3choBoomer

@3choBoomer 3choBoomer commented Mar 17, 2026

Copy link
Copy Markdown

Summary

Adds support for triggering an asynchronous repository sync by introducing a functional options pattern on the existing RepoListSync method.

This is one of two proposed approaches to resolve #74, which has been open since 2024. See #XX for an alternative implementation that adds a dedicated RepoListSyncAsync() function instead.

Changes

  • Adds RepoListSyncOption functional option type
  • Adds WithRepoListSyncAsync() option constructor, which appends async=true to the request URL
  • Updates RepoListSync in both the Client interface and client implementation to accept opts ...RepoListSyncOption

Usage

// Existing behaviour — unchanged
repos, err := client.RepoListSync()

// New — trigger async sync
repos, err := client.RepoListSync(drone.WithRepoListSyncAsync())

Notes

  • This is backwards compatible — all existing callers of RepoListSync() continue to work without modification.
    • code that references an interface for this functionality may need minor code changes.

The functional options pattern also leaves room for future query parameters to be added without further signature changes.

Alternatives

See #76 for an alternative that adds a dedicated RepoListSyncAsync() function instead. That approach keeps the Client interface flat and makes the async behaviour self-documenting via the function name, at the cost of a new method per option.

@CLAassistant

CLAassistant commented Mar 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@3choBoomer

Copy link
Copy Markdown
Author

Closing in favor of #76

@3choBoomer 3choBoomer closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants