From 540770f043023b558d447ab4a7231563465fd02c Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 22 Dec 2024 13:00:26 +0100 Subject: [PATCH] update ghub Signed-off-by: Andreas Gerler --- elpa/ghub-20240507.1647/ghub-pkg.el | 15 -- .../buck.el | 0 .../dir | 0 .../ghub-autoloads.el | 0 .../ghub-graphql.el | 8 +- elpa/ghub-20241208.2219/ghub-pkg.el | 13 + .../ghub.el | 224 +++--------------- .../ghub.info | 94 ++++---- .../glab.el | 0 .../gogs.el | 0 .../gsexp.el | 0 elpa/ghub-20241208.2219/gtea.el | 141 +++++++++++ 12 files changed, 239 insertions(+), 256 deletions(-) delete mode 100644 elpa/ghub-20240507.1647/ghub-pkg.el rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/buck.el (100%) rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/dir (100%) rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/ghub-autoloads.el (100%) rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/ghub-graphql.el (99%) create mode 100644 elpa/ghub-20241208.2219/ghub-pkg.el rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/ghub.el (77%) rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/ghub.info (95%) rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/glab.el (100%) rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/gogs.el (100%) rename elpa/{ghub-20240507.1647 => ghub-20241208.2219}/gsexp.el (100%) create mode 100644 elpa/ghub-20241208.2219/gtea.el diff --git a/elpa/ghub-20240507.1647/ghub-pkg.el b/elpa/ghub-20240507.1647/ghub-pkg.el deleted file mode 100644 index c792cfcf..00000000 --- a/elpa/ghub-20240507.1647/ghub-pkg.el +++ /dev/null @@ -1,15 +0,0 @@ -(define-package "ghub" "20240507.1647" "Client libraries for Git forge APIs." - '((emacs "26.3") - (compat "29.1.4.5") - (let-alist "1.0.6") - (treepy "0.1.2")) - :commit "1df5298c3c4d26ec3720dc6c31f8bfd07858f8a9" :authors - '(("Jonas Bernoulli" . "emacs.ghub@jonas.bernoulli.dev")) - :maintainer - '("Jonas Bernoulli" . "emacs.ghub@jonas.bernoulli.dev") - :keywords - '("tools") - :url "https://github.com/magit/ghub") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/ghub-20240507.1647/buck.el b/elpa/ghub-20241208.2219/buck.el similarity index 100% rename from elpa/ghub-20240507.1647/buck.el rename to elpa/ghub-20241208.2219/buck.el diff --git a/elpa/ghub-20240507.1647/dir b/elpa/ghub-20241208.2219/dir similarity index 100% rename from elpa/ghub-20240507.1647/dir rename to elpa/ghub-20241208.2219/dir diff --git a/elpa/ghub-20240507.1647/ghub-autoloads.el b/elpa/ghub-20241208.2219/ghub-autoloads.el similarity index 100% rename from elpa/ghub-20240507.1647/ghub-autoloads.el rename to elpa/ghub-20241208.2219/ghub-autoloads.el diff --git a/elpa/ghub-20240507.1647/ghub-graphql.el b/elpa/ghub-20241208.2219/ghub-graphql.el similarity index 99% rename from elpa/ghub-20240507.1647/ghub-graphql.el rename to elpa/ghub-20241208.2219/ghub-graphql.el index 088c8198..3e3cd114 100644 --- a/elpa/ghub-20240507.1647/ghub-graphql.el +++ b/elpa/ghub-20241208.2219/ghub-graphql.el @@ -39,7 +39,7 @@ (define-error 'ghub-graphql-error "GraphQL Error" 'ghub-error) -(defvar ghub-graphql-items-per-request 100 +(defvar ghub-graphql-items-per-request 50 "Number of GraphQL items to query for entities that return a collection. Adjust this value if you're hitting query timeouts against larger @@ -454,7 +454,7 @@ See Info node `(ghub)GraphQL Support'." (setq loc (treepy-next loc))))))) (defun ghub--graphql-handle-response (status req) - (let ((buffer (current-buffer))) + (let ((buf (current-buffer))) (unwind-protect (progn (set-buffer-multibyte t) @@ -468,8 +468,8 @@ See Info node `(ghub)GraphQL Support'." (ghub--graphql-handle-failure req (or err errors) headers status) (ghub--graphql-walk-response req (assq 'data payload))))) - (when (buffer-live-p buffer) - (kill-buffer buffer))))) + (when (buffer-live-p buf) + (kill-buffer buf))))) (defun ghub--graphql-handle-failure (req errors headers status) (if-let ((errorback (ghub--req-errorback req))) diff --git a/elpa/ghub-20241208.2219/ghub-pkg.el b/elpa/ghub-20241208.2219/ghub-pkg.el new file mode 100644 index 00000000..44d4c951 --- /dev/null +++ b/elpa/ghub-20241208.2219/ghub-pkg.el @@ -0,0 +1,13 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "ghub" "20241208.2219" + "Client libraries for Git forge APIs." + '((emacs "29.1") + (compat "30.0.0.0") + (let-alist "1.0.6") + (treepy "0.1.2")) + :url "https://github.com/magit/ghub" + :commit "97edaf450ef74f40e6c0bd6a35ebd3fcb710ca4d" + :revdesc "97edaf450ef7" + :keywords '("tools") + :authors '(("Jonas Bernoulli" . "emacs.ghub@jonas.bernoulli.dev")) + :maintainers '(("Jonas Bernoulli" . "emacs.ghub@jonas.bernoulli.dev"))) diff --git a/elpa/ghub-20240507.1647/ghub.el b/elpa/ghub-20241208.2219/ghub.el similarity index 77% rename from elpa/ghub-20240507.1647/ghub.el rename to elpa/ghub-20241208.2219/ghub.el index 2d89ea39..69572fd7 100644 --- a/elpa/ghub-20240507.1647/ghub.el +++ b/elpa/ghub-20241208.2219/ghub.el @@ -6,6 +6,14 @@ ;; Homepage: https://github.com/magit/ghub ;; Keywords: tools +;; Package-Version: 20241208.2219 +;; Package-Revision: 97edaf450ef7 +;; Package-Requires: ( +;; (emacs "29.1") +;; (compat "30.0.0.0") +;; (let-alist "1.0.6") +;; (treepy "0.1.2")) + ;; SPDX-License-Identifier: GPL-3.0-or-later ;; This file is free software: you can redistribute it and/or modify @@ -438,10 +446,10 @@ to the value of `ghub-response-headers', for later use when this function is called with nil for PAYLOAD." (if (eq (ghub--req-forge req) 'bitbucket) (if payload - (let* ((page (cl-mapcan (lambda (key) - (and-let* ((elt (assq key payload))) - (list elt))) - '(size page pagelen next previous))) + (let* ((page (mapcan (lambda (key) + (and-let* ((elt (assq key payload))) + (list elt))) + '(size page pagelen next previous))) (headers (cons (cons 'link-alist page) headers))) (if (and req (or (ghub--req-callback req) (ghub--req-errorback req))) @@ -481,16 +489,6 @@ Signal an error if the id cannot be determined." ;;;; Internal -(defvar ghub-use-workaround-for-emacs-bug-54989 t - "Whether to work around Emacs bug debbugs#54989. - -If t (the default), work around the bug if necessary (i.e., if not -using Emacs 29 or later). If nil, then don't work around the bug. -Setting this variable only has an effect if it is done before -`ghub' is loaded. - -Also see https://github.com/magit/ghub/wiki/Known-Issues.") - (cl-defun ghub--retrieve (payload req) (let ((url-request-extra-headers (let ((headers (ghub--req-headers req))) @@ -510,18 +508,18 @@ Also see https://github.com/magit/ghub/wiki/Known-Issues.") (error "ghub--retrieve: No buffer returned"))))) (defun ghub--handle-response (status req) - (let ((buffer (current-buffer))) + (let ((buf (current-buffer))) (unwind-protect (progn (set-buffer-multibyte t) (let* ((unpaginate (ghub--req-unpaginate req)) - (headers (ghub--handle-response-headers status req)) - (payload (ghub--handle-response-payload req)) - (payload (ghub--handle-response-error status payload req)) - (value (ghub--handle-response-value payload req)) - (prev (ghub--req-url req)) - (next (cdr (assq 'next (ghub-response-link-relations - req headers payload))))) + (headers (ghub--handle-response-headers status req)) + (payload (ghub--handle-response-payload req)) + (payload (ghub--handle-response-error status payload req)) + (value (ghub--handle-response-value payload req)) + (prev (ghub--req-url req)) + (next (cdr (assq 'next (ghub-response-link-relations + req headers payload))))) (when (numberp unpaginate) (cl-decf unpaginate)) (setf (ghub--req-url req) @@ -532,7 +530,7 @@ Also see https://github.com/magit/ghub/wiki/Known-Issues.") (or (eq unpaginate t) (> unpaginate 0)) (ghub-continue req)) - (let ((buffer (ghub--req-buffer req)) + (let ((req-buf (ghub--req-buffer req)) (callback (ghub--req-callback req)) (errorback (ghub--req-errorback req)) (err (plist-get status :error))) @@ -543,21 +541,21 @@ Also see https://github.com/magit/ghub/wiki/Known-Issues.") errorback) err headers status req)) (callback - (with-current-buffer - (if (buffer-live-p buffer) buffer (current-buffer)) + (save-current-buffer + (when (buffer-live-p req-buf) + (set-buffer req-buf)) (funcall callback value headers status req))) (t value)))))) - (when (buffer-live-p buffer) - (kill-buffer buffer))))) + (when (buffer-live-p buf) + (kill-buffer buf))))) (defun ghub--handle-response-headers (_status req) - (goto-char (point-min)) - (forward-line 1) (let (headers) (when (memq url-http-end-of-headers '(nil 0)) - (setq url-debug t) - (error "BUG: missing headers; but there's a patch for that \ -see https://github.com/magit/ghub/wiki/Known-Issues")) + (unless url-debug (setq url-debug t)) + (error "BUG: Missing headers in response buffer %s" (current-buffer))) + (goto-char (point-min)) + (forward-line 1) (while (re-search-forward "^\\([^:]*\\): \\(.+\\)" url-http-end-of-headers t) (push (cons (match-string 1) @@ -572,16 +570,14 @@ see https://github.com/magit/ghub/wiki/Known-Issues")) headers)) (defun ghub--handle-response-error (status payload req) - (let ((noerror (ghub--req-noerror req)) - (err (plist-get status :error))) - (if err - (if noerror - (if (eq noerror 'return) - payload - (setcdr (last err) (list payload)) - nil) - (ghub--signal-error err payload req)) - payload))) + (if-let ((err (plist-get status :error))) + (if-let ((noerror (ghub--req-noerror req))) + (if (eq noerror 'return) + payload + (setcdr (last err) (list payload)) + nil) + (ghub--signal-error err payload req)) + payload)) (defun ghub--signal-error (err &optional payload req) (pcase-let ((`(,symb . ,data) err)) @@ -591,7 +587,7 @@ see https://github.com/magit/ghub/wiki/Known-Issues")) (let ((code (car (cdr-safe data)))) (list code (nth 2 (assq code url-http-codes)) - (and req (url-filename (ghub--req-url req))) + (and req (url-recreate-url (ghub--req-url req))) payload))) (signal 'ghub-error data)) (signal symb data)))) @@ -850,148 +846,6 @@ or (info \"(ghub)Getting Started\") for instructions. (plist-get plist k)) keys))) -(when (< emacs-major-version 28) - ;; Fixed by Emacs commit 0b98ea5fbe276c67206896dca111c000f984ee0f. - (advice-add 'url-http-handle-authentication :around - 'url-http-handle-authentication@unauthorized-bugfix) - (defun url-http-handle-authentication@unauthorized-bugfix (fn proxy) - "If authorization failed then don't try again but fail properly. -For Emacs 27.1 prevent a useful `http' error from being replaced -by a generic one that omits all useful information. For earlier -releases prevent a new request from being made, which would -either result in an infinite loop or (e.g., in the case of `ghub') -the user being asked for their name." - (if (assoc "Authorization" url-http-extra-headers) - t ; Return "success", here also known as "successfully failed". - (funcall fn proxy)))) - -(when (and (< emacs-major-version 29) - ghub-use-workaround-for-emacs-bug-54989) - ;; Fixed in Emacs commit 0829c6836eff14dda0cf8b3047376967f7b000f4. - ;; Discussed in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54989 - ;; and https://github.com/magit/ghub/issues/81#issuecomment-1100700165. - ;; - ;; Cleanup from 26faa2b943675107e1664b2fea7174137c473475 is not - ;; included in this copy because doing that would require changes - ;; to more functions. - ;; - ;; This function has seen a few other changes since Emacs 25.1. - ;; Of these only 4f1df40db36b221e7842bd75d6281922dcb268ee makes - ;; a functional change, fixing debbug#35658. The first release to - ;; contain that commit is 27.1. That commit either fixes a related - ;; bug or it deals with the same bug but only partially fixes it. - (advice-add 'url-http-chunked-encoding-after-change-function :override - 'url-http-chunked-encoding-after-change-function@54989-backport) - (defvar url-http-chunked-last-crlf-missing nil) - (defvar url-http-content-type) - (defvar url-http-chunked-start) - (defvar url-http-chunked-length) - (defvar url-http-chunked-counter) - (defun url-http-chunked-encoding-after-change-function@54989-backport - (st nd length) - "Backport bugfix from https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54989." - (if url-http-chunked-last-crlf-missing - (progn - (goto-char url-http-chunked-last-crlf-missing) - (if (not (looking-at "\r\n")) - (url-http-debug - "Still spinning for the terminator of last chunk...") - (url-http-debug "Saw the last CRLF.") - (delete-region (match-beginning 0) (match-end 0)) - (when (url-http-parse-headers) - (url-http-activate-callback)))) - (save-excursion - (goto-char st) - (let ((read-next-chunk t) - (case-fold-search t) - (regexp nil) - (no-initial-crlf nil)) - ;; We need to loop thru looking for more chunks even within - ;; one after-change-function call. - (while read-next-chunk - (setq no-initial-crlf (= 0 url-http-chunked-counter)) - (with-no-warnings - (if url-http-content-type - (url-display-percentage nil - "Reading [%s]... chunk #%d" - url-http-content-type url-http-chunked-counter) - (url-display-percentage nil - "Reading... chunk #%d" - url-http-chunked-counter))) - (url-http-debug "Reading chunk %d (%d %d %d)" - url-http-chunked-counter st nd length) - (setq regexp (if no-initial-crlf - "\\([0-9a-z]+\\).*\r?\n" - "\r?\n\\([0-9a-z]+\\).*\r?\n")) - - (if url-http-chunked-start - ;; We know how long the chunk is supposed to be, skip over - ;; leading crap if possible. - (if (> nd (+ url-http-chunked-start url-http-chunked-length)) - (progn - (url-http-debug "Got to the end of chunk #%d!" - url-http-chunked-counter) - (goto-char (+ url-http-chunked-start - url-http-chunked-length))) - (url-http-debug "Still need %d bytes to hit end of chunk" - (- (+ url-http-chunked-start - url-http-chunked-length) - nd)) - (setq read-next-chunk nil))) - (if (not read-next-chunk) - (url-http-debug "Still spinning for next chunk...") - (if no-initial-crlf (skip-chars-forward "\r\n")) - (if (not (looking-at regexp)) - (progn - ;; Must not have received the entirety of the chunk header, - ;; need to spin some more. - (url-http-debug "Did not see start of chunk @ %d!" (point)) - (setq read-next-chunk nil)) - ;; The data we got may have started in the middle of the - ;; initial chunk header, so move back to the start of the - ;; line and re-compute. - (when (= url-http-chunked-counter 0) - (beginning-of-line) - (looking-at regexp)) - (add-text-properties (match-beginning 0) (match-end 0) - (list 'chunked-encoding t - 'face 'cursor - 'invisible t)) - (setq url-http-chunked-length - (string-to-number (buffer-substring (match-beginning 1) - (match-end 1)) - 16) - url-http-chunked-counter (1+ url-http-chunked-counter) - url-http-chunked-start (set-marker - (or url-http-chunked-start - (make-marker)) - (match-end 0))) - (delete-region (match-beginning 0) (match-end 0)) - (url-http-debug "Saw start of chunk %d (length=%d, start=%d" - url-http-chunked-counter url-http-chunked-length - (marker-position url-http-chunked-start)) - (if (= 0 url-http-chunked-length) - (progn - ;; Found the end of the document! Wheee! - (url-http-debug "Saw end of stream chunk!") - (setq read-next-chunk nil) - (with-no-warnings - (url-display-percentage nil nil)) - ;; Every chunk, even the last 0-length one, is - ;; terminated by CRLF. Skip it. - (if (not (looking-at "\r?\n")) - (progn - (url-http-debug - "Spinning for the terminator of last chunk...") - (setq-local url-http-chunked-last-crlf-missing - (point))) - (url-http-debug "Removing terminator of last chunk") - (delete-region (match-beginning 0) (match-end 0)) - (when (re-search-forward "^\r?\n" nil t) - (url-http-debug "Saw end of trailers...")) - (when (url-http-parse-headers) - (url-http-activate-callback))))))))))))) - ;;; _ (provide 'ghub) (require 'ghub-graphql) diff --git a/elpa/ghub-20240507.1647/ghub.info b/elpa/ghub-20241208.2219/ghub.info similarity index 95% rename from elpa/ghub-20240507.1647/ghub.info rename to elpa/ghub-20241208.2219/ghub.info index a57ff1bf..dc9830dc 100644 --- a/elpa/ghub-20240507.1647/ghub.info +++ b/elpa/ghub-20241208.2219/ghub.info @@ -1,4 +1,4 @@ -This is ghub.info, produced by makeinfo version 6.7 from ghub.texi. +This is ghub.info, produced by makeinfo version 6.8 from ghub.texi. Copyright (C) 2017-2024 Jonas Bernoulli @@ -27,7 +27,7 @@ Ghub User and Developer Manual Ghub is an Emacs library that is used by various packages to access the APIs of various instances of various Git forge implementations. -This manual is for Ghub version 3.6.0. +This manual is for Ghub version 4.2.0. Copyright (C) 2017-2024 Jonas Bernoulli @@ -112,22 +112,10 @@ who you are, and how you are going to prove the latter to the former. Additionally Ghub wants to know on behalf of which Emacs package it is making a request. So the question of "who is making the request" has to be rephrased as "which human (or bot) is using what (Emacs) package -to make the request". If for example, the human known as "tarsius" is +to make the request". If, for example, the human known as "tarsius" is using the ‘forge’ package, then that is represented in some places using the string "tarsius^forge". - This package used to attempt to get the answers to these questions -using a setup wizard. Unfortunately that had to be removed because (a) -it only ever supported Github, (b) by now Github has removed support for -that on their end, (c) it did not always work, and (d) when it couldn’t -be used, or failed, then it made things _more_ complicated. - - So now it is necessary for users to read some documentation and -because many things can go wrong, those instructions have to be fairly -detailed. You can of course skip over most of this, but if things go -wrong, then I would like to kindly request that you take another look -before asking me for help. - * Menu: * Basic Concepts, Arguments and Variables: Basic Concepts Arguments and Variables. @@ -141,14 +129,17 @@ File: ghub.info, Node: Basic Concepts Arguments and Variables, Next: Setting t 2.1 Basic Concepts, Arguments and Variables =========================================== -Originally Ghub supported only Github but now it also supports Gitlab, -Gitea, Gogs and Bitbucket. For the historic reason just given, the -function ‘ghub-request’ defaults to acting on a ‘github’ forge, but can -be told to act on another forge using the FORGE argument. +(If you are trying to configure Forge for and/or +, then you can skip this section.) + + Originally Ghub supported only Github but now it also supports +Gitlab, Gitea, Gogs and Bitbucket. Because of that, the function +‘ghub-request’ defaults to acting on a ‘github’ forge, but can be told +to act on other forges using the FORGE argument. - The FORGE argument only specifies what kind of forge to act on, not -which instance. The HOST argument can be used to select the instance. -For some forges a default instance is defined: + The FORGE argument only specifies what kind of forge we are +accessing, not which host specifically. The HOST argument can be used +to select the instance. For some forges a default instance is defined: • Forge ‘github’ defaults to host ‘api.github.com’. • Forge ‘gitlab’ defaults to host ‘gitlab.com/api/v4’. @@ -223,10 +214,10 @@ File: ghub.info, Node: Setting the Username, Next: Creating and Storing a Toke 2.2 Setting the Username ======================== -Ghub needs to know your username that you use on the host that you want -it to connect to. For each host a different Git variable has to be set -to specify the username on that host. More than one variable is needed -because you might use different usernames on different hosts. +Ghub needs to know your username, which you use on the host that you +want it to connect to. For each host a different Git variable has to be +set, to specify the username on that host. More than one variable is +needed, because you might use different usernames on different hosts. Setting your Github.com Username -------------------------------- @@ -316,9 +307,8 @@ File: ghub.info, Node: Creating a Token, Next: Storing a Token, Up: Creating 2.3.1 Creating a Token ---------------------- -To create a token, use the web interface of the forge/host you want to -connect to. Here is a list of pages to do this for certain popular -hosts: +To create a token, use the web interface of the host you want to connect +to. Here is a list of pages to do this for certain popular hosts: • • @@ -348,7 +338,7 @@ Auth-Source. The variable ‘auth-sources’ controls how and where Auth-Source keeps its secrets. The default value is a list of three files: ‘("~/.authinfo" "~/.authinfo.gpg" "~/.netrc")’, but to avoid confusion -you should make sure that only one of these files exists and then you +you should make sure that only one of these files exists, and then you should also adjust the value of the variable to only ever use that file, for example: @@ -1141,28 +1131,28 @@ Tag Table: Node: Top773 Node: Introduction2316 Node: Getting Started2721 -Node: Basic Concepts Arguments and Variables4403 -Node: Setting the Username8257 -Ref: Setting your Githubcom Username8741 -Ref: Setting your Gitlabcom Username9097 -Ref: Setting your Github Enterprise Username9563 -Ref: Setting your Username for Other Hosts and/or Forges10296 -Node: Creating and Storing a Token11102 -Node: Creating a Token11366 -Node: Storing a Token12386 -Node: Github Configuration Variables14231 -Node: API15942 -Node: Their APIs16180 -Node: Making REST Requests16905 -Node: Making GraphQL Requests26318 -Node: Github Convenience Wrappers33001 -Node: Non-Github Convenience Wrappers36705 -Node: Notes42209 -Node: Using Ghub in Personal Scripts42416 -Node: Using Ghub in Your Own Package43307 -Node: Forge Limitations and Notes44242 -Node: Function Index45215 -Node: Variable Index50864 +Node: Basic Concepts Arguments and Variables3748 +Node: Setting the Username7728 +Ref: Setting your Githubcom Username8216 +Ref: Setting your Gitlabcom Username8572 +Ref: Setting your Github Enterprise Username9038 +Ref: Setting your Username for Other Hosts and/or Forges9771 +Node: Creating and Storing a Token10577 +Node: Creating a Token10841 +Node: Storing a Token11855 +Node: Github Configuration Variables13701 +Node: API15412 +Node: Their APIs15650 +Node: Making REST Requests16375 +Node: Making GraphQL Requests25788 +Node: Github Convenience Wrappers32471 +Node: Non-Github Convenience Wrappers36175 +Node: Notes41679 +Node: Using Ghub in Personal Scripts41886 +Node: Using Ghub in Your Own Package42777 +Node: Forge Limitations and Notes43712 +Node: Function Index44685 +Node: Variable Index50334  End Tag Table diff --git a/elpa/ghub-20240507.1647/glab.el b/elpa/ghub-20241208.2219/glab.el similarity index 100% rename from elpa/ghub-20240507.1647/glab.el rename to elpa/ghub-20241208.2219/glab.el diff --git a/elpa/ghub-20240507.1647/gogs.el b/elpa/ghub-20241208.2219/gogs.el similarity index 100% rename from elpa/ghub-20240507.1647/gogs.el rename to elpa/ghub-20241208.2219/gogs.el diff --git a/elpa/ghub-20240507.1647/gsexp.el b/elpa/ghub-20241208.2219/gsexp.el similarity index 100% rename from elpa/ghub-20240507.1647/gsexp.el rename to elpa/ghub-20241208.2219/gsexp.el diff --git a/elpa/ghub-20241208.2219/gtea.el b/elpa/ghub-20241208.2219/gtea.el new file mode 100644 index 00000000..e7c0292f --- /dev/null +++ b/elpa/ghub-20241208.2219/gtea.el @@ -0,0 +1,141 @@ +;;; gtea.el --- Client library for the Gitea API -*- lexical-binding:t -*- + +;; Copyright (C) 2016-2024 Jonas Bernoulli + +;; Author: Jonas Bernoulli +;; Homepage: https://github.com/magit/ghub +;; Keywords: tools + +;; SPDX-License-Identifier: GPL-3.0-or-later + +;; This file is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published +;; by the Free Software Foundation, either version 3 of the License, +;; or (at your option) any later version. +;; +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this file. If not, see . + +;;; Commentary: + +;; Gtea is a library that provides basic support for using the Gitea API +;; from Emacs packages. It abstracts access to API resources using only +;; a handful of functions that are not resource-specific. + +;; This library is implemented on top of Ghub. Unlike Ghub, Gtea does +;; not support the guided creation of tokens because Gitea lacks the +;; features that would be necessary to implement that. Users have to +;; create tokens through the web interface. + +;;; Code: + +(require 'ghub) + +(defconst gtea-default-host "localhost:3000/api/v1" + "The default Gitea host.") + +;; HEAD does not appear to be supported. + +(cl-defun gtea-get (resource &optional params + &key query payload headers + silent unpaginate noerror reader + username auth host + callback errorback extra) + "Make a `GET' request for RESOURCE, with optional query PARAMS. +Like calling `ghub-request' (which see) with \"GET\" as METHOD +and `gitea' as FORGE." + (ghub-request "GET" resource params :forge 'gitea + :query query :payload payload :headers headers + :silent silent :unpaginate unpaginate + :noerror noerror :reader reader + :username username :auth auth :host host + :callback callback :errorback errorback :extra extra)) + +(cl-defun gtea-put (resource &optional params + &key query payload headers + silent unpaginate noerror reader + username auth host + callback errorback extra) + "Make a `PUT' request for RESOURCE, with optional payload PARAMS. +Like calling `ghub-request' (which see) with \"PUT\" as METHOD +and `gitea' as FORGE." + (ghub-request "PUT" resource params :forge 'gitea + :query query :payload payload :headers headers + :silent silent :unpaginate unpaginate + :noerror noerror :reader reader + :username username :auth auth :host host + :callback callback :errorback errorback :extra extra)) + +(cl-defun gtea-post (resource &optional params + &key query payload headers + silent unpaginate noerror reader + username auth host + callback errorback extra) + "Make a `POST' request for RESOURCE, with optional payload PARAMS. +Like calling `ghub-request' (which see) with \"POST\" as METHOD +and `gitea' as FORGE." + (ghub-request "POST" resource params :forge 'gitea + :query query :payload payload :headers headers + :silent silent :unpaginate unpaginate + :noerror noerror :reader reader + :username username :auth auth :host host + :callback callback :errorback errorback :extra extra)) + +(cl-defun gtea-patch (resource &optional params + &key query payload headers + silent unpaginate noerror reader + username auth host + callback errorback extra) + "Make a `PATCH' request for RESOURCE, with optional payload PARAMS. +Like calling `ghub-request' (which see) with \"PATCH\" as METHOD +and `gitea' as FORGE." + (ghub-request "PATCH" resource params :forge 'gitea + :query query :payload payload :headers headers + :silent silent :unpaginate unpaginate + :noerror noerror :reader reader + :username username :auth auth :host host + :callback callback :errorback errorback :extra extra)) + +(cl-defun gtea-delete (resource &optional params + &key query payload headers + silent unpaginate noerror reader + username auth host + callback errorback extra) + "Make a `DELETE' request for RESOURCE, with optional payload PARAMS. +Like calling `ghub-request' (which see) with \"DELETE\" as METHOD +and `gitea' as FORGE." + (ghub-request "DELETE" resource params :forge 'gitea + :query query :payload payload :headers headers + :silent silent :unpaginate unpaginate + :noerror noerror :reader reader + :username username :auth auth :host host + :callback callback :errorback errorback :extra extra)) + +(cl-defun gtea-request (method resource &optional params + &key query payload headers + silent unpaginate noerror reader + username auth host + callback errorback extra) + "Make a request for RESOURCE and return the response body. +Like calling `ghub-request' (which see) with `gitea' as FORGE." + (ghub-request method resource params :forge 'gitea + :query query :payload payload :headers headers + :silent silent :unpaginate unpaginate + :noerror noerror :reader reader + :username username :auth auth :host host + :callback callback :errorback errorback :extra extra)) + +(cl-defun gtea-repository-id (owner name &key username auth host) + "Return the id of the repository specified by OWNER, NAME and HOST." + (number-to-string + (cdr (assq 'id (gtea-get (format "/repos/%s/%s" owner name) + nil :username username :auth auth :host host))))) + +;;; _ +(provide 'gtea) +;;; gtea.el ends here -- 2.47.3