ADDED: verbose(true) option for sourcehut_graphql, -v for hutpl
Update .build.yml
Build a more minimal swipl in CI
SWI-Prolog pack
implementing a SourceHut GraphQL API client.
Run pack_install/1
in the SWI-Prolog toplevel:
?- pack_install(sourcehut).
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 either define
the multifile predicate sourcehut_token/2
to relate the token by
default to a certain SourceHut instance or set the
SOURCEHUT_PL_TOKEN
environment variable to an appropriate token.
?- 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.
?- 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.
sourcehut.pl
includes a CLI called hutpl
, which allows interacting
with the sourcehut GraphQL API from the command line. By default,
hutpl
is built in the root directory in which the SWI-Prolog
sourcehut
package is installed. To make hutpl
available everywhere, run:
$ export PATH=$PATH:$(swipl -g 'absolute_file_name(pack(sourcehut), P), writeln(P)' -t halt)
Then run hutpl
like so:
$ hutpl git repo eshel sourcehut.pl
{
"HEAD": {
"name":"refs/heads/main",
"target":"dbade1278b9cf0b76ce90fce49dbb6d32a1ba558"
},
"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-11T16:20:10.860091Z",
"visibility":"PUBLIC"
}
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
.