Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add webhook description to menu's mutations (#13371)
Maciej Korycinski932633dfc348
diff --git a/saleor/graphql/menu/bulk_mutations/menu_bulk_delete.py b/saleor/graphql/menu/bulk_mutations/menu_bulk_delete.pyindex cbfcb0c459..1fd4488411 100644--- a/saleor/graphql/menu/bulk_mutations/menu_bulk_delete.py+++ b/saleor/graphql/menu/bulk_mutations/menu_bulk_delete.py@@ -2,9 +2,11 @@ import graphenefrom ....menu import modelsfrom ....permission.enums import MenuPermissions+from ....webhook.event_types import WebhookEventAsyncTypefrom ...core import ResolveInfofrom ...core.mutations import ModelBulkDeleteMutationfrom ...core.types import MenuError, NonNullList+from ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import Menu@@ -22,6 +24,12 @@ class MenuBulkDelete(ModelBulkDeleteMutation):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_DELETED,+ description="A menu was deleted.",+ ),+ ]@classmethoddef bulk_action(cls, info: ResolveInfo, queryset, /):diff --git a/saleor/graphql/menu/bulk_mutations/menu_item_bulk_delete.py b/saleor/graphql/menu/bulk_mutations/menu_item_bulk_delete.pyindex 1cd9e0c5ef..1ccab1d7ae 100644--- a/saleor/graphql/menu/bulk_mutations/menu_item_bulk_delete.py+++ b/saleor/graphql/menu/bulk_mutations/menu_item_bulk_delete.py@@ -2,9 +2,11 @@ import graphenefrom ....menu import modelsfrom ....permission.enums import MenuPermissions+from ....webhook.event_types import WebhookEventAsyncTypefrom ...core import ResolveInfofrom ...core.mutations import ModelBulkDeleteMutationfrom ...core.types import MenuError, NonNullList+from ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import MenuItem@@ -22,6 +24,12 @@ class MenuItemBulkDelete(ModelBulkDeleteMutation):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_ITEM_DELETED,+ description="A menu item was deleted.",+ ),+ ]@classmethoddef bulk_action(cls, info: ResolveInfo, queryset, /):diff --git a/saleor/graphql/menu/mutations/menu_create.py b/saleor/graphql/menu/mutations/menu_create.pyindex 7a5b055a54..cd362e43a9 100644--- a/saleor/graphql/menu/mutations/menu_create.py+++ b/saleor/graphql/menu/mutations/menu_create.py@@ -4,10 +4,12 @@ from django.core.exceptions import ValidationErrorfrom ....menu import modelsfrom ....menu.error_codes import MenuErrorCodefrom ....permission.enums import MenuPermissions+from ....webhook.event_types import WebhookEventAsyncTypefrom ...channel import ChannelContextfrom ...core import ResolveInfofrom ...core.mutations import ModelMutationfrom ...core.types import MenuError, NonNullList+from ...core.utils import WebhookEventInfofrom ...core.validators import validate_slug_and_generate_if_neededfrom ...page.types import Pagefrom ...plugins.dataloaders import get_plugin_manager_promise@@ -38,6 +40,12 @@ class MenuCreate(ModelMutation):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_CREATED,+ description="A menu was created.",+ ),+ ]@classmethoddef clean_input(cls, info: ResolveInfo, instance, data, **kwargs):diff --git a/saleor/graphql/menu/mutations/menu_delete.py b/saleor/graphql/menu/mutations/menu_delete.pyindex 1a8d430c9f..a56eb3645c 100644--- a/saleor/graphql/menu/mutations/menu_delete.py+++ b/saleor/graphql/menu/mutations/menu_delete.py@@ -2,10 +2,12 @@ import graphenefrom ....menu import modelsfrom ....permission.enums import MenuPermissions+from ....webhook.event_types import WebhookEventAsyncTypefrom ...channel import ChannelContextfrom ...core import ResolveInfofrom ...core.mutations import ModelDeleteMutationfrom ...core.types import MenuError+from ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import Menu@@ -21,6 +23,12 @@ class MenuDelete(ModelDeleteMutation):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_DELETED,+ description="A menu was deleted.",+ ),+ ]@classmethoddef post_save_action(cls, info: ResolveInfo, instance, cleaned_input):diff --git a/saleor/graphql/menu/mutations/menu_item_create.py b/saleor/graphql/menu/mutations/menu_item_create.pyindex 59d5b6fe21..ef2b98e796 100644--- a/saleor/graphql/menu/mutations/menu_item_create.py+++ b/saleor/graphql/menu/mutations/menu_item_create.py@@ -9,10 +9,12 @@ from ....menu.error_codes import MenuErrorCodefrom ....page import models as page_modelsfrom ....permission.enums import MenuPermissionsfrom ....product import models as product_models+from ....webhook.event_types import WebhookEventAsyncTypefrom ...channel import ChannelContextfrom ...core import ResolveInfofrom ...core.mutations import ModelMutationfrom ...core.types import MenuError+from ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import MenuItem@@ -57,6 +59,12 @@ class MenuItemCreate(ModelMutation):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_ITEM_CREATED,+ description="A menu item was created.",+ ),+ ]@classmethoddef post_save_action(cls, info: ResolveInfo, instance, cleaned_input):diff --git a/saleor/graphql/menu/mutations/menu_item_delete.py b/saleor/graphql/menu/mutations/menu_item_delete.pyindex d150137648..80a01602a0 100644--- a/saleor/graphql/menu/mutations/menu_item_delete.py+++ b/saleor/graphql/menu/mutations/menu_item_delete.py@@ -2,10 +2,12 @@ import graphenefrom ....menu import modelsfrom ....permission.enums import MenuPermissions+from ....webhook.event_types import WebhookEventAsyncTypefrom ...channel import ChannelContextfrom ...core import ResolveInfofrom ...core.mutations import ModelDeleteMutationfrom ...core.types import MenuError+from ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import MenuItem@@ -21,6 +23,12 @@ class MenuItemDelete(ModelDeleteMutation):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_ITEM_DELETED,+ description="A menu item was deleted.",+ ),+ ]@classmethoddef post_save_action(cls, info: ResolveInfo, instance, cleaned_input):diff --git a/saleor/graphql/menu/mutations/menu_item_move.py b/saleor/graphql/menu/mutations/menu_item_move.pyindex bc4caf2104..b585e67a0b 100644--- a/saleor/graphql/menu/mutations/menu_item_move.py+++ b/saleor/graphql/menu/mutations/menu_item_move.py@@ -8,11 +8,13 @@ from ....core.tracing import traced_atomic_transactionfrom ....menu import modelsfrom ....menu.error_codes import MenuErrorCodefrom ....permission.enums import MenuPermissions+from ....webhook.event_types import WebhookEventAsyncTypefrom ...channel import ChannelContextfrom ...core import ResolveInfofrom ...core.doc_category import DOC_CATEGORY_MENUfrom ...core.mutations import BaseMutationfrom ...core.types import MenuError, NonNullList+from ...core.utils import WebhookEventInfofrom ...core.utils.reordering import perform_reorderingfrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..dataloaders import MenuItemsByParentMenuLoader@@ -42,6 +44,15 @@ class MenuItemMove(BaseMutation):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_ITEM_UPDATED,+ description=(+ "Optionally triggered when sort order or parent changed for "+ "menu item."+ ),+ ),+ ]@classmethoddef success_response(cls, instance):diff --git a/saleor/graphql/menu/mutations/menu_item_update.py b/saleor/graphql/menu/mutations/menu_item_update.pyindex 7e912736e3..fc711499f2 100644--- a/saleor/graphql/menu/mutations/menu_item_update.py+++ b/saleor/graphql/menu/mutations/menu_item_update.py@@ -2,8 +2,10 @@ import graphenefrom ....menu import modelsfrom ....permission.enums import MenuPermissions+from ....webhook.event_types import WebhookEventAsyncTypefrom ...core import ResolveInfofrom ...core.types import MenuError+from ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import MenuItemfrom .menu_item_create import MenuItemCreate, MenuItemInput@@ -27,6 +29,12 @@ class MenuItemUpdate(MenuItemCreate):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_ITEM_UPDATED,+ description="A menu item was updated.",+ ),+ ]@classmethoddef construct_instance(cls, instance, cleaned_data):diff --git a/saleor/graphql/menu/mutations/menu_update.py b/saleor/graphql/menu/mutations/menu_update.pyindex ae985b3e23..cc4bee256c 100644--- a/saleor/graphql/menu/mutations/menu_update.py+++ b/saleor/graphql/menu/mutations/menu_update.py@@ -2,10 +2,12 @@ import graphenefrom ....menu import modelsfrom ....permission.enums import MenuPermissions+from ....webhook.event_types import WebhookEventAsyncTypefrom ...channel import ChannelContextfrom ...core import ResolveInfofrom ...core.mutations import ModelMutationfrom ...core.types import MenuError+from ...core.utils import WebhookEventInfofrom ...plugins.dataloaders import get_plugin_manager_promisefrom ..types import Menu@@ -29,6 +31,12 @@ class MenuUpdate(ModelMutation):permissions = (MenuPermissions.MANAGE_MENUS,)error_type_class = MenuErrorerror_type_field = "menu_errors"+ webhook_events_info = [+ WebhookEventInfo(+ type=WebhookEventAsyncType.MENU_UPDATED,+ description="A menu was updated.",+ ),+ ]@classmethoddef post_save_action(cls, info: ResolveInfo, instance, cleaned_input):diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 1244c80539..1e7db44f5f 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -15807,36 +15807,48 @@ type Mutation {Creates a new Menu.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_CREATED (async): A menu was created."""menuCreate("""Fields required to create a menu."""input: MenuCreateInput!- ): MenuCreate @doc(category: "Menu")+ ): MenuCreate @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_CREATED], syncEvents: [])"""Deletes a menu.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_DELETED (async): A menu was deleted."""menuDelete("""ID of a menu to delete."""id: ID!- ): MenuDelete @doc(category: "Menu")+ ): MenuDelete @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_DELETED], syncEvents: [])"""Deletes menus.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_DELETED (async): A menu was deleted."""menuBulkDelete("""List of menu IDs to delete."""ids: [ID!]!- ): MenuBulkDelete @doc(category: "Menu")+ ): MenuBulkDelete @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_DELETED], syncEvents: [])"""Updates a menu.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_UPDATED (async): A menu was updated."""menuUpdate("""ID of a menu to update."""@@ -15844,44 +15856,56 @@ type Mutation {"""Fields required to update a menu."""input: MenuInput!- ): MenuUpdate @doc(category: "Menu")+ ): MenuUpdate @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_UPDATED], syncEvents: [])"""Creates a new menu item.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_ITEM_CREATED (async): A menu item was created."""menuItemCreate("""Fields required to update a menu item. Only one of `url`, `category`, `page`, `collection` is allowed per item."""input: MenuItemCreateInput!- ): MenuItemCreate @doc(category: "Menu")+ ): MenuItemCreate @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_CREATED], syncEvents: [])"""Deletes a menu item.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_ITEM_DELETED (async): A menu item was deleted."""menuItemDelete("""ID of a menu item to delete."""id: ID!- ): MenuItemDelete @doc(category: "Menu")+ ): MenuItemDelete @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_DELETED], syncEvents: [])"""Deletes menu items.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_ITEM_DELETED (async): A menu item was deleted."""menuItemBulkDelete("""List of menu item IDs to delete."""ids: [ID!]!- ): MenuItemBulkDelete @doc(category: "Menu")+ ): MenuItemBulkDelete @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_DELETED], syncEvents: [])"""Updates a menu item.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_ITEM_UPDATED (async): A menu item was updated."""menuItemUpdate("""ID of a menu item to update."""@@ -15891,7 +15915,7 @@ type Mutation {Fields required to update a menu item. Only one of `url`, `category`, `page`, `collection` is allowed per item."""input: MenuItemInput!- ): MenuItemUpdate @doc(category: "Menu")+ ): MenuItemUpdate @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_UPDATED], syncEvents: [])"""Creates/updates translations for a menu item.@@ -15911,6 +15935,9 @@ type Mutation {Moves items of menus.Requires one of the following permissions: MANAGE_MENUS.++ Triggers the following webhook events:+ - MENU_ITEM_UPDATED (async): Optionally triggered when sort order or parent changed for menu item."""menuItemMove("""ID of the menu."""@@ -15918,7 +15945,7 @@ type Mutation {"""The menu position data."""moves: [MenuItemMoveInput!]!- ): MenuItemMove @doc(category: "Menu")+ ): MenuItemMove @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_UPDATED], syncEvents: [])"""Request an invoice for the order using plugin.@@ -24315,8 +24342,11 @@ enum NavigationType {Creates a new Menu.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_CREATED (async): A menu was created."""-type MenuCreate @doc(category: "Menu") {+type MenuCreate @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_CREATED], syncEvents: []) {menuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")errors: [MenuError!]!menu: Menu@@ -24354,8 +24384,11 @@ input MenuItemInput {Deletes a menu.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_DELETED (async): A menu was deleted."""-type MenuDelete @doc(category: "Menu") {+type MenuDelete @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_DELETED], syncEvents: []) {menuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")errors: [MenuError!]!menu: Menu@@ -24365,8 +24398,11 @@ type MenuDelete @doc(category: "Menu") {Deletes menus.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_DELETED (async): A menu was deleted."""-type MenuBulkDelete @doc(category: "Menu") {+type MenuBulkDelete @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_DELETED], syncEvents: []) {"""Returns how many objects were affected."""count: Int!menuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")@@ -24377,8 +24413,11 @@ type MenuBulkDelete @doc(category: "Menu") {Updates a menu.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_UPDATED (async): A menu was updated."""-type MenuUpdate @doc(category: "Menu") {+type MenuUpdate @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_UPDATED], syncEvents: []) {menuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")errors: [MenuError!]!menu: Menu@@ -24396,8 +24435,11 @@ input MenuInput {Creates a new menu item.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_ITEM_CREATED (async): A menu item was created."""-type MenuItemCreate @doc(category: "Menu") {+type MenuItemCreate @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_CREATED], syncEvents: []) {menuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")errors: [MenuError!]!menuItem: MenuItem@@ -24430,8 +24472,11 @@ input MenuItemCreateInput {Deletes a menu item.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_ITEM_DELETED (async): A menu item was deleted."""-type MenuItemDelete @doc(category: "Menu") {+type MenuItemDelete @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_DELETED], syncEvents: []) {menuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")errors: [MenuError!]!menuItem: MenuItem@@ -24441,8 +24486,11 @@ type MenuItemDelete @doc(category: "Menu") {Deletes menu items.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_ITEM_DELETED (async): A menu item was deleted."""-type MenuItemBulkDelete @doc(category: "Menu") {+type MenuItemBulkDelete @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_DELETED], syncEvents: []) {"""Returns how many objects were affected."""count: Int!menuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")@@ -24453,8 +24501,11 @@ type MenuItemBulkDelete @doc(category: "Menu") {Updates a menu item.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_ITEM_UPDATED (async): A menu item was updated."""-type MenuItemUpdate @doc(category: "Menu") {+type MenuItemUpdate @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_UPDATED], syncEvents: []) {menuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")errors: [MenuError!]!menuItem: MenuItem@@ -24475,8 +24526,11 @@ type MenuItemTranslate @doc(category: "Menu") {Moves items of menus.Requires one of the following permissions: MANAGE_MENUS.++Triggers the following webhook events:+- MENU_ITEM_UPDATED (async): Optionally triggered when sort order or parent changed for menu item."""-type MenuItemMove @doc(category: "Menu") {+type MenuItemMove @doc(category: "Menu") @webhookEventsInfo(asyncEvents: [MENU_ITEM_UPDATED], syncEvents: []) {"""Assigned menu to move within."""menu: MenumenuErrors: [MenuError!]! @deprecated(reason: "This field will be removed in Saleor 4.0. Use `errors` field instead.")