lib/github_api/v4/client.rb in github_api-v4-client-0.1.0 vs lib/github_api/v4/client.rb in github_api-v4-client-0.2.0
- old
+ new
@@ -27,33 +27,113 @@
def schema
graphql(query: <<~GRAPHQL)
query {
__schema {
types {
- name
kind
+ name
description
- fields {
+ fields(includeDeprecated: true) {
name
+ description
+ args {
+ name
+ description
+ type {
+ name
+ }
+ defaultValue
+ }
+ type {
+ name
+ description
+ }
+ isDeprecated
+ deprecationReason
}
+ inputFields {
+ name
+ description
+ type {
+ name
+ }
+ defaultValue
+ }
}
}
}
GRAPHQL
end
+ # @return [Hash]
+ def query_schema
+ type('Query')
+ end
+
# @param [String] name
# @return [Hash]
def type(name)
graphql(query: <<~GRAPHQL)
query {
__type(name: #{name.dump}) {
- name
kind
+ name
description
- fields {
+ fields(includeDeprecated: true) {
name
+ description
+ args {
+ name
+ description
+ type {
+ name
+ }
+ defaultValue
+ }
+ type {
+ name
+ description
+ fields(includeDeprecated: true) {
+ name
+ description
+ args {
+ name
+ description
+ type {
+ name
+ }
+ defaultValue
+ }
+ type {
+ name
+ description
+ }
+ isDeprecated
+ deprecationReason
+ }
+ }
+ isDeprecated
+ deprecationReason
}
+ inputFields {
+ name
+ description
+ type {
+ name
+ }
+ defaultValue
+ }
+ }
+ }
+ GRAPHQL
+ end
+
+ def rate_limit
+ graphql(query: <<~GRAPHQL).dig('data', 'rateLimit')
+ query {
+ rateLimit {
+ remaining
+ limit
}
}
GRAPHQL
end