Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add query for authorization keys

Marcin Gębala709b2ed23ea8
diff --git a/saleor/graphql/core/types/shop.py b/saleor/graphql/core/types/shop.py
index d2620a5ce5..70c3b0618c 100644
--- a/saleor/graphql/core/types/shop.py
+++ b/saleor/graphql/core/types/shop.py
@@ -5,11 +5,17 @@ from django.conf import settings
from phonenumbers import COUNTRY_CODE_TO_REGION_CODE
from ....core.permissions import get_permissions
+from ....site import models as site_models
from ...utils import format_permissions_for_display
from .common import CountryDisplay, LanguageDisplay, PermissionDisplay
from .money import VAT
+class AuthorizationKey(graphene.ObjectType):
+ name = graphene.String(description='Name of the key.', required=True)
+ key = graphene.String(description='Value of the key.', required=True)
+
+
class Domain(graphene.ObjectType):
host = graphene.String(
description='The host name of the domain.', required=True)
@@ -23,6 +29,9 @@ class Domain(graphene.ObjectType):
class Shop(graphene.ObjectType):
+ authorization_keys = graphene.List(
+ AuthorizationKey, description='List of configured authorization keys.',
+ required=True)
countries = graphene.List(
CountryDisplay, description='List of countries available in the shop.',
required=True)
@@ -56,6 +65,9 @@ class Shop(graphene.ObjectType):
Represents a shop resource containing general shop\'s data
and configuration.'''
+ def resolve_authorization_keys(self, info):
+ return site_models.AuthorizationKey.objects.all()
+
def resolve_countries(self, info):
return [
CountryDisplay(code=country[0], country=country[1])