-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd8849a
commit df08d37
Showing
4 changed files
with
696 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
module Spree | ||
module Graphql | ||
module Types | ||
class Country < Base::RelayNode | ||
field :iso_name, String, null: false | ||
field :iso, String, null: false | ||
field :iso3, String, null: false | ||
field :name, String, null: false | ||
field :numcode, Integer, null: false | ||
field :states_required, Boolean, null: false | ||
field :created_at, GraphQL::Types::ISO8601DateTime, null: true | ||
field :updated_at, GraphQL::Types::ISO8601DateTime, null: true | ||
end | ||
end | ||
end | ||
end |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,133 @@ | ||
type Country implements Node { | ||
createdAt: ISO8601DateTime | ||
id: ID! | ||
iso: String! | ||
iso3: String! | ||
isoName: String! | ||
name: String! | ||
numcode: Int! | ||
statesRequired: Boolean! | ||
updatedAt: ISO8601DateTime | ||
} | ||
|
||
""" | ||
The connection type for Country. | ||
""" | ||
type CountryConnection { | ||
""" | ||
A list of edges. | ||
""" | ||
edges: [CountryEdge] | ||
|
||
""" | ||
A list of nodes. | ||
""" | ||
nodes: [Country] | ||
|
||
""" | ||
Information to aid in pagination. | ||
""" | ||
pageInfo: PageInfo! | ||
} | ||
|
||
""" | ||
An edge in a connection. | ||
""" | ||
type CountryEdge { | ||
""" | ||
A cursor for use in pagination. | ||
""" | ||
cursor: String! | ||
|
||
""" | ||
The item at the end of the edge. | ||
""" | ||
node: Country | ||
} | ||
|
||
""" | ||
An ISO 8601-encoded datetime | ||
""" | ||
scalar ISO8601DateTime | ||
|
||
""" | ||
An object with an ID. | ||
""" | ||
interface Node { | ||
""" | ||
ID of the object. | ||
""" | ||
id: ID! | ||
} | ||
|
||
""" | ||
Information about pagination in a connection. | ||
""" | ||
type PageInfo { | ||
""" | ||
When paginating forwards, the cursor to continue. | ||
""" | ||
endCursor: String | ||
|
||
""" | ||
When paginating forwards, are there more items? | ||
""" | ||
hasNextPage: Boolean! | ||
|
||
""" | ||
When paginating backwards, are there more items? | ||
""" | ||
hasPreviousPage: Boolean! | ||
|
||
""" | ||
When paginating backwards, the cursor to continue. | ||
""" | ||
startCursor: String | ||
} | ||
|
||
type Query { | ||
""" | ||
Supported Countries | ||
""" | ||
countries( | ||
""" | ||
Returns the elements in the list that come after the specified cursor. | ||
""" | ||
after: String | ||
|
||
""" | ||
Returns the elements in the list that come before the specified cursor. | ||
""" | ||
before: String | ||
|
||
""" | ||
Returns the first _n_ elements from the list. | ||
""" | ||
first: Int | ||
|
||
""" | ||
Returns the last _n_ elements from the list. | ||
""" | ||
last: Int | ||
): CountryConnection! | ||
|
||
""" | ||
Fetches an object given its ID. | ||
""" | ||
node( | ||
""" | ||
ID of the object. | ||
""" | ||
id: ID! | ||
): Node | ||
|
||
""" | ||
Fetches a list of objects given a list of IDs. | ||
""" | ||
nodes( | ||
""" | ||
IDs of the objects. | ||
""" | ||
ids: [ID!]! | ||
): [Node]! | ||
} |
Oops, something went wrong.