From 69dfe126775cc0ebf8e3fadbfc3c4622eceb9648 Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi Date: Sun, 11 Oct 2020 23:56:16 +0300 Subject: [PATCH 1/9] ISSUE-7987: The topic "Company team mutations" has been created --- src/_data/toc/graphql.yml | 17 + src/_includes/graphql/company-team.md | 7 + .../mutations/company-team-mutations.md | 384 ++++++++++++++++++ 3 files changed, 408 insertions(+) create mode 100644 src/_includes/graphql/company-team.md create mode 100644 src/guides/v2.4/graphql/mutations/company-team-mutations.md diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index 64ebd69cc0b..b51b7df6322 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -185,6 +185,23 @@ pages: - label: changeCustomerPassword mutation url: /graphql/mutations/change-customer-password.html + - label: companyTeam mutations + url: /graphql/mutations/company-team-mutations.html + edition: ee-only + exclude_versions: ["2.3"] + children: + - label: createCompanyTeam mutation + url: /graphql/mutations/company-team-mutations.html#createcompanyteam-mutation + + - label: updateCompanyTeam mutation + url: /graphql/mutations/company-team-mutations.html#updatecompanyteam-mutation + + - label: deleteCompanyTeam mutation + url: /graphql/mutations/company-team-mutations.html#deletecompanyteam-mutation + + - label: updateCompanyStructure mutation + url: /graphql/mutations/company-team-mutations.html#updatecompanystructure-mutation + - label: copyProductsToWishlist mutation url: /graphql/mutations/copy-products-to-wishlist.html edition: ee-only diff --git a/src/_includes/graphql/company-team.md b/src/_includes/graphql/company-team.md new file mode 100644 index 00000000000..78fff75c476 --- /dev/null +++ b/src/_includes/graphql/company-team.md @@ -0,0 +1,7 @@ +The `CompanyTeam` object contains details about a company team. It contains the following attributes. + +Attribute | Data Type | Description +--- | --- | --- +`name` | String | Team name. +`description` | String | Team description. +`id` | ID | A string that contains the encoded team id. diff --git a/src/guides/v2.4/graphql/mutations/company-team-mutations.md b/src/guides/v2.4/graphql/mutations/company-team-mutations.md new file mode 100644 index 00000000000..9a42f52a40b --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/company-team-mutations.md @@ -0,0 +1,384 @@ +--- +group: graphql +title: Company Team mutations +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +Use these mutations to manage the structure of the company teams. + +The main mutations for this provided below: + +* [createCompanyTeam mutation](#createcompanyteam-mutation) + +* [updateCompanyTeam mutation](#updatecompanyteam-mutation) + +* [deleteCompanyTeam mutation](#deletecompanyteam-mutation) + +* [updateCompanyStructure mutation](#updatecompanystructure-mutation) + +## createCompanyTeam mutation + +Use this mutation to create a new team for your company. + +### Syntax + +```graphql +mutation { + createCompanyTeam( + input: CompanyTeamCreateInput! + ) { + CreateCompanyTeamOutput + } +} +``` + +### Example usage + +The following example shows the minimal payload for adding a new team to a customer's company. + +**Request:** + +```graphql +mutation { + createCompanyTeam( + input: { + name: "Test Team" + } + ) { + team { + id + name + description + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "createCompanyTeam": { + "team": { + "id": "MQ==", + "name": "Test Team", + "description": null + } + } + } +} +``` + +In the next example, the team will be created in the parent team assigned from `target_id` field. + +**Request:** + +```graphql +mutation { + createCompanyTeam( + input: { + name: "Test Child Team" + description: "Test Child Team description" + target_id: "MQ==" + } + ) { + team { + id + name + description + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "createCompanyTeam": { + "team": { + "id": "Mg==", + "name": "Test Child Team", + "description": "Test Child Team description" + } + } + } +} +``` + +### Input attributes + +The `CompanyTeamCreateInput` input object defines the company team data. + +#### CompanyTeamCreateInput attributes {#CompanyTeamCreateInput} + +The `CompanyTeamCreateInput` object contains the following attributes: + +Attribute | Data Type | Description +--- | --- | --- +`name` | String! | Team Name. This is required attribute. +`description` | String | Team Description. +`target_id` | ID | A target structure element ID within a company's structure for a team to be assigned to. + +### Output attributes + +The `CreateCompanyTeamOutput` output object contains the following attribute: + +Attribute | Data Type | Description +--- | --- | --- +`team` | CompanyTeam! | Contains the company team data. + +#### CompanyTeam attributes {#CompanyTeam} + +{% include graphql/company-team.md %} + +## updateCompanyTeam mutation + +Use this mutation to update the company team data. + +### Syntax + +```graphql +mutation { + updateCompanyTeam( + input: CompanyTeamUpdateInput! + ) { + UpdateCompanyTeamOutput + } +} +``` + +### Example usage + +The following example shows how to update a team data of the customer's company. + +**Request:** + +```graphql +mutation { + updateCompanyTeam( + input: { + name: "My Test Team" + description: "My Test Team description" + id: "MQ==" + } + ) { + team { + id + name + description + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "updateCompanyTeam": { + "team": { + "id": "MQ==", + "name": "My Test Team", + "description": "My Test Team description" + } + } + } +} +``` + +### Input attributes + +The `CompanyTeamUpdateInput` input object defines the company team data. + +#### CompanyTeamUpdateInput attributes {#CompanyTeamUpdateInput} + +The `CompanyTeamUpdateInput` object contains the following attributes: + +Attribute | Data Type | Description +--- | --- | --- +`id` | ID! | The encoded team id for updating. This is required attribute. +`name` | String | Team Name. +`description` | String | Team Description. + +### Output attributes + +The `UpdateCompanyTeamOutput` output object contains the following attribute: + +Attribute | Data Type | Description +--- | --- | --- +`team` | [CompanyTeam!](#CompanyTeam) | Contains the company team data. + +## deleteCompanyTeam mutation + +Use this mutation to delete a company team by ID. + +### Syntax + +```graphql +mutation { + deleteCompanyTeam( + id: ID! + ) { + DeleteCompanyTeamOutput + } +} +``` + +### Example usage + +The following example shows how to delete a team of the customer's company. + +**Request:** + +```graphql +mutation { + deleteCompanyTeam( + id: "Mg==" + ) { + success + } +} +``` + +**Response:** + +```json +{ + "data": { + "deleteCompanyTeam": { + "success": true + } + } +} +``` + +### Input attributes + +The `deleteCompanyTeam` mutation requires the following input: + +Attribute | Data Type | Description +--- | --- | --- +`id` | ID! | The encoded team id to delete. + +You can get the team id using GraphQl query `company` + +### Output attributes + +The `deleteCompanyTeam` mutation returns a Boolean value that indicates whether the operation was successful. + +## updateCompanyStructure mutation + +Use this mutation to update the company structure element's parent node assignment. + +### Syntax + +```graphql +mutation { + updateCompanyStructure( + input: CompanyStructureUpdateInput! + ) { + UpdateCompanyStructureOutput + } +} +``` + +### Example usage + +The following example shows how to update the customer's company structure. + +**Request:** + +```graphql +mutation { + updateCompanyStructure( + input: { + tree_id: "Mw==" + parent_tree_id: "MQ==" + } + ) { + company { + structure( + rootId: "MQ==" + ) { + items { + id + parent_id + entity { + ... on CompanyTeam { + name + id + description + } + } + } + } + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "updateCompanyStructure": { + "company": { + "structure": { + "items": [ + { + "id": "MQ==", + "parent_id": "MA==", + "entity": {} + }, + { + "id": "Mg==", + "parent_id": "MQ==", + "entity": { + "name": "Test Team", + "id": "MQ==", + "description": "Test Team description" + } + }, + { + "id": "Mw==", + "parent_id": "Mg==", + "entity": { + "name": "Test Child Team", + "id": "Mg==", + "description": "Test Child Team dexription" + } + } + ] + } + } + } + } +} +``` + +### Input attributes + +The `CompanyStructureUpdateInput` input object defines the company team data. + +#### CompanyStructureUpdateInput attributes {#CompanyStructureUpdateInput} + +The `CompanyStructureUpdateInput` object contains the following attributes: + +Attribute | Data Type | Description +--- | --- | --- +`tree_id` | ID! | Company Structure element's hierarchical ID that is being moved to another parent. Required. +`parent_tree_id` | ID! | A target parent element tree ID within a Company's Structure. Required. + +### Output attributes + +The `UpdateCompanyStructureOutput` output object contains the following attribute: + +Attribute | Data Type | Description +--- | --- | --- +`company` | [Company!](#company-link-from-company-query) | Contains the company data. From ff2ca73d138e4312166bcfa01b3213efb3d4c2d8 Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi Date: Mon, 12 Oct 2020 18:50:02 +0300 Subject: [PATCH 2/9] ISSUE-7987: Fixes according to reviewer proposal --- src/_includes/graphql/company-team.md | 2 +- .../v2.4/graphql/mutations/company-team-mutations.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/_includes/graphql/company-team.md b/src/_includes/graphql/company-team.md index 78fff75c476..95be100d005 100644 --- a/src/_includes/graphql/company-team.md +++ b/src/_includes/graphql/company-team.md @@ -4,4 +4,4 @@ Attribute | Data Type | Description --- | --- | --- `name` | String | Team name. `description` | String | Team description. -`id` | ID | A string that contains the encoded team id. +`id` | ID! | A string that contains the encoded team id. diff --git a/src/guides/v2.4/graphql/mutations/company-team-mutations.md b/src/guides/v2.4/graphql/mutations/company-team-mutations.md index 9a42f52a40b..a49bb532269 100644 --- a/src/guides/v2.4/graphql/mutations/company-team-mutations.md +++ b/src/guides/v2.4/graphql/mutations/company-team-mutations.md @@ -120,7 +120,7 @@ The `CompanyTeamCreateInput` object contains the following attributes: Attribute | Data Type | Description --- | --- | --- `name` | String! | Team Name. This is required attribute. -`description` | String | Team Description. +`description` | String | Team description. `target_id` | ID | A target structure element ID within a company's structure for a team to be assigned to. ### Output attributes @@ -201,9 +201,9 @@ The `CompanyTeamUpdateInput` object contains the following attributes: Attribute | Data Type | Description --- | --- | --- -`id` | ID! | The encoded team id for updating. This is required attribute. -`name` | String | Team Name. -`description` | String | Team Description. +`id` | ID! | The encoded team ID for updating. This is required attribute. +`name` | String | Team name. +`description` | String | Team description. ### Output attributes @@ -263,7 +263,7 @@ The `deleteCompanyTeam` mutation requires the following input: Attribute | Data Type | Description --- | --- | --- -`id` | ID! | The encoded team id to delete. +`id` | ID! | The encoded team ID to delete. You can get the team id using GraphQl query `company` @@ -372,7 +372,7 @@ The `CompanyStructureUpdateInput` object contains the following attributes: Attribute | Data Type | Description --- | --- | --- -`tree_id` | ID! | Company Structure element's hierarchical ID that is being moved to another parent. Required. +`tree_id` | ID! | Company structure element's hierarchical ID that is being moved to another parent. Required. `parent_tree_id` | ID! | A target parent element tree ID within a Company's Structure. Required. ### Output attributes From ccdafeb62f12123b7fd5b763056cccb8e3ccfe53 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Wed, 14 Oct 2020 20:53:50 -0500 Subject: [PATCH 3/9] Update company-team.md --- src/_includes/graphql/company-team.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_includes/graphql/company-team.md b/src/_includes/graphql/company-team.md index 95be100d005..cb2f3135a3a 100644 --- a/src/_includes/graphql/company-team.md +++ b/src/_includes/graphql/company-team.md @@ -2,6 +2,6 @@ The `CompanyTeam` object contains details about a company team. It contains the Attribute | Data Type | Description --- | --- | --- -`name` | String | Team name. -`description` | String | Team description. -`id` | ID! | A string that contains the encoded team id. +`name` | String | The display name of the team +`description` | String | An optional description of the team +`id` | ID! | A string that contains the encoded team ID From 6da38d609c47d7e51e5a812214294c3a93a2766b Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Wed, 14 Oct 2020 21:23:03 -0500 Subject: [PATCH 4/9] Update company-team-mutations.md --- .../mutations/company-team-mutations.md | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/guides/v2.4/graphql/mutations/company-team-mutations.md b/src/guides/v2.4/graphql/mutations/company-team-mutations.md index a49bb532269..80d146dda2f 100644 --- a/src/guides/v2.4/graphql/mutations/company-team-mutations.md +++ b/src/guides/v2.4/graphql/mutations/company-team-mutations.md @@ -19,7 +19,7 @@ The main mutations for this provided below: ## createCompanyTeam mutation -Use this mutation to create a new team for your company. +Use the `createCompanyTeam` mutation to create a new team for your company. ### Syntax @@ -71,7 +71,7 @@ mutation { } ``` -In the next example, the team will be created in the parent team assigned from `target_id` field. +This example creates a child team of the parent team specified in the `target_id` field. **Request:** @@ -119,9 +119,9 @@ The `CompanyTeamCreateInput` object contains the following attributes: Attribute | Data Type | Description --- | --- | --- -`name` | String! | Team Name. This is required attribute. -`description` | String | Team description. -`target_id` | ID | A target structure element ID within a company's structure for a team to be assigned to. +`description` | String | An optional description of the team +`name` | String! | The display name of the team +`target_id` | ID | The ID of a node within a company's structure. This ID will be the parent of the created team ### Output attributes @@ -129,7 +129,7 @@ The `CreateCompanyTeamOutput` output object contains the following attribute: Attribute | Data Type | Description --- | --- | --- -`team` | CompanyTeam! | Contains the company team data. +`team` | CompanyTeam! | Contains company team data #### CompanyTeam attributes {#CompanyTeam} @@ -137,7 +137,7 @@ Attribute | Data Type | Description ## updateCompanyTeam mutation -Use this mutation to update the company team data. +Use the `updateCompanyTeam` mutation to update the company team data. ### Syntax @@ -153,7 +153,7 @@ mutation { ### Example usage -The following example shows how to update a team data of the customer's company. +The following example updates the name and description of a company team. **Request:** @@ -201,9 +201,9 @@ The `CompanyTeamUpdateInput` object contains the following attributes: Attribute | Data Type | Description --- | --- | --- -`id` | ID! | The encoded team ID for updating. This is required attribute. -`name` | String | Team name. -`description` | String | Team description. +`description` | String | An optional description of the team +`id` | ID! | The encoded team ID for updating +`name` | String | The display name of the team ### Output attributes @@ -211,11 +211,12 @@ The `UpdateCompanyTeamOutput` output object contains the following attribute: Attribute | Data Type | Description --- | --- | --- -`team` | [CompanyTeam!](#CompanyTeam) | Contains the company team data. +`team` | [CompanyTeam!](#CompanyTeam) | Contains company team data ## deleteCompanyTeam mutation -Use this mutation to delete a company team by ID. +Use the `deleteCompanyTeam` mutation to delete a company team by ID. You can get the team ID with the [`company` query]({{page.baseurl}}/graphql/queries/company.html). + ### Syntax @@ -231,7 +232,7 @@ mutation { ### Example usage -The following example shows how to delete a team of the customer's company. +The following example deletes the specified team. **Request:** @@ -263,9 +264,7 @@ The `deleteCompanyTeam` mutation requires the following input: Attribute | Data Type | Description --- | --- | --- -`id` | ID! | The encoded team ID to delete. - -You can get the team id using GraphQl query `company` +`id` | ID! | The encoded team ID to delete ### Output attributes @@ -273,7 +272,7 @@ The `deleteCompanyTeam` mutation returns a Boolean value that indicates whether ## updateCompanyStructure mutation -Use this mutation to update the company structure element's parent node assignment. +Use the `updateCompanyStructure` mutation to change the parent node of a company team. ### Syntax @@ -372,8 +371,8 @@ The `CompanyStructureUpdateInput` object contains the following attributes: Attribute | Data Type | Description --- | --- | --- -`tree_id` | ID! | Company structure element's hierarchical ID that is being moved to another parent. Required. -`parent_tree_id` | ID! | A target parent element tree ID within a Company's Structure. Required. +`parent_tree_id` | ID! | The ID of a company that will be the new parent +`tree_id` | ID! | The ID of the company team that is being moved to another parent ### Output attributes @@ -381,4 +380,4 @@ The `UpdateCompanyStructureOutput` output object contains the following attribut Attribute | Data Type | Description --- | --- | --- -`company` | [Company!](#company-link-from-company-query) | Contains the company data. +`company` | [Company!](#company-link-from-company-query) | Contains company data From 173f11c009f507c5982163e55211a7068210aa02 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Wed, 14 Oct 2020 21:24:01 -0500 Subject: [PATCH 5/9] Update company-team.md --- src/_includes/graphql/company-team.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_includes/graphql/company-team.md b/src/_includes/graphql/company-team.md index cb2f3135a3a..74b6616d0c7 100644 --- a/src/_includes/graphql/company-team.md +++ b/src/_includes/graphql/company-team.md @@ -2,6 +2,6 @@ The `CompanyTeam` object contains details about a company team. It contains the Attribute | Data Type | Description --- | --- | --- -`name` | String | The display name of the team `description` | String | An optional description of the team `id` | ID! | A string that contains the encoded team ID +`name` | String | The display name of the team From d4c491738dba794d5220b8e74428bf0cbdbfe3b3 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Wed, 14 Oct 2020 21:34:04 -0500 Subject: [PATCH 6/9] Update company-team-mutations.md --- src/guides/v2.4/graphql/mutations/company-team-mutations.md | 1 - 1 file changed, 1 deletion(-) diff --git a/src/guides/v2.4/graphql/mutations/company-team-mutations.md b/src/guides/v2.4/graphql/mutations/company-team-mutations.md index 80d146dda2f..1c9914d9fde 100644 --- a/src/guides/v2.4/graphql/mutations/company-team-mutations.md +++ b/src/guides/v2.4/graphql/mutations/company-team-mutations.md @@ -217,7 +217,6 @@ Attribute | Data Type | Description Use the `deleteCompanyTeam` mutation to delete a company team by ID. You can get the team ID with the [`company` query]({{page.baseurl}}/graphql/queries/company.html). - ### Syntax ```graphql From 91fed997fc70efba0ab1ec0b5f54722e95effeb7 Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi Date: Thu, 15 Oct 2020 20:55:43 +0300 Subject: [PATCH 7/9] ISSUE-7987: Small fixes - separating the topics; - adding the links --- src/_data/toc/graphql.yml | 27 +- .../mutations/company-team-mutations.md | 382 ------------------ .../graphql/mutations/create-company-team.md | 125 ++++++ .../graphql/mutations/delete-company-team.md | 61 +++ .../mutations/update-company-structure.md | 121 ++++++ .../graphql/mutations/update-company-team.md | 89 ++++ 6 files changed, 411 insertions(+), 394 deletions(-) delete mode 100644 src/guides/v2.4/graphql/mutations/company-team-mutations.md create mode 100644 src/guides/v2.4/graphql/mutations/create-company-team.md create mode 100644 src/guides/v2.4/graphql/mutations/delete-company-team.md create mode 100644 src/guides/v2.4/graphql/mutations/update-company-structure.md create mode 100644 src/guides/v2.4/graphql/mutations/update-company-team.md diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index b3d14e9d2a2..ecedadc9857 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -205,22 +205,25 @@ pages: - label: changeCustomerPassword mutation url: /graphql/mutations/change-customer-password.html - - label: companyTeam mutations - url: /graphql/mutations/company-team-mutations.html - edition: ee-only + - label: createCompanyTeam mutation + url: /graphql/mutations/create-company-team.html + edition: b2b-only exclude_versions: ["2.3"] - children: - - label: createCompanyTeam mutation - url: /graphql/mutations/company-team-mutations.html#createcompanyteam-mutation - - label: updateCompanyTeam mutation - url: /graphql/mutations/company-team-mutations.html#updatecompanyteam-mutation + - label: updateCompanyTeam mutation + url: /graphql/mutations/update-company-team.html + edition: b2b-only + exclude_versions: ["2.3"] - - label: deleteCompanyTeam mutation - url: /graphql/mutations/company-team-mutations.html#deletecompanyteam-mutation + - label: deleteCompanyTeam mutation + url: /graphql/mutations/delete-company-team.html + edition: b2b-only + exclude_versions: ["2.3"] - - label: updateCompanyStructure mutation - url: /graphql/mutations/company-team-mutations.html#updatecompanystructure-mutation + - label: updateCompanyStructure mutation + url: /graphql/mutations/update-company-structure.html + edition: b2b-only + exclude_versions: ["2.3"] - label: copyProductsToWishlist mutation url: /graphql/mutations/copy-products-to-wishlist.html diff --git a/src/guides/v2.4/graphql/mutations/company-team-mutations.md b/src/guides/v2.4/graphql/mutations/company-team-mutations.md deleted file mode 100644 index 1c9914d9fde..00000000000 --- a/src/guides/v2.4/graphql/mutations/company-team-mutations.md +++ /dev/null @@ -1,382 +0,0 @@ ---- -group: graphql -title: Company Team mutations -contributor_name: Atwix -contributor_link: https://www.atwix.com/ ---- - -Use these mutations to manage the structure of the company teams. - -The main mutations for this provided below: - -* [createCompanyTeam mutation](#createcompanyteam-mutation) - -* [updateCompanyTeam mutation](#updatecompanyteam-mutation) - -* [deleteCompanyTeam mutation](#deletecompanyteam-mutation) - -* [updateCompanyStructure mutation](#updatecompanystructure-mutation) - -## createCompanyTeam mutation - -Use the `createCompanyTeam` mutation to create a new team for your company. - -### Syntax - -```graphql -mutation { - createCompanyTeam( - input: CompanyTeamCreateInput! - ) { - CreateCompanyTeamOutput - } -} -``` - -### Example usage - -The following example shows the minimal payload for adding a new team to a customer's company. - -**Request:** - -```graphql -mutation { - createCompanyTeam( - input: { - name: "Test Team" - } - ) { - team { - id - name - description - } - } -} -``` - -**Response:** - -```json -{ - "data": { - "createCompanyTeam": { - "team": { - "id": "MQ==", - "name": "Test Team", - "description": null - } - } - } -} -``` - -This example creates a child team of the parent team specified in the `target_id` field. - -**Request:** - -```graphql -mutation { - createCompanyTeam( - input: { - name: "Test Child Team" - description: "Test Child Team description" - target_id: "MQ==" - } - ) { - team { - id - name - description - } - } -} -``` - -**Response:** - -```json -{ - "data": { - "createCompanyTeam": { - "team": { - "id": "Mg==", - "name": "Test Child Team", - "description": "Test Child Team description" - } - } - } -} -``` - -### Input attributes - -The `CompanyTeamCreateInput` input object defines the company team data. - -#### CompanyTeamCreateInput attributes {#CompanyTeamCreateInput} - -The `CompanyTeamCreateInput` object contains the following attributes: - -Attribute | Data Type | Description ---- | --- | --- -`description` | String | An optional description of the team -`name` | String! | The display name of the team -`target_id` | ID | The ID of a node within a company's structure. This ID will be the parent of the created team - -### Output attributes - -The `CreateCompanyTeamOutput` output object contains the following attribute: - -Attribute | Data Type | Description ---- | --- | --- -`team` | CompanyTeam! | Contains company team data - -#### CompanyTeam attributes {#CompanyTeam} - -{% include graphql/company-team.md %} - -## updateCompanyTeam mutation - -Use the `updateCompanyTeam` mutation to update the company team data. - -### Syntax - -```graphql -mutation { - updateCompanyTeam( - input: CompanyTeamUpdateInput! - ) { - UpdateCompanyTeamOutput - } -} -``` - -### Example usage - -The following example updates the name and description of a company team. - -**Request:** - -```graphql -mutation { - updateCompanyTeam( - input: { - name: "My Test Team" - description: "My Test Team description" - id: "MQ==" - } - ) { - team { - id - name - description - } - } -} -``` - -**Response:** - -```json -{ - "data": { - "updateCompanyTeam": { - "team": { - "id": "MQ==", - "name": "My Test Team", - "description": "My Test Team description" - } - } - } -} -``` - -### Input attributes - -The `CompanyTeamUpdateInput` input object defines the company team data. - -#### CompanyTeamUpdateInput attributes {#CompanyTeamUpdateInput} - -The `CompanyTeamUpdateInput` object contains the following attributes: - -Attribute | Data Type | Description ---- | --- | --- -`description` | String | An optional description of the team -`id` | ID! | The encoded team ID for updating -`name` | String | The display name of the team - -### Output attributes - -The `UpdateCompanyTeamOutput` output object contains the following attribute: - -Attribute | Data Type | Description ---- | --- | --- -`team` | [CompanyTeam!](#CompanyTeam) | Contains company team data - -## deleteCompanyTeam mutation - -Use the `deleteCompanyTeam` mutation to delete a company team by ID. You can get the team ID with the [`company` query]({{page.baseurl}}/graphql/queries/company.html). - -### Syntax - -```graphql -mutation { - deleteCompanyTeam( - id: ID! - ) { - DeleteCompanyTeamOutput - } -} -``` - -### Example usage - -The following example deletes the specified team. - -**Request:** - -```graphql -mutation { - deleteCompanyTeam( - id: "Mg==" - ) { - success - } -} -``` - -**Response:** - -```json -{ - "data": { - "deleteCompanyTeam": { - "success": true - } - } -} -``` - -### Input attributes - -The `deleteCompanyTeam` mutation requires the following input: - -Attribute | Data Type | Description ---- | --- | --- -`id` | ID! | The encoded team ID to delete - -### Output attributes - -The `deleteCompanyTeam` mutation returns a Boolean value that indicates whether the operation was successful. - -## updateCompanyStructure mutation - -Use the `updateCompanyStructure` mutation to change the parent node of a company team. - -### Syntax - -```graphql -mutation { - updateCompanyStructure( - input: CompanyStructureUpdateInput! - ) { - UpdateCompanyStructureOutput - } -} -``` - -### Example usage - -The following example shows how to update the customer's company structure. - -**Request:** - -```graphql -mutation { - updateCompanyStructure( - input: { - tree_id: "Mw==" - parent_tree_id: "MQ==" - } - ) { - company { - structure( - rootId: "MQ==" - ) { - items { - id - parent_id - entity { - ... on CompanyTeam { - name - id - description - } - } - } - } - } - } -} -``` - -**Response:** - -```json -{ - "data": { - "updateCompanyStructure": { - "company": { - "structure": { - "items": [ - { - "id": "MQ==", - "parent_id": "MA==", - "entity": {} - }, - { - "id": "Mg==", - "parent_id": "MQ==", - "entity": { - "name": "Test Team", - "id": "MQ==", - "description": "Test Team description" - } - }, - { - "id": "Mw==", - "parent_id": "Mg==", - "entity": { - "name": "Test Child Team", - "id": "Mg==", - "description": "Test Child Team dexription" - } - } - ] - } - } - } - } -} -``` - -### Input attributes - -The `CompanyStructureUpdateInput` input object defines the company team data. - -#### CompanyStructureUpdateInput attributes {#CompanyStructureUpdateInput} - -The `CompanyStructureUpdateInput` object contains the following attributes: - -Attribute | Data Type | Description ---- | --- | --- -`parent_tree_id` | ID! | The ID of a company that will be the new parent -`tree_id` | ID! | The ID of the company team that is being moved to another parent - -### Output attributes - -The `UpdateCompanyStructureOutput` output object contains the following attribute: - -Attribute | Data Type | Description ---- | --- | --- -`company` | [Company!](#company-link-from-company-query) | Contains company data diff --git a/src/guides/v2.4/graphql/mutations/create-company-team.md b/src/guides/v2.4/graphql/mutations/create-company-team.md new file mode 100644 index 00000000000..5b69d12fbcb --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/create-company-team.md @@ -0,0 +1,125 @@ +--- +group: graphql +title: createCompanyTeam mutation +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +b2b_only: true +--- + +Use the `createCompanyTeam` mutation to create a new team for your company. + +## Syntax + +```graphql +mutation { + createCompanyTeam( + input: CompanyTeamCreateInput! + ) { + CreateCompanyTeamOutput + } +} +``` + +## Example usage + +The following example shows the minimal payload for adding a new team to a customer's company. + +**Request:** + +```graphql +mutation { + createCompanyTeam( + input: { + name: "Test Team" + } + ) { + team { + id + name + description + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "createCompanyTeam": { + "team": { + "id": "MQ==", + "name": "Test Team", + "description": null + } + } + } +} +``` + +This example creates a child team of the parent team specified in the `target_id` field. + +**Request:** + +```graphql +mutation { + createCompanyTeam( + input: { + name: "Test Child Team" + description: "Test Child Team description" + target_id: "MQ==" + } + ) { + team { + id + name + description + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "createCompanyTeam": { + "team": { + "id": "Mg==", + "name": "Test Child Team", + "description": "Test Child Team description" + } + } + } +} +``` + +## Input attributes + +The `CompanyTeamCreateInput` input object defines the company team data. + +### CompanyTeamCreateInput attributes {#CompanyTeamCreateInput} + +The `CompanyTeamCreateInput` object contains the following attributes: + +Attribute | Data Type | Description +--- | --- | --- +`description` | String | An optional description of the team +`name` | String! | The display name of the team +`target_id` | ID | The ID of a node within a company's structure. This ID will be the parent of the created team + +You can get the `target_id` with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query. + +## Output attributes + +The `CreateCompanyTeamOutput` output object contains the following attribute: + +Attribute | Data Type | Description +--- | --- | --- +`team` | CompanyTeam! | Contains company team data + +### CompanyTeam attributes {#CompanyTeam} + +{% include graphql/company-team.md %} diff --git a/src/guides/v2.4/graphql/mutations/delete-company-team.md b/src/guides/v2.4/graphql/mutations/delete-company-team.md new file mode 100644 index 00000000000..422a709f07b --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/delete-company-team.md @@ -0,0 +1,61 @@ +--- +group: graphql +title: deleteCompanyTeam mutation +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +b2b_only: true +--- + +Use the `deleteCompanyTeam` mutation to delete a company team by ID. You can get the team ID with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query. + +## Syntax + +```graphql +mutation { + deleteCompanyTeam( + id: ID! + ) { + DeleteCompanyTeamOutput + } +} +``` + +## Example usage + +The following example deletes the specified team. + +**Request:** + +```graphql +mutation { + deleteCompanyTeam( + id: "Mg==" + ) { + success + } +} +``` + +**Response:** + +```json +{ + "data": { + "deleteCompanyTeam": { + "success": true + } + } +} +``` + +## Input attributes + +The `deleteCompanyTeam` mutation requires the following input: + +Attribute | Data Type | Description +--- | --- | --- +`id` | ID! | The encoded team ID to delete + +## Output attributes + +The `deleteCompanyTeam` mutation returns a Boolean value that indicates whether the operation was successful. diff --git a/src/guides/v2.4/graphql/mutations/update-company-structure.md b/src/guides/v2.4/graphql/mutations/update-company-structure.md new file mode 100644 index 00000000000..2224b530eeb --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/update-company-structure.md @@ -0,0 +1,121 @@ +--- +group: graphql +title: updateCompanyStructure mutation +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +b2b_only: true +--- + +Use the `updateCompanyStructure` mutation to change the parent node of a company team. + +## Syntax + +```graphql +mutation { + updateCompanyStructure( + input: CompanyStructureUpdateInput! + ) { + UpdateCompanyStructureOutput + } +} +``` + +## Example usage + +The following example shows how to update the customer's company structure. + +**Request:** + +```graphql +mutation { + updateCompanyStructure( + input: { + tree_id: "Mw==" + parent_tree_id: "MQ==" + } + ) { + company { + structure( + rootId: "MQ==" + ) { + items { + id + parent_id + entity { + ... on CompanyTeam { + name + id + description + } + } + } + } + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "updateCompanyStructure": { + "company": { + "structure": { + "items": [ + { + "id": "MQ==", + "parent_id": "MA==", + "entity": {} + }, + { + "id": "Mg==", + "parent_id": "MQ==", + "entity": { + "name": "Test Team", + "id": "MQ==", + "description": "Test Team description" + } + }, + { + "id": "Mw==", + "parent_id": "Mg==", + "entity": { + "name": "Test Child Team", + "id": "Mg==", + "description": "Test Child Team dexription" + } + } + ] + } + } + } + } +} +``` + +## Input attributes + +The `CompanyStructureUpdateInput` input object defines the company team data. + +### CompanyStructureUpdateInput attributes {#CompanyStructureUpdateInput} + +The `CompanyStructureUpdateInput` object contains the following attributes: + +Attribute | Data Type | Description +--- | --- | --- +`parent_tree_id` | ID! | The ID of a company that will be the new parent +`tree_id` | ID! | The ID of the company team that is being moved to another parent + +You can get the `parent_tree_id` and `tree_id` with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query. + +## Output attributes + +The `UpdateCompanyStructureOutput` output object contains the following attribute: + +Attribute | Data Type | Description +--- | --- | --- +`company` | Company! | Contains company data + +{% include graphql/company.md %} diff --git a/src/guides/v2.4/graphql/mutations/update-company-team.md b/src/guides/v2.4/graphql/mutations/update-company-team.md new file mode 100644 index 00000000000..342640212c6 --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/update-company-team.md @@ -0,0 +1,89 @@ +--- +group: graphql +title: updateCompanyTeam mutation +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +b2b_only: true +--- + +Use the `updateCompanyTeam` mutation to update the company team data. + +## Syntax + +```graphql +mutation { + updateCompanyTeam( + input: CompanyTeamUpdateInput! + ) { + UpdateCompanyTeamOutput + } +} +``` + +## Example usage + +The following example updates the name and description of a company team. + +**Request:** + +```graphql +mutation { + updateCompanyTeam( + input: { + name: "My Test Team" + description: "My Test Team description" + id: "MQ==" + } + ) { + team { + id + name + description + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "updateCompanyTeam": { + "team": { + "id": "MQ==", + "name": "My Test Team", + "description": "My Test Team description" + } + } + } +} +``` + +## Input attributes + +The `CompanyTeamUpdateInput` input object defines the company team data. + +### CompanyTeamUpdateInput attributes {#CompanyTeamUpdateInput} + +The `CompanyTeamUpdateInput` object contains the following attributes: + +Attribute | Data Type | Description +--- | --- | --- +`description` | String | An optional description of the team +`id` | ID! | The encoded team ID for updating +`name` | String | The display name of the team + +You can get the team ID with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query. + +## Output attributes + +The `UpdateCompanyTeamOutput` output object contains the following attribute: + +Attribute | Data Type | Description +--- | --- | --- +`team` | CompanyTeam! | Contains company team data + +### CompanyTeam attributes {#CompanyTeam} + +{% include graphql/company-team.md %} From 76adb2cf414061e9fe75aa849c4cc5c623e7999b Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Thu, 15 Oct 2020 21:52:20 -0500 Subject: [PATCH 8/9] Update graphql.yml --- src/_data/toc/graphql.yml | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index ecedadc9857..839b454eb9b 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -205,26 +205,6 @@ pages: - label: changeCustomerPassword mutation url: /graphql/mutations/change-customer-password.html - - label: createCompanyTeam mutation - url: /graphql/mutations/create-company-team.html - edition: b2b-only - exclude_versions: ["2.3"] - - - label: updateCompanyTeam mutation - url: /graphql/mutations/update-company-team.html - edition: b2b-only - exclude_versions: ["2.3"] - - - label: deleteCompanyTeam mutation - url: /graphql/mutations/delete-company-team.html - edition: b2b-only - exclude_versions: ["2.3"] - - - label: updateCompanyStructure mutation - url: /graphql/mutations/update-company-structure.html - edition: b2b-only - exclude_versions: ["2.3"] - - label: copyProductsToWishlist mutation url: /graphql/mutations/copy-products-to-wishlist.html edition: ee-only @@ -238,6 +218,11 @@ pages: edition: b2b-only exclude_versions: ["2.3"] + - label: createCompanyTeam mutation + url: /graphql/mutations/create-company-team.html + edition: b2b-only + exclude_versions: ["2.3"] + - label: createCustomer mutation url: /graphql/mutations/create-customer.html @@ -270,6 +255,11 @@ pages: edition: ee-only exclude_versions: ["2.3"] + - label: deleteCompanyTeam mutation + url: /graphql/mutations/delete-company-team.html + edition: b2b-only + exclude_versions: ["2.3"] + - label: deleteCustomerAddress mutation url: /graphql/mutations/delete-customer-address.html @@ -377,6 +367,16 @@ pages: edition: b2b-only exclude_versions: ["2.3"] + - label: updateCompanyStructure mutation + url: /graphql/mutations/update-company-structure.html + edition: b2b-only + exclude_versions: ["2.3"] + + - label: updateCompanyTeam mutation + url: /graphql/mutations/update-company-team.html + edition: b2b-only + exclude_versions: ["2.3"] + - label: updateCustomer mutation url: /graphql/mutations/update-customer.html From b7f969e627fb1720134690f90a53569212137da8 Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi Date: Fri, 16 Oct 2020 06:05:10 +0300 Subject: [PATCH 9/9] Small fixes --- src/guides/v2.4/graphql/mutations/create-company-team.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/guides/v2.4/graphql/mutations/create-company-team.md b/src/guides/v2.4/graphql/mutations/create-company-team.md index 5b69d12fbcb..77f6ea7cc78 100644 --- a/src/guides/v2.4/graphql/mutations/create-company-team.md +++ b/src/guides/v2.4/graphql/mutations/create-company-team.md @@ -8,6 +8,10 @@ b2b_only: true Use the `createCompanyTeam` mutation to create a new team for your company. +The `target_id` input attribute allows you to specify which node in the company structure will be the parent node of the company team. If you do not specify a value, the team will be assigned to the top-level (root) node of the company structure. + +You can get the `target_id` with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query. + ## Syntax ```graphql @@ -110,8 +114,6 @@ Attribute | Data Type | Description `name` | String! | The display name of the team `target_id` | ID | The ID of a node within a company's structure. This ID will be the parent of the created team -You can get the `target_id` with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query. - ## Output attributes The `CreateCompanyTeamOutput` output object contains the following attribute: