diff options
| author | William Boman <william@redwill.se> | 2022-08-15 21:03:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-15 21:03:06 +0200 |
| commit | 3c62386a396ae0c1cd7adbaacc379eb4af072a65 (patch) | |
| tree | 4d00d20958839a04e6a996c11b97724c762e491a /lua/mason-core/managers/github/client.lua | |
| parent | chore: update generated code (#295) (diff) | |
| download | mason-3c62386a396ae0c1cd7adbaacc379eb4af072a65.tar mason-3c62386a396ae0c1cd7adbaacc379eb4af072a65.tar.gz mason-3c62386a396ae0c1cd7adbaacc379eb4af072a65.tar.bz2 mason-3c62386a396ae0c1cd7adbaacc379eb4af072a65.tar.lz mason-3c62386a396ae0c1cd7adbaacc379eb4af072a65.tar.xz mason-3c62386a396ae0c1cd7adbaacc379eb4af072a65.tar.zst mason-3c62386a396ae0c1cd7adbaacc379eb4af072a65.zip | |
refactor: introduce selene, harden type defs, and use proper EmmyLua syntax (#296)
Diffstat (limited to 'lua/mason-core/managers/github/client.lua')
| -rw-r--r-- | lua/mason-core/managers/github/client.lua | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lua/mason-core/managers/github/client.lua b/lua/mason-core/managers/github/client.lua index 80011e22..894df658 100644 --- a/lua/mason-core/managers/github/client.lua +++ b/lua/mason-core/managers/github/client.lua @@ -10,7 +10,7 @@ local M = {} ---@alias GitHubTag {name: string} ---@param path string ----@return Result: JSON decoded response. +---@return Result # JSON decoded response. local function api_call(path) return spawn .gh({ "api", path }) @@ -22,8 +22,8 @@ local function api_call(path) end ---@async ----@param repo string: The GitHub repo ("username/repo"). ----@return Result: of GitHubRelease[] +---@param repo string The GitHub repo ("username/repo"). +---@return Result # Result<GitHubRelease[]> function M.fetch_releases(repo) log.fmt_trace("Fetching GitHub releases for repo=%s", repo) local path = ("repos/%s/releases"):format(repo) @@ -33,8 +33,8 @@ function M.fetch_releases(repo) end ---@async ----@param repo string: The GitHub repo ("username/repo"). ----@param tag_name string: The tag_name of the release to fetch. +---@param repo string The GitHub repo ("username/repo"). +---@param tag_name string The tag_name of the release to fetch. function M.fetch_release(repo, tag_name) log.fmt_trace("Fetching GitHub release for repo=%s, tag_name=%s", repo, tag_name) local path = ("repos/%s/releases/tags/%s"):format(repo, tag_name) @@ -56,12 +56,12 @@ function M.release_predicate(opts) } end ----@alias FetchLatestGithubReleaseOpts {tag_name_pattern:string|nil, include_prerelease: boolean} +---@alias FetchLatestGithubReleaseOpts {tag_name_pattern:string?, include_prerelease: boolean} ---@async ----@param repo string: The GitHub repo ("username/repo"). ----@param opts FetchLatestGithubReleaseOpts|nil ----@return Result: of GitHubRelease +---@param repo string The GitHub repo ("username/repo"). +---@param opts FetchLatestGithubReleaseOpts? +---@return Result # Result<GitHubRelease> function M.fetch_latest_release(repo, opts) opts = opts or { tag_name_pattern = nil, @@ -86,8 +86,8 @@ function M.fetch_latest_release(repo, opts) end ---@async ----@param repo string: The GitHub repo ("username/repo"). ----@return Result: of GitHubTag[] +---@param repo string The GitHub repo ("username/repo"). +---@return Result # Result<GitHubTag[]> function M.fetch_tags(repo) local path = ("repos/%s/tags"):format(repo) return api_call(path):map_err(function() @@ -96,8 +96,8 @@ function M.fetch_tags(repo) end ---@async ----@param repo string: The GitHub repo ("username/repo"). ----@return Result: Result<string> - The latest tag name. +---@param repo string The GitHub repo ("username/repo"). +---@return Result # Result<string> The latest tag name. function M.fetch_latest_tag(repo) -- https://github.com/williamboman/vercel-github-api-latest-tag-proxy return fetch(("https://latest-github-tag.redwill.se/api/repo/%s/latest-tag"):format(repo)) |
