Did you know ... Search Documentation:
Pack canny_tudor -- prolog/gh/api.pl
PublicShow source

You need a personal access token for updates. You do not require them for public access.

- Roy Ratcliffe
 ghapi_update_gist(+GistID, +Data, -Reply, +Options) is det
Updates a Gist by its unique identifier. Data is the patch payload as a JSON object, or dictionary if you include json_object(dict) in Options. Reply is the updated Gist in JSON on success.

The example below illustrates a Gist update using a JSON term. Notice the doubly-nested json/1 terms. The first sets up the HTTP request for JSON while the inner term specifies a JSON object payload. In this example, the update adds or replaces the cov.json file with content of "{}" as serialised JSON. Update requests for Gists have a files object with a nested filename-object comprising a content string for the new contents of the file.

    json(json([ files=json([ 'cov.json'=json([ content='{}'
              ])), _, []).
See also
- https://docs.github.com/en/rest/reference/gists#update-a-gist
 ghapi_get(+PathComponents, +Data, +Options) is det
Accesses the GitHub API. Supports JSON terms and dictionaries. For example, the following goal accesses the GitHub Gist API looking for a particular Gist by its identifier and unifies A with a JSON term representing the Gist's current contents and state.
ghapi_get([gists, ec92ac84832950815861d35c2f661953], A, []).

Supports all HTTP methods despite the predicate name. The "get" mirrors the underlying http_get/3 method which also supports all methods. POST and PATCH send data using the post/1 option and override the default HTTP verb using the method/1 option. Similarly here.

Handles authentication via settings, and from the system environment indirectly. Option ghapi_access_token/1 overrides both. Order of overriding proceeds as: option, setting, environment, none. Empty atom counts as none.

Abstracts away the path using path components. Argument PathComponents is an atomic list specifying the URL path.