Skip to content

Instantly share code, notes, and snippets.

@JayGreentree
Created February 25, 2022 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JayGreentree/a6f10453d5c0e1e8c7036f436fb52c0d to your computer and use it in GitHub Desktop.
Save JayGreentree/a6f10453d5c0e1e8c7036f436fb52c0d to your computer and use it in GitHub Desktop.
{% cache key:'ne-services' duration:'1800' %}
{% assign domain = "https://9embers.online.church" %}
{% assign jsonResults = '' %}
{% webrequest url:'{{domain}}/auth/guest' method:'POST' return:'auth' %}
{%- assign dateTimeNow = 'Now' | Date:'yyyy-MM-ddTHH:mm:ss zzz' %}
{%- capture body -%}{"operationName":"ServicesConnectionQuery","variables":{"limit":1,"from":"{{dateTimeNow}}"},"query":"query ServicesConnectionQuery($from: Timestamp, $limit: Int = 0) {currentOrganization { id servicesConnection(from: $from, limit: $limit) { services { id startTime scheduleTime endTime __typename } __typename } __typename }}"}{%- endcapture -%}
{% webrequest url:'{{domain}}/graphql' method:'POST' body:'{{body}}' requestcontenttype:'application/json' headers:'Authorization^Bearer {{auth.access_token}}' %}
{% assign jsonResults = results | ToJSON %}
{% endwebrequest %}
{% endwebrequest %}
{% assign rawJSON = jsonResults | ReplaceFirst:'{', '' | ReplaceLast:'}', '' %}
{% capture updatedJSON %}
{
"domain": "{{ domain }}",
{{ rawJSON }}
}
{% endcapture %}
{{ updatedJSON }}
{% endcache %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment