Add GraphQL riggings to Python module
This commit is contained in:
parent
4618c7ad8b
commit
a38f6136fd
|
@ -42,3 +42,4 @@ tasks:
|
|||
- deploy: |
|
||||
ssh $master doas apk upgrade -U
|
||||
ssh $master doas service $project restart
|
||||
ssh $master doas service $project-api restart
|
||||
|
|
|
@ -18,8 +18,10 @@ class PasteApp(SrhtFlask):
|
|||
|
||||
from pastesrht.blueprints.public import public
|
||||
from pastesrht.blueprints.api import register_api
|
||||
from srht.graphql import gql_blueprint
|
||||
|
||||
self.register_blueprint(public)
|
||||
self.register_blueprint(gql_blueprint)
|
||||
register_api(self)
|
||||
|
||||
self.add_template_filter(filters.render_markdown)
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
# 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 repositories:
|
||||
pastes {
|
||||
# This resource is paginated, so it has a cursor. If you pass this value
|
||||
# into repositories(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, created, visibility
|
||||
files {
|
||||
filename
|
||||
hash
|
||||
contents
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 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/oauth2
|
||||
#
|
||||
# curl \
|
||||
# -H Authorization:"Bearer <your oauth token>" \
|
||||
# -H Content-Type:application/json \
|
||||
# -d '{"query": "{ me { canonicalName } }"}' \
|
||||
# https://paste.sr.ht/query
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
../api/graph/schema.graphqls
|
Loading…
Reference in New Issue