GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

✨ GOLF(2gg) β€” run-remote πŸ’–

okay bestie, this one lives in the Development part of the GOLF(2gg) manual, and it's literally a whole vibe. sit down, grab a boba, let's go πŸ§‹


🌸 NAME 🌸

run-remote β€” (distributed-computing) πŸ¦‹


πŸŽ€ PURPOSE πŸŽ€

Call a remote service in a single statement. that's it. that's the whole flex. one line, one call, no drama πŸ’…


⭐ SYNTAX ⭐

no cap, this one is a lot, so here it is exactly as written, not a single character changed:

    run-remote <service> \
        ( local <app name> ) | ( location <location> ) \
        url-path <service URL> |
            ( \
            app-path <app path> \
            request-path <request path> \
            [ url-params <url params> ] \
            ) \
        [ request-body content <content> \
            [ content-length <content length> ] \
            [ content-type <content type> ] ] \
        [ method <request method> ] \
        [ environment <name>=<value> [ , ... ] ] \
        [ timeout <timeout> ]\
        [ status <status> ]  \
        [ started <started> ] \
        [ finished-okay <finished okay> ]\
        [ data <data> ] \
        [ error <error> ] \
        [ status <status> ] \
        [ status-text <status text> ] \
        [ exit-status <service status> ]

    `

(yes, there's a lil lonely ` hanging out at the end. she's part of the family now 🫢)


πŸ‘‘ DESCRIPTION πŸ‘‘

so run-remote is basically a combination of new-remote, call-remote and read-remote all in one gorgeous little package. it's giving "why text three people when you could just make a group chat" energy ✨

the clauses for each of those three can be specified in any order. chaotic? yes. valid? also yes πŸ’…

Only a single <service> can be used. one service, one moment, main character energy only.

if a call to <service> succeeds, its results are read. so how do you know things worked out? you've got two options, bestie:

  • use <status> (in the status clause) to check if there are results to be read: if it is GG_OKAY, then you can use the results βœ…
  • use <finished okay> (in the finished-okay clause) to check if the service call executed: if it's 1, then it has βœ…

and where do you find the details for each clause? go read the girlies:

  • new-remote β€” for the local through timeout clauses πŸŽ€
  • call-remote β€” for the status through finished-okay clauses πŸŽ€
  • read-remote β€” for the data through exit-status clauses πŸŽ€

🌈 EXAMPLES 🌈

here's the moment you've been waiting for, the demo, the reveal, the serve πŸ“

    begin-handler /serv public
        run-remote nf local "hash-server-yey" \
            url-path "/hash-server-yey/server/op=add/key=sb_XYZ/data=sdb_123" \
            finished-okay sfok \
            data rdata error edata  \
            status st exit-status rstatus
        if-true sfok  not-equal  1 or st  not-equal  GG_OKAY
            @Call did not succeed
        else-if
            @Result is <<print-out rdata> and (any) error is <<print-out edata>>
        end-if

    end-handler

see how it's all one statement? iconic. the if-true is checking both the finished-okay value (sfok not equal to 1) or the status (st not equal to GG_OKAY) β€” if either one is off, you get the sad path: @Call did not succeed 😭. otherwise, slay, you get the result printed out of rdata and any error out of edata πŸ’–


πŸ¦‹ SEE ALSO πŸ¦‹

  • Distributed computing 🌐
  • call-remote
  • new-remote
  • read-remote
  • run-remote
  • See all documentation πŸ“š

and that's the whole page, bestie, no notes πŸ’… this was $VERSION from $DATE, filed under GOLF(2gg) β€” go forth and call your remotes, you absolute legend πŸ‘‘βœ¨πŸ«Ά

πŸ“¦ where this page comes from