graphqlhub-schemas
Advanced tools
Comparing version 0.1.0-rc6 to 0.1.0-rc7
@@ -24,8 +24,16 @@ 'use strict'; | ||
// Twit throws a runtime error if you try to create a client | ||
// without API keys, so we do it lazily | ||
var Twitter = new _twit2.default({ | ||
consumer_key: TWITTER_CONSUMER_KEY, | ||
consumer_secret: TWITTER_CONSUMER_SECRET, | ||
app_only_auth: true | ||
}); | ||
var twitterClient = undefined; | ||
var getTwitterClient = function getTwitterClient() { | ||
if (!twitterClient) { | ||
twitterClient = new _twit2.default({ | ||
consumer_key: TWITTER_CONSUMER_KEY, | ||
consumer_secret: TWITTER_CONSUMER_SECRET, | ||
app_only_auth: true | ||
}); | ||
} | ||
return twitterClient; | ||
}; | ||
@@ -54,3 +62,3 @@ var getUser = exports.getUser = function getUser(identifier, identity) { | ||
Twitter.get(endpoint, parameters, function (error, result) { | ||
getTwitterClient().get(endpoint, parameters, function (error, result) { | ||
@@ -57,0 +65,0 @@ if (error) { |
{ | ||
"name": "graphqlhub-schemas", | ||
"repository": "clayallsopp/graphqlhub", | ||
"version": "0.1.0-rc6", | ||
"version": "0.1.0-rc7", | ||
"description": "GraphQL Schemas for REST APIs like Github, Hacker News, Reddit, and Twitter", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -7,10 +7,12 @@ # graphqlhub-schemas | ||
import { Reddit } from 'graphqlhub-schemas'; | ||
import { GraphQLSchema } from 'graphql'; | ||
import graphqlHTTP from 'express-graphql'; | ||
import { GraphQLSchema, graphql } from 'graphql'; | ||
let schema = new GraphQLSchema({ | ||
query: Reddit.query | ||
query: Reddit.query.type | ||
}); | ||
app.use('/graphql', graphqlHTTP({ schema })); | ||
let query = ' { user(username: "kn0thing") { username } } '; | ||
graphql(schema, query).then((result) => { | ||
console.log(result); | ||
}); | ||
``` | ||
@@ -26,7 +28,6 @@ | ||
let { query } = Schema; | ||
let { type, resolve } = query; | ||
let { type } = query; | ||
// type is a GraphQLObjectType | ||
// resolve is an empty function | ||
``` | ||
See [src/index.js](src/index.js) from available schemas. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
49263
1507
32
0