-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #308 from the-hideout/goon-reports
Add goon reports query
- Loading branch information
Showing
6 changed files
with
163 additions
and
10 deletions.
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
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,119 @@ | ||
const defaultQuery = `# Welcome to the Tarkov.dev API Playground | ||
# | ||
# Type queries into this side of the screen, click the Execute query | ||
# button at the top center, the the results will appear on the right side | ||
# of the screen. | ||
# | ||
# You can explore the available queries and data types by clicking the | ||
# book icon in the upper left to open the documentation. | ||
# | ||
# Here's an example query to get you started: | ||
# | ||
{ | ||
items(lang: en) { | ||
id | ||
name | ||
} | ||
} | ||
# | ||
# Keyboard shortcuts: | ||
# | ||
# Prettify query: Shift-Ctrl-P (or press the prettify button) | ||
# | ||
# Merge fragments: Shift-Ctrl-M (or press the merge button) | ||
# | ||
# Run Query: Ctrl-Enter (or press the play button) | ||
# | ||
# Auto Complete: Ctrl-Space (or just start typing) | ||
# | ||
`; | ||
|
||
const html = baseEndpoint => ` | ||
<!-- | ||
* Copyright (c) 2021 GraphQL Contributors | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
--> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Tarkov.dev API Playground</title> | ||
<link rel="shortcut icon" href="//cdn.jsdelivr.net/npm/graphql-playground-react/build/favicon.png" /> | ||
<style> | ||
body { | ||
height: 100%; | ||
margin: 0; | ||
width: 100%; | ||
overflow: hidden; | ||
} | ||
#graphiql { | ||
height: 100vh; | ||
} | ||
</style> | ||
<!-- | ||
This GraphiQL example depends on Promise and fetch, which are available in | ||
modern browsers, but can be "polyfilled" for older browsers. | ||
GraphiQL itself depends on React DOM. | ||
If you do not want to rely on a CDN, you can host these files locally or | ||
include them directly in your favored resource bundler. | ||
--> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/react@18/umd/react.development.js" | ||
></script> | ||
<script | ||
crossorigin | ||
src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" | ||
></script> | ||
<!-- | ||
These two files can be found in the npm module, however you may wish to | ||
copy them directly into your environment, or perhaps include them in your | ||
favored resource bundler. | ||
--> | ||
<script | ||
src="https://unpkg.com/graphiql/graphiql.min.js" | ||
type="application/javascript" | ||
></script> | ||
<link rel="stylesheet" href="https://unpkg.com/graphiql/graphiql.min.css" /> | ||
<!-- | ||
These are imports for the GraphIQL Explorer plugin. | ||
--> | ||
<script | ||
src="https://unpkg.com/@graphiql/plugin-explorer/dist/index.umd.js" | ||
crossorigin | ||
></script> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/@graphiql/plugin-explorer/dist/style.css" | ||
/> | ||
</head> | ||
<body> | ||
<div id="graphiql">Loading...</div> | ||
<script> | ||
const root = ReactDOM.createRoot(document.getElementById('graphiql')); | ||
const fetcher = GraphiQL.createFetcher({ | ||
url: '${baseEndpoint}', | ||
}); | ||
const explorerPlugin = GraphiQLPluginExplorer.explorerPlugin(); | ||
root.render( | ||
React.createElement(GraphiQL, { | ||
fetcher, | ||
defaultEditorToolsVisibility: true, | ||
plugins: [explorerPlugin], | ||
defaultQuery: \`${defaultQuery}\`, | ||
}), | ||
); | ||
</script> | ||
</body> | ||
</html> | ||
` | ||
|
||
const headers = { 'Content-Type': 'text/html' } | ||
const handler = (request, { baseEndpoint }) => new Response(html(baseEndpoint), { headers }); | ||
|
||
export default handler; |
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
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