Skip to content

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

Add webhook definitions for part of the schema (#13183)

Maciej Korycinskiac5667964a83
diff --git a/saleor/graphql/account/bulk_mutations/customer_bulk_delete.py b/saleor/graphql/account/bulk_mutations/customer_bulk_delete.py
index 58d7c1bb14..4c637ba806 100644
--- a/saleor/graphql/account/bulk_mutations/customer_bulk_delete.py
+++ b/saleor/graphql/account/bulk_mutations/customer_bulk_delete.py
@@ -2,10 +2,12 @@ import graphene
from ....account import models
from ....permission.enums import AccountPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_USERS
from ...core.mutations import ModelBulkDeleteMutation
from ...core.types import AccountError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..mutations.base import CustomerDeleteMixin
from ..types import User
@@ -30,6 +32,12 @@ class CustomerBulkDelete(CustomerDeleteMixin, UserBulkDelete):
permissions = (AccountPermissions.MANAGE_USERS,)
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_DELETED,
+ description="A customer account was deleted.",
+ )
+ ]
@classmethod
def perform_mutation(cls, root, info: ResolveInfo, /, **data):
diff --git a/saleor/graphql/account/bulk_mutations/customer_bulk_update.py b/saleor/graphql/account/bulk_mutations/customer_bulk_update.py
index f883a4ee3d..7ad7a7463a 100644
--- a/saleor/graphql/account/bulk_mutations/customer_bulk_update.py
+++ b/saleor/graphql/account/bulk_mutations/customer_bulk_update.py
@@ -15,6 +15,7 @@ from ....core.tracing import traced_atomic_transaction
from ....giftcard.utils import assign_user_gift_cards
from ....order.utils import match_orders_with_new_user
from ....permission.enums import AccountPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core.descriptions import ADDED_IN_313, PREVIEW_FEATURE
from ...core.doc_category import DOC_CATEGORY_USERS
from ...core.enums import CustomerBulkUpdateErrorCode, ErrorPolicyEnum
@@ -25,7 +26,7 @@ from ...core.types import (
CustomerBulkUpdateError,
NonNullList,
)
-from ...core.utils import get_duplicated_values
+from ...core.utils import WebhookEventInfo, get_duplicated_values
from ...core.validators import validate_one_of_args_is_in_mutation
from ...payment.utils import metadata_contains_empty_key
from ...plugins.dataloaders import get_app_promise, get_plugin_manager_promise
@@ -96,6 +97,16 @@ class CustomerBulkUpdate(BaseMutation, I18nMixin):
doc_category = DOC_CATEGORY_USERS
permissions = (AccountPermissions.MANAGE_USERS,)
error_type_class = CustomerBulkUpdateError
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_UPDATED,
+ description="A customer account was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_METADATA_UPDATED,
+ description="Optionally called when customer's metadata was updated.",
+ ),
+ ]
@classmethod
def format_errors(cls, index, errors, index_error_map, field_prefix=None):
diff --git a/saleor/graphql/account/bulk_mutations/staff_bulk_delete.py b/saleor/graphql/account/bulk_mutations/staff_bulk_delete.py
index cb236c354a..94a27195ce 100644
--- a/saleor/graphql/account/bulk_mutations/staff_bulk_delete.py
+++ b/saleor/graphql/account/bulk_mutations/staff_bulk_delete.py
@@ -5,9 +5,11 @@ from django.core.exceptions import ValidationError
from ....account import models
from ....permission.enums import AccountPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_USERS
from ...core.types import StaffError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..mutations.base import StaffDeleteMixin
from ..types import User
@@ -25,6 +27,12 @@ class StaffBulkDelete(StaffDeleteMixin, UserBulkDelete):
permissions = (AccountPermissions.MANAGE_STAFF,)
error_type_class = StaffError
error_type_field = "staff_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.STAFF_DELETED,
+ description="A staff account was deleted.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/account/mutations/account/account_address_create.py b/saleor/graphql/account/mutations/account/account_address_create.py
index e5d4f90c0c..57ea86ccb1 100644
--- a/saleor/graphql/account/mutations/account/account_address_create.py
+++ b/saleor/graphql/account/mutations/account/account_address_create.py
@@ -8,10 +8,12 @@ from .....account.utils import (
)
from .....core.tracing import traced_atomic_transaction
from .....permission.auth_filters import AuthorizationFilters
+from .....webhook.event_types import WebhookEventAsyncType
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import ModelMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...enums import AddressTypeEnum
from ...i18n import I18nMixin
@@ -44,6 +46,16 @@ class AccountAddressCreate(ModelMutation, I18nMixin):
error_type_class = AccountError
error_type_field = "account_errors"
permissions = (AuthorizationFilters.AUTHENTICATED_USER,)
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_UPDATED,
+ description="A customer account was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ADDRESS_CREATED,
+ description="An address was created.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/account/mutations/account/account_address_delete.py b/saleor/graphql/account/mutations/account/account_address_delete.py
index c2657f8788..8a3b1975b6 100644
--- a/saleor/graphql/account/mutations/account/account_address_delete.py
+++ b/saleor/graphql/account/mutations/account/account_address_delete.py
@@ -1,6 +1,8 @@
from .....account import models
+from .....webhook.event_types import WebhookEventAsyncType
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ...types import Address
from ..base import BaseAddressDelete
@@ -17,3 +19,9 @@ class AccountAddressDelete(BaseAddressDelete):
object_type = Address
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ADDRESS_DELETED,
+ description="An address was deleted.",
+ )
+ ]
diff --git a/saleor/graphql/account/mutations/account/account_address_update.py b/saleor/graphql/account/mutations/account/account_address_update.py
index e0ec6e3d1a..11783bc798 100644
--- a/saleor/graphql/account/mutations/account/account_address_update.py
+++ b/saleor/graphql/account/mutations/account/account_address_update.py
@@ -1,6 +1,8 @@
from .....account import models
+from .....webhook.event_types import WebhookEventAsyncType
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ...types import Address
from ..base import BaseAddressUpdate
@@ -17,3 +19,9 @@ class AccountAddressUpdate(BaseAddressUpdate):
error_type_field = "account_errors"
model = models.Address
object_type = Address
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ADDRESS_UPDATED,
+ description="An address was updated.",
+ )
+ ]
diff --git a/saleor/graphql/account/mutations/account/account_register.py b/saleor/graphql/account/mutations/account/account_register.py
index 9cb060b240..534689222d 100644
--- a/saleor/graphql/account/mutations/account/account_register.py
+++ b/saleor/graphql/account/mutations/account/account_register.py
@@ -11,12 +11,14 @@ from .....account import models, notifications, search
from .....account.error_codes import AccountErrorCode
from .....core.tracing import traced_atomic_transaction
from .....core.utils.url import prepare_url, validate_storefront_url
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel.utils import clean_channel
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.enums import LanguageCodeEnum
from ....core.mutations import ModelMutation
from ....core.types import AccountError, NonNullList
+from ....core.utils import WebhookEventInfo
from ....meta.inputs import MetadataInput
from ....plugins.dataloaders import get_plugin_manager_promise
from ....site.dataloaders import get_site_promise
@@ -74,6 +76,16 @@ class AccountRegister(ModelMutation):
error_type_class = AccountError
error_type_field = "account_errors"
support_meta_field = True
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_CREATED,
+ description="A new customer account was created.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for account confirmation.",
+ ),
+ ]
@classmethod
def mutate(cls, root, info: ResolveInfo, **data):
diff --git a/saleor/graphql/account/mutations/account/account_request_deletion.py b/saleor/graphql/account/mutations/account/account_request_deletion.py
index e561e42dab..810320472e 100644
--- a/saleor/graphql/account/mutations/account/account_request_deletion.py
+++ b/saleor/graphql/account/mutations/account/account_request_deletion.py
@@ -8,11 +8,13 @@ from .....account.error_codes import AccountErrorCode
from .....core.tokens import account_delete_token_generator
from .....core.utils.url import prepare_url, validate_storefront_url
from .....permission.auth_filters import AuthorizationFilters
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel.utils import clean_channel
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import BaseMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
@@ -40,6 +42,12 @@ class AccountRequestDeletion(BaseMutation):
permissions = (AuthorizationFilters.AUTHENTICATED_USER,)
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for account delete request.",
+ )
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/account/mutations/account/account_set_default_address.py b/saleor/graphql/account/mutations/account/account_set_default_address.py
index 9ce5bd5e69..8d513843b0 100644
--- a/saleor/graphql/account/mutations/account/account_set_default_address.py
+++ b/saleor/graphql/account/mutations/account/account_set_default_address.py
@@ -7,10 +7,12 @@ from .....account import models, utils
from .....account.error_codes import AccountErrorCode
from .....checkout import AddressType
from .....permission.auth_filters import AuthorizationFilters
+from .....webhook.event_types import WebhookEventAsyncType
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import BaseMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...enums import AddressTypeEnum
from ...types import Address, User
@@ -31,6 +33,12 @@ class AccountSetDefaultAddress(BaseMutation):
error_type_class = AccountError
error_type_field = "account_errors"
permissions = (AuthorizationFilters.AUTHENTICATED_USER,)
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_UPDATED,
+ description="A customer's address was updated.",
+ )
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/account/mutations/account/account_update.py b/saleor/graphql/account/mutations/account/account_update.py
index 35982fb5ab..a62cdb53bb 100644
--- a/saleor/graphql/account/mutations/account/account_update.py
+++ b/saleor/graphql/account/mutations/account/account_update.py
@@ -4,10 +4,12 @@ import graphene
from .....account import models
from .....permission.auth_filters import AuthorizationFilters
+from .....webhook.event_types import WebhookEventAsyncType
from ....core import ResolveInfo
from ....core.descriptions import ADDED_IN_314
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError, NonNullList
+from ....core.utils import WebhookEventInfo
from ....meta.inputs import MetadataInput
from ...types import AddressInput, User
from ..base import BaseCustomerCreate
@@ -49,6 +51,16 @@ class AccountUpdate(BaseCustomerCreate):
error_type_class = AccountError
error_type_field = "account_errors"
support_meta_field = True
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_UPDATED,
+ description="A customer account was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_METADATA_UPDATED,
+ description="Optionally called when customer's metadata was updated.",
+ ),
+ ]
@classmethod
def perform_mutation(cls, root, info: ResolveInfo, /, **data):
diff --git a/saleor/graphql/account/mutations/account/confirm_email_change.py b/saleor/graphql/account/mutations/account/confirm_email_change.py
index 09f882880b..ebea27c818 100644
--- a/saleor/graphql/account/mutations/account/confirm_email_change.py
+++ b/saleor/graphql/account/mutations/account/confirm_email_change.py
@@ -10,11 +10,13 @@ from .....core.jwt import jwt_decode
from .....giftcard.utils import assign_user_gift_cards
from .....order.utils import match_orders_with_new_user
from .....permission.auth_filters import AuthorizationFilters
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel.utils import clean_channel
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import BaseMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import User
@@ -39,6 +41,16 @@ class ConfirmEmailChange(BaseMutation):
error_type_class = AccountError
error_type_field = "account_errors"
permissions = (AuthorizationFilters.AUTHENTICATED_USER,)
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_UPDATED,
+ description="A customer account was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification that account email change was confirmed.",
+ ),
+ ]
@classmethod
def get_token_payload(cls, token):
diff --git a/saleor/graphql/account/mutations/account/request_email_change.py b/saleor/graphql/account/mutations/account/request_email_change.py
index 9858f0b900..905a5f8095 100644
--- a/saleor/graphql/account/mutations/account/request_email_change.py
+++ b/saleor/graphql/account/mutations/account/request_email_change.py
@@ -9,11 +9,13 @@ from .....account.error_codes import AccountErrorCode
from .....core.jwt import create_token
from .....core.utils.url import validate_storefront_url
from .....permission.auth_filters import AuthorizationFilters
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel.utils import clean_channel
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import BaseMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import User
@@ -44,6 +46,12 @@ class RequestEmailChange(BaseMutation):
error_type_class = AccountError
error_type_field = "account_errors"
permissions = (AuthorizationFilters.AUTHENTICATED_USER,)
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for account email change.",
+ )
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/account/mutations/authentication/request_password_reset.py b/saleor/graphql/account/mutations/authentication/request_password_reset.py
index fa640f2760..ca33988175 100644
--- a/saleor/graphql/account/mutations/authentication/request_password_reset.py
+++ b/saleor/graphql/account/mutations/authentication/request_password_reset.py
@@ -7,11 +7,13 @@ from .....account.error_codes import AccountErrorCode
from .....account.notifications import send_password_reset_notification
from .....account.utils import retrieve_user_by_email
from .....core.utils.url import validate_storefront_url
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel.utils import clean_channel, validate_channel
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import BaseMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
@@ -40,6 +42,12 @@ class RequestPasswordReset(BaseMutation):
doc_category = DOC_CATEGORY_USERS
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for password reset.",
+ )
+ ]
@classmethod
def clean_user(cls, email, redirect_url):
diff --git a/saleor/graphql/account/mutations/permission_group/permission_group_create.py b/saleor/graphql/account/mutations/permission_group/permission_group_create.py
index 4f024ef710..00b4b6351f 100644
--- a/saleor/graphql/account/mutations/permission_group/permission_group_create.py
+++ b/saleor/graphql/account/mutations/permission_group/permission_group_create.py
@@ -11,6 +11,7 @@ from .....channel.models import Channel
from .....core.exceptions import PermissionDenied
from .....core.tracing import traced_atomic_transaction
from .....permission.enums import AccountPermissions, get_permissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.utils import get_out_of_scope_permissions, get_user_accessible_channels
from ....app.dataloaders import get_app_promise
from ....core import ResolveInfo
@@ -19,6 +20,7 @@ from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.enums import PermissionEnum
from ....core.mutations import ModelMutation
from ....core.types import BaseInputObjectType, NonNullList, PermissionGroupError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Group
@@ -78,6 +80,11 @@ class PermissionGroupCreate(ModelMutation):
permissions = (AccountPermissions.MANAGE_STAFF,)
error_type_class = PermissionGroupError
error_type_field = "permission_group_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.PERMISSION_GROUP_CREATED,
+ )
+ ]
@classmethod
def _save_m2m(cls, info: ResolveInfo, instance, cleaned_data):
diff --git a/saleor/graphql/account/mutations/permission_group/permission_group_delete.py b/saleor/graphql/account/mutations/permission_group/permission_group_delete.py
index 67c4ea2fb6..31da316726 100644
--- a/saleor/graphql/account/mutations/permission_group/permission_group_delete.py
+++ b/saleor/graphql/account/mutations/permission_group/permission_group_delete.py
@@ -5,6 +5,7 @@ from .....account import models
from .....account.error_codes import PermissionGroupErrorCode
from .....core.exceptions import PermissionDenied
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.utils import (
can_user_manage_group_channels,
can_user_manage_group_permissions,
@@ -16,6 +17,7 @@ from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.enums import PermissionEnum
from ....core.mutations import ModelDeleteMutation
from ....core.types import PermissionGroupError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Group
@@ -34,6 +36,11 @@ class PermissionGroupDelete(ModelDeleteMutation):
permissions = (AccountPermissions.MANAGE_STAFF,)
error_type_class = PermissionGroupError
error_type_field = "permission_group_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.PERMISSION_GROUP_DELETED,
+ )
+ ]
@classmethod
def post_save_action(cls, info: ResolveInfo, instance, cleaned_input):
diff --git a/saleor/graphql/account/mutations/permission_group/permission_group_update.py b/saleor/graphql/account/mutations/permission_group/permission_group_update.py
index 3c8016db50..91b4121615 100644
--- a/saleor/graphql/account/mutations/permission_group/permission_group_update.py
+++ b/saleor/graphql/account/mutations/permission_group/permission_group_update.py
@@ -10,6 +10,7 @@ from .....account.models import User
from .....channel.models import Channel
from .....core.tracing import traced_atomic_transaction
from .....permission.enums import AccountPermissions, get_permissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.utils import (
can_user_manage_group_channels,
can_user_manage_group_permissions,
@@ -22,6 +23,7 @@ from ....core.descriptions import ADDED_IN_314, PREVIEW_FEATURE
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.enums import PermissionEnum
from ....core.types import NonNullList, PermissionGroupError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ....utils.validators import check_for_duplicates
from ...dataloaders import AccessibleChannelsByGroupIdLoader
@@ -75,6 +77,11 @@ class PermissionGroupUpdate(PermissionGroupCreate):
permissions = (AccountPermissions.MANAGE_STAFF,)
error_type_class = PermissionGroupError
error_type_field = "permission_group_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.PERMISSION_GROUP_UPDATED,
+ )
+ ]
@classmethod
def _save_m2m(cls, info: ResolveInfo, instance, cleaned_data):
diff --git a/saleor/graphql/account/mutations/staff/address_create.py b/saleor/graphql/account/mutations/staff/address_create.py
index eb6c762882..7f754b4caa 100644
--- a/saleor/graphql/account/mutations/staff/address_create.py
+++ b/saleor/graphql/account/mutations/staff/address_create.py
@@ -7,11 +7,13 @@ from .....account.utils import (
)
from .....core.tracing import traced_atomic_transaction
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import Address, AddressInput, User
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import ModelMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...i18n import I18nMixin
@@ -37,6 +39,12 @@ class AddressCreate(ModelMutation, I18nMixin):
permissions = (AccountPermissions.MANAGE_USERS,)
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ADDRESS_CREATED,
+ description="A new address was created.",
+ ),
+ ]
@classmethod
def perform_mutation(cls, root, info: ResolveInfo, /, **data):
diff --git a/saleor/graphql/account/mutations/staff/address_delete.py b/saleor/graphql/account/mutations/staff/address_delete.py
index 7176f48cc0..93a985a91b 100644
--- a/saleor/graphql/account/mutations/staff/address_delete.py
+++ b/saleor/graphql/account/mutations/staff/address_delete.py
@@ -1,8 +1,10 @@
from .....account import models
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import Address
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ..base import BaseAddressDelete
@@ -15,3 +17,9 @@ class AddressDelete(BaseAddressDelete):
permissions = (AccountPermissions.MANAGE_USERS,)
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ADDRESS_DELETED,
+ description="An address was deleted.",
+ )
+ ]
diff --git a/saleor/graphql/account/mutations/staff/address_set_default.py b/saleor/graphql/account/mutations/staff/address_set_default.py
index 7d7b277c7f..61bd1dead7 100644
--- a/saleor/graphql/account/mutations/staff/address_set_default.py
+++ b/saleor/graphql/account/mutations/staff/address_set_default.py
@@ -5,12 +5,14 @@ from .....account import utils
from .....account.error_codes import AccountErrorCode
from .....checkout import AddressType
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.enums import AddressTypeEnum
from ....account.types import Address, User
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import BaseMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
@@ -30,6 +32,12 @@ class AddressSetDefault(BaseMutation):
permissions = (AccountPermissions.MANAGE_USERS,)
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_UPDATED,
+ description="A customer was updated.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/account/mutations/staff/address_update.py b/saleor/graphql/account/mutations/staff/address_update.py
index c5e228a919..dafb4fae14 100644
--- a/saleor/graphql/account/mutations/staff/address_update.py
+++ b/saleor/graphql/account/mutations/staff/address_update.py
@@ -1,8 +1,10 @@
from .....account import models
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import Address
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ..base import BaseAddressUpdate
@@ -15,3 +17,9 @@ class AddressUpdate(BaseAddressUpdate):
permissions = (AccountPermissions.MANAGE_USERS,)
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ADDRESS_UPDATED,
+ description="An address was updated.",
+ ),
+ ]
diff --git a/saleor/graphql/account/mutations/staff/customer_create.py b/saleor/graphql/account/mutations/staff/customer_create.py
index badba54ba3..4cf1d3f40c 100644
--- a/saleor/graphql/account/mutations/staff/customer_create.py
+++ b/saleor/graphql/account/mutations/staff/customer_create.py
@@ -1,8 +1,10 @@
from .....account import models
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import User
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ..base import BaseCustomerCreate
@@ -18,3 +20,17 @@ class CustomerCreate(BaseCustomerCreate):
support_private_meta_field = True
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_CREATED,
+ description="A new customer account was created.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_METADATA_UPDATED,
+ description="Optionally called when customer's metadata was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for setting the password.",
+ ),
+ ]
diff --git a/saleor/graphql/account/mutations/staff/customer_delete.py b/saleor/graphql/account/mutations/staff/customer_delete.py
index e074e844f1..e23cb86f6d 100644
--- a/saleor/graphql/account/mutations/staff/customer_delete.py
+++ b/saleor/graphql/account/mutations/staff/customer_delete.py
@@ -2,11 +2,13 @@ import graphene
from .....account import models
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import User
from ....core import ResolveInfo
from ....core.descriptions import ADDED_IN_310
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ..base import CustomerDeleteMixin
from .base import UserDelete
@@ -21,6 +23,12 @@ class CustomerDelete(CustomerDeleteMixin, UserDelete):
permissions = (AccountPermissions.MANAGE_USERS,)
error_type_class = AccountError
error_type_field = "account_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_DELETED,
+ description="A customer account was deleted.",
+ )
+ ]
class Arguments:
id = graphene.ID(required=False, description="ID of a customer to delete.")
diff --git a/saleor/graphql/account/mutations/staff/customer_update.py b/saleor/graphql/account/mutations/staff/customer_update.py
index 0e1eac4d77..ddca1b32dc 100644
--- a/saleor/graphql/account/mutations/staff/customer_update.py
+++ b/saleor/graphql/account/mutations/staff/customer_update.py
@@ -7,6 +7,7 @@ from .....account import models
from .....giftcard.utils import assign_user_gift_cards
from .....order.utils import match_orders_with_new_user
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import User
from ....app.dataloaders import get_app_promise
from ....core import ResolveInfo
@@ -14,6 +15,7 @@ from ....core.descriptions import ADDED_IN_310
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import ModelWithExtRefMutation
from ....core.types import AccountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ..base import CustomerInput
from .customer_create import CustomerCreate
@@ -41,6 +43,16 @@ class CustomerUpdate(CustomerCreate, ModelWithExtRefMutation):
error_type_field = "account_errors"
support_meta_field = True
support_private_meta_field = True
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_UPDATED,
+ description="A new customer account was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CUSTOMER_METADATA_UPDATED,
+ description="Optionally called when customer's metadata was updated.",
+ ),
+ ]
@classmethod
def generate_events(
diff --git a/saleor/graphql/account/mutations/staff/staff_create.py b/saleor/graphql/account/mutations/staff/staff_create.py
index 2b904a6630..9189e37f4e 100644
--- a/saleor/graphql/account/mutations/staff/staff_create.py
+++ b/saleor/graphql/account/mutations/staff/staff_create.py
@@ -12,12 +12,14 @@ from .....core.exceptions import PermissionDenied
from .....core.tracing import traced_atomic_transaction
from .....core.utils.url import validate_storefront_url
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import User
from ....app.dataloaders import get_app_promise
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.mutations import ModelMutation
from ....core.types import NonNullList, StaffError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...utils import get_groups_which_user_can_manage
from ..base import UserInput
@@ -64,6 +66,16 @@ class StaffCreate(ModelMutation):
error_type_field = "staff_errors"
support_meta_field = True
support_private_meta_field = True
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.STAFF_CREATED,
+ description="A new staff account was created.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for setting the password.",
+ ),
+ ]
@classmethod
def check_permissions(cls, context, permissions=None, **data):
diff --git a/saleor/graphql/account/mutations/staff/staff_delete.py b/saleor/graphql/account/mutations/staff/staff_delete.py
index ce7f565bcd..5dc751d121 100644
--- a/saleor/graphql/account/mutations/staff/staff_delete.py
+++ b/saleor/graphql/account/mutations/staff/staff_delete.py
@@ -3,10 +3,12 @@ import graphene
from .....account import models
from .....account.utils import remove_staff_member
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import User
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import StaffError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ..base import StaffDeleteMixin
from .base import UserDelete
@@ -23,6 +25,12 @@ class StaffDelete(StaffDeleteMixin, UserDelete):
permissions = (AccountPermissions.MANAGE_STAFF,)
error_type_class = StaffError
error_type_field = "staff_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.STAFF_DELETED,
+ description="A staff account was deleted.",
+ ),
+ ]
class Arguments:
id = graphene.ID(required=True, description="ID of a staff user to delete.")
diff --git a/saleor/graphql/account/mutations/staff/staff_update.py b/saleor/graphql/account/mutations/staff/staff_update.py
index d61a3c4f2e..77fa84058d 100644
--- a/saleor/graphql/account/mutations/staff/staff_update.py
+++ b/saleor/graphql/account/mutations/staff/staff_update.py
@@ -9,10 +9,12 @@ from .....core.tracing import traced_atomic_transaction
from .....giftcard.utils import assign_user_gift_cards
from .....order.utils import match_orders_with_new_user
from .....permission.enums import AccountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....account.types import User
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_USERS
from ....core.types import NonNullList, StaffError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ....utils.validators import check_for_duplicates
from ...utils import (
@@ -57,6 +59,12 @@ class StaffUpdate(StaffCreate):
error_type_field = "staff_errors"
support_meta_field = True
support_private_meta_field = True
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.STAFF_UPDATED,
+ description="A staff account was updated.",
+ ),
+ ]
@classmethod
def clean_input(cls, info: ResolveInfo, instance, data, **kwargs):
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.py
index 0c75bfb3dd..511a5ed5b3 100644
--- a/saleor/graphql/api.py
+++ b/saleor/graphql/api.py
@@ -1,6 +1,7 @@
import graphql
from django.urls import reverse
from django.utils.functional import SimpleLazyObject
+from graphql import GraphQLScalarType
from ..graphql.notifications.schema import ExternalNotificationMutations
from .account.schema import AccountMutations, AccountQueries
@@ -113,10 +114,57 @@ GraphQLDocDirective = graphql.GraphQLDirective(
)
+def serialize_webhook_event(value):
+ return value
+
+
+GraphQLWebhookEventAsyncType = GraphQLScalarType(
+ name="WebhookEventTypeAsyncEnum",
+ description="",
+ serialize=serialize_webhook_event,
+)
+
+GraphQLWebhookEventSyncType = GraphQLScalarType(
+ name="WebhookEventTypeSyncEnum",
+ description="",
+ serialize=serialize_webhook_event,
+)
+
+GraphQLWebhookEventsInfoDirective = graphql.GraphQLDirective(
+ name="webhookEventsInfo",
+ description="Webhook events triggered by a specific location.",
+ args={
+ "asyncEvents": graphql.GraphQLArgument(
+ type_=graphql.GraphQLNonNull(
+ graphql.GraphQLList(
+ graphql.GraphQLNonNull(GraphQLWebhookEventAsyncType)
+ )
+ ),
+ description=(
+ "List of asynchronous webhook events triggered by a specific location."
+ ),
+ ),
+ "syncEvents": graphql.GraphQLArgument(
+ type_=graphql.GraphQLNonNull(
+ graphql.GraphQLList(graphql.GraphQLNonNull(GraphQLWebhookEventSyncType))
+ ),
+ description=(
+ "List of synchronous webhook events triggered by a specific location."
+ ),
+ ),
+ },
+ locations=[
+ graphql.DirectiveLocation.FIELD,
+ graphql.DirectiveLocation.FIELD_DEFINITION,
+ graphql.DirectiveLocation.INPUT_OBJECT,
+ graphql.DirectiveLocation.OBJECT,
+ ],
+)
schema = build_federated_schema(
Query,
mutation=Mutation,
types=unit_enums + list(WEBHOOK_TYPES_MAP.values()),
subscription=Subscription,
- directives=graphql.specified_directives + [GraphQLDocDirective],
+ directives=graphql.specified_directives
+ + [GraphQLDocDirective, GraphQLWebhookEventsInfoDirective],
)
diff --git a/saleor/graphql/app/mutations/app_activate.py b/saleor/graphql/app/mutations/app_activate.py
index abdd03bd9a..d4bbbabe47 100644
--- a/saleor/graphql/app/mutations/app_activate.py
+++ b/saleor/graphql/app/mutations/app_activate.py
@@ -2,8 +2,10 @@ import graphene
from ....app import models
from ....permission.enums import AppPermission
+from ....webhook.event_types import WebhookEventAsyncType
from ...core.mutations import ModelMutation
from ...core.types import AppError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import App
@@ -19,6 +21,12 @@ class AppActivate(ModelMutation):
permissions = (AppPermission.MANAGE_APPS,)
error_type_class = AppError
error_type_field = "app_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.APP_STATUS_CHANGED,
+ description="An app was activated.",
+ ),
+ ]
@classmethod
def perform_mutation(cls, _root, info, /, *, id):
diff --git a/saleor/graphql/app/mutations/app_create.py b/saleor/graphql/app/mutations/app_create.py
index 28b5740f46..e2bcefe68e 100644
--- a/saleor/graphql/app/mutations/app_create.py
+++ b/saleor/graphql/app/mutations/app_create.py
@@ -2,10 +2,12 @@ import graphene
from ....app import models
from ....permission.enums import AppPermission, get_permissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core.doc_category import DOC_CATEGORY_APPS
from ...core.enums import PermissionEnum
from ...core.mutations import ModelMutation
from ...core.types import AppError, BaseInputObjectType, NonNullList
+from ...core.utils import WebhookEventInfo
from ...decorators import staff_member_required
from ...plugins.dataloaders import get_plugin_manager_promise
from ...utils import get_user_or_app_from_context
@@ -46,6 +48,12 @@ class AppCreate(ModelMutation):
permissions = (AppPermission.MANAGE_APPS,)
error_type_class = AppError
error_type_field = "app_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.APP_INSTALLED,
+ description="An app was installed.",
+ ),
+ ]
@classmethod
def clean_input(cls, info, instance, data, **kwargs):
diff --git a/saleor/graphql/app/mutations/app_deactivate.py b/saleor/graphql/app/mutations/app_deactivate.py
index 339c99408e..097e8e1740 100644
--- a/saleor/graphql/app/mutations/app_deactivate.py
+++ b/saleor/graphql/app/mutations/app_deactivate.py
@@ -2,8 +2,10 @@ import graphene
from ....app import models
from ....permission.enums import AppPermission
+from ....webhook.event_types import WebhookEventAsyncType
from ...core.mutations import ModelMutation
from ...core.types import AppError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import App
@@ -19,6 +21,12 @@ class AppDeactivate(ModelMutation):
permissions = (AppPermission.MANAGE_APPS,)
error_type_class = AppError
error_type_field = "app_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.APP_STATUS_CHANGED,
+ description="An app was deactivated.",
+ ),
+ ]
@classmethod
def perform_mutation(cls, _root, info, /, *, id):
diff --git a/saleor/graphql/app/mutations/app_delete.py b/saleor/graphql/app/mutations/app_delete.py
index 9403fe012f..5c7f4179c4 100644
--- a/saleor/graphql/app/mutations/app_delete.py
+++ b/saleor/graphql/app/mutations/app_delete.py
@@ -4,10 +4,12 @@ from django.core.exceptions import ValidationError
from ....app import models
from ....app.error_codes import AppErrorCode
from ....permission.enums import AppPermission
+from ....webhook.event_types import WebhookEventAsyncType
from ...account.utils import can_manage_app
from ...core import ResolveInfo
from ...core.mutations import ModelDeleteMutation
from ...core.types import AppError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ...utils import get_user_or_app_from_context, requestor_is_superuser
from ..types import App
@@ -24,6 +26,12 @@ class AppDelete(ModelDeleteMutation):
permissions = (AppPermission.MANAGE_APPS,)
error_type_class = AppError
error_type_field = "app_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.APP_DELETED,
+ description="An app was deleted.",
+ ),
+ ]
@classmethod
def clean_instance(cls, info: ResolveInfo, instance):
diff --git a/saleor/graphql/app/mutations/app_install.py b/saleor/graphql/app/mutations/app_install.py
index b5c5b8e812..73420fd169 100644
--- a/saleor/graphql/app/mutations/app_install.py
+++ b/saleor/graphql/app/mutations/app_install.py
@@ -4,10 +4,12 @@ from ....app import models
from ....app.manifest_validations import clean_manifest_url
from ....app.tasks import install_app_task
from ....permission.enums import AppPermission, get_permissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core.doc_category import DOC_CATEGORY_APPS
from ...core.enums import PermissionEnum
from ...core.mutations import ModelMutation
from ...core.types import AppError, BaseInputObjectType, NonNullList
+from ...core.utils import WebhookEventInfo
from ...decorators import staff_member_required
from ...utils import get_user_or_app_from_context
from ..types import AppInstallation
@@ -29,6 +31,12 @@ class AppInstallInput(BaseInputObjectType):
class Meta:
doc_category = DOC_CATEGORY_APPS
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.APP_INSTALLED,
+ description="An app was installed.",
+ ),
+ ]
class AppInstall(ModelMutation):
diff --git a/saleor/graphql/app/mutations/app_retry_install.py b/saleor/graphql/app/mutations/app_retry_install.py
index 35e0d68622..64faee9ee4 100644
--- a/saleor/graphql/app/mutations/app_retry_install.py
+++ b/saleor/graphql/app/mutations/app_retry_install.py
@@ -6,9 +6,11 @@ from ....app.error_codes import AppErrorCode
from ....app.tasks import install_app_task
from ....core import JobStatus
from ....permission.enums import AppPermission
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.mutations import ModelMutation
from ...core.types import AppError
+from ...core.utils import WebhookEventInfo
from ..types import AppInstallation
@@ -28,6 +30,12 @@ class AppRetryInstall(ModelMutation):
permissions = (AppPermission.MANAGE_APPS,)
error_type_class = AppError
error_type_field = "app_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.APP_INSTALLED,
+ description="An app was installed.",
+ ),
+ ]
@classmethod
def save(cls, _info: ResolveInfo, instance, _cleaned_input, /):
diff --git a/saleor/graphql/app/mutations/app_update.py b/saleor/graphql/app/mutations/app_update.py
index 0be3fe4e12..e2d15d7f28 100644
--- a/saleor/graphql/app/mutations/app_update.py
+++ b/saleor/graphql/app/mutations/app_update.py
@@ -4,9 +4,11 @@ from django.core.exceptions import ValidationError
from ....app import models
from ....app.error_codes import AppErrorCode
from ....permission.enums import AppPermission, get_permissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...account.utils import can_manage_app
from ...core.mutations import ModelMutation
from ...core.types import AppError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ...utils import get_user_or_app_from_context, requestor_is_superuser
from ..types import App
@@ -29,6 +31,12 @@ class AppUpdate(ModelMutation):
permissions = (AppPermission.MANAGE_APPS,)
error_type_class = AppError
error_type_field = "app_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.APP_UPDATED,
+ description="An app was updated.",
+ ),
+ ]
@classmethod
def clean_input(cls, info, instance, data, **kwargs):
diff --git a/saleor/graphql/attribute/bulk_mutations.py b/saleor/graphql/attribute/bulk_mutations.py
index 8ad9e9b0ff..d1c947be4e 100644
--- a/saleor/graphql/attribute/bulk_mutations.py
+++ b/saleor/graphql/attribute/bulk_mutations.py
@@ -5,9 +5,11 @@ from ...attribute import models
from ...permission.enums import PageTypePermissions
from ...product import models as product_models
from ...product.search import update_products_search_vector
+from ...webhook.event_types import WebhookEventAsyncType
from ..core import ResolveInfo
from ..core.mutations import ModelBulkDeleteMutation
from ..core.types import AttributeError, NonNullList
+from ..core.utils import WebhookEventInfo
from ..plugins.dataloaders import get_plugin_manager_promise
from ..utils import resolve_global_ids_to_primary_keys
from .types import Attribute, AttributeValue
@@ -26,6 +28,12 @@ class AttributeBulkDelete(ModelBulkDeleteMutation):
permissions = (PageTypePermissions.MANAGE_PAGE_TYPES_AND_ATTRIBUTES,)
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_DELETED,
+ description="An attribute was deleted.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
@@ -90,6 +98,16 @@ class AttributeValueBulkDelete(ModelBulkDeleteMutation):
permissions = (PageTypePermissions.MANAGE_PAGE_TYPES_AND_ATTRIBUTES,)
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_VALUE_DELETED,
+ description="An attribute value was deleted.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_UPDATED,
+ description="An attribute was updated.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/attribute/mutations/attribute_create.py b/saleor/graphql/attribute/mutations/attribute_create.py
index 4921da7aa8..90fddaca4d 100644
--- a/saleor/graphql/attribute/mutations/attribute_create.py
+++ b/saleor/graphql/attribute/mutations/attribute_create.py
@@ -8,6 +8,7 @@ from ....attribute import models as models
from ....attribute.error_codes import AttributeErrorCode
from ....core.exceptions import PermissionDenied
from ....permission.enums import PageTypePermissions, ProductTypePermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_310, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_ATTRIBUTES
@@ -15,6 +16,7 @@ from ...core.enums import MeasurementUnitsEnum
from ...core.fields import JSONString
from ...core.mutations import ModelMutation
from ...core.types import AttributeError, BaseInputObjectType, NonNullList
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..descriptions import AttributeDescriptions, AttributeValueDescriptions
from ..enums import AttributeEntityTypeEnum, AttributeInputTypeEnum, AttributeTypeEnum
@@ -116,6 +118,12 @@ class AttributeCreate(AttributeMixin, ModelMutation):
description = "Creates an attribute."
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_CREATED,
+ description="An attribute was created.",
+ ),
+ ]
@classmethod
def clean_input(cls, info: ResolveInfo, instance, data, **kwargs):
diff --git a/saleor/graphql/attribute/mutations/attribute_delete.py b/saleor/graphql/attribute/mutations/attribute_delete.py
index 25cb169829..fb6e083e20 100644
--- a/saleor/graphql/attribute/mutations/attribute_delete.py
+++ b/saleor/graphql/attribute/mutations/attribute_delete.py
@@ -2,10 +2,12 @@ import graphene
from ....attribute import models as models
from ....permission.enums import ProductTypePermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_310
from ...core.mutations import ModelDeleteMutation, ModelWithExtRefMutation
from ...core.types import AttributeError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Attribute
@@ -25,6 +27,12 @@ class AttributeDelete(ModelDeleteMutation, ModelWithExtRefMutation):
permissions = (ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES,)
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_DELETED,
+ description="An attribute was deleted.",
+ ),
+ ]
@classmethod
def post_save_action(cls, info: ResolveInfo, instance, cleaned_input):
diff --git a/saleor/graphql/attribute/mutations/attribute_reorder_values.py b/saleor/graphql/attribute/mutations/attribute_reorder_values.py
index 35a8b499fe..c8b9f9dab0 100644
--- a/saleor/graphql/attribute/mutations/attribute_reorder_values.py
+++ b/saleor/graphql/attribute/mutations/attribute_reorder_values.py
@@ -5,11 +5,13 @@ from ....attribute import models as models
from ....attribute.error_codes import AttributeErrorCode
from ....core.tracing import traced_atomic_transaction
from ....permission.enums import ProductTypePermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_ATTRIBUTES
from ...core.inputs import ReorderInput
from ...core.mutations import BaseMutation
from ...core.types import AttributeError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...core.utils.reordering import perform_reordering
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Attribute, AttributeValue
@@ -26,6 +28,16 @@ class AttributeReorderValues(BaseMutation):
permissions = (ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES,)
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_VALUE_UPDATED,
+ description="An attribute value was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_UPDATED,
+ description="An attribute was updated.",
+ ),
+ ]
class Arguments:
attribute_id = graphene.Argument(
diff --git a/saleor/graphql/attribute/mutations/attribute_update.py b/saleor/graphql/attribute/mutations/attribute_update.py
index b41d565ef7..76d7f5284f 100644
--- a/saleor/graphql/attribute/mutations/attribute_update.py
+++ b/saleor/graphql/attribute/mutations/attribute_update.py
@@ -4,12 +4,14 @@ from django.core.exceptions import ValidationError
from ....attribute import models as models
from ....attribute.error_codes import AttributeErrorCode
from ....permission.enums import ProductTypePermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_310, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_ATTRIBUTES
from ...core.enums import MeasurementUnitsEnum
from ...core.mutations import ModelWithExtRefMutation
from ...core.types import AttributeError, BaseInputObjectType, NonNullList
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..descriptions import AttributeDescriptions, AttributeValueDescriptions
from ..types import Attribute
@@ -93,6 +95,12 @@ class AttributeUpdate(AttributeMixin, ModelWithExtRefMutation):
permissions = (ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES,)
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_UPDATED,
+ description="An attribute was updated.",
+ ),
+ ]
@classmethod
def clean_remove_values(cls, cleaned_input, instance):
diff --git a/saleor/graphql/attribute/mutations/attribute_value_create.py b/saleor/graphql/attribute/mutations/attribute_value_create.py
index f05e3be7ed..2f6dbb4917 100644
--- a/saleor/graphql/attribute/mutations/attribute_value_create.py
+++ b/saleor/graphql/attribute/mutations/attribute_value_create.py
@@ -8,9 +8,11 @@ from ....attribute import models as models
from ....attribute.error_codes import AttributeErrorCode
from ....core.utils import generate_unique_slug
from ....permission.enums import ProductPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.mutations import ModelMutation
from ...core.types import AttributeError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Attribute, AttributeValue
from .attribute_create import AttributeValueCreateInput
@@ -40,6 +42,16 @@ class AttributeValueCreate(AttributeMixin, ModelMutation):
permissions = (ProductPermissions.MANAGE_PRODUCTS,)
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_VALUE_CREATED,
+ description="An attribute value was created.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_UPDATED,
+ description="An attribute was updated.",
+ ),
+ ]
@classmethod
def clean_input(cls, info: ResolveInfo, instance, data, **kwargs):
diff --git a/saleor/graphql/attribute/mutations/attribute_value_delete.py b/saleor/graphql/attribute/mutations/attribute_value_delete.py
index 6c6991ff8a..81832b351a 100644
--- a/saleor/graphql/attribute/mutations/attribute_value_delete.py
+++ b/saleor/graphql/attribute/mutations/attribute_value_delete.py
@@ -4,10 +4,12 @@ from django.db.models import Exists, OuterRef, Q
from ....attribute import models as models
from ....permission.enums import ProductTypePermissions
from ....product import models as product_models
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_310
from ...core.mutations import ModelDeleteMutation, ModelWithExtRefMutation
from ...core.types import AttributeError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Attribute, AttributeValue
@@ -29,6 +31,16 @@ class AttributeValueDelete(ModelDeleteMutation, ModelWithExtRefMutation):
permissions = (ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES,)
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_VALUE_DELETED,
+ description="An attribute value was deleted.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_UPDATED,
+ description="An attribute was updated.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/attribute/mutations/attribute_value_update.py b/saleor/graphql/attribute/mutations/attribute_value_update.py
index 1d1a929e64..34b0fb0859 100644
--- a/saleor/graphql/attribute/mutations/attribute_value_update.py
+++ b/saleor/graphql/attribute/mutations/attribute_value_update.py
@@ -5,10 +5,12 @@ from django.db.models import Exists, OuterRef, Q
from ....attribute import models as models
from ....permission.enums import ProductTypePermissions
from ....product import models as product_models
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_310
from ...core.mutations import ModelWithExtRefMutation
from ...core.types import AttributeError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Attribute, AttributeValue
from .attribute_update import AttributeValueUpdateInput
@@ -58,6 +60,16 @@ class AttributeValueUpdate(AttributeValueCreate, ModelWithExtRefMutation):
permissions = (ProductTypePermissions.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES,)
error_type_class = AttributeError
error_type_field = "attribute_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_VALUE_UPDATED,
+ description="An attribute value was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ATTRIBUTE_UPDATED,
+ description="An attribute was updated.",
+ ),
+ ]
@classmethod
def clean_input(cls, info: ResolveInfo, instance, data, **kwargs):
diff --git a/saleor/graphql/channel/mutations/channel_activate.py b/saleor/graphql/channel/mutations/channel_activate.py
index 544a418049..a0f0b157b1 100644
--- a/saleor/graphql/channel/mutations/channel_activate.py
+++ b/saleor/graphql/channel/mutations/channel_activate.py
@@ -3,10 +3,12 @@ from django.core.exceptions import ValidationError
from ....channel.error_codes import ChannelErrorCode
from ....permission.enums import ChannelPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_CHANNELS
from ...core.mutations import BaseMutation
from ...core.types import ChannelError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Channel
@@ -23,6 +25,12 @@ class ChannelActivate(BaseMutation):
permissions = (ChannelPermissions.MANAGE_CHANNELS,)
error_type_class = ChannelError
error_type_field = "channel_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHANNEL_STATUS_CHANGED,
+ description="A channel was activated.",
+ ),
+ ]
@classmethod
def clean_channel_availability(cls, channel):
diff --git a/saleor/graphql/channel/mutations/channel_create.py b/saleor/graphql/channel/mutations/channel_create.py
index 85ec8e5e65..65b6046be9 100644
--- a/saleor/graphql/channel/mutations/channel_create.py
+++ b/saleor/graphql/channel/mutations/channel_create.py
@@ -5,6 +5,7 @@ from ....channel import models
from ....core.tracing import traced_atomic_transaction
from ....permission.enums import ChannelPermissions
from ....tax.models import TaxConfiguration
+from ....webhook.event_types import WebhookEventAsyncType
from ...account.enums import CountryCodeEnum
from ...core import ResolveInfo
from ...core.descriptions import (
@@ -24,6 +25,7 @@ from ...core.doc_category import (
from ...core.mutations import ModelMutation
from ...core.scalars import Day, Minute
from ...core.types import BaseInputObjectType, ChannelError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..enums import (
AllocationStrategyEnum,
@@ -160,6 +162,12 @@ class ChannelCreate(ModelMutation):
permissions = (ChannelPermissions.MANAGE_CHANNELS,)
error_type_class = ChannelError
error_type_field = "channel_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHANNEL_CREATED,
+ description="A channel was created.",
+ ),
+ ]
@classmethod
def get_type_for_model(cls):
diff --git a/saleor/graphql/channel/mutations/channel_deactivate.py b/saleor/graphql/channel/mutations/channel_deactivate.py
index 1445aa80f7..ffc5d4a53d 100644
--- a/saleor/graphql/channel/mutations/channel_deactivate.py
+++ b/saleor/graphql/channel/mutations/channel_deactivate.py
@@ -3,10 +3,12 @@ from django.core.exceptions import ValidationError
from ....channel.error_codes import ChannelErrorCode
from ....permission.enums import ChannelPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_CHANNELS
from ...core.mutations import BaseMutation
from ...core.types import ChannelError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Channel
@@ -23,6 +25,12 @@ class ChannelDeactivate(BaseMutation):
permissions = (ChannelPermissions.MANAGE_CHANNELS,)
error_type_class = ChannelError
error_type_field = "channel_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHANNEL_STATUS_CHANGED,
+ description="A channel was deactivated.",
+ ),
+ ]
@classmethod
def clean_channel_availability(cls, channel):
diff --git a/saleor/graphql/channel/mutations/channel_delete.py b/saleor/graphql/channel/mutations/channel_delete.py
index 3fa03fe939..b2820f863c 100644
--- a/saleor/graphql/channel/mutations/channel_delete.py
+++ b/saleor/graphql/channel/mutations/channel_delete.py
@@ -9,10 +9,12 @@ from ....checkout.models import Checkout
from ....core.tracing import traced_atomic_transaction
from ....order.models import Order
from ....permission.enums import ChannelPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_CHANNELS
from ...core.mutations import ModelDeleteMutation
from ...core.types import BaseInputObjectType, ChannelError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Channel
from ..utils import delete_invalid_warehouse_to_shipping_zone_relations
@@ -44,6 +46,12 @@ class ChannelDelete(ModelDeleteMutation):
permissions = (ChannelPermissions.MANAGE_CHANNELS,)
error_type_class = ChannelError
error_type_field = "channel_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHANNEL_DELETED,
+ description="A channel was deleted.",
+ ),
+ ]
@classmethod
def validate_input(cls, origin_channel, target_channel):
diff --git a/saleor/graphql/channel/mutations/channel_update.py b/saleor/graphql/channel/mutations/channel_update.py
index 6f98fd48f0..ee22294837 100644
--- a/saleor/graphql/channel/mutations/channel_update.py
+++ b/saleor/graphql/channel/mutations/channel_update.py
@@ -9,12 +9,14 @@ from ....permission.enums import ChannelPermissions, OrderPermissions
from ....shipping.tasks import (
drop_invalid_shipping_methods_relations_for_given_channels,
)
+from ....webhook.event_types import WebhookEventAsyncType
from ...account.enums import CountryCodeEnum
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_31, ADDED_IN_35
from ...core.doc_category import DOC_CATEGORY_CHANNELS
from ...core.mutations import ModelMutation
from ...core.types import ChannelError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ...utils.validators import check_for_duplicates
from ..types import Channel
@@ -68,6 +70,12 @@ class ChannelUpdate(ModelMutation):
object_type = Channel
error_type_class = ChannelError
error_type_field = "channel_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHANNEL_UPDATED,
+ description="A channel was updated.",
+ ),
+ ]
@classmethod
def clean_input(cls, info: ResolveInfo, instance, data, **kwargs):
diff --git a/saleor/graphql/checkout/mutations/checkout_add_promo_code.py b/saleor/graphql/checkout/mutations/checkout_add_promo_code.py
index 0aead36ff0..c32906a4cb 100644
--- a/saleor/graphql/checkout/mutations/checkout_add_promo_code.py
+++ b/saleor/graphql/checkout/mutations/checkout_add_promo_code.py
@@ -8,12 +8,14 @@ from ....checkout.fetch import (
update_delivery_method_lists_for_checkout_info,
)
from ....checkout.utils import add_promo_code_to_checkout, invalidate_checkout_prices
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Checkout
from .utils import get_checkout, update_checkout_shipping_method_if_invalid
@@ -48,6 +50,12 @@ class CheckoutAddPromoCode(BaseMutation):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/checkout/mutations/checkout_billing_address_update.py b/saleor/graphql/checkout/mutations/checkout_billing_address_update.py
index d7751901c7..09a5536ae0 100644
--- a/saleor/graphql/checkout/mutations/checkout_billing_address_update.py
+++ b/saleor/graphql/checkout/mutations/checkout_billing_address_update.py
@@ -7,12 +7,14 @@ from ....checkout.utils import (
invalidate_checkout_prices,
)
from ....core.tracing import traced_atomic_transaction
+from ....webhook.event_types import WebhookEventAsyncType
from ...account.types import AddressInput
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, ADDED_IN_35, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.scalars import UUID
from ...core.types import CheckoutError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Checkout
from .checkout_create import CheckoutAddressValidationRules
@@ -54,6 +56,12 @@ class CheckoutBillingAddressUpdate(CheckoutShippingAddressUpdate):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/checkout/mutations/checkout_complete.py b/saleor/graphql/checkout/mutations/checkout_complete.py
index ff76ae4ab3..cbd67a0864 100644
--- a/saleor/graphql/checkout/mutations/checkout_complete.py
+++ b/saleor/graphql/checkout/mutations/checkout_complete.py
@@ -19,6 +19,7 @@ from ....checkout.fetch import (
from ....checkout.utils import is_shipping_required
from ....order import models as order_models
from ....permission.enums import AccountPermissions
+from ....webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ...account.i18n import I18nMixin
from ...app.dataloaders import get_app_promise
from ...core import ResolveInfo
@@ -28,6 +29,7 @@ from ...core.fields import JSONString
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError, NonNullList
+from ...core.utils import CHECKOUT_CALCULATE_TAXES_MESSAGE, WebhookEventInfo
from ...core.validators import validate_one_of_args_is_in_mutation
from ...meta.inputs import MetadataInput
from ...order.types import Order
@@ -110,6 +112,59 @@ class CheckoutComplete(BaseMutation, I18nMixin):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ description=(
+ "Optionally triggered when cached external shipping methods are "
+ "invalid."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_FILTER_SHIPPING_METHODS,
+ description=(
+ "Optionally triggered when cached filtered shipping methods are "
+ "invalid."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_CREATED,
+ description="Triggered when order is created.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for order placement.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A staff notification for order placement.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_UPDATED,
+ description=(
+ "Triggered when order received the update after placement."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_PAID,
+ description="Triggered when newly created order is paid.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_FULLY_PAID,
+ description="Triggered when newly created order is fully paid.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_CONFIRMED,
+ description=(
+ "Optionally triggered when newly created order are automatically "
+ "marked as confirmed."
+ ),
+ ),
+ ]
@classmethod
def validate_checkout_addresses(
diff --git a/saleor/graphql/checkout/mutations/checkout_create.py b/saleor/graphql/checkout/mutations/checkout_create.py
index 08e6be010f..d4e62a1337 100644
--- a/saleor/graphql/checkout/mutations/checkout_create.py
+++ b/saleor/graphql/checkout/mutations/checkout_create.py
@@ -10,6 +10,7 @@ from ....core.tracing import traced_atomic_transaction
from ....core.utils.country import get_active_country
from ....product import models as product_models
from ....warehouse.reservations import get_reservation_length, is_reservation_enabled
+from ....webhook.event_types import WebhookEventAsyncType
from ...account.i18n import I18nMixin
from ...account.types import AddressInput
from ...app.dataloaders import get_app_promise
@@ -27,6 +28,7 @@ from ...core.enums import LanguageCodeEnum
from ...core.mutations import ModelMutation
from ...core.scalars import PositiveDecimal
from ...core.types import BaseInputObjectType, CheckoutError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...core.validators import validate_variants_available_in_channel
from ...plugins.dataloaders import get_plugin_manager_promise
from ...product.types import ProductVariant
@@ -186,6 +188,12 @@ class CheckoutCreate(ModelMutation, I18nMixin):
return_field_name = "checkout"
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_CREATED,
+ description="A checkout was created.",
+ )
+ ]
@classmethod
def clean_checkout_lines(
diff --git a/saleor/graphql/checkout/mutations/checkout_customer_attach.py b/saleor/graphql/checkout/mutations/checkout_customer_attach.py
index 7bf858cd5b..e2d8a7e84d 100644
--- a/saleor/graphql/checkout/mutations/checkout_customer_attach.py
+++ b/saleor/graphql/checkout/mutations/checkout_customer_attach.py
@@ -5,6 +5,7 @@ from ....checkout.error_codes import CheckoutErrorCode
from ....core.exceptions import PermissionDenied
from ....permission.auth_filters import AuthorizationFilters
from ....permission.enums import AccountPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...account.types import User
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
@@ -12,6 +13,7 @@ from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ...utils import get_user_or_app_from_context
from ..types import Checkout
@@ -54,6 +56,12 @@ class CheckoutCustomerAttach(BaseMutation):
AuthorizationFilters.AUTHENTICATED_APP,
AuthorizationFilters.AUTHENTICATED_USER,
)
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def perform_mutation(
diff --git a/saleor/graphql/checkout/mutations/checkout_customer_detach.py b/saleor/graphql/checkout/mutations/checkout_customer_detach.py
index 17e1491c64..445ca02155 100644
--- a/saleor/graphql/checkout/mutations/checkout_customer_detach.py
+++ b/saleor/graphql/checkout/mutations/checkout_customer_detach.py
@@ -3,12 +3,14 @@ import graphene
from ....core.exceptions import PermissionDenied
from ....permission.auth_filters import AuthorizationFilters
from ....permission.enums import AccountPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ...utils import get_user_or_app_from_context
from ..types import Checkout
@@ -43,6 +45,12 @@ class CheckoutCustomerDetach(BaseMutation):
AuthorizationFilters.AUTHENTICATED_APP,
AuthorizationFilters.AUTHENTICATED_USER,
)
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def perform_mutation(
diff --git a/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py b/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py
index 81d177d169..099e960ea4 100644
--- a/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py
+++ b/saleor/graphql/checkout/mutations/checkout_delivery_method_update.py
@@ -22,13 +22,14 @@ from ....shipping import interface as shipping_interface
from ....shipping import models as shipping_models
from ....shipping.utils import convert_to_shipping_method_data
from ....warehouse import models as warehouse_models
+from ....webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_31, ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
-from ...core.utils import from_global_id_or_error
+from ...core.utils import WebhookEventInfo, from_global_id_or_error
from ...plugins.dataloaders import get_plugin_manager_promise
from ...shipping.types import ShippingMethod
from ...warehouse.types import Warehouse
@@ -61,6 +62,19 @@ class CheckoutDeliveryMethodUpdate(BaseMutation):
)
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ description=(
+ "Triggered when updating the checkout delivery method with "
+ "the external one."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ ),
+ ]
@classmethod
def perform_on_shipping_method(
diff --git a/saleor/graphql/checkout/mutations/checkout_email_update.py b/saleor/graphql/checkout/mutations/checkout_email_update.py
index 713c655f6f..18d2fdf568 100644
--- a/saleor/graphql/checkout/mutations/checkout_email_update.py
+++ b/saleor/graphql/checkout/mutations/checkout_email_update.py
@@ -2,12 +2,14 @@ import graphene
from django.core.exceptions import ValidationError
from ....checkout.error_codes import CheckoutErrorCode
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Checkout
from .utils import get_checkout
@@ -38,6 +40,12 @@ class CheckoutEmailUpdate(BaseMutation):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@staticmethod
def clean_email(email):
diff --git a/saleor/graphql/checkout/mutations/checkout_language_code_update.py b/saleor/graphql/checkout/mutations/checkout_language_code_update.py
index 8007bdf550..2da8f5d51c 100644
--- a/saleor/graphql/checkout/mutations/checkout_language_code_update.py
+++ b/saleor/graphql/checkout/mutations/checkout_language_code_update.py
@@ -1,5 +1,7 @@
import graphene
+from saleor.webhook.event_types import WebhookEventAsyncType
+
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
@@ -7,6 +9,7 @@ from ...core.enums import LanguageCodeEnum
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Checkout
from .utils import get_checkout
@@ -39,6 +42,12 @@ class CheckoutLanguageCodeUpdate(BaseMutation):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/checkout/mutations/checkout_line_delete.py b/saleor/graphql/checkout/mutations/checkout_line_delete.py
index f93cc82f1b..68358da327 100644
--- a/saleor/graphql/checkout/mutations/checkout_line_delete.py
+++ b/saleor/graphql/checkout/mutations/checkout_line_delete.py
@@ -2,12 +2,14 @@ import graphene
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....checkout.utils import invalidate_checkout_prices
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Checkout, CheckoutLine
from .utils import get_checkout, update_checkout_shipping_method_if_invalid
@@ -38,6 +40,12 @@ class CheckoutLineDelete(BaseMutation):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/checkout/mutations/checkout_lines_add.py b/saleor/graphql/checkout/mutations/checkout_lines_add.py
index df7227af85..58e1c0030c 100644
--- a/saleor/graphql/checkout/mutations/checkout_lines_add.py
+++ b/saleor/graphql/checkout/mutations/checkout_lines_add.py
@@ -10,6 +10,7 @@ from ....checkout.fetch import (
)
from ....checkout.utils import add_variants_to_checkout, invalidate_checkout_prices
from ....warehouse.reservations import get_reservation_length, is_reservation_enabled
+from ....webhook.event_types import WebhookEventAsyncType
from ...app.dataloaders import get_app_promise
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
@@ -17,6 +18,7 @@ from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...core.validators import validate_variants_available_in_channel
from ...plugins.dataloaders import get_plugin_manager_promise
from ...product.types import ProductVariant
@@ -70,6 +72,12 @@ class CheckoutLinesAdd(BaseMutation):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def validate_checkout_lines(
diff --git a/saleor/graphql/checkout/mutations/checkout_lines_delete.py b/saleor/graphql/checkout/mutations/checkout_lines_delete.py
index f009f4b26b..146f93cdfe 100644
--- a/saleor/graphql/checkout/mutations/checkout_lines_delete.py
+++ b/saleor/graphql/checkout/mutations/checkout_lines_delete.py
@@ -3,12 +3,14 @@ from django.core.exceptions import ValidationError
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....checkout.utils import invalidate_checkout_prices
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ...utils import resolve_global_ids_to_primary_keys
from ..types import Checkout
@@ -37,6 +39,12 @@ class CheckoutLinesDelete(BaseMutation):
description = "Deletes checkout lines."
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def validate_lines(cls, checkout, lines_to_delete):
diff --git a/saleor/graphql/checkout/mutations/checkout_lines_update.py b/saleor/graphql/checkout/mutations/checkout_lines_update.py
index b36068dd9f..0371e39469 100644
--- a/saleor/graphql/checkout/mutations/checkout_lines_update.py
+++ b/saleor/graphql/checkout/mutations/checkout_lines_update.py
@@ -5,6 +5,7 @@ from django.forms import ValidationError
from ....checkout.error_codes import CheckoutErrorCode
from ....warehouse.reservations import is_reservation_enabled
+from ....webhook.event_types import WebhookEventAsyncType
from ...app.dataloaders import get_app_promise
from ...checkout.types import CheckoutLine
from ...core import ResolveInfo
@@ -17,6 +18,7 @@ from ...core.descriptions import (
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.scalars import UUID, PositiveDecimal
from ...core.types import BaseInputObjectType, CheckoutError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...core.validators import validate_one_of_args_is_in_mutation
from ...product.types import ProductVariant
from ...site.dataloaders import get_site_promise
@@ -93,6 +95,12 @@ class CheckoutLinesUpdate(CheckoutLinesAdd):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def validate_checkout_lines(
diff --git a/saleor/graphql/checkout/mutations/checkout_remove_promo_code.py b/saleor/graphql/checkout/mutations/checkout_remove_promo_code.py
index 78e318ce19..227058a787 100644
--- a/saleor/graphql/checkout/mutations/checkout_remove_promo_code.py
+++ b/saleor/graphql/checkout/mutations/checkout_remove_promo_code.py
@@ -12,13 +12,14 @@ from ....checkout.utils import (
remove_promo_code_from_checkout,
remove_voucher_from_checkout,
)
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
-from ...core.utils import from_global_id_or_error
+from ...core.utils import WebhookEventInfo, from_global_id_or_error
from ...core.validators import validate_one_of_args_is_in_mutation
from ...discount.types import Voucher
from ...giftcard.types import GiftCard
@@ -60,6 +61,12 @@ class CheckoutRemovePromoCode(BaseMutation):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def perform_mutation(
diff --git a/saleor/graphql/checkout/mutations/checkout_shipping_address_update.py b/saleor/graphql/checkout/mutations/checkout_shipping_address_update.py
index 6e50383d5d..806bb6043d 100644
--- a/saleor/graphql/checkout/mutations/checkout_shipping_address_update.py
+++ b/saleor/graphql/checkout/mutations/checkout_shipping_address_update.py
@@ -17,6 +17,7 @@ from ....checkout.utils import (
)
from ....core.tracing import traced_atomic_transaction
from ....warehouse.reservations import is_reservation_enabled
+from ....webhook.event_types import WebhookEventAsyncType
from ...account.i18n import I18nMixin
from ...account.types import AddressInput
from ...core.descriptions import ADDED_IN_34, ADDED_IN_35, DEPRECATED_IN_3X_INPUT
@@ -24,6 +25,7 @@ from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ...site.dataloaders import get_site_promise
from ..types import Checkout
@@ -74,6 +76,12 @@ class CheckoutShippingAddressUpdate(BaseMutation, I18nMixin):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ )
+ ]
@classmethod
def process_checkout_lines(
diff --git a/saleor/graphql/checkout/mutations/checkout_shipping_method_update.py b/saleor/graphql/checkout/mutations/checkout_shipping_method_update.py
index ac39680f83..7d6a739707 100644
--- a/saleor/graphql/checkout/mutations/checkout_shipping_method_update.py
+++ b/saleor/graphql/checkout/mutations/checkout_shipping_method_update.py
@@ -16,13 +16,14 @@ from ....plugins.webhook.utils import APP_ID_PREFIX
from ....shipping import interface as shipping_interface
from ....shipping import models as shipping_models
from ....shipping.utils import convert_to_shipping_method_data
+from ....webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_34, DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...core.scalars import UUID
from ...core.types import CheckoutError
-from ...core.utils import from_global_id_or_error
+from ...core.utils import WebhookEventInfo, from_global_id_or_error
from ...plugins.dataloaders import get_plugin_manager_promise
from ...shipping.types import ShippingMethod
from ..types import Checkout
@@ -54,6 +55,19 @@ class CheckoutShippingMethodUpdate(BaseMutation):
doc_category = DOC_CATEGORY_CHECKOUT
error_type_class = CheckoutError
error_type_field = "checkout_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ description=(
+ "Triggered when updating the checkout shipping method with "
+ "the external one."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.CHECKOUT_UPDATED,
+ description="A checkout was updated.",
+ ),
+ ]
@staticmethod
def _resolve_delivery_method_type(id_) -> Optional[str]:
diff --git a/saleor/graphql/checkout/mutations/order_create_from_checkout.py b/saleor/graphql/checkout/mutations/order_create_from_checkout.py
index e9c68696b1..5965c6ef4c 100644
--- a/saleor/graphql/checkout/mutations/order_create_from_checkout.py
+++ b/saleor/graphql/checkout/mutations/order_create_from_checkout.py
@@ -7,12 +7,14 @@ from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....core.exceptions import GiftCardNotApplicable, InsufficientStock
from ....discount.models import NotApplicable
from ....permission.enums import CheckoutPermissions
+from ....webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ...app.dataloaders import get_app_promise
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_32, ADDED_IN_38
from ...core.doc_category import DOC_CATEGORY_ORDERS
from ...core.mutations import BaseMutation
from ...core.types import Error, NonNullList
+from ...core.utils import CHECKOUT_CALCULATE_TAXES_MESSAGE, WebhookEventInfo
from ...meta.inputs import MetadataInput
from ...order.types import Order
from ...plugins.dataloaders import get_plugin_manager_promise
@@ -83,6 +85,59 @@ class OrderCreateFromCheckout(BaseMutation):
error_type_class = OrderCreateFromCheckoutError
support_meta_field = True
support_private_meta_field = True
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ description=(
+ "Optionally triggered when cached external shipping methods are "
+ "invalid."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_FILTER_SHIPPING_METHODS,
+ description=(
+ "Optionally triggered when cached filtered shipping methods are "
+ "invalid."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_CREATED,
+ description="Triggered when order is created.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for order placement.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A staff notification for order placement.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_UPDATED,
+ description=(
+ "Triggered when order received the update after placement."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_PAID,
+ description="Triggered when newly created order is paid.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_FULLY_PAID,
+ description="Triggered when newly created order is fully paid.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.ORDER_CONFIRMED,
+ description=(
+ "Optionally triggered when newly created order are automatically "
+ "marked as confirmed."
+ ),
+ ),
+ ]
@classmethod
def check_permissions(cls, context, permissions=None, **data):
diff --git a/saleor/graphql/checkout/types.py b/saleor/graphql/checkout/types.py
index 77bc3d2108..7d5ee24a62 100644
--- a/saleor/graphql/checkout/types.py
+++ b/saleor/graphql/checkout/types.py
@@ -21,6 +21,7 @@ from ...shipping.interface import ShippingMethodData
from ...tax.utils import get_display_gross_prices
from ...warehouse import models as warehouse_models
from ...warehouse.reservations import is_reservation_enabled
+from ...webhook.event_types import WebhookEventSyncType
from ..account.dataloaders import AddressByIdLoader
from ..account.utils import check_is_owner_or_has_one_of_perms
from ..channel import ChannelContext
@@ -40,10 +41,11 @@ from ..core.descriptions import (
)
from ..core.doc_category import DOC_CATEGORY_CHECKOUT, DOC_CATEGORY_PAYMENTS
from ..core.enums import LanguageCodeEnum
+from ..core.fields import BaseField
from ..core.scalars import UUID
from ..core.tracing import traced_resolver
from ..core.types import BaseObjectType, ModelObjectType, Money, NonNullList, TaxedMoney
-from ..core.utils import str_to_enum
+from ..core.utils import CHECKOUT_CALCULATE_TAXES_MESSAGE, WebhookEventInfo, str_to_enum
from ..decorators import one_of_permissions_required
from ..giftcard.types import GiftCard
from ..meta import resolvers as MetaResolvers
@@ -142,20 +144,32 @@ class CheckoutLine(ModelObjectType[models.CheckoutLine]):
required=True,
description="The quantity of product variant assigned to the checkout line.",
)
- unit_price = graphene.Field(
+ unit_price = BaseField(
TaxedMoney,
description="The unit price of the checkout line, with taxes and discounts.",
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ ],
)
undiscounted_unit_price = graphene.Field(
Money,
description="The unit price of the checkout line, without discounts.",
required=True,
)
- total_price = graphene.Field(
+ total_price = BaseField(
TaxedMoney,
description="The sum of the checkout line price, taxes and discounts.",
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ ],
)
undiscounted_total_price = graphene.Field(
Money,
@@ -417,16 +431,48 @@ class Checkout(ModelObjectType[models.Checkout]):
voucher_code = graphene.String(
description="The code of voucher assigned to the checkout."
)
- available_shipping_methods = NonNullList(
- ShippingMethod,
+ available_shipping_methods = BaseField(
+ NonNullList(ShippingMethod),
required=True,
description="Shipping methods that can be used with this checkout.",
deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use `shippingMethods` instead."),
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ description=(
+ "Optionally triggered when cached external shipping methods are "
+ "invalid."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_FILTER_SHIPPING_METHODS,
+ description=(
+ "Optionally triggered when cached filtered shipping methods are "
+ "invalid."
+ ),
+ ),
+ ],
)
- shipping_methods = NonNullList(
- ShippingMethod,
+ shipping_methods = BaseField(
+ NonNullList(ShippingMethod),
required=True,
description="Shipping methods that can be used with this checkout.",
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ description=(
+ "Optionally triggered when cached external shipping methods are "
+ "invalid."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_FILTER_SHIPPING_METHODS,
+ description=(
+ "Optionally triggered when cached filtered shipping methods are "
+ "invalid."
+ ),
+ ),
+ ],
)
available_collection_points = NonNullList(
Warehouse,
@@ -435,10 +481,16 @@ class Checkout(ModelObjectType[models.Checkout]):
"Collection points that can be used for this order." + ADDED_IN_31
),
)
- available_payment_gateways = NonNullList(
- PaymentGateway,
+ available_payment_gateways = BaseField(
+ NonNullList(PaymentGateway),
description="List of available payment gateways.",
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.PAYMENT_LIST_GATEWAYS,
+ description="Fetch payment gateways available for checkout.",
+ ),
+ ],
)
email = graphene.String(description="Email of a customer.", required=False)
gift_cards = NonNullList(
@@ -464,27 +516,71 @@ class Checkout(ModelObjectType[models.Checkout]):
),
required=True,
)
- shipping_price = graphene.Field(
+ shipping_price = BaseField(
TaxedMoney,
description=(
"The price of the shipping, with all the taxes included. Set to 0 when no "
"delivery method is selected."
),
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ ],
)
- shipping_method = graphene.Field(
+ shipping_method = BaseField(
ShippingMethod,
description="The shipping method related with checkout.",
deprecation_reason=(f"{DEPRECATED_IN_3X_FIELD} Use `deliveryMethod` instead."),
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ description=(
+ "Optionally triggered when cached external shipping methods are "
+ "invalid."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_FILTER_SHIPPING_METHODS,
+ description=(
+ "Optionally triggered when cached filtered shipping methods are "
+ "invalid."
+ ),
+ ),
+ ],
)
- delivery_method = graphene.Field(
+ delivery_method = BaseField(
DeliveryMethod,
description=("The delivery method selected for this checkout." + ADDED_IN_31),
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.SHIPPING_LIST_METHODS_FOR_CHECKOUT,
+ description=(
+ "Optionally triggered when cached external shipping methods are "
+ "invalid."
+ ),
+ ),
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_FILTER_SHIPPING_METHODS,
+ description=(
+ "Optionally triggered when cached filtered shipping methods are "
+ "invalid."
+ ),
+ ),
+ ],
)
- subtotal_price = graphene.Field(
+ subtotal_price = BaseField(
TaxedMoney,
description="The price of the checkout before shipping, with taxes included.",
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ ],
)
tax_exemption = graphene.Boolean(
description=(
@@ -493,16 +589,22 @@ class Checkout(ModelObjectType[models.Checkout]):
required=True,
)
token = graphene.Field(UUID, description="The checkout's token.", required=True)
- total_price = graphene.Field(
+ total_price = BaseField(
TaxedMoney,
description=(
"The sum of the the checkout line prices, with all the taxes,"
"shipping costs, and discounts included."
),
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ ],
)
- total_balance = graphene.Field(
+ total_balance = BaseField(
Money,
description=(
"The difference between the paid and the checkout total amount."
@@ -510,6 +612,12 @@ class Checkout(ModelObjectType[models.Checkout]):
+ PREVIEW_FEATURE
),
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ ],
)
language_code = graphene.Field(
@@ -531,17 +639,31 @@ class Checkout(ModelObjectType[models.Checkout]):
),
required=True,
)
- authorize_status = CheckoutAuthorizeStatusEnum(
+ authorize_status = BaseField(
+ CheckoutAuthorizeStatusEnum,
description=(
"The authorize status of the checkout." + ADDED_IN_313 + PREVIEW_FEATURE
),
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ ],
)
- charge_status = CheckoutChargeStatusEnum(
+ charge_status = BaseField(
+ CheckoutChargeStatusEnum,
description=(
"The charge status of the checkout." + ADDED_IN_313 + PREVIEW_FEATURE
),
required=True,
+ webhook_events_info=[
+ WebhookEventInfo(
+ type=WebhookEventSyncType.CHECKOUT_CALCULATE_TAXES,
+ description=CHECKOUT_CALCULATE_TAXES_MESSAGE,
+ ),
+ ],
)
class Meta:
@@ -587,8 +709,8 @@ class Checkout(ModelObjectType[models.Checkout]):
def resolve_email(root: models.Checkout, _info: ResolveInfo):
return root.get_customer_email()
- @classmethod
- def resolve_shipping_method(cls, root: models.Checkout, info):
+ @staticmethod
+ def resolve_shipping_method(root: models.Checkout, info):
def with_checkout_info(checkout_info):
delivery_method = checkout_info.delivery_method_info.delivery_method
if not delivery_method or not isinstance(
@@ -603,10 +725,10 @@ class Checkout(ModelObjectType[models.Checkout]):
.then(with_checkout_info)
)
- @classmethod
+ @staticmethod
@traced_resolver
@prevent_sync_event_circular_query
- def resolve_shipping_methods(cls, root: models.Checkout, info: ResolveInfo):
+ def resolve_shipping_methods(root: models.Checkout, info: ResolveInfo):
return (
CheckoutInfoByCheckoutTokenLoader(info.context)
.load(root.token)
@@ -903,8 +1025,8 @@ class Checkout(ModelObjectType[models.Checkout]):
def resolve_updated_at(cls, root: models.Checkout, _info):
return root.last_change
- @classmethod
- def resolve_authorize_status(cls, root: models.Checkout, info):
+ @staticmethod
+ def resolve_authorize_status(root: models.Checkout, info):
def _resolve_authorize_status(data):
address, lines, checkout_info, manager, transactions = data
fetch_checkout_data(
@@ -922,8 +1044,8 @@ class Checkout(ModelObjectType[models.Checkout]):
)
return Promise.all(dataloaders).then(_resolve_authorize_status)
- @classmethod
- def resolve_charge_status(cls, root: models.Checkout, info):
+ @staticmethod
+ def resolve_charge_status(root: models.Checkout, info):
def _resolve_charge_status(data):
address, lines, checkout_info, manager, transactions = data
fetch_checkout_data(
@@ -941,8 +1063,8 @@ class Checkout(ModelObjectType[models.Checkout]):
)
return Promise.all(dataloaders).then(_resolve_charge_status)
- @classmethod
- def resolve_total_balance(cls, root: models.Checkout, info):
+ @staticmethod
+ def resolve_total_balance(root: models.Checkout, info):
def _calculate_total_balance_for_transactions(data):
address, lines, checkout_info, manager, transactions = data
taxed_total = calculations.calculate_checkout_total_with_gift_cards(
diff --git a/saleor/graphql/core/fields.py b/saleor/graphql/core/fields.py
index 1a784f8435..93f8779ebb 100644
--- a/saleor/graphql/core/fields.py
+++ b/saleor/graphql/core/fields.py
@@ -10,18 +10,32 @@ from graphql import GraphQLError
from ...permission.utils import message_one_of_permissions_required
from ..decorators import one_of_permissions_required
from .connection import FILTERS_NAME, FILTERSET_CLASS, WHERE_FILTERSET_CLASS, WHERE_NAME
+from .utils import WebhookEventInfo, message_webhook_events
class BaseField(graphene.Field):
+ description: Optional[str]
doc_category: Optional[str]
+ webhook_events_info: Optional[list[WebhookEventInfo]]
def __init__(self, *args, **kwargs):
+ auto_webhook_events_info_message = kwargs.pop(
+ "auto_webhook_events_info_message", True
+ )
self.doc_category = kwargs.pop("doc_category", None)
+ self.webhook_events_info = kwargs.pop("webhook_events_info", None)
+
super(BaseField, self).__init__(*args, **kwargs)
+ if self.webhook_events_info and auto_webhook_events_info_message:
+ description = self.description or ""
+ description += message_webhook_events(self.webhook_events_info)
+ self.description = description
+
def get_resolver(self, parent_resolver):
resolver = self.resolver or parent_resolver
setattr(resolver, "doc_category", self.doc_category)
+ setattr(resolver, "webhook_events_info", self.webhook_events_info)
return resolver
diff --git a/saleor/graphql/core/mutations.py b/saleor/graphql/core/mutations.py
index bcb7b24084..6d845c44c7 100644
--- a/saleor/graphql/core/mutations.py
+++ b/saleor/graphql/core/mutations.py
@@ -61,8 +61,10 @@ from .types import (
UploadError,
)
from .utils import (
+ WebhookEventInfo,
ext_ref_to_global_id_or_error,
from_global_id_or_error,
+ message_webhook_events,
snake_to_camel_case,
)
from .utils.error_codes import get_error_code_from_error
@@ -172,6 +174,8 @@ class BaseMutation(graphene.Mutation):
errors_mapping=None,
support_meta_field=False,
support_private_meta_field=False,
+ auto_webhook_events_message: bool = True,
+ webhook_events_info: Optional[List[WebhookEventInfo]] = None,
**options,
):
if not _meta:
@@ -197,6 +201,11 @@ class BaseMutation(graphene.Mutation):
permissions_msg = message_one_of_permissions_required(permissions)
description = f"{description} {permissions_msg}"
+ if webhook_events_info and auto_webhook_events_message:
+ description += message_webhook_events(webhook_events_info)
+
+ cls.webhook_events_info = webhook_events_info
+
cls.doc_category = doc_category
super().__init_subclass_with_meta__(
diff --git a/saleor/graphql/core/types/base.py b/saleor/graphql/core/types/base.py
index 3659b16eb7..6fa2362b41 100644
--- a/saleor/graphql/core/types/base.py
+++ b/saleor/graphql/core/types/base.py
@@ -13,9 +13,11 @@ class BaseObjectType(ObjectType):
default_resolver=None,
_meta=None,
doc_category=None,
+ webhook_events_info=None,
**options,
):
cls.doc_category = doc_category
+ cls.webhook_events_info = webhook_events_info
super(BaseObjectType, cls).__init_subclass_with_meta__(
interfaces=interfaces,
possible_types=possible_types,
diff --git a/saleor/graphql/core/utils/__init__.py b/saleor/graphql/core/utils/__init__.py
index 72309fca83..c1219941c3 100644
--- a/saleor/graphql/core/utils/__init__.py
+++ b/saleor/graphql/core/utils/__init__.py
@@ -1,7 +1,8 @@
import binascii
import os
import secrets
-from typing import Literal, Tuple, Type, Union, overload
+from dataclasses import dataclass
+from typing import List, Literal, Optional, Tuple, Type, Union, overload
import graphene
from django.core.exceptions import ValidationError
@@ -10,6 +11,7 @@ from graphql.error import GraphQLError
from ....plugins.const import APP_ID_PREFIX
from ....thumbnail import FILE_NAME_MAX_LENGTH
+from ....webhook.event_types import WebhookEventAsyncType
from ..validators import validate_if_int_or_uuid
@@ -134,3 +136,24 @@ def ext_ref_to_global_id_or_error(model, external_reference):
message=f"Couldn't resolve to a node: {external_reference}",
code="not_found",
)
+
+
+@dataclass
+class WebhookEventInfo:
+ type: str
+ description: Optional[str] = None
+
+
+CHECKOUT_CALCULATE_TAXES_MESSAGE = (
+ "Optionally triggered when checkout prices are expired."
+)
+
+
+def message_webhook_events(webhook_events: List[WebhookEventInfo]) -> str:
+ description = "\n\nTriggers the following webhook events:"
+ for event in webhook_events:
+ webhook_type = "async" if event.type in WebhookEventAsyncType.ALL else "sync"
+ description += f"\n- {event.type.upper()} ({webhook_type})"
+ if event.description:
+ description += f": {event.description}"
+ return description
diff --git a/saleor/graphql/csv/mutations/export_gift_cards.py b/saleor/graphql/csv/mutations/export_gift_cards.py
index 3c10d58588..38226411bc 100644
--- a/saleor/graphql/csv/mutations/export_gift_cards.py
+++ b/saleor/graphql/csv/mutations/export_gift_cards.py
@@ -4,11 +4,13 @@ from ....csv import models as csv_models
from ....csv.events import export_started_event
from ....csv.tasks import export_gift_cards_task
from ....permission.enums import GiftcardPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...app.dataloaders import get_app_promise
from ...core import ResolveInfo
from ...core.descriptions import ADDED_IN_31
from ...core.doc_category import DOC_CATEGORY_GIFT_CARDS
from ...core.types import BaseInputObjectType, ExportError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...giftcard.filters import GiftCardFilterInput
from ...giftcard.types import GiftCard
from ..enums import ExportScope, FileTypeEnum
@@ -44,6 +46,12 @@ class ExportGiftCards(BaseExportMutation):
doc_category = DOC_CATEGORY_GIFT_CARDS
permissions = (GiftcardPermissions.MANAGE_GIFT_CARD,)
error_type_class = ExportError
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for the exported file.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/csv/mutations/export_products.py b/saleor/graphql/csv/mutations/export_products.py
index cdb88d946e..d21e09dd95 100644
--- a/saleor/graphql/csv/mutations/export_products.py
+++ b/saleor/graphql/csv/mutations/export_products.py
@@ -4,12 +4,14 @@ from ....csv import models as csv_models
from ....csv.events import export_started_event
from ....csv.tasks import export_products_task
from ....permission.enums import ProductPermissions
+from ....webhook.event_types import WebhookEventAsyncType
from ...app.dataloaders import get_app_promise
from ...attribute.types import Attribute
from ...channel.types import Channel
from ...core import ResolveInfo
from ...core.doc_category import DOC_CATEGORY_PRODUCTS
from ...core.types import BaseInputObjectType, ExportError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...product.filters import ProductFilterInput
from ...product.types import Product
from ...warehouse.types import Warehouse
@@ -73,6 +75,12 @@ class ExportProducts(BaseExportMutation):
permissions = (ProductPermissions.MANAGE_PRODUCTS,)
error_type_class = ExportError
error_type_field = "export_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.NOTIFY_USER,
+ description="A notification for the exported file.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/discount/mutations/bulk_mutations.py b/saleor/graphql/discount/mutations/bulk_mutations.py
index 040519e138..37df35d8f8 100644
--- a/saleor/graphql/discount/mutations/bulk_mutations.py
+++ b/saleor/graphql/discount/mutations/bulk_mutations.py
@@ -6,9 +6,11 @@ from ....discount import models
from ....discount.utils import CATALOGUE_FIELDS, fetch_catalogue_info
from ....permission.enums import DiscountPermissions
from ....product.tasks import update_products_discounted_prices_of_catalogues_task
+from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.mutations import ModelBulkDeleteMutation
from ...core.types import DiscountError, NonNullList
+from ...core.utils import WebhookEventInfo
from ...plugins.dataloaders import get_plugin_manager_promise
from ..types import Sale, Voucher
from .utils import convert_catalogue_info_to_global_ids
@@ -27,6 +29,12 @@ class SaleBulkDelete(ModelBulkDeleteMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.SALE_DELETED,
+ description="A sale was deleted.",
+ )
+ ]
@classmethod
def bulk_action(cls, info: ResolveInfo, queryset, /):
@@ -66,6 +74,12 @@ class VoucherBulkDelete(ModelBulkDeleteMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.VOUCHER_DELETED,
+ description="A voucher was deleted.",
+ )
+ ]
@classmethod
def bulk_action(cls, info: ResolveInfo, queryset, /):
diff --git a/saleor/graphql/discount/mutations/sale/sale_add_catalogues.py b/saleor/graphql/discount/mutations/sale/sale_add_catalogues.py
index 29c4fbf7bc..c2c48cc39b 100644
--- a/saleor/graphql/discount/mutations/sale/sale_add_catalogues.py
+++ b/saleor/graphql/discount/mutations/sale/sale_add_catalogues.py
@@ -4,10 +4,12 @@ from .....core.tracing import traced_atomic_transaction
from .....discount import models
from .....discount.utils import fetch_catalogue_info
from .....permission.enums import DiscountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel import ChannelContext
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_DISCOUNTS
from ....core.types import DiscountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Sale
from ..utils import convert_catalogue_info_to_global_ids
@@ -21,6 +23,12 @@ class SaleAddCatalogues(SaleBaseCatalogueMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.SALE_UPDATED,
+ description="A sale was updated.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/discount/mutations/sale/sale_create.py b/saleor/graphql/discount/mutations/sale/sale_create.py
index 176170449c..4471cc76f7 100644
--- a/saleor/graphql/discount/mutations/sale/sale_create.py
+++ b/saleor/graphql/discount/mutations/sale/sale_create.py
@@ -10,6 +10,7 @@ from .....discount.error_codes import DiscountErrorCode
from .....discount.utils import fetch_catalogue_info
from .....permission.enums import DiscountPermissions
from .....product.tasks import update_products_discounted_prices_of_sale_task
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel import ChannelContext
from ....core import ResolveInfo
from ....core.descriptions import ADDED_IN_31
@@ -17,6 +18,7 @@ from ....core.doc_category import DOC_CATEGORY_DISCOUNTS
from ....core.mutations import ModelMutation
from ....core.scalars import PositiveDecimal
from ....core.types import BaseInputObjectType, DiscountError, NonNullList
+from ....core.utils import WebhookEventInfo
from ....core.validators import validate_end_is_after_start
from ....plugins.dataloaders import get_plugin_manager_promise
from ...enums import DiscountValueTypeEnum
@@ -70,6 +72,12 @@ class SaleCreate(ModelMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.SALE_CREATED,
+ description="A sale was created.",
+ ),
+ ]
@classmethod
def clean_instance(cls, info: ResolveInfo, instance):
diff --git a/saleor/graphql/discount/mutations/sale/sale_delete.py b/saleor/graphql/discount/mutations/sale/sale_delete.py
index 62aadcc113..ba23a62940 100644
--- a/saleor/graphql/discount/mutations/sale/sale_delete.py
+++ b/saleor/graphql/discount/mutations/sale/sale_delete.py
@@ -6,9 +6,11 @@ from .....discount.utils import fetch_catalogue_info
from .....graphql.core.mutations import ModelDeleteMutation
from .....permission.enums import DiscountPermissions
from .....product.tasks import update_products_discounted_prices_of_catalogues_task
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel import ChannelContext
from ....core import ResolveInfo
from ....core.types import DiscountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Sale
from ..utils import convert_catalogue_info_to_global_ids
@@ -25,6 +27,12 @@ class SaleDelete(ModelDeleteMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.SALE_DELETED,
+ description="A sale was deleted.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/discount/mutations/sale/sale_remove_catalogues.py b/saleor/graphql/discount/mutations/sale/sale_remove_catalogues.py
index d49e974c24..22c3125948 100644
--- a/saleor/graphql/discount/mutations/sale/sale_remove_catalogues.py
+++ b/saleor/graphql/discount/mutations/sale/sale_remove_catalogues.py
@@ -5,9 +5,11 @@ from .....discount import models
from .....discount.utils import fetch_catalogue_info
from .....graphql.channel import ChannelContext
from .....permission.enums import DiscountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_DISCOUNTS
from ....core.types import DiscountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Sale
from ..utils import convert_catalogue_info_to_global_ids
@@ -21,6 +23,12 @@ class SaleRemoveCatalogues(SaleBaseCatalogueMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.SALE_UPDATED,
+ description="A sale was updated.",
+ ),
+ ]
@classmethod
def perform_mutation( # type: ignore[override]
diff --git a/saleor/graphql/discount/mutations/sale/sale_update.py b/saleor/graphql/discount/mutations/sale/sale_update.py
index 9366038dda..46d6dc86e2 100644
--- a/saleor/graphql/discount/mutations/sale/sale_update.py
+++ b/saleor/graphql/discount/mutations/sale/sale_update.py
@@ -9,10 +9,12 @@ from .....discount import models
from .....discount.utils import CATALOGUE_FIELDS, fetch_catalogue_info
from .....permission.enums import DiscountPermissions
from .....product.tasks import update_products_discounted_prices_of_catalogues_task
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel import ChannelContext
from ....core import ResolveInfo
from ....core.mutations import ModelMutation
from ....core.types import DiscountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Sale
from ..utils import convert_catalogue_info_to_global_ids
@@ -33,6 +35,16 @@ class SaleUpdate(ModelMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.SALE_UPDATED,
+ description="A sale was updated.",
+ ),
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.SALE_TOGGLE,
+ description="Optionally triggered when a sale is started or stopped.",
+ ),
+ ]
@classmethod
def perform_mutation(cls, _root, info: ResolveInfo, /, **data):
diff --git a/saleor/graphql/discount/mutations/voucher/voucher_add_catalogues.py b/saleor/graphql/discount/mutations/voucher/voucher_add_catalogues.py
index dfddf9342c..e5e7623f36 100644
--- a/saleor/graphql/discount/mutations/voucher/voucher_add_catalogues.py
+++ b/saleor/graphql/discount/mutations/voucher/voucher_add_catalogues.py
@@ -1,11 +1,13 @@
import graphene
from .....permission.enums import DiscountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel import ChannelContext
from ....core import ResolveInfo
from ....core.descriptions import ADDED_IN_31
from ....core.doc_category import DOC_CATEGORY_DISCOUNTS
from ....core.types import BaseInputObjectType, DiscountError, NonNullList
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Voucher
from ..sale.sale_base_discount_catalogue import BaseDiscountCatalogueMutation
@@ -65,6 +67,12 @@ class VoucherAddCatalogues(VoucherBaseCatalogueMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.VOUCHER_UPDATED,
+ description="A voucher was updated.",
+ )
+ ]
@classmethod
def perform_mutation(cls, _root, info: ResolveInfo, /, **data):
diff --git a/saleor/graphql/discount/mutations/voucher/voucher_channel_listing_update.py b/saleor/graphql/discount/mutations/voucher/voucher_channel_listing_update.py
index a74cde3fa1..ea92a82cd9 100644
--- a/saleor/graphql/discount/mutations/voucher/voucher_channel_listing_update.py
+++ b/saleor/graphql/discount/mutations/voucher/voucher_channel_listing_update.py
@@ -8,12 +8,14 @@ from .....core.tracing import traced_atomic_transaction
from .....discount import DiscountValueType, models
from .....discount.error_codes import DiscountErrorCode
from .....permission.enums import DiscountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel import ChannelContext
from ....channel.mutations import BaseChannelListingMutation
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_DISCOUNTS
from ....core.scalars import PositiveDecimal
from ....core.types import BaseInputObjectType, DiscountError, NonNullList
+from ....core.utils import WebhookEventInfo
from ....core.validators import validate_price_precision
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Voucher
@@ -62,6 +64,12 @@ class VoucherChannelListingUpdate(BaseChannelListingMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.VOUCHER_UPDATED,
+ description="A voucher was updated.",
+ )
+ ]
@classmethod
def clean_discount_values_per_channel(cls, cleaned_input, voucher, error_dict):
diff --git a/saleor/graphql/discount/mutations/voucher/voucher_create.py b/saleor/graphql/discount/mutations/voucher/voucher_create.py
index b96bab0623..1d3b3b3ed7 100644
--- a/saleor/graphql/discount/mutations/voucher/voucher_create.py
+++ b/saleor/graphql/discount/mutations/voucher/voucher_create.py
@@ -5,12 +5,14 @@ from .....core.utils.promo_code import generate_promo_code, is_available_promo_c
from .....discount import models
from .....discount.error_codes import DiscountErrorCode
from .....permission.enums import DiscountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel import ChannelContext
from ....core import ResolveInfo
from ....core.descriptions import ADDED_IN_31
from ....core.doc_category import DOC_CATEGORY_DISCOUNTS
from ....core.mutations import ModelMutation
from ....core.types import BaseInputObjectType, DiscountError, NonNullList
+from ....core.utils import WebhookEventInfo
from ....core.validators import validate_end_is_after_start
from ....plugins.dataloaders import get_plugin_manager_promise
from ...enums import DiscountValueTypeEnum, VoucherTypeEnum
@@ -87,6 +89,12 @@ class VoucherCreate(ModelMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.VOUCHER_CREATED,
+ description="A voucher was created.",
+ )
+ ]
@classmethod
def clean_input(cls, info: ResolveInfo, instance, data, **kwargs):
diff --git a/saleor/graphql/discount/mutations/voucher/voucher_delete.py b/saleor/graphql/discount/mutations/voucher/voucher_delete.py
index 74135e6e23..3c5b23dda9 100644
--- a/saleor/graphql/discount/mutations/voucher/voucher_delete.py
+++ b/saleor/graphql/discount/mutations/voucher/voucher_delete.py
@@ -3,10 +3,12 @@ import graphene
from saleor.discount import models
from .....permission.enums import DiscountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....channel import ChannelContext
from ....core import ResolveInfo
from ....core.mutations import ModelDeleteMutation
from ....core.types import DiscountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Voucher
@@ -22,6 +24,12 @@ class VoucherDelete(ModelDeleteMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.VOUCHER_DELETED,
+ description="A voucher was deleted.",
+ )
+ ]
@classmethod
def success_response(cls, instance):
diff --git a/saleor/graphql/discount/mutations/voucher/voucher_remove_catalogues.py b/saleor/graphql/discount/mutations/voucher/voucher_remove_catalogues.py
index 49c369bb21..d7d60f9e45 100644
--- a/saleor/graphql/discount/mutations/voucher/voucher_remove_catalogues.py
+++ b/saleor/graphql/discount/mutations/voucher/voucher_remove_catalogues.py
@@ -1,7 +1,9 @@
from .....permission.enums import DiscountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....core import ResolveInfo
from ....core.doc_category import DOC_CATEGORY_DISCOUNTS
from ....core.types import DiscountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Voucher
from .voucher_add_catalogues import VoucherBaseCatalogueMutation
@@ -14,6 +16,12 @@ class VoucherRemoveCatalogues(VoucherBaseCatalogueMutation):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.VOUCHER_UPDATED,
+ description="A voucher was updated.",
+ )
+ ]
@classmethod
def perform_mutation(cls, _root, info: ResolveInfo, /, **data):
diff --git a/saleor/graphql/discount/mutations/voucher/voucher_update.py b/saleor/graphql/discount/mutations/voucher/voucher_update.py
index 2ca1425cdd..ef550f4034 100644
--- a/saleor/graphql/discount/mutations/voucher/voucher_update.py
+++ b/saleor/graphql/discount/mutations/voucher/voucher_update.py
@@ -2,8 +2,10 @@ import graphene
from .....discount import models
from .....permission.enums import DiscountPermissions
+from .....webhook.event_types import WebhookEventAsyncType
from ....core import ResolveInfo
from ....core.types import DiscountError
+from ....core.utils import WebhookEventInfo
from ....plugins.dataloaders import get_plugin_manager_promise
from ...types import Voucher
from .voucher_create import VoucherCreate, VoucherInput
@@ -23,6 +25,12 @@ class VoucherUpdate(VoucherCreate):
permissions = (DiscountPermissions.MANAGE_DISCOUNTS,)
error_type_class = DiscountError
error_type_field = "discount_errors"
+ webhook_events_info = [
+ WebhookEventInfo(
+ type=WebhookEventAsyncType.VOUCHER_UPDATED,
+ description="A voucher was updated.",
+ )
+ ]
@classmethod
def post_save_action(cls, info: ResolveInfo, instance, cleaned_input):
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index ab2f191604..f10fae0b13 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -10,6 +10,15 @@ directive @doc(
category: String!
) on ENUM | FIELD | FIELD_DEFINITION | INPUT_OBJECT | OBJECT
+"""Webhook events triggered by a specific location."""
+directive @webhookEventsInfo(
+ """List of asynchronous webhook events triggered by a specific location."""
+ asyncEvents: [WebhookEventTypeAsyncEnum!]!
+
+ """List of synchronous webhook events triggered by a specific location."""
+ syncEvents: [WebhookEventTypeSyncEnum!]!
+) on FIELD | FIELD_DEFINITION | INPUT_OBJECT | OBJECT
+
type Query {
"""
Look up a webhook by ID. Requires one of the following permissions: MANAGE_APPS, OWNER.
@@ -9731,11 +9740,23 @@ type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
"""The code of voucher assigned to the checkout."""
voucherCode: String
- """Shipping methods that can be used with this checkout."""
- availableShippingMethods: [ShippingMethod!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `shippingMethods` instead.")
+ """
+ Shipping methods that can be used with this checkout.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ """
+ availableShippingMethods: [ShippingMethod!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS]) @deprecated(reason: "This field will be removed in Saleor 4.0. Use `shippingMethods` instead.")
- """Shipping methods that can be used with this checkout."""
- shippingMethods: [ShippingMethod!]!
+ """
+ Shipping methods that can be used with this checkout.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ """
+ shippingMethods: [ShippingMethod!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS])
"""
Collection points that can be used for this order.
@@ -9744,8 +9765,13 @@ type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
"""
availableCollectionPoints: [Warehouse!]!
- """List of available payment gateways."""
- availablePaymentGateways: [PaymentGateway!]!
+ """
+ List of available payment gateways.
+
+ Triggers the following webhook events:
+ - PAYMENT_LIST_GATEWAYS (sync): Fetch payment gateways available for checkout.
+ """
+ availablePaymentGateways: [PaymentGateway!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [PAYMENT_LIST_GATEWAYS])
"""Email of a customer."""
email: String
@@ -9773,21 +9799,39 @@ type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
"""
The price of the shipping, with all the taxes included. Set to 0 when no delivery method is selected.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- shippingPrice: TaxedMoney!
+ shippingPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
- """The shipping method related with checkout."""
- shippingMethod: ShippingMethod @deprecated(reason: "This field will be removed in Saleor 4.0. Use `deliveryMethod` instead.")
+ """
+ The shipping method related with checkout.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ """
+ shippingMethod: ShippingMethod @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS]) @deprecated(reason: "This field will be removed in Saleor 4.0. Use `deliveryMethod` instead.")
"""
The delivery method selected for this checkout.
Added in Saleor 3.1.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
"""
- deliveryMethod: DeliveryMethod
+ deliveryMethod: DeliveryMethod @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS])
- """The price of the checkout before shipping, with taxes included."""
- subtotalPrice: TaxedMoney!
+ """
+ The price of the checkout before shipping, with taxes included.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ """
+ subtotalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
"""
Returns True if checkout has to be exempt from taxes.
@@ -9801,8 +9845,11 @@ type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
"""
The sum of the the checkout line prices, with all the taxes,shipping costs, and discounts included.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- totalPrice: TaxedMoney!
+ totalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
"""
The difference between the paid and the checkout total amount.
@@ -9810,8 +9857,11 @@ type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
Added in Saleor 3.13.
Note: this API is currently in Feature Preview and can be subject to changes at later point.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- totalBalance: Money!
+ totalBalance: Money! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
"""Checkout language code."""
languageCode: LanguageCodeEnum!
@@ -9838,8 +9888,11 @@ type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
Added in Saleor 3.13.
Note: this API is currently in Feature Preview and can be subject to changes at later point.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- authorizeStatus: CheckoutAuthorizeStatusEnum!
+ authorizeStatus: CheckoutAuthorizeStatusEnum! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
"""
The charge status of the checkout.
@@ -9847,8 +9900,11 @@ type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
Added in Saleor 3.13.
Note: this API is currently in Feature Preview and can be subject to changes at later point.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- chargeStatus: CheckoutChargeStatusEnum!
+ chargeStatus: CheckoutChargeStatusEnum! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
}
"""
@@ -10170,14 +10226,24 @@ type CheckoutLine implements Node & ObjectWithMetadata @doc(category: "Checkout"
"""The quantity of product variant assigned to the checkout line."""
quantity: Int!
- """The unit price of the checkout line, with taxes and discounts."""
- unitPrice: TaxedMoney!
+ """
+ The unit price of the checkout line, with taxes and discounts.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ """
+ unitPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
"""The unit price of the checkout line, without discounts."""
undiscountedUnitPrice: Money!
- """The sum of the checkout line price, taxes and discounts."""
- totalPrice: TaxedMoney!
+ """
+ The sum of the checkout line price, taxes and discounts.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ """
+ totalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
"""The sum of the checkout line price, without discounts."""
undiscountedTotalPrice: Money!
@@ -16020,36 +16086,49 @@ type Mutation {
Creates a new sale.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - SALE_CREATED (async): A sale was created.
"""
saleCreate(
"""Fields required to create a sale."""
input: SaleInput!
- ): SaleCreate @doc(category: "Discounts")
+ ): SaleCreate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_CREATED], syncEvents: [])
"""
Deletes a sale.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - SALE_DELETED (async): A sale was deleted.
"""
saleDelete(
"""ID of a sale to delete."""
id: ID!
- ): SaleDelete @doc(category: "Discounts")
+ ): SaleDelete @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_DELETED], syncEvents: [])
"""
Deletes sales.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - SALE_DELETED (async): A sale was deleted.
"""
saleBulkDelete(
"""List of sale IDs to delete."""
ids: [ID!]!
- ): SaleBulkDelete @doc(category: "Discounts")
+ ): SaleBulkDelete @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_DELETED], syncEvents: [])
"""
Updates a sale.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - SALE_UPDATED (async): A sale was updated.
+ - SALE_TOGGLE (async): Optionally triggered when a sale is started or stopped.
"""
saleUpdate(
"""ID of a sale to update."""
@@ -16057,12 +16136,15 @@ type Mutation {
"""Fields required to update a sale."""
input: SaleInput!
- ): SaleUpdate @doc(category: "Discounts")
+ ): SaleUpdate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_UPDATED, SALE_TOGGLE], syncEvents: [])
"""
Adds products, categories, collections to a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - SALE_UPDATED (async): A sale was updated.
"""
saleCataloguesAdd(
"""ID of a sale."""
@@ -16070,12 +16152,15 @@ type Mutation {
"""Fields required to modify catalogue IDs of sale."""
input: CatalogueInput!
- ): SaleAddCatalogues @doc(category: "Discounts")
+ ): SaleAddCatalogues @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_UPDATED], syncEvents: [])
"""
Removes products, categories, collections from a sale.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - SALE_UPDATED (async): A sale was updated.
"""
saleCataloguesRemove(
"""ID of a sale."""
@@ -16083,7 +16168,7 @@ type Mutation {
"""Fields required to modify catalogue IDs of sale."""
input: CatalogueInput!
- ): SaleRemoveCatalogues @doc(category: "Discounts")
+ ): SaleRemoveCatalogues @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_UPDATED], syncEvents: [])
"""
Creates/updates translations for a sale.
@@ -16116,36 +16201,48 @@ type Mutation {
Creates a new voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - VOUCHER_CREATED (async): A voucher was created.
"""
voucherCreate(
"""Fields required to create a voucher."""
input: VoucherInput!
- ): VoucherCreate @doc(category: "Discounts")
+ ): VoucherCreate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_CREATED], syncEvents: [])
"""
Deletes a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - VOUCHER_DELETED (async): A voucher was deleted.
"""
voucherDelete(
"""ID of a voucher to delete."""
id: ID!
- ): VoucherDelete @doc(category: "Discounts")
+ ): VoucherDelete @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_DELETED], syncEvents: [])
"""
Deletes vouchers.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - VOUCHER_DELETED (async): A voucher was deleted.
"""
voucherBulkDelete(
"""List of voucher IDs to delete."""
ids: [ID!]!
- ): VoucherBulkDelete @doc(category: "Discounts")
+ ): VoucherBulkDelete @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_DELETED], syncEvents: [])
"""
Updates a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - VOUCHER_UPDATED (async): A voucher was updated.
"""
voucherUpdate(
"""ID of a voucher to update."""
@@ -16153,12 +16250,15 @@ type Mutation {
"""Fields required to update a voucher."""
input: VoucherInput!
- ): VoucherUpdate @doc(category: "Discounts")
+ ): VoucherUpdate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_UPDATED], syncEvents: [])
"""
Adds products, categories, collections to a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - VOUCHER_UPDATED (async): A voucher was updated.
"""
voucherCataloguesAdd(
"""ID of a voucher."""
@@ -16166,12 +16266,15 @@ type Mutation {
"""Fields required to modify catalogue IDs of voucher."""
input: CatalogueInput!
- ): VoucherAddCatalogues @doc(category: "Discounts")
+ ): VoucherAddCatalogues @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_UPDATED], syncEvents: [])
"""
Removes products, categories, collections from a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - VOUCHER_UPDATED (async): A voucher was updated.
"""
voucherCataloguesRemove(
"""ID of a voucher."""
@@ -16179,7 +16282,7 @@ type Mutation {
"""Fields required to modify catalogue IDs of voucher."""
input: CatalogueInput!
- ): VoucherRemoveCatalogues @doc(category: "Discounts")
+ ): VoucherRemoveCatalogues @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_UPDATED], syncEvents: [])
"""
Creates/updates translations for a voucher.
@@ -16199,6 +16302,9 @@ type Mutation {
Manage voucher's availability in channels.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+ Triggers the following webhook events:
+ - VOUCHER_UPDATED (async): A voucher was updated.
"""
voucherChannelListingUpdate(
"""ID of a voucher to update."""
@@ -16206,17 +16312,20 @@ type Mutation {
"""Fields required to update voucher channel listings."""
input: VoucherChannelListingInput!
- ): VoucherChannelListingUpdate @doc(category: "Discounts")
+ ): VoucherChannelListingUpdate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_UPDATED], syncEvents: [])
"""
Export products to csv file.
Requires one of the following permissions: MANAGE_PRODUCTS.
+
+ Triggers the following webhook events:
+ - NOTIFY_USER (async): A notification for the exported file.
"""
exportProducts(
"""Fields required to export product data."""
input: ExportProductsInput!
- ): ExportProducts @doc(category: "Products")
+ ): ExportProducts @doc(category: "Products") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: [])
"""
Export gift cards to csv file.
@@ -16224,11 +16333,14 @@ type Mutation {
Added in Saleor 3.1.
Requires one of the following permissions: MANAGE_GIFT_CARD.
+
+ Triggers the following webhook events:
+ - NOTIFY_USER (async): A notification for the exported file.
"""
exportGiftCards(
"""Fields required to export gift cards data."""
input: ExportGiftCardsInput!
- ): ExportGiftCards @doc(category: "Gift cards")
+ ): ExportGiftCards @doc(category: "Gift cards") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: [])
"""
Upload a file. This mutation must be sent as a `multipart` request. More detailed specs of the upload format can be found here: https://github.com/jaydenseric/graphql-multipart-request-spec
@@ -16240,7 +16352,12 @@ type Mutation {
file: Upload!
): FileUpload
- """Adds a gift card or a voucher to a checkout."""
+ """
+ Adds a gift card or a voucher to a checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutAddPromoCode(
"""
The ID of the checkout.
@@ -16265,9 +16382,14 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutAddPromoCode @doc(category: "Checkout")
+ ): CheckoutAddPromoCode @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
- """Update billing address in the existing checkout."""
+ """
+ Update billing address in the existing checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutBillingAddressUpdate(
"""The billing address of the checkout."""
billingAddress: AddressInput!
@@ -16299,10 +16421,22 @@ type Mutation {
Added in Saleor 3.5.
"""
validationRules: CheckoutAddressValidationRules
- ): CheckoutBillingAddressUpdate @doc(category: "Checkout")
+ ): CheckoutBillingAddressUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
"""
Completes the checkout. As a result a new order is created and a payment charge is made. This action requires a successful payment before it can be performed. In case additional confirmation step as 3D secure is required confirmationNeeded flag will be set to True and no order created until payment is confirmed with second call of this mutation.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ - ORDER_CREATED (async): Triggered when order is created.
+ - NOTIFY_USER (async): A notification for order placement.
+ - NOTIFY_USER (async): A staff notification for order placement.
+ - ORDER_UPDATED (async): Triggered when order received the update after placement.
+ - ORDER_PAID (async): Triggered when newly created order is paid.
+ - ORDER_FULLY_PAID (async): Triggered when newly created order is fully paid.
+ - ORDER_CONFIRMED (async): Optionally triggered when newly created order are automatically marked as confirmed.
"""
checkoutComplete(
"""
@@ -16347,13 +16481,18 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutComplete @doc(category: "Checkout")
+ ): CheckoutComplete @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [ORDER_CREATED, NOTIFY_USER, NOTIFY_USER, ORDER_UPDATED, ORDER_PAID, ORDER_FULLY_PAID, ORDER_CONFIRMED], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS, CHECKOUT_CALCULATE_TAXES])
- """Create a new checkout."""
+ """
+ Create a new checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CREATED (async): A checkout was created.
+ """
checkoutCreate(
"""Fields required to create checkout."""
input: CheckoutCreateInput!
- ): CheckoutCreate @doc(category: "Checkout")
+ ): CheckoutCreate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_CREATED], syncEvents: [])
"""
Create new checkout from existing order.
@@ -16371,6 +16510,9 @@ type Mutation {
Sets the customer as the owner of the checkout.
Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_USER.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
"""
checkoutCustomerAttach(
"""
@@ -16398,12 +16540,15 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutCustomerAttach @doc(category: "Checkout")
+ ): CheckoutCustomerAttach @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
"""
Removes the user assigned as the owner of the checkout.
Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_USER.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
"""
checkoutCustomerDetach(
"""
@@ -16426,9 +16571,14 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutCustomerDetach @doc(category: "Checkout")
+ ): CheckoutCustomerDetach @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
- """Updates email address in the existing checkout object."""
+ """
+ Updates email address in the existing checkout object.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutEmailUpdate(
"""
The ID of the checkout.
@@ -16453,9 +16603,14 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutEmailUpdate @doc(category: "Checkout")
+ ): CheckoutEmailUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
- """Deletes a CheckoutLine."""
+ """
+ Deletes a CheckoutLine.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutLineDelete(
"""
The ID of the checkout.
@@ -16480,9 +16635,14 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutLineDelete @doc(category: "Checkout") @deprecated(reason: "This field will be removed in Saleor 4.0. Use `checkoutLinesDelete` instead.")
+ ): CheckoutLineDelete @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) @deprecated(reason: "This field will be removed in Saleor 4.0. Use `checkoutLinesDelete` instead.")
- """Deletes checkout lines."""
+ """
+ Deletes checkout lines.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutLinesDelete(
"""
The checkout's ID.
@@ -16500,10 +16660,13 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutLinesDelete @doc(category: "Checkout")
+ ): CheckoutLinesDelete @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
"""
Adds a checkout line to the existing checkout.If line was already in checkout, its quantity will be increased.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
"""
checkoutLinesAdd(
"""
@@ -16531,9 +16694,14 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutLinesAdd @doc(category: "Checkout")
+ ): CheckoutLinesAdd @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
- """Updates checkout line in the existing checkout."""
+ """
+ Updates checkout line in the existing checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutLinesUpdate(
"""
The ID of the checkout.
@@ -16560,9 +16728,14 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutLinesUpdate @doc(category: "Checkout")
+ ): CheckoutLinesUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
- """Remove a gift card or a voucher from a checkout."""
+ """
+ Remove a gift card or a voucher from a checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutRemovePromoCode(
"""
The ID of the checkout.
@@ -16590,7 +16763,7 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutRemovePromoCode @doc(category: "Checkout")
+ ): CheckoutRemovePromoCode @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
"""Create a new payment for given checkout."""
checkoutPaymentCreate(
@@ -16619,7 +16792,12 @@ type Mutation {
token: UUID
): CheckoutPaymentCreate @doc(category: "Checkout")
- """Update shipping address in the existing checkout."""
+ """
+ Update shipping address in the existing checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutShippingAddressUpdate(
"""
The ID of the checkout.
@@ -16651,9 +16829,15 @@ type Mutation {
Added in Saleor 3.5.
"""
validationRules: CheckoutAddressValidationRules
- ): CheckoutShippingAddressUpdate @doc(category: "Checkout")
+ ): CheckoutShippingAddressUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
- """Updates the shipping method of the checkout."""
+ """
+ Updates the shipping method of the checkout.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Triggered when updating the checkout shipping method with the external one.
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutShippingMethodUpdate(
"""
The ID of the checkout.
@@ -16678,12 +16862,16 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutShippingMethodUpdate @doc(category: "Checkout") @deprecated(reason: "This field will be removed in Saleor 4.0. Use `checkoutDeliveryMethodUpdate` instead.")
+ ): CheckoutShippingMethodUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT]) @deprecated(reason: "This field will be removed in Saleor 4.0. Use `checkoutDeliveryMethodUpdate` instead.")
"""
Updates the delivery method (shipping method or pick up point) of the checkout.
Added in Saleor 3.1.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Triggered when updating the checkout delivery method with the external one.
+ - CHECKOUT_UPDATED (async): A checkout was updated.
"""
checkoutDeliveryMethodUpdate(
"""Delivery Method ID (`Warehouse` ID or `ShippingMethod` ID)."""
@@ -16702,9 +16890,14 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutDeliveryMethodUpdate @doc(category: "Checkout")
+ ): CheckoutDeliveryMethodUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT])
- """Update language code in the existing checkout."""
+ """
+ Update language code in the existing checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_UPDATED (async): A checkout was updated.
+ """
checkoutLanguageCodeUpdate(
"""
The ID of the checkout.
@@ -16729,12 +16922,24 @@ type Mutation {
DEPRECATED: this field will be removed in Saleor 4.0. Use `id` instead.
"""
token: UUID
- ): CheckoutLanguageCodeUpdate @doc(category: "Checkout")
+ ): CheckoutLanguageCodeUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [])
"""
Create new order from existing checkout. Requires the following permissions: AUTHENTICATED_APP and HANDLE_CHECKOUTS.
Added in Saleor 3.2.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ - ORDER_CREATED (async): Triggered when order is created.
+ - NOTIFY_USER (async): A notification for order placement.
+ - NOTIFY_USER (async): A staff notification for order placement.
+ - ORDER_UPDATED (async): Triggered when order received the update after placement.
+ - ORDER_PAID (async): Triggered when newly created order is paid.
+ - ORDER_FULLY_PAID (async): Triggered when newly created order is fully paid.
+ - ORDER_CONFIRMED (async): Optionally triggered when newly created order are automatically marked as confirmed.
"""
orderCreateFromCheckout(
"""ID of a checkout that will be converted to an order."""
@@ -16758,23 +16963,29 @@ type Mutation {
Determines if checkout should be removed after creating an order. Default true.
"""
removeCheckout: Boolean = true
- ): OrderCreateFromCheckout @doc(category: "Orders")
+ ): OrderCreateFromCheckout @doc(category: "Orders") @webhookEventsInfo(asyncEvents: [ORDER_CREATED, NOTIFY_USER, NOTIFY_USER, ORDER_UPDATED, ORDER_PAID, ORDER_FULLY_PAID, ORDER_CONFIRMED], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS, CHECKOUT_CALCULATE_TAXES])
"""
Creates new channel.
Requires one of the following permissions: MANAGE_CHANNELS.
+
+ Triggers the following webhook events:
+ - CHANNEL_CREATED (async): A channel was created.
"""
channelCreate(
"""Fields required to create channel."""
input: ChannelCreateInput!
- ): ChannelCreate @doc(category: "Channels")
+ ): ChannelCreate @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_CREATED], syncEvents: [])
"""
Update a channel.
Requires one of the following permissions: MANAGE_CHANNELS.
Requires one of the following permissions when updating only orderSettings field: MANAGE_CHANNELS, MANAGE_ORDERS.
+
+ Triggers the following webhook events:
+ - CHANNEL_UPDATED (async): A channel was updated.
"""
channelUpdate(
"""ID of a channel to update."""
@@ -16782,12 +16993,15 @@ type Mutation {
"""Fields required to update a channel."""
input: ChannelUpdateInput!
- ): ChannelUpdate @doc(category: "Channels")
+ ): ChannelUpdate @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_UPDATED], syncEvents: [])
"""
Delete a channel. Orders associated with the deleted channel will be moved to the target channel. Checkouts, product availability, and pricing will be removed.
Requires one of the following permissions: MANAGE_CHANNELS.
+
+ Triggers the following webhook events:
+ - CHANNEL_DELETED (async): A channel was deleted.
"""
channelDelete(
"""ID of a channel to delete."""
@@ -16795,27 +17009,33 @@ type Mutation {
"""Fields required to delete a channel."""
input: ChannelDeleteInput
- ): ChannelDelete @doc(category: "Channels")
+ ): ChannelDelete @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_DELETED], syncEvents: [])
"""
Activate a channel.
Requires one of the following permissions: MANAGE_CHANNELS.
+
+ Triggers the following webhook events:
+ - CHANNEL_STATUS_CHANGED (async): A channel was activated.
"""
channelActivate(
"""ID of the channel to activate."""
id: ID!
- ): ChannelActivate @doc(category: "Channels")
+ ): ChannelActivate @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_STATUS_CHANGED], syncEvents: [])
"""
Deactivate a channel.
Requires one of the following permissions: MANAGE_CHANNELS.
+
+ Triggers the following webhook events:
+ - CHANNEL_STATUS_CHANGED (async): A channel was deactivated.
"""
channelDeactivate(
"""ID of the channel to deactivate."""
id: ID!
- ): ChannelDeactivate @doc(category: "Channels")
+ ): ChannelDeactivate @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_STATUS_CHANGED], syncEvents: [])
"""
Reorder the warehouses of a channel.
@@ -16832,16 +17052,24 @@ type Mutation {
moves: [ReorderInput!]!
): ChannelReorderWarehouses @doc(category: "Channels")
- """Creates an attribute."""
+ """
+ Creates an attribute.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_CREATED (async): An attribute was created.
+ """
attributeCreate(
"""Fields required to create an attribute."""
input: AttributeCreateInput!
- ): AttributeCreate @doc(category: "Attributes")
+ ): AttributeCreate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_CREATED], syncEvents: [])
"""
Deletes an attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_DELETED (async): An attribute was deleted.
"""
attributeDelete(
"""
@@ -16853,12 +17081,15 @@ type Mutation {
"""ID of an attribute to delete."""
id: ID
- ): AttributeDelete @doc(category: "Attributes")
+ ): AttributeDelete @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_DELETED], syncEvents: [])
"""
Updates attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
attributeUpdate(
"""
@@ -16873,7 +17104,7 @@ type Mutation {
"""Fields required to update an attribute."""
input: AttributeUpdateInput!
- ): AttributeUpdate @doc(category: "Attributes")
+ ): AttributeUpdate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_UPDATED], syncEvents: [])
"""
Creates/updates translations for an attribute.
@@ -16910,26 +17141,37 @@ type Mutation {
Deletes attributes.
Requires one of the following permissions: MANAGE_PAGE_TYPES_AND_ATTRIBUTES.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_DELETED (async): An attribute was deleted.
"""
attributeBulkDelete(
"""List of attribute IDs to delete."""
ids: [ID!]!
- ): AttributeBulkDelete @doc(category: "Attributes")
+ ): AttributeBulkDelete @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_DELETED], syncEvents: [])
"""
Deletes values of attributes.
Requires one of the following permissions: MANAGE_PAGE_TYPES_AND_ATTRIBUTES.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_VALUE_DELETED (async): An attribute value was deleted.
+ - ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
attributeValueBulkDelete(
"""List of attribute value IDs to delete."""
ids: [ID!]!
- ): AttributeValueBulkDelete @doc(category: "Attributes")
+ ): AttributeValueBulkDelete @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_DELETED, ATTRIBUTE_UPDATED], syncEvents: [])
"""
Creates a value for an attribute.
Requires one of the following permissions: MANAGE_PRODUCTS.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_VALUE_CREATED (async): An attribute value was created.
+ - ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
attributeValueCreate(
"""Attribute to which value will be assigned."""
@@ -16937,12 +17179,16 @@ type Mutation {
"""Fields required to create an AttributeValue."""
input: AttributeValueCreateInput!
- ): AttributeValueCreate @doc(category: "Attributes")
+ ): AttributeValueCreate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_CREATED, ATTRIBUTE_UPDATED], syncEvents: [])
"""
Deletes a value of an attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_VALUE_DELETED (async): An attribute value was deleted.
+ - ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
attributeValueDelete(
"""
@@ -16954,12 +17200,16 @@ type Mutation {
"""ID of a value to delete."""
id: ID
- ): AttributeValueDelete @doc(category: "Attributes")
+ ): AttributeValueDelete @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_DELETED, ATTRIBUTE_UPDATED], syncEvents: [])
"""
Updates value of an attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_VALUE_UPDATED (async): An attribute value was updated.
+ - ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
attributeValueUpdate(
"""
@@ -16974,7 +17224,7 @@ type Mutation {
"""Fields required to update an AttributeValue."""
input: AttributeValueUpdateInput!
- ): AttributeValueUpdate @doc(category: "Attributes")
+ ): AttributeValueUpdate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_UPDATED, ATTRIBUTE_UPDATED], syncEvents: [])
"""
Creates/updates translations for attributes values.
@@ -17011,6 +17261,10 @@ type Mutation {
Reorder the values of an attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+ Triggers the following webhook events:
+ - ATTRIBUTE_VALUE_UPDATED (async): An attribute value was updated.
+ - ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
attributeReorderValues(
"""ID of an attribute."""
@@ -17018,20 +17272,26 @@ type Mutation {
"""The list of reordering operations for given attribute values."""
moves: [ReorderInput!]!
- ): AttributeReorderValues @doc(category: "Attributes")
+ ): AttributeReorderValues @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_UPDATED, ATTRIBUTE_UPDATED], syncEvents: [])
"""
Creates a new app. Requires the following permissions: AUTHENTICATED_STAFF_USER and MANAGE_APPS.
+
+ Triggers the following webhook events:
+ - APP_INSTALLED (async): An app was installed.
"""
appCreate(
"""Fields required to create a new app."""
input: AppInput!
- ): AppCreate @doc(category: "Apps")
+ ): AppCreate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_INSTALLED], syncEvents: [])
"""
Updates an existing app.
Requires one of the following permissions: MANAGE_APPS.
+
+ Triggers the following webhook events:
+ - APP_UPDATED (async): An app was updated.
"""
appUpdate(
"""ID of an app to update."""
@@ -17039,17 +17299,20 @@ type Mutation {
"""Fields required to update an existing app."""
input: AppInput!
- ): AppUpdate @doc(category: "Apps")
+ ): AppUpdate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_UPDATED], syncEvents: [])
"""
Deletes an app.
Requires one of the following permissions: MANAGE_APPS.
+
+ Triggers the following webhook events:
+ - APP_DELETED (async): An app was deleted.
"""
appDelete(
"""ID of an app to delete."""
id: ID!
- ): AppDelete @doc(category: "Apps")
+ ): AppDelete @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_DELETED], syncEvents: [])
"""
Creates a new token.
@@ -17089,6 +17352,9 @@ type Mutation {
Retry failed installation of new app.
Requires one of the following permissions: MANAGE_APPS.
+
+ Triggers the following webhook events:
+ - APP_INSTALLED (async): An app was installed.
"""
appRetryInstall(
"""Determine if app will be set active or not."""
@@ -17096,7 +17362,7 @@ type Mutation {
"""ID of failed installation."""
id: ID!
- ): AppRetryInstall @doc(category: "Apps")
+ ): AppRetryInstall @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_INSTALLED], syncEvents: [])
"""
Delete failed installation.
@@ -17122,21 +17388,27 @@ type Mutation {
Activate the app.
Requires one of the following permissions: MANAGE_APPS.
+
+ Triggers the following webhook events:
+ - APP_STATUS_CHANGED (async): An app was activated.
"""
appActivate(
"""ID of app to activate."""
id: ID!
- ): AppActivate @doc(category: "Apps")
+ ): AppActivate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_STATUS_CHANGED], syncEvents: [])
"""
Deactivate the app.
Requires one of the following permissions: MANAGE_APPS.
+
+ Triggers the following webhook events:
+ - APP_STATUS_CHANGED (async): An app was deactivated.
"""
appDeactivate(
"""ID of app to deactivate."""
id: ID!
- ): AppDeactivate @doc(category: "Apps")
+ ): AppDeactivate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_STATUS_CHANGED], syncEvents: [])
"""Create JWT token."""
tokenCreate(
@@ -17225,7 +17497,12 @@ type Mutation {
pluginId: String!
): ExternalVerify @doc(category: "Authentication")
- """Sends an email with the account password modification link."""
+ """
+ Sends an email with the account password modification link.
+
+ Triggers the following webhook events:
+ - NOTIFY_USER (async): A notification for password reset.
+ """
requestPasswordReset(
"""
Slug of a channel which will be used for notify user. Optional when only one channel exists.
@@ -17239,7 +17516,7 @@ type Mutation {
URL of a view where users should be redirected to reset the password. URL in RFC 1808 format.
"""
redirectUrl: String!
- ): RequestPasswordReset @doc(category: "Users")
+ ): RequestPasswordReset @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: [])
"""Confirm user account with token sent by email during registration."""
confirmAccount(
@@ -17281,6 +17558,9 @@ type Mutation {
Request email change of the logged in user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+ Triggers the following webhook events:
+ - NOTIFY_USER (async): A notification for account email change.
"""
requestEmailChange(
"""
@@ -17298,12 +17578,16 @@ type Mutation {
URL of a view where users should be redirected to update the email address. URL in RFC 1808 format.
"""
redirectUrl: String!
- ): RequestEmailChange @doc(category: "Users")
+ ): RequestEmailChange @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: [])
"""
Confirm the email change of the logged-in user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+ Triggers the following webhook events:
+ - CUSTOMER_UPDATED (async): A customer account was updated.
+ - NOTIFY_USER (async): A notification that account email change was confirmed.
"""
confirmEmailChange(
"""
@@ -17313,12 +17597,16 @@ type Mutation {
"""A one-time token required to change the email."""
token: String!
- ): ConfirmEmailChange @doc(category: "Users")
+ ): ConfirmEmailChange @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, NOTIFY_USER], syncEvents: [])
"""
Create a new address for the customer.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+ Triggers the following webhook events:
+ - CUSTOMER_UPDATED (async): A customer account was updated.
+ - ADDRESS_CREATED (async): An address was created.
"""
accountAddressCreate(
"""Fields required to create address."""
@@ -17328,10 +17616,13 @@ type Mutation {
A type of address. If provided, the new address will be automatically assigned as the customer's default address of that type.
"""
type: AddressTypeEnum
- ): AccountAddressCreate @doc(category: "Users")
+ ): AccountAddressCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, ADDRESS_CREATED], syncEvents: [])
"""
Updates an address of the logged-in user. Requires one of the following permissions: MANAGE_USERS, IS_OWNER.
+
+ Triggers the following webhook events:
+ - ADDRESS_UPDATED (async): An address was updated.
"""
accountAddressUpdate(
"""ID of the address to update."""
@@ -17339,20 +17630,26 @@ type Mutation {
"""Fields required to update the address."""
input: AddressInput!
- ): AccountAddressUpdate @doc(category: "Users")
+ ): AccountAddressUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_UPDATED], syncEvents: [])
"""
Delete an address of the logged-in user. Requires one of the following permissions: MANAGE_USERS, IS_OWNER.
+
+ Triggers the following webhook events:
+ - ADDRESS_DELETED (async): An address was deleted.
"""
accountAddressDelete(
"""ID of the address to delete."""
id: ID!
- ): AccountAddressDelete @doc(category: "Users")
+ ): AccountAddressDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_DELETED], syncEvents: [])
"""
Sets a default address for the authenticated user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+ Triggers the following webhook events:
+ - CUSTOMER_UPDATED (async): A customer's address was updated.
"""
accountSetDefaultAddress(
"""ID of the address to set as default."""
@@ -17360,28 +17657,41 @@ type Mutation {
"""The type of address."""
type: AddressTypeEnum!
- ): AccountSetDefaultAddress @doc(category: "Users")
+ ): AccountSetDefaultAddress @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED], syncEvents: [])
- """Register a new user."""
+ """
+ Register a new user.
+
+ Triggers the following webhook events:
+ - CUSTOMER_CREATED (async): A new customer account was created.
+ - NOTIFY_USER (async): A notification for account confirmation.
+ """
accountRegister(
"""Fields required to create a user."""
input: AccountRegisterInput!
- ): AccountRegister @doc(category: "Users")
+ ): AccountRegister @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, NOTIFY_USER], syncEvents: [])
"""
Updates the account of the logged-in user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+ Triggers the following webhook events:
+ - CUSTOMER_UPDATED (async): A customer account was updated.
+ - CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
"""
accountUpdate(
"""Fields required to update the account of the logged-in user."""
input: AccountInput!
- ): AccountUpdate @doc(category: "Users")
+ ): AccountUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, CUSTOMER_METADATA_UPDATED], syncEvents: [])
"""
Sends an email with the account removal link for the logged-in user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+ Triggers the following webhook events:
+ - NOTIFY_USER (async): A notification for account delete request.
"""
accountRequestDeletion(
"""
@@ -17393,7 +17703,7 @@ type Mutation {
URL of a view where users should be redirected to delete their account. URL in RFC 1808 format.
"""
redirectUrl: String!
- ): AccountRequestDeletion @doc(category: "Users")
+ ): AccountRequestDeletion @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: [])
"""
Remove user account.
@@ -17411,6 +17721,9 @@ type Mutation {
Creates user address.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - ADDRESS_CREATED (async): A new address was created.
"""
addressCreate(
"""Fields required to create address."""
@@ -17418,12 +17731,15 @@ type Mutation {
"""ID of a user to create address for."""
userId: ID!
- ): AddressCreate @doc(category: "Users")
+ ): AddressCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_CREATED], syncEvents: [])
"""
Updates an address.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - ADDRESS_UPDATED (async): An address was updated.
"""
addressUpdate(
"""ID of the address to update."""
@@ -17431,22 +17747,28 @@ type Mutation {
"""Fields required to update the address."""
input: AddressInput!
- ): AddressUpdate @doc(category: "Users")
+ ): AddressUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_UPDATED], syncEvents: [])
"""
Deletes an address.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - ADDRESS_DELETED (async): An address was deleted.
"""
addressDelete(
"""ID of the address to delete."""
id: ID!
- ): AddressDelete @doc(category: "Users")
+ ): AddressDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_DELETED], syncEvents: [])
"""
Sets a default address for the given user.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - CUSTOMER_UPDATED (async): A customer was updated.
"""
addressSetDefault(
"""ID of the address."""
@@ -17457,22 +17779,31 @@ type Mutation {
"""ID of the user to change the address for."""
userId: ID!
- ): AddressSetDefault @doc(category: "Users")
+ ): AddressSetDefault @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED], syncEvents: [])
"""
Creates a new customer.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - CUSTOMER_CREATED (async): A new customer account was created.
+ - CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
+ - NOTIFY_USER (async): A notification for setting the password.
"""
customerCreate(
"""Fields required to create a customer."""
input: UserCreateInput!
- ): CustomerCreate @doc(category: "Users")
+ ): CustomerCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, CUSTOMER_METADATA_UPDATED, NOTIFY_USER], syncEvents: [])
"""
Updates an existing customer.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - CUSTOMER_UPDATED (async): A new customer account was updated.
+ - CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
"""
customerUpdate(
"""
@@ -17487,12 +17818,15 @@ type Mutation {
"""Fields required to update a customer."""
input: CustomerInput!
- ): CustomerUpdate @doc(category: "Users")
+ ): CustomerUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, CUSTOMER_METADATA_UPDATED], syncEvents: [])
"""
Deletes a customer.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - CUSTOMER_DELETED (async): A customer account was deleted.
"""
customerDelete(
"""
@@ -17504,17 +17838,20 @@ type Mutation {
"""ID of a customer to delete."""
id: ID
- ): CustomerDelete @doc(category: "Users")
+ ): CustomerDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_DELETED], syncEvents: [])
"""
Deletes customers.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - CUSTOMER_DELETED (async): A customer account was deleted.
"""
customerBulkDelete(
"""List of user IDs to delete."""
ids: [ID!]!
- ): CustomerBulkDelete @doc(category: "Users")
+ ): CustomerBulkDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_DELETED], syncEvents: [])
"""
Updates customers.
@@ -17524,6 +17861,10 @@ type Mutation {
Note: this API is currently in Feature Preview and can be subject to changes at later point.
Requires one of the following permissions: MANAGE_USERS.
+
+ Triggers the following webhook events:
+ - CUSTOMER_UPDATED (async): A customer account was updated.
+ - CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
"""
customerBulkUpdate(
"""Input list of customers to update."""
@@ -17531,22 +17872,29 @@ type Mutation {
"""Policies of error handling. DEFAULT: REJECT_EVERYTHING"""
errorPolicy: ErrorPolicyEnum
- ): CustomerBulkUpdate @doc(category: "Users")
+ ): CustomerBulkUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, CUSTOMER_METADATA_UPDATED], syncEvents: [])
"""
Creates a new staff user. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+ Triggers the following webhook events:
+ - STAFF_CREATED (async): A new staff account was created.
+ - NOTIFY_USER (async): A notification for setting the password.
"""
staffCreate(
"""Fields required to create a staff user."""
input: StaffCreateInput!
- ): StaffCreate @doc(category: "Users")
+ ): StaffCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [STAFF_CREATED, NOTIFY_USER], syncEvents: [])
"""
Updates an existing staff user. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+ Triggers the following webhook events:
+ - STAFF_UPDATED (async): A staff account was updated.
"""
staffUpdate(
"""ID of a staff user to update."""
@@ -17554,27 +17902,33 @@ type Mutation {
"""Fields required to update a staff user."""
input: StaffUpdateInput!
- ): StaffUpdate @doc(category: "Users")
+ ): StaffUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [STAFF_UPDATED], syncEvents: [])
"""
Deletes a staff user. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+ Triggers the following webhook events:
+ - STAFF_DELETED (async): A staff account was deleted.
"""
staffDelete(
"""ID of a staff user to delete."""
id: ID!
- ): StaffDelete @doc(category: "Users")
+ ): StaffDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [STAFF_DELETED], syncEvents: [])
"""
Deletes staff users. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+ Triggers the following webhook events:
+ - STAFF_DELETED (async): A staff account was deleted.
"""
staffBulkDelete(
"""List of user IDs to delete."""
ids: [ID!]!
- ): StaffBulkDelete @doc(category: "Users")
+ ): StaffBulkDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [STAFF_DELETED], syncEvents: [])
"""
Create a user avatar. Only for staff members. This mutation must be sent as a `multipart` request. More detailed specs of the upload format can be found here: https://github.com/jaydenseric/graphql-multipart-request-spec
@@ -17610,16 +17964,22 @@ type Mutation {
Create new permission group. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+ Triggers the following webhook events:
+ - PERMISSION_GROUP_CREATED (async)
"""
permissionGroupCreate(
"""Input fields to create permission group."""
input: PermissionGroupCreateInput!
- ): PermissionGroupCreate @doc(category: "Users")
+ ): PermissionGroupCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [PERMISSION_GROUP_CREATED], syncEvents: [])
"""
Update permission group. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+ Triggers the following webhook events:
+ - PERMISSION_GROUP_UPDATED (async)
"""
permissionGroupUpdate(
"""ID of the group to update."""
@@ -17627,17 +17987,20 @@ type Mutation {
"""Input fields to create permission group."""
input: PermissionGroupUpdateInput!
- ): PermissionGroupUpdate @doc(category: "Users")
+ ): PermissionGroupUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [PERMISSION_GROUP_UPDATED], syncEvents: [])
"""
Delete permission group. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+ Triggers the following webhook events:
+ - PERMISSION_GROUP_DELETED (async)
"""
permissionGroupDelete(
"""ID of the group to delete."""
id: ID!
- ): PermissionGroupDelete @doc(category: "Users")
+ ): PermissionGroupDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [PERMISSION_GROUP_DELETED], syncEvents: [])
}
"""
@@ -24508,8 +24871,11 @@ input ExternalNotificationTriggerInput {
Creates a new sale.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- SALE_CREATED (async): A sale was created.
"""
-type SaleCreate @doc(category: "Discounts") {
+type SaleCreate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_CREATED], syncEvents: []) {
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [DiscountError!]!
sale: Sale
@@ -24577,8 +24943,11 @@ input SaleInput @doc(category: "Discounts") {
Deletes a sale.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- SALE_DELETED (async): A sale was deleted.
"""
-type SaleDelete @doc(category: "Discounts") {
+type SaleDelete @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_DELETED], syncEvents: []) {
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [DiscountError!]!
sale: Sale
@@ -24588,8 +24957,11 @@ type SaleDelete @doc(category: "Discounts") {
Deletes sales.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- SALE_DELETED (async): A sale was deleted.
"""
-type SaleBulkDelete @doc(category: "Discounts") {
+type SaleBulkDelete @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_DELETED], syncEvents: []) {
"""Returns how many objects were affected."""
count: Int!
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -24600,8 +24972,12 @@ type SaleBulkDelete @doc(category: "Discounts") {
Updates a sale.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- SALE_UPDATED (async): A sale was updated.
+- SALE_TOGGLE (async): Optionally triggered when a sale is started or stopped.
"""
-type SaleUpdate @doc(category: "Discounts") {
+type SaleUpdate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_UPDATED, SALE_TOGGLE], syncEvents: []) {
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [DiscountError!]!
sale: Sale
@@ -24611,8 +24987,11 @@ type SaleUpdate @doc(category: "Discounts") {
Adds products, categories, collections to a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- SALE_UPDATED (async): A sale was updated.
"""
-type SaleAddCatalogues @doc(category: "Discounts") {
+type SaleAddCatalogues @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_UPDATED], syncEvents: []) {
"""Sale of which catalogue IDs will be modified."""
sale: Sale
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -24641,8 +25020,11 @@ input CatalogueInput @doc(category: "Discounts") {
Removes products, categories, collections from a sale.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- SALE_UPDATED (async): A sale was updated.
"""
-type SaleRemoveCatalogues @doc(category: "Discounts") {
+type SaleRemoveCatalogues @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [SALE_UPDATED], syncEvents: []) {
"""Sale of which catalogue IDs will be modified."""
sale: Sale
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -24692,8 +25074,11 @@ input SaleChannelListingAddInput @doc(category: "Discounts") {
Creates a new voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- VOUCHER_CREATED (async): A voucher was created.
"""
-type VoucherCreate @doc(category: "Discounts") {
+type VoucherCreate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_CREATED], syncEvents: []) {
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [DiscountError!]!
voucher: Voucher
@@ -24757,8 +25142,11 @@ input VoucherInput @doc(category: "Discounts") {
Deletes a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- VOUCHER_DELETED (async): A voucher was deleted.
"""
-type VoucherDelete @doc(category: "Discounts") {
+type VoucherDelete @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_DELETED], syncEvents: []) {
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [DiscountError!]!
voucher: Voucher
@@ -24768,8 +25156,11 @@ type VoucherDelete @doc(category: "Discounts") {
Deletes vouchers.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- VOUCHER_DELETED (async): A voucher was deleted.
"""
-type VoucherBulkDelete @doc(category: "Discounts") {
+type VoucherBulkDelete @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_DELETED], syncEvents: []) {
"""Returns how many objects were affected."""
count: Int!
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -24780,8 +25171,11 @@ type VoucherBulkDelete @doc(category: "Discounts") {
Updates a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- VOUCHER_UPDATED (async): A voucher was updated.
"""
-type VoucherUpdate @doc(category: "Discounts") {
+type VoucherUpdate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_UPDATED], syncEvents: []) {
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [DiscountError!]!
voucher: Voucher
@@ -24791,8 +25185,11 @@ type VoucherUpdate @doc(category: "Discounts") {
Adds products, categories, collections to a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- VOUCHER_UPDATED (async): A voucher was updated.
"""
-type VoucherAddCatalogues @doc(category: "Discounts") {
+type VoucherAddCatalogues @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_UPDATED], syncEvents: []) {
"""Voucher of which catalogue IDs will be modified."""
voucher: Voucher
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -24803,8 +25200,11 @@ type VoucherAddCatalogues @doc(category: "Discounts") {
Removes products, categories, collections from a voucher.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- VOUCHER_UPDATED (async): A voucher was updated.
"""
-type VoucherRemoveCatalogues @doc(category: "Discounts") {
+type VoucherRemoveCatalogues @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_UPDATED], syncEvents: []) {
"""Voucher of which catalogue IDs will be modified."""
voucher: Voucher
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -24826,8 +25226,11 @@ type VoucherTranslate @doc(category: "Discounts") {
Manage voucher's availability in channels.
Requires one of the following permissions: MANAGE_DISCOUNTS.
+
+Triggers the following webhook events:
+- VOUCHER_UPDATED (async): A voucher was updated.
"""
-type VoucherChannelListingUpdate @doc(category: "Discounts") {
+type VoucherChannelListingUpdate @doc(category: "Discounts") @webhookEventsInfo(asyncEvents: [VOUCHER_UPDATED], syncEvents: []) {
"""An updated voucher instance."""
voucher: Voucher
discountErrors: [DiscountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -24857,8 +25260,11 @@ input VoucherChannelListingAddInput @doc(category: "Discounts") {
Export products to csv file.
Requires one of the following permissions: MANAGE_PRODUCTS.
+
+Triggers the following webhook events:
+- NOTIFY_USER (async): A notification for the exported file.
"""
-type ExportProducts @doc(category: "Products") {
+type ExportProducts @doc(category: "Products") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: []) {
"""
The newly created export file job which is responsible for export data.
"""
@@ -24957,8 +25363,11 @@ Export gift cards to csv file.
Added in Saleor 3.1.
Requires one of the following permissions: MANAGE_GIFT_CARD.
+
+Triggers the following webhook events:
+- NOTIFY_USER (async): A notification for the exported file.
"""
-type ExportGiftCards @doc(category: "Gift cards") {
+type ExportGiftCards @doc(category: "Gift cards") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: []) {
"""
The newly created export file job which is responsible for export data.
"""
@@ -25009,8 +25418,13 @@ enum UploadErrorCode {
GRAPHQL_ERROR
}
-"""Adds a gift card or a voucher to a checkout."""
-type CheckoutAddPromoCode @doc(category: "Checkout") {
+"""
+Adds a gift card or a voucher to a checkout.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutAddPromoCode @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""The checkout with the added gift card or voucher."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25071,8 +25485,13 @@ enum CheckoutErrorCode @doc(category: "Checkout") {
INACTIVE_PAYMENT
}
-"""Update billing address in the existing checkout."""
-type CheckoutBillingAddressUpdate @doc(category: "Checkout") {
+"""
+Update billing address in the existing checkout.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutBillingAddressUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25098,8 +25517,20 @@ input CheckoutAddressValidationRules @doc(category: "Checkout") {
"""
Completes the checkout. As a result a new order is created and a payment charge is made. This action requires a successful payment before it can be performed. In case additional confirmation step as 3D secure is required confirmationNeeded flag will be set to True and no order created until payment is confirmed with second call of this mutation.
-"""
-type CheckoutComplete @doc(category: "Checkout") {
+
+Triggers the following webhook events:
+- SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+- CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+- CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+- ORDER_CREATED (async): Triggered when order is created.
+- NOTIFY_USER (async): A notification for order placement.
+- NOTIFY_USER (async): A staff notification for order placement.
+- ORDER_UPDATED (async): Triggered when order received the update after placement.
+- ORDER_PAID (async): Triggered when newly created order is paid.
+- ORDER_FULLY_PAID (async): Triggered when newly created order is fully paid.
+- ORDER_CONFIRMED (async): Optionally triggered when newly created order are automatically marked as confirmed.
+"""
+type CheckoutComplete @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [ORDER_CREATED, NOTIFY_USER, NOTIFY_USER, ORDER_UPDATED, ORDER_PAID, ORDER_FULLY_PAID, ORDER_CONFIRMED], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS, CHECKOUT_CALCULATE_TAXES]) {
"""Placed order."""
order: Order
@@ -25114,8 +25545,13 @@ type CheckoutComplete @doc(category: "Checkout") {
errors: [CheckoutError!]!
}
-"""Create a new checkout."""
-type CheckoutCreate @doc(category: "Checkout") {
+"""
+Create a new checkout.
+
+Triggers the following webhook events:
+- CHECKOUT_CREATED (async): A checkout was created.
+"""
+type CheckoutCreate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_CREATED], syncEvents: []) {
"""
Whether the checkout was created or the current active one was returned. Refer to checkoutLinesAdd and checkoutLinesUpdate to merge a cart with an active checkout.
"""
@@ -25263,8 +25699,11 @@ enum CheckoutCreateFromOrderErrorCode @doc(category: "Checkout") {
Sets the customer as the owner of the checkout.
Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_USER.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
"""
-type CheckoutCustomerAttach @doc(category: "Checkout") {
+type CheckoutCustomerAttach @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25275,32 +25714,50 @@ type CheckoutCustomerAttach @doc(category: "Checkout") {
Removes the user assigned as the owner of the checkout.
Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_USER.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
"""
-type CheckoutCustomerDetach @doc(category: "Checkout") {
+type CheckoutCustomerDetach @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [CheckoutError!]!
}
-"""Updates email address in the existing checkout object."""
-type CheckoutEmailUpdate @doc(category: "Checkout") {
+"""
+Updates email address in the existing checkout object.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutEmailUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [CheckoutError!]!
}
-"""Deletes a CheckoutLine."""
-type CheckoutLineDelete @doc(category: "Checkout") {
+"""
+Deletes a CheckoutLine.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutLineDelete @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [CheckoutError!]!
}
-"""Deletes checkout lines."""
-type CheckoutLinesDelete @doc(category: "Checkout") {
+"""
+Deletes checkout lines.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutLinesDelete @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
errors: [CheckoutError!]!
@@ -25308,16 +25765,24 @@ type CheckoutLinesDelete @doc(category: "Checkout") {
"""
Adds a checkout line to the existing checkout.If line was already in checkout, its quantity will be increased.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
"""
-type CheckoutLinesAdd @doc(category: "Checkout") {
+type CheckoutLinesAdd @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [CheckoutError!]!
}
-"""Updates checkout line in the existing checkout."""
-type CheckoutLinesUpdate @doc(category: "Checkout") {
+"""
+Updates checkout line in the existing checkout.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutLinesUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25352,8 +25817,13 @@ input CheckoutLineUpdateInput @doc(category: "Checkout") {
lineId: ID
}
-"""Remove a gift card or a voucher from a checkout."""
-type CheckoutRemovePromoCode @doc(category: "Checkout") {
+"""
+Remove a gift card or a voucher from a checkout.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutRemovePromoCode @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""The checkout with the removed gift card or voucher."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25421,16 +25891,27 @@ enum StorePaymentMethodEnum @doc(category: "Payments") {
NONE
}
-"""Update shipping address in the existing checkout."""
-type CheckoutShippingAddressUpdate @doc(category: "Checkout") {
+"""
+Update shipping address in the existing checkout.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutShippingAddressUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [CheckoutError!]!
}
-"""Updates the shipping method of the checkout."""
-type CheckoutShippingMethodUpdate @doc(category: "Checkout") {
+"""
+Updates the shipping method of the checkout.
+
+Triggers the following webhook events:
+- SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Triggered when updating the checkout shipping method with the external one.
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutShippingMethodUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT]) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25441,15 +25922,24 @@ type CheckoutShippingMethodUpdate @doc(category: "Checkout") {
Updates the delivery method (shipping method or pick up point) of the checkout.
Added in Saleor 3.1.
+
+Triggers the following webhook events:
+- SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Triggered when updating the checkout delivery method with the external one.
+- CHECKOUT_UPDATED (async): A checkout was updated.
"""
-type CheckoutDeliveryMethodUpdate @doc(category: "Checkout") {
+type CheckoutDeliveryMethodUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT]) {
"""An updated checkout."""
checkout: Checkout
errors: [CheckoutError!]!
}
-"""Update language code in the existing checkout."""
-type CheckoutLanguageCodeUpdate @doc(category: "Checkout") {
+"""
+Update language code in the existing checkout.
+
+Triggers the following webhook events:
+- CHECKOUT_UPDATED (async): A checkout was updated.
+"""
+type CheckoutLanguageCodeUpdate @doc(category: "Checkout") @webhookEventsInfo(asyncEvents: [CHECKOUT_UPDATED], syncEvents: []) {
"""An updated checkout."""
checkout: Checkout
checkoutErrors: [CheckoutError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25460,8 +25950,20 @@ type CheckoutLanguageCodeUpdate @doc(category: "Checkout") {
Create new order from existing checkout. Requires the following permissions: AUTHENTICATED_APP and HANDLE_CHECKOUTS.
Added in Saleor 3.2.
-"""
-type OrderCreateFromCheckout @doc(category: "Orders") {
+
+Triggers the following webhook events:
+- SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+- CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+- CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+- ORDER_CREATED (async): Triggered when order is created.
+- NOTIFY_USER (async): A notification for order placement.
+- NOTIFY_USER (async): A staff notification for order placement.
+- ORDER_UPDATED (async): Triggered when order received the update after placement.
+- ORDER_PAID (async): Triggered when newly created order is paid.
+- ORDER_FULLY_PAID (async): Triggered when newly created order is fully paid.
+- ORDER_CONFIRMED (async): Optionally triggered when newly created order are automatically marked as confirmed.
+"""
+type OrderCreateFromCheckout @doc(category: "Orders") @webhookEventsInfo(asyncEvents: [ORDER_CREATED, NOTIFY_USER, NOTIFY_USER, ORDER_UPDATED, ORDER_PAID, ORDER_FULLY_PAID, ORDER_CONFIRMED], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS, CHECKOUT_CALCULATE_TAXES]) {
"""Placed order."""
order: Order
errors: [OrderCreateFromCheckoutError!]!
@@ -25508,8 +26010,11 @@ enum OrderCreateFromCheckoutErrorCode @doc(category: "Orders") {
Creates new channel.
Requires one of the following permissions: MANAGE_CHANNELS.
+
+Triggers the following webhook events:
+- CHANNEL_CREATED (async): A channel was created.
"""
-type ChannelCreate @doc(category: "Channels") {
+type ChannelCreate @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_CREATED], syncEvents: []) {
channelErrors: [ChannelError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [ChannelError!]!
channel: Channel
@@ -25654,8 +26159,11 @@ Update a channel.
Requires one of the following permissions: MANAGE_CHANNELS.
Requires one of the following permissions when updating only orderSettings field: MANAGE_CHANNELS, MANAGE_ORDERS.
+
+Triggers the following webhook events:
+- CHANNEL_UPDATED (async): A channel was updated.
"""
-type ChannelUpdate @doc(category: "Channels") {
+type ChannelUpdate @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_UPDATED], syncEvents: []) {
channelErrors: [ChannelError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [ChannelError!]!
channel: Channel
@@ -25717,8 +26225,11 @@ input ChannelUpdateInput @doc(category: "Channels") {
Delete a channel. Orders associated with the deleted channel will be moved to the target channel. Checkouts, product availability, and pricing will be removed.
Requires one of the following permissions: MANAGE_CHANNELS.
+
+Triggers the following webhook events:
+- CHANNEL_DELETED (async): A channel was deleted.
"""
-type ChannelDelete @doc(category: "Channels") {
+type ChannelDelete @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_DELETED], syncEvents: []) {
channelErrors: [ChannelError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [ChannelError!]!
channel: Channel
@@ -25733,8 +26244,11 @@ input ChannelDeleteInput @doc(category: "Channels") {
Activate a channel.
Requires one of the following permissions: MANAGE_CHANNELS.
+
+Triggers the following webhook events:
+- CHANNEL_STATUS_CHANGED (async): A channel was activated.
"""
-type ChannelActivate @doc(category: "Channels") {
+type ChannelActivate @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_STATUS_CHANGED], syncEvents: []) {
"""Activated channel."""
channel: Channel
channelErrors: [ChannelError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25745,8 +26259,11 @@ type ChannelActivate @doc(category: "Channels") {
Deactivate a channel.
Requires one of the following permissions: MANAGE_CHANNELS.
+
+Triggers the following webhook events:
+- CHANNEL_STATUS_CHANGED (async): A channel was deactivated.
"""
-type ChannelDeactivate @doc(category: "Channels") {
+type ChannelDeactivate @doc(category: "Channels") @webhookEventsInfo(asyncEvents: [CHANNEL_STATUS_CHANGED], syncEvents: []) {
"""Deactivated channel."""
channel: Channel
channelErrors: [ChannelError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -25766,8 +26283,13 @@ type ChannelReorderWarehouses @doc(category: "Channels") {
errors: [ChannelError!]!
}
-"""Creates an attribute."""
-type AttributeCreate @doc(category: "Attributes") {
+"""
+Creates an attribute.
+
+Triggers the following webhook events:
+- ATTRIBUTE_CREATED (async): An attribute was created.
+"""
+type AttributeCreate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_CREATED], syncEvents: []) {
attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AttributeError!]!
@@ -25902,8 +26424,11 @@ input AttributeValueCreateInput @doc(category: "Attributes") {
Deletes an attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+Triggers the following webhook events:
+- ATTRIBUTE_DELETED (async): An attribute was deleted.
"""
-type AttributeDelete @doc(category: "Attributes") {
+type AttributeDelete @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_DELETED], syncEvents: []) {
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AttributeError!]!
attribute: Attribute
@@ -25913,8 +26438,11 @@ type AttributeDelete @doc(category: "Attributes") {
Updates attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+Triggers the following webhook events:
+- ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
-type AttributeUpdate @doc(category: "Attributes") {
+type AttributeUpdate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_UPDATED], syncEvents: []) {
attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AttributeError!]!
@@ -26092,8 +26620,11 @@ input AttributeBulkTranslateInput @doc(category: "Attributes") {
Deletes attributes.
Requires one of the following permissions: MANAGE_PAGE_TYPES_AND_ATTRIBUTES.
+
+Triggers the following webhook events:
+- ATTRIBUTE_DELETED (async): An attribute was deleted.
"""
-type AttributeBulkDelete @doc(category: "Attributes") {
+type AttributeBulkDelete @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_DELETED], syncEvents: []) {
"""Returns how many objects were affected."""
count: Int!
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26104,8 +26635,12 @@ type AttributeBulkDelete @doc(category: "Attributes") {
Deletes values of attributes.
Requires one of the following permissions: MANAGE_PAGE_TYPES_AND_ATTRIBUTES.
+
+Triggers the following webhook events:
+- ATTRIBUTE_VALUE_DELETED (async): An attribute value was deleted.
+- ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
-type AttributeValueBulkDelete @doc(category: "Attributes") {
+type AttributeValueBulkDelete @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_DELETED, ATTRIBUTE_UPDATED], syncEvents: []) {
"""Returns how many objects were affected."""
count: Int!
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26116,8 +26651,12 @@ type AttributeValueBulkDelete @doc(category: "Attributes") {
Creates a value for an attribute.
Requires one of the following permissions: MANAGE_PRODUCTS.
+
+Triggers the following webhook events:
+- ATTRIBUTE_VALUE_CREATED (async): An attribute value was created.
+- ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
-type AttributeValueCreate @doc(category: "Attributes") {
+type AttributeValueCreate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_CREATED, ATTRIBUTE_UPDATED], syncEvents: []) {
"""The updated attribute."""
attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26129,8 +26668,12 @@ type AttributeValueCreate @doc(category: "Attributes") {
Deletes a value of an attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+Triggers the following webhook events:
+- ATTRIBUTE_VALUE_DELETED (async): An attribute value was deleted.
+- ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
-type AttributeValueDelete @doc(category: "Attributes") {
+type AttributeValueDelete @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_DELETED, ATTRIBUTE_UPDATED], syncEvents: []) {
"""The updated attribute."""
attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26142,8 +26685,12 @@ type AttributeValueDelete @doc(category: "Attributes") {
Updates value of an attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+Triggers the following webhook events:
+- ATTRIBUTE_VALUE_UPDATED (async): An attribute value was updated.
+- ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
-type AttributeValueUpdate @doc(category: "Attributes") {
+type AttributeValueUpdate @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_UPDATED, ATTRIBUTE_UPDATED], syncEvents: []) {
"""The updated attribute."""
attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26241,8 +26788,12 @@ type AttributeValueTranslate @doc(category: "Attributes") {
Reorder the values of an attribute.
Requires one of the following permissions: MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.
+
+Triggers the following webhook events:
+- ATTRIBUTE_VALUE_UPDATED (async): An attribute value was updated.
+- ATTRIBUTE_UPDATED (async): An attribute was updated.
"""
-type AttributeReorderValues @doc(category: "Attributes") {
+type AttributeReorderValues @doc(category: "Attributes") @webhookEventsInfo(asyncEvents: [ATTRIBUTE_VALUE_UPDATED, ATTRIBUTE_UPDATED], syncEvents: []) {
"""Attribute from which values are reordered."""
attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26251,8 +26802,11 @@ type AttributeReorderValues @doc(category: "Attributes") {
"""
Creates a new app. Requires the following permissions: AUTHENTICATED_STAFF_USER and MANAGE_APPS.
+
+Triggers the following webhook events:
+- APP_INSTALLED (async): An app was installed.
"""
-type AppCreate @doc(category: "Apps") {
+type AppCreate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_INSTALLED], syncEvents: []) {
"""The newly created authentication token."""
authToken: String
appErrors: [AppError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26307,8 +26861,11 @@ input AppInput @doc(category: "Apps") {
Updates an existing app.
Requires one of the following permissions: MANAGE_APPS.
+
+Triggers the following webhook events:
+- APP_UPDATED (async): An app was updated.
"""
-type AppUpdate @doc(category: "Apps") {
+type AppUpdate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_UPDATED], syncEvents: []) {
appErrors: [AppError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AppError!]!
app: App
@@ -26318,8 +26875,11 @@ type AppUpdate @doc(category: "Apps") {
Deletes an app.
Requires one of the following permissions: MANAGE_APPS.
+
+Triggers the following webhook events:
+- APP_DELETED (async): An app was deleted.
"""
-type AppDelete @doc(category: "Apps") {
+type AppDelete @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_DELETED], syncEvents: []) {
appErrors: [AppError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AppError!]!
app: App
@@ -26392,8 +26952,11 @@ input AppInstallInput @doc(category: "Apps") {
Retry failed installation of new app.
Requires one of the following permissions: MANAGE_APPS.
+
+Triggers the following webhook events:
+- APP_INSTALLED (async): An app was installed.
"""
-type AppRetryInstall @doc(category: "Apps") {
+type AppRetryInstall @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_INSTALLED], syncEvents: []) {
appErrors: [AppError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AppError!]!
appInstallation: AppInstallation
@@ -26617,8 +27180,11 @@ type AppManifestBrandLogo @doc(category: "Apps") {
Activate the app.
Requires one of the following permissions: MANAGE_APPS.
+
+Triggers the following webhook events:
+- APP_STATUS_CHANGED (async): An app was activated.
"""
-type AppActivate @doc(category: "Apps") {
+type AppActivate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_STATUS_CHANGED], syncEvents: []) {
appErrors: [AppError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AppError!]!
app: App
@@ -26628,8 +27194,11 @@ type AppActivate @doc(category: "Apps") {
Deactivate the app.
Requires one of the following permissions: MANAGE_APPS.
+
+Triggers the following webhook events:
+- APP_STATUS_CHANGED (async): An app was deactivated.
"""
-type AppDeactivate @doc(category: "Apps") {
+type AppDeactivate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_STATUS_CHANGED], syncEvents: []) {
appErrors: [AppError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AppError!]!
app: App
@@ -26815,8 +27384,13 @@ type ExternalVerify @doc(category: "Authentication") {
errors: [AccountError!]!
}
-"""Sends an email with the account password modification link."""
-type RequestPasswordReset @doc(category: "Users") {
+"""
+Sends an email with the account password modification link.
+
+Triggers the following webhook events:
+- NOTIFY_USER (async): A notification for password reset.
+"""
+type RequestPasswordReset @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: []) {
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
}
@@ -26864,8 +27438,11 @@ type PasswordChange @doc(category: "Users") {
Request email change of the logged in user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+Triggers the following webhook events:
+- NOTIFY_USER (async): A notification for account email change.
"""
-type RequestEmailChange @doc(category: "Users") {
+type RequestEmailChange @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: []) {
"""A user instance."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26876,8 +27453,12 @@ type RequestEmailChange @doc(category: "Users") {
Confirm the email change of the logged-in user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+Triggers the following webhook events:
+- CUSTOMER_UPDATED (async): A customer account was updated.
+- NOTIFY_USER (async): A notification that account email change was confirmed.
"""
-type ConfirmEmailChange @doc(category: "Users") {
+type ConfirmEmailChange @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, NOTIFY_USER], syncEvents: []) {
"""A user instance with a new email."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26888,8 +27469,12 @@ type ConfirmEmailChange @doc(category: "Users") {
Create a new address for the customer.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+Triggers the following webhook events:
+- CUSTOMER_UPDATED (async): A customer account was updated.
+- ADDRESS_CREATED (async): An address was created.
"""
-type AccountAddressCreate @doc(category: "Users") {
+type AccountAddressCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, ADDRESS_CREATED], syncEvents: []) {
"""A user instance for which the address was created."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26899,8 +27484,11 @@ type AccountAddressCreate @doc(category: "Users") {
"""
Updates an address of the logged-in user. Requires one of the following permissions: MANAGE_USERS, IS_OWNER.
+
+Triggers the following webhook events:
+- ADDRESS_UPDATED (async): An address was updated.
"""
-type AccountAddressUpdate @doc(category: "Users") {
+type AccountAddressUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_UPDATED], syncEvents: []) {
"""A user object for which the address was edited."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26910,8 +27498,11 @@ type AccountAddressUpdate @doc(category: "Users") {
"""
Delete an address of the logged-in user. Requires one of the following permissions: MANAGE_USERS, IS_OWNER.
+
+Triggers the following webhook events:
+- ADDRESS_DELETED (async): An address was deleted.
"""
-type AccountAddressDelete @doc(category: "Users") {
+type AccountAddressDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_DELETED], syncEvents: []) {
"""A user instance for which the address was deleted."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26923,16 +27514,25 @@ type AccountAddressDelete @doc(category: "Users") {
Sets a default address for the authenticated user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+Triggers the following webhook events:
+- CUSTOMER_UPDATED (async): A customer's address was updated.
"""
-type AccountSetDefaultAddress @doc(category: "Users") {
+type AccountSetDefaultAddress @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED], syncEvents: []) {
"""An updated user instance."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
}
-"""Register a new user."""
-type AccountRegister @doc(category: "Users") {
+"""
+Register a new user.
+
+Triggers the following webhook events:
+- CUSTOMER_CREATED (async): A new customer account was created.
+- NOTIFY_USER (async): A notification for account confirmation.
+"""
+type AccountRegister @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, NOTIFY_USER], syncEvents: []) {
"""Informs whether users need to confirm their email address."""
requiresConfirmation: Boolean
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -26973,8 +27573,12 @@ input AccountRegisterInput @doc(category: "Users") {
Updates the account of the logged-in user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+Triggers the following webhook events:
+- CUSTOMER_UPDATED (async): A customer account was updated.
+- CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
"""
-type AccountUpdate @doc(category: "Users") {
+type AccountUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, CUSTOMER_METADATA_UPDATED], syncEvents: []) {
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
user: User
@@ -27009,8 +27613,11 @@ input AccountInput @doc(category: "Users") {
Sends an email with the account removal link for the logged-in user.
Requires one of the following permissions: AUTHENTICATED_USER.
+
+Triggers the following webhook events:
+- NOTIFY_USER (async): A notification for account delete request.
"""
-type AccountRequestDeletion @doc(category: "Users") {
+type AccountRequestDeletion @doc(category: "Users") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: []) {
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
}
@@ -27030,8 +27637,11 @@ type AccountDelete @doc(category: "Users") {
Creates user address.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- ADDRESS_CREATED (async): A new address was created.
"""
-type AddressCreate @doc(category: "Users") {
+type AddressCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_CREATED], syncEvents: []) {
"""A user instance for which the address was created."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -27043,8 +27653,11 @@ type AddressCreate @doc(category: "Users") {
Updates an address.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- ADDRESS_UPDATED (async): An address was updated.
"""
-type AddressUpdate @doc(category: "Users") {
+type AddressUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_UPDATED], syncEvents: []) {
"""A user object for which the address was edited."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -27056,8 +27669,11 @@ type AddressUpdate @doc(category: "Users") {
Deletes an address.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- ADDRESS_DELETED (async): An address was deleted.
"""
-type AddressDelete @doc(category: "Users") {
+type AddressDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [ADDRESS_DELETED], syncEvents: []) {
"""A user instance for which the address was deleted."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -27069,8 +27685,11 @@ type AddressDelete @doc(category: "Users") {
Sets a default address for the given user.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- CUSTOMER_UPDATED (async): A customer was updated.
"""
-type AddressSetDefault @doc(category: "Users") {
+type AddressSetDefault @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED], syncEvents: []) {
"""An updated user instance."""
user: User
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -27081,8 +27700,13 @@ type AddressSetDefault @doc(category: "Users") {
Creates a new customer.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- CUSTOMER_CREATED (async): A new customer account was created.
+- CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
+- NOTIFY_USER (async): A notification for setting the password.
"""
-type CustomerCreate @doc(category: "Users") {
+type CustomerCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_CREATED, CUSTOMER_METADATA_UPDATED, NOTIFY_USER], syncEvents: []) {
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
user: User
@@ -27149,8 +27773,12 @@ input UserCreateInput @doc(category: "Users") {
Updates an existing customer.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- CUSTOMER_UPDATED (async): A new customer account was updated.
+- CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
"""
-type CustomerUpdate @doc(category: "Users") {
+type CustomerUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, CUSTOMER_METADATA_UPDATED], syncEvents: []) {
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
user: User
@@ -27207,8 +27835,11 @@ input CustomerInput @doc(category: "Users") {
Deletes a customer.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- CUSTOMER_DELETED (async): A customer account was deleted.
"""
-type CustomerDelete @doc(category: "Users") {
+type CustomerDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_DELETED], syncEvents: []) {
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [AccountError!]!
user: User
@@ -27218,8 +27849,11 @@ type CustomerDelete @doc(category: "Users") {
Deletes customers.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- CUSTOMER_DELETED (async): A customer account was deleted.
"""
-type CustomerBulkDelete @doc(category: "Users") {
+type CustomerBulkDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_DELETED], syncEvents: []) {
"""Returns how many objects were affected."""
count: Int!
accountErrors: [AccountError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -27234,8 +27868,12 @@ Added in Saleor 3.13.
Note: this API is currently in Feature Preview and can be subject to changes at later point.
Requires one of the following permissions: MANAGE_USERS.
+
+Triggers the following webhook events:
+- CUSTOMER_UPDATED (async): A customer account was updated.
+- CUSTOMER_METADATA_UPDATED (async): Optionally called when customer's metadata was updated.
"""
-type CustomerBulkUpdate @doc(category: "Users") {
+type CustomerBulkUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [CUSTOMER_UPDATED, CUSTOMER_METADATA_UPDATED], syncEvents: []) {
"""Returns how many objects were created."""
count: Int!
@@ -27292,8 +27930,12 @@ input CustomerBulkUpdateInput @doc(category: "Users") {
Creates a new staff user. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+Triggers the following webhook events:
+- STAFF_CREATED (async): A new staff account was created.
+- NOTIFY_USER (async): A notification for setting the password.
"""
-type StaffCreate @doc(category: "Users") {
+type StaffCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [STAFF_CREATED, NOTIFY_USER], syncEvents: []) {
staffErrors: [StaffError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [StaffError!]!
user: User
@@ -27368,8 +28010,11 @@ input StaffCreateInput @doc(category: "Users") {
Updates an existing staff user. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+Triggers the following webhook events:
+- STAFF_UPDATED (async): A staff account was updated.
"""
-type StaffUpdate @doc(category: "Users") {
+type StaffUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [STAFF_UPDATED], syncEvents: []) {
staffErrors: [StaffError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [StaffError!]!
user: User
@@ -27417,8 +28062,11 @@ input StaffUpdateInput @doc(category: "Users") {
Deletes a staff user. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+Triggers the following webhook events:
+- STAFF_DELETED (async): A staff account was deleted.
"""
-type StaffDelete @doc(category: "Users") {
+type StaffDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [STAFF_DELETED], syncEvents: []) {
staffErrors: [StaffError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [StaffError!]!
user: User
@@ -27428,8 +28076,11 @@ type StaffDelete @doc(category: "Users") {
Deletes staff users. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+Triggers the following webhook events:
+- STAFF_DELETED (async): A staff account was deleted.
"""
-type StaffBulkDelete @doc(category: "Users") {
+type StaffBulkDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [STAFF_DELETED], syncEvents: []) {
"""Returns how many objects were affected."""
count: Int!
staffErrors: [StaffError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
@@ -27476,8 +28127,11 @@ type UserBulkSetActive @doc(category: "Users") {
Create new permission group. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+Triggers the following webhook events:
+- PERMISSION_GROUP_CREATED (async)
"""
-type PermissionGroupCreate @doc(category: "Users") {
+type PermissionGroupCreate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [PERMISSION_GROUP_CREATED], syncEvents: []) {
permissionGroupErrors: [PermissionGroupError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [PermissionGroupError!]!
group: Group
@@ -27551,8 +28205,11 @@ input PermissionGroupCreateInput @doc(category: "Users") {
Update permission group. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+Triggers the following webhook events:
+- PERMISSION_GROUP_UPDATED (async)
"""
-type PermissionGroupUpdate @doc(category: "Users") {
+type PermissionGroupUpdate @doc(category: "Users") @webhookEventsInfo(asyncEvents: [PERMISSION_GROUP_UPDATED], syncEvents: []) {
permissionGroupErrors: [PermissionGroupError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [PermissionGroupError!]!
group: Group
@@ -27606,8 +28263,11 @@ input PermissionGroupUpdateInput @doc(category: "Users") {
Delete permission group. Apps are not allowed to perform this mutation.
Requires one of the following permissions: MANAGE_STAFF.
+
+Triggers the following webhook events:
+- PERMISSION_GROUP_DELETED (async)
"""
-type PermissionGroupDelete @doc(category: "Users") {
+type PermissionGroupDelete @doc(category: "Users") @webhookEventsInfo(asyncEvents: [PERMISSION_GROUP_DELETED], syncEvents: []) {
permissionGroupErrors: [PermissionGroupError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")
errors: [PermissionGroupError!]!
group: Group
diff --git a/saleor/graphql/schema_printer.py b/saleor/graphql/schema_printer.py
index b72b9b6851..24f375dc7f 100644
--- a/saleor/graphql/schema_printer.py
+++ b/saleor/graphql/schema_printer.py
@@ -24,6 +24,8 @@ from graphql.utils.ast_from_value import ast_from_value
__all__ = ["print_schema", "print_introspection_schema", "print_type"]
+from ..webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
+
def is_specified_directive(directive: GraphQLDirective) -> bool:
return directive.name in ("skip", "include", "deprecated")
@@ -118,12 +120,39 @@ def is_schema_of_common_names(schema: GraphQLSchema) -> bool:
return not subscription_type or subscription_type.name == "Subscription"
-def print_object_directives(type_) -> str:
+def print_object_directives_for_category(type_) -> str:
doc_category = getattr(type_.graphene_type, "doc_category", None)
return f' @doc(category: "{doc_category}")' if doc_category else ""
-def print_field_directives(field, name) -> str:
+def print_object_directvie_for_webhook_events_info(type_) -> str:
+ webhook_events_info = getattr(type_.graphene_type, "webhook_events_info", None)
+
+ if not webhook_events_info:
+ return ""
+
+ async_events = []
+ sync_events = []
+ for event in webhook_events_info:
+ if event.type in WebhookEventAsyncType.ALL:
+ async_events.append(event.type.upper())
+ if event.type in WebhookEventSyncType.ALL:
+ sync_events.append(event.type.upper())
+ async_events_str = ", ".join(async_events)
+ sync_events_str = ", ".join(sync_events)
+ return (
+ f" @webhookEventsInfo(asyncEvents: [{async_events_str}], syncEvents: "
+ f"[{sync_events_str}])"
+ )
+
+
+def print_object_directives(type_) -> str:
+ directive = print_object_directives_for_category(type_)
+ directive += print_object_directvie_for_webhook_events_info(type_)
+ return directive
+
+
+def print_field_directives_for_category(field, name) -> str:
# Get doc_category for `type Query` fields.
doc_category = getattr(field.resolver, "doc_category", None)
@@ -134,6 +163,41 @@ def print_field_directives(field, name) -> str:
return f' @doc(category: "{doc_category}")' if doc_category else ""
+def print_field_directives_for_webhook_events_info(field, name) -> str:
+ webhook_events_info = getattr(field.resolver, "webhook_events_info", None)
+
+ if not webhook_events_info and hasattr(field.type, "graphene_type"):
+ webhook_events_info = getattr(
+ field.type.graphene_type, "webhook_events_info", None
+ )
+
+ if not webhook_events_info:
+ return ""
+
+ async_events = []
+ sync_events = []
+ for event in webhook_events_info:
+ if event.type in WebhookEventAsyncType.ALL:
+ async_events.append(event.type.upper())
+ if event.type in WebhookEventSyncType.ALL:
+ sync_events.append(event.type.upper())
+ async_events_str = ", ".join(async_events)
+ sync_events_str = ", ".join(sync_events)
+
+ return (
+ f" @webhookEventsInfo(asyncEvents: [{async_events_str}], syncEvents: "
+ f"[{sync_events_str}])"
+ )
+
+
+def print_field_directives(field, name, include_doc_category: bool = True) -> str:
+ directive = ""
+ if include_doc_category:
+ directive = print_field_directives_for_category(field, name)
+ directive += print_field_directives_for_webhook_events_info(field, name)
+ return directive
+
+
def print_type(type_: GraphQLNamedType) -> str:
if isinstance(type_, GraphQLScalarType):
type_ = type_
@@ -168,13 +232,13 @@ def print_implemented_interfaces(type_: GraphQLObjectType) -> str:
def print_object(type_: GrapheneObjectType) -> str:
- include_field_directives = type_.name in ["Mutation", "Query"]
+ include_doc_category_directives = type_.name in ["Mutation", "Query"]
return (
print_description(type_)
+ f"type {type_.name}"
+ print_implemented_interfaces(type_)
+ print_object_directives(type_)
- + print_fields(type_, include_field_directives)
+ + print_fields(type_, include_doc_category_directives)
)
@@ -218,14 +282,14 @@ def print_input_object(type_: GraphQLInputObjectType) -> str:
def print_fields(
type_: Union[GraphQLObjectType, GraphQLInterfaceType],
- include_field_directives: bool = True,
+ include_doc_category_directives: bool = True,
) -> str:
fields = [
print_description(field, " ", not i)
+ f" {name}"
+ print_args(field.args, " ")
+ f": {field.type}"
- + (print_field_directives(field, name) if include_field_directives else "")
+ + print_field_directives(field, name, include_doc_category_directives)
+ print_deprecated(field.deprecation_reason)
for i, (name, field) in enumerate(type_.fields.items())
]