Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "sourcehut"

Title:SourceHut GraphQL API client
Rating:Not rated. Create the first rating!
Latest version:0.1.10
SHA1 sum:2da935db586de9b2f94669097ed813e74a05ad81
Author:Eshel Yaron <eshelshay.yaron@gmail.com>
Home page:https://git.sr.ht/~eshel/sourcehut.pl

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.1.102da935db586de9b2f94669097ed813e74a05ad818https://git.sr.ht/~eshel/sourcehut.pl/refs/download/v0.1.10/sourcehut-0.1.10.zip

sourcehut.pl

![builds.sr.ht status](https://builds.sr.ht/~eshel/sourcehut.pl?)

SWI-Prolog pack implementing a SourceHut GraphQL API client.

Installation

Clone this repository and cd into the root directory:

$ git clone https://git.sr.ht/~eshel/sourcehut.pl
$ cd sourcehut.pl

Run pack_install/1 from the root of the repository:

?- pack_install(.).

Usage

Get an OAuth2 token for the GraphQL API

If you don't already have one, you can generate a new OAuth2 token here https://meta.sr.ht/oauth2

The token can be passed to predicates of this library via the token(+Token) option on a per call basis, otherwise define the multifile predicate sourcehut_token/2 to relate the token by default to a certain SourceHut instance.

Query hosted Git repositories

?- sourcehut_git_repository("eshel", "sourcehut.pl", _Repo, []), print_term(_Repo, []).
_{ 'HEAD':_{ name:"refs/heads/main",
         target:"4f482c45d418fc5b2dbef84279b7bebfc5726dd7"
       },
   created:"2022-06-04T13:40:01.424243Z",
   description:"SWI-Prolog package implementing a SourceHut GraphQL API client.",
   id:130804,
   name:"sourcehut.pl",
   updated:"2022-06-05T09:27:23.376706Z",
   visibility:"PUBLIC"
 }
true.

Upload and delete artifacts

?- sourcehut_git_upload_artifact(Repo.id, "v0.1.2", "/tmp/foo/baz.txt", Artifact, []).
Artifact = _{checksum:"...", created:"2022-06-06T08:16:08.044836Z", filename:"baz.txt", id:2644, size:7}.

?- sourcehut_git_delete_artifact(2644, []).
true.

Contributing

For questions, requests, patches, please write to ~eshel/dev@lists.sr.ht specifying the name of this repository in mail subject, e.g. `[PATCH sourcehut.pl] fix it`.

Contents of pack "sourcehut"

Pack contains 8 files holding a total of 27.3K bytes.