Created
April 2, 2017 18:52
-
-
Save wcandillon/5cbd987d706f7a3031526b8f9c113dad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module namespace fb = "http://wcandillon.io/modules/firebase"; | |
import module namespace http = "http://zorba.io/modules/http-client"; | |
declare namespace an = "http://zorba.io/annotations"; | |
declare variable $admin:firebase-endpoint := "https://myapp.firebaseio.com/"; | |
declare %an:nondeterministic function fb:get($document-uri as string, $token as string) { | |
http:get( | |
$admin:firebase-endpoint || $document-uri || "?auth=" || $token | |
).body.content ! parse-json($$) | |
}; | |
declare %an:sequential function fb:delete($document-uri as string, $token as string) { | |
http:delete($admin:firebase-endpoint || $document-uri || "?auth=" || $token) | |
}; | |
declare %an:sequential function fb:put($document-uri as string, $document as object, $token as string) { | |
http:put( | |
$admin:firebase-endpoint || $document-uri || "?auth=" || $token, | |
serialize($document), | |
"application/json" | |
) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment