Enable GQL blueprint

This commit is contained in:
Drew DeVault 2021-07-26 12:05:39 +02:00
parent 06380a602a
commit d04c92be31
4 changed files with 47 additions and 1 deletions

View File

@ -20,12 +20,14 @@ class ListsApp(SrhtFlask):
from listssrht.blueprints.patches import patches
from listssrht.blueprints.settings import settings
from listssrht.blueprints.user import user
from srht.graphql import gql_blueprint
register_api(self)
self.register_blueprint(archives)
self.register_blueprint(patches)
self.register_blueprint(settings)
self.register_blueprint(user)
self.register_blueprint(gql_blueprint)
@self.context_processor
def inject():

View File

@ -0,0 +1,41 @@
# Welcome to the SourceHut GraphQL explorer!
# You can use this to run test requests against the GraphQL API.
# To view the GraphQL schema, expand the button on the bottom of this page.
# Here's a sample query to get you started:
query {
# Fetch info about the authenticated user (you):
me {
# Grab their canonical name:
canonicalName
# And a list of mailing lists:
lists {
# This resource is paginated, so it has a cursor. If you pass this value
# into lists(cursor:"...") in a subsequent request, you'll get the
# next page.
cursor
# These are the actual results. Grab the id, name, and updated fields
# from each repository.
results {
id, name, updated
}
}
}
# Also fetch the API version. Please note that the GraphQL API is considered
# experimental: as long as this returns 0.0.0, the API is subject to change
# without notice. Some features may not be working; notably, all write
# operations are presently unsupported.
version {
major, minor, patch
}
# On this page, you have been automatically authorized to make API requests
# with your sr.ht login cookie. If you wish to make GraphQL requests outside
# of the browser, create a personal access token at https://meta.sr.ht/oauth
#
# curl \
# -H Authorization:"Bearer <your oauth token>" \
# -H Content-Type:application/json \
# -d '{"query": "{ me { canonicalName } }"}' \
# https://lists.sr.ht/query
}

1
listssrht/schema.graphqls Symbolic link
View File

@ -0,0 +1 @@
../api/graph/schema.graphqls

View File

@ -43,7 +43,9 @@ setup(
'listssrht': [
'templates/*.html',
'static/icons/*',
'static/*'
'static/*',
'schema.graphqls',
'default_query.graphql',
]
},
scripts = [