gql-crystal
Version, currently 0.1.02 versions
- 0.2.0latestJul 26, 2020
- 0.1.0not indexedJul 26, 2020
github.com/dgodd/gql-crystal
No description declared in shard.yml.
Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
gql-crystal:
github: dgodd/gql-crystal
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
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.1.0- Tagged
- Jul 26, 2020
- Commit
9a29864becf2- Indexed
- not yet
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