Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 2f1dd22

Browse files
andrewbesskeharper
andauthored
ISSUE-7987: The GraphQL topic "Company team mutations" has been created (#8028)
* ISSUE-7987: The topic "Company team mutations" has been created * ISSUE-7987: Fixes according to reviewer proposal * Update company-team.md * Update company-team-mutations.md * Update company-team.md * Update company-team-mutations.md * ISSUE-7987: Small fixes - separating the topics; - adding the links * Update graphql.yml * Small fixes Co-authored-by: Kevin Harper <[email protected]>
1 parent abb7604 commit 2f1dd22

File tree

6 files changed

+425
-0
lines changed

6 files changed

+425
-0
lines changed

src/_data/toc/graphql.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ pages:
218218
edition: b2b-only
219219
exclude_versions: ["2.3"]
220220

221+
- label: createCompanyTeam mutation
222+
url: /graphql/mutations/create-company-team.html
223+
edition: b2b-only
224+
exclude_versions: ["2.3"]
225+
221226
- label: createCustomer mutation
222227
url: /graphql/mutations/create-customer.html
223228

@@ -250,6 +255,11 @@ pages:
250255
edition: ee-only
251256
exclude_versions: ["2.3"]
252257

258+
- label: deleteCompanyTeam mutation
259+
url: /graphql/mutations/delete-company-team.html
260+
edition: b2b-only
261+
exclude_versions: ["2.3"]
262+
253263
- label: deleteCustomerAddress mutation
254264
url: /graphql/mutations/delete-customer-address.html
255265

@@ -357,6 +367,16 @@ pages:
357367
edition: b2b-only
358368
exclude_versions: ["2.3"]
359369

370+
- label: updateCompanyStructure mutation
371+
url: /graphql/mutations/update-company-structure.html
372+
edition: b2b-only
373+
exclude_versions: ["2.3"]
374+
375+
- label: updateCompanyTeam mutation
376+
url: /graphql/mutations/update-company-team.html
377+
edition: b2b-only
378+
exclude_versions: ["2.3"]
379+
360380
- label: updateCustomer mutation
361381
url: /graphql/mutations/update-customer.html
362382

src/_includes/graphql/company-team.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The `CompanyTeam` object contains details about a company team. It contains the following attributes.
2+
3+
Attribute | Data Type | Description
4+
--- | --- | ---
5+
`description` | String | An optional description of the team
6+
`id` | ID! | A string that contains the encoded team ID
7+
`name` | String | The display name of the team
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
group: graphql
3+
title: createCompanyTeam mutation
4+
contributor_name: Atwix
5+
contributor_link: https://www.atwix.com/
6+
b2b_only: true
7+
---
8+
9+
Use the `createCompanyTeam` mutation to create a new team for your company.
10+
11+
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.
12+
13+
You can get the `target_id` with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query.
14+
15+
## Syntax
16+
17+
```graphql
18+
mutation {
19+
createCompanyTeam(
20+
input: CompanyTeamCreateInput!
21+
) {
22+
CreateCompanyTeamOutput
23+
}
24+
}
25+
```
26+
27+
## Example usage
28+
29+
The following example shows the minimal payload for adding a new team to a customer's company.
30+
31+
**Request:**
32+
33+
```graphql
34+
mutation {
35+
createCompanyTeam(
36+
input: {
37+
name: "Test Team"
38+
}
39+
) {
40+
team {
41+
id
42+
name
43+
description
44+
}
45+
}
46+
}
47+
```
48+
49+
**Response:**
50+
51+
```json
52+
{
53+
"data": {
54+
"createCompanyTeam": {
55+
"team": {
56+
"id": "MQ==",
57+
"name": "Test Team",
58+
"description": null
59+
}
60+
}
61+
}
62+
}
63+
```
64+
65+
This example creates a child team of the parent team specified in the `target_id` field.
66+
67+
**Request:**
68+
69+
```graphql
70+
mutation {
71+
createCompanyTeam(
72+
input: {
73+
name: "Test Child Team"
74+
description: "Test Child Team description"
75+
target_id: "MQ=="
76+
}
77+
) {
78+
team {
79+
id
80+
name
81+
description
82+
}
83+
}
84+
}
85+
```
86+
87+
**Response:**
88+
89+
```json
90+
{
91+
"data": {
92+
"createCompanyTeam": {
93+
"team": {
94+
"id": "Mg==",
95+
"name": "Test Child Team",
96+
"description": "Test Child Team description"
97+
}
98+
}
99+
}
100+
}
101+
```
102+
103+
## Input attributes
104+
105+
The `CompanyTeamCreateInput` input object defines the company team data.
106+
107+
### CompanyTeamCreateInput attributes {#CompanyTeamCreateInput}
108+
109+
The `CompanyTeamCreateInput` object contains the following attributes:
110+
111+
Attribute | Data Type | Description
112+
--- | --- | ---
113+
`description` | String | An optional description of the team
114+
`name` | String! | The display name of the team
115+
`target_id` | ID | The ID of a node within a company's structure. This ID will be the parent of the created team
116+
117+
## Output attributes
118+
119+
The `CreateCompanyTeamOutput` output object contains the following attribute:
120+
121+
Attribute | Data Type | Description
122+
--- | --- | ---
123+
`team` | CompanyTeam! | Contains company team data
124+
125+
### CompanyTeam attributes {#CompanyTeam}
126+
127+
{% include graphql/company-team.md %}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
group: graphql
3+
title: deleteCompanyTeam mutation
4+
contributor_name: Atwix
5+
contributor_link: https://www.atwix.com/
6+
b2b_only: true
7+
---
8+
9+
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.
10+
11+
## Syntax
12+
13+
```graphql
14+
mutation {
15+
deleteCompanyTeam(
16+
id: ID!
17+
) {
18+
DeleteCompanyTeamOutput
19+
}
20+
}
21+
```
22+
23+
## Example usage
24+
25+
The following example deletes the specified team.
26+
27+
**Request:**
28+
29+
```graphql
30+
mutation {
31+
deleteCompanyTeam(
32+
id: "Mg=="
33+
) {
34+
success
35+
}
36+
}
37+
```
38+
39+
**Response:**
40+
41+
```json
42+
{
43+
"data": {
44+
"deleteCompanyTeam": {
45+
"success": true
46+
}
47+
}
48+
}
49+
```
50+
51+
## Input attributes
52+
53+
The `deleteCompanyTeam` mutation requires the following input:
54+
55+
Attribute | Data Type | Description
56+
--- | --- | ---
57+
`id` | ID! | The encoded team ID to delete
58+
59+
## Output attributes
60+
61+
The `deleteCompanyTeam` mutation returns a Boolean value that indicates whether the operation was successful.
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
group: graphql
3+
title: updateCompanyStructure mutation
4+
contributor_name: Atwix
5+
contributor_link: https://www.atwix.com/
6+
b2b_only: true
7+
---
8+
9+
Use the `updateCompanyStructure` mutation to change the parent node of a company team.
10+
11+
## Syntax
12+
13+
```graphql
14+
mutation {
15+
updateCompanyStructure(
16+
input: CompanyStructureUpdateInput!
17+
) {
18+
UpdateCompanyStructureOutput
19+
}
20+
}
21+
```
22+
23+
## Example usage
24+
25+
The following example shows how to update the customer's company structure.
26+
27+
**Request:**
28+
29+
```graphql
30+
mutation {
31+
updateCompanyStructure(
32+
input: {
33+
tree_id: "Mw=="
34+
parent_tree_id: "MQ=="
35+
}
36+
) {
37+
company {
38+
structure(
39+
rootId: "MQ=="
40+
) {
41+
items {
42+
id
43+
parent_id
44+
entity {
45+
... on CompanyTeam {
46+
name
47+
id
48+
description
49+
}
50+
}
51+
}
52+
}
53+
}
54+
}
55+
}
56+
```
57+
58+
**Response:**
59+
60+
```json
61+
{
62+
"data": {
63+
"updateCompanyStructure": {
64+
"company": {
65+
"structure": {
66+
"items": [
67+
{
68+
"id": "MQ==",
69+
"parent_id": "MA==",
70+
"entity": {}
71+
},
72+
{
73+
"id": "Mg==",
74+
"parent_id": "MQ==",
75+
"entity": {
76+
"name": "Test Team",
77+
"id": "MQ==",
78+
"description": "Test Team description"
79+
}
80+
},
81+
{
82+
"id": "Mw==",
83+
"parent_id": "Mg==",
84+
"entity": {
85+
"name": "Test Child Team",
86+
"id": "Mg==",
87+
"description": "Test Child Team dexription"
88+
}
89+
}
90+
]
91+
}
92+
}
93+
}
94+
}
95+
}
96+
```
97+
98+
## Input attributes
99+
100+
The `CompanyStructureUpdateInput` input object defines the company team data.
101+
102+
### CompanyStructureUpdateInput attributes {#CompanyStructureUpdateInput}
103+
104+
The `CompanyStructureUpdateInput` object contains the following attributes:
105+
106+
Attribute | Data Type | Description
107+
--- | --- | ---
108+
`parent_tree_id` | ID! | The ID of a company that will be the new parent
109+
`tree_id` | ID! | The ID of the company team that is being moved to another parent
110+
111+
You can get the `parent_tree_id` and `tree_id` with the [`company`]({{page.baseurl}}/graphql/queries/company.html) query.
112+
113+
## Output attributes
114+
115+
The `UpdateCompanyStructureOutput` output object contains the following attribute:
116+
117+
Attribute | Data Type | Description
118+
--- | --- | ---
119+
`company` | Company! | Contains company data
120+
121+
{% include graphql/company.md %}

0 commit comments

Comments
 (0)