gql-crystal
Version, currently 0.2.02 versions
- 0.2.0latestJul 26, 2020
- 0.1.0not indexedJul 26, 2020
github.com/dgodd/gql-crystal
No description declared in shard.yml.
0 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
gql-crystal:
github: dgodd/gql-crystal
version: ~> 0.2.0Then run:
shards installshard.yml
- Crystal
0.35.1- License
- MIT
- Author
- Dave Goddard
Dependencies
This version declares no dependencies.
README
GQL
Creates simple Graphql clients
Installation
-
Add the dependency to your
shard.yml:dependencies: gql: github: dgodd/gql-crystal -
Run
shards install
Usage
require "http/client"
require "gql"
@[GQL::Serializable::Options(query_args: {updatedSince: ISO8601DateTime, first: Int, after: String})]
class AdvertSearch
include GQL::Serializable
class PageInfo
include GQL::Serializable
property has_next_page : Bool
property end_cursor : String
end
class Advert
include GQL::Serializable
property id : String
property legacy_id : Int64
property title : String
property updated_at : String
end
class Adverts
include GQL::Serializable
@[GQL::Field(sub: true)]
property page_info : PageInfo
@[GQL::Field(type: AdvertSearch::Advert, sub: true)]
property nodes : Array(Advert)
end
class AdvertSearch
include GQL::Serializable
@[GQL::Field(graphql: "adverts(first: $first, after: $after)", sub: true)]
property adverts : Adverts
end
@[GQL::Field(graphql: "advertSearch(attributes: { updatedSince: $updatedSince })", sub: true)]
property advert_search : AdvertSearch
def page_info
advert_search.adverts.page_info
end
end
client = HTTP::Client.new("marketplacer.lvh.me", port: 3000, tls: false)
pp AdvertSearch.post(client, { updatedSince: "2020-06-24T08:45:14+10:00", first: 10 })
data = nil
loop do
after = data.page_info.end_cursor if data
data = AdvertSearch.post(client, updated_since: "2020-06-24T08:45:14+10:00", first: 10, after: after)
pp data
break unless data && data.page_info.has_next_page
end
Development
crystal spec
Contributing
- Fork it (https://github.com/your-github-user/gql-crystal/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Dave Goddard - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.2.0- Tagged
- Jul 26, 2020
- Commit
70cac9e979f2- Crystal
0.35.1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/dgodd/gql-crystal
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 2