Skip to content

Commit 92063c4

Browse files
box-sdk-buildbox-sdk-build
andauthored
feat: add Integration Mappings Teams API (box/box-openapi#517) (#429)
Co-authored-by: box-sdk-build <[email protected]>
1 parent d90faea commit 92063c4

23 files changed

+863
-1
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "41feeaa", "specHash": "1080bb4", "version": "1.8.0" }
1+
{ "engineHash": "41feeaa", "specHash": "c303afc", "version": "1.8.0" }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using System.Text.Json.Serialization;
5+
using Box.Sdk.Gen.Internal;
6+
using Box.Sdk.Gen.Schemas;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class CreateIntegrationMappingTeamsHeaders {
10+
/// <summary>
11+
/// Extra headers that will be included in the HTTP request.
12+
/// </summary>
13+
public Dictionary<string, string?> ExtraHeaders { get; }
14+
15+
public CreateIntegrationMappingTeamsHeaders(Dictionary<string, string?>? extraHeaders = default) {
16+
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { };
17+
}
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using System.Text.Json.Serialization;
5+
using Box.Sdk.Gen.Internal;
6+
using Box.Sdk.Gen.Schemas;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class DeleteIntegrationMappingTeamsByIdHeaders {
10+
/// <summary>
11+
/// Extra headers that will be included in the HTTP request.
12+
/// </summary>
13+
public Dictionary<string, string?> ExtraHeaders { get; }
14+
15+
public DeleteIntegrationMappingTeamsByIdHeaders(Dictionary<string, string?>? extraHeaders = default) {
16+
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { };
17+
}
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using System.Text.Json.Serialization;
5+
using Box.Sdk.Gen.Internal;
6+
using Box.Sdk.Gen.Schemas;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class GetIntegrationMappingTeamsHeaders {
10+
/// <summary>
11+
/// Extra headers that will be included in the HTTP request.
12+
/// </summary>
13+
public Dictionary<string, string?> ExtraHeaders { get; }
14+
15+
public GetIntegrationMappingTeamsHeaders(Dictionary<string, string?>? extraHeaders = default) {
16+
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { };
17+
}
18+
}
19+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using System.Text.Json.Serialization;
5+
using Box.Sdk.Gen.Internal;
6+
using Box.Sdk.Gen.Schemas;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class GetIntegrationMappingTeamsQueryParams {
10+
/// <summary>
11+
/// Mapped item type, for which the mapping should be returned
12+
/// </summary>
13+
public StringEnum<GetIntegrationMappingTeamsQueryParamsPartnerItemTypeField>? PartnerItemType { get; init; }
14+
15+
/// <summary>
16+
/// ID of the mapped item, for which the mapping should be returned
17+
/// </summary>
18+
public string? PartnerItemId { get; init; }
19+
20+
/// <summary>
21+
/// Box item ID, for which the mappings should be returned
22+
/// </summary>
23+
public string? BoxItemId { get; init; }
24+
25+
/// <summary>
26+
/// Box item type, for which the mappings should be returned
27+
/// </summary>
28+
public StringEnum<GetIntegrationMappingTeamsQueryParamsBoxItemTypeField>? BoxItemType { get; init; }
29+
30+
public GetIntegrationMappingTeamsQueryParams() {
31+
32+
}
33+
}
34+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.ComponentModel;
2+
using Box.Sdk.Gen.Internal;
3+
using Box.Sdk.Gen.Schemas;
4+
5+
namespace Box.Sdk.Gen.Managers {
6+
public enum GetIntegrationMappingTeamsQueryParamsBoxItemTypeField {
7+
[Description("folder")]
8+
Folder
9+
}
10+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.ComponentModel;
2+
using Box.Sdk.Gen.Internal;
3+
using Box.Sdk.Gen.Schemas;
4+
5+
namespace Box.Sdk.Gen.Managers {
6+
public enum GetIntegrationMappingTeamsQueryParamsPartnerItemTypeField {
7+
[Description("channel")]
8+
Channel,
9+
[Description("team")]
10+
Team
11+
}
12+
}

Box.Sdk.Gen/Managers/IntegrationMappings/IIntegrationMappingsManager.cs

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,76 @@ public interface IIntegrationMappingsManager {
8383
/// </param>
8484
public System.Threading.Tasks.Task DeleteSlackIntegrationMappingByIdAsync(string integrationMappingId, DeleteSlackIntegrationMappingByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it.");
8585

86+
/// <summary>
87+
/// Lists [Teams integration mappings](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams) in a users' enterprise.
88+
/// You need Admin or Co-Admin role to
89+
/// use this endpoint.
90+
/// </summary>
91+
/// <param name="queryParams">
92+
/// Query parameters of getIntegrationMappingTeams method
93+
/// </param>
94+
/// <param name="headers">
95+
/// Headers of getIntegrationMappingTeams method
96+
/// </param>
97+
/// <param name="cancellationToken">
98+
/// Token used for request cancellation.
99+
/// </param>
100+
public System.Threading.Tasks.Task<IntegrationMappingsTeams> GetIntegrationMappingTeamsAsync(GetIntegrationMappingTeamsQueryParams? queryParams = default, GetIntegrationMappingTeamsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it.");
101+
102+
/// <summary>
103+
/// Creates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams)
104+
/// by mapping a Teams channel to a Box item.
105+
/// You need Admin or Co-Admin role to
106+
/// use this endpoint.
107+
/// </summary>
108+
/// <param name="requestBody">
109+
/// Request body of createIntegrationMappingTeams method
110+
/// </param>
111+
/// <param name="headers">
112+
/// Headers of createIntegrationMappingTeams method
113+
/// </param>
114+
/// <param name="cancellationToken">
115+
/// Token used for request cancellation.
116+
/// </param>
117+
public System.Threading.Tasks.Task<IntegrationMappingTeams> CreateIntegrationMappingTeamsAsync(IntegrationMappingTeamsCreateRequest requestBody, CreateIntegrationMappingTeamsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it.");
118+
119+
/// <summary>
120+
/// Updates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams).
121+
/// Supports updating the Box folder ID and options.
122+
/// You need Admin or Co-Admin role to
123+
/// use this endpoint.
124+
/// </summary>
125+
/// <param name="integrationMappingId">
126+
/// An ID of an integration mapping
127+
/// Example: "11235432"
128+
/// </param>
129+
/// <param name="requestBody">
130+
/// Request body of updateIntegrationMappingTeamsById method
131+
/// </param>
132+
/// <param name="headers">
133+
/// Headers of updateIntegrationMappingTeamsById method
134+
/// </param>
135+
/// <param name="cancellationToken">
136+
/// Token used for request cancellation.
137+
/// </param>
138+
public System.Threading.Tasks.Task<IntegrationMappingTeams> UpdateIntegrationMappingTeamsByIdAsync(string integrationMappingId, UpdateIntegrationMappingTeamsByIdRequestBody? requestBody = default, UpdateIntegrationMappingTeamsByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it.");
139+
140+
/// <summary>
141+
/// Deletes a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams).
142+
/// You need Admin or Co-Admin role to
143+
/// use this endpoint.
144+
/// </summary>
145+
/// <param name="integrationMappingId">
146+
/// An ID of an integration mapping
147+
/// Example: "11235432"
148+
/// </param>
149+
/// <param name="headers">
150+
/// Headers of deleteIntegrationMappingTeamsById method
151+
/// </param>
152+
/// <param name="cancellationToken">
153+
/// Token used for request cancellation.
154+
/// </param>
155+
public System.Threading.Tasks.Task DeleteIntegrationMappingTeamsByIdAsync(string integrationMappingId, DeleteIntegrationMappingTeamsByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) => throw new System.NotImplementedException("This method needs to be implemented by the derived class before calling it.");
156+
86157
}
87158
}

Box.Sdk.Gen/Managers/IntegrationMappings/IntegrationMappingsManager.cs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,98 @@ public async System.Threading.Tasks.Task DeleteSlackIntegrationMappingByIdAsync(
112112
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/integration_mappings/slack/", StringUtils.ToStringRepresentation(integrationMappingId)), method: "DELETE", responseFormat: Box.Sdk.Gen.ResponseFormat.NoContent) { Headers = headersMap, Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
113113
}
114114

115+
/// <summary>
116+
/// Lists [Teams integration mappings](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams) in a users' enterprise.
117+
/// You need Admin or Co-Admin role to
118+
/// use this endpoint.
119+
/// </summary>
120+
/// <param name="queryParams">
121+
/// Query parameters of getIntegrationMappingTeams method
122+
/// </param>
123+
/// <param name="headers">
124+
/// Headers of getIntegrationMappingTeams method
125+
/// </param>
126+
/// <param name="cancellationToken">
127+
/// Token used for request cancellation.
128+
/// </param>
129+
public async System.Threading.Tasks.Task<IntegrationMappingsTeams> GetIntegrationMappingTeamsAsync(GetIntegrationMappingTeamsQueryParams? queryParams = default, GetIntegrationMappingTeamsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
130+
queryParams = queryParams ?? new GetIntegrationMappingTeamsQueryParams();
131+
headers = headers ?? new GetIntegrationMappingTeamsHeaders();
132+
Dictionary<string, string> queryParamsMap = Utils.PrepareParams(map: new Dictionary<string, string?>() { { "partner_item_type", StringUtils.ToStringRepresentation(queryParams.PartnerItemType) }, { "partner_item_id", StringUtils.ToStringRepresentation(queryParams.PartnerItemId) }, { "box_item_id", StringUtils.ToStringRepresentation(queryParams.BoxItemId) }, { "box_item_type", StringUtils.ToStringRepresentation(queryParams.BoxItemType) } });
133+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { }, headers.ExtraHeaders));
134+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/integration_mappings/teams"), method: "GET", responseFormat: Box.Sdk.Gen.ResponseFormat.Json) { Parameters = queryParamsMap, Headers = headersMap, Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
135+
return SimpleJsonSerializer.Deserialize<IntegrationMappingsTeams>(NullableUtils.Unwrap(response.Data));
136+
}
137+
138+
/// <summary>
139+
/// Creates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams)
140+
/// by mapping a Teams channel to a Box item.
141+
/// You need Admin or Co-Admin role to
142+
/// use this endpoint.
143+
/// </summary>
144+
/// <param name="requestBody">
145+
/// Request body of createIntegrationMappingTeams method
146+
/// </param>
147+
/// <param name="headers">
148+
/// Headers of createIntegrationMappingTeams method
149+
/// </param>
150+
/// <param name="cancellationToken">
151+
/// Token used for request cancellation.
152+
/// </param>
153+
public async System.Threading.Tasks.Task<IntegrationMappingTeams> CreateIntegrationMappingTeamsAsync(IntegrationMappingTeamsCreateRequest requestBody, CreateIntegrationMappingTeamsHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
154+
headers = headers ?? new CreateIntegrationMappingTeamsHeaders();
155+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { }, headers.ExtraHeaders));
156+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/integration_mappings/teams"), method: "POST", contentType: "application/json", responseFormat: Box.Sdk.Gen.ResponseFormat.Json) { Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
157+
return SimpleJsonSerializer.Deserialize<IntegrationMappingTeams>(NullableUtils.Unwrap(response.Data));
158+
}
159+
160+
/// <summary>
161+
/// Updates a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams).
162+
/// Supports updating the Box folder ID and options.
163+
/// You need Admin or Co-Admin role to
164+
/// use this endpoint.
165+
/// </summary>
166+
/// <param name="integrationMappingId">
167+
/// An ID of an integration mapping
168+
/// Example: "11235432"
169+
/// </param>
170+
/// <param name="requestBody">
171+
/// Request body of updateIntegrationMappingTeamsById method
172+
/// </param>
173+
/// <param name="headers">
174+
/// Headers of updateIntegrationMappingTeamsById method
175+
/// </param>
176+
/// <param name="cancellationToken">
177+
/// Token used for request cancellation.
178+
/// </param>
179+
public async System.Threading.Tasks.Task<IntegrationMappingTeams> UpdateIntegrationMappingTeamsByIdAsync(string integrationMappingId, UpdateIntegrationMappingTeamsByIdRequestBody? requestBody = default, UpdateIntegrationMappingTeamsByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
180+
requestBody = requestBody ?? new UpdateIntegrationMappingTeamsByIdRequestBody();
181+
headers = headers ?? new UpdateIntegrationMappingTeamsByIdHeaders();
182+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { }, headers.ExtraHeaders));
183+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/integration_mappings/teams/", StringUtils.ToStringRepresentation(integrationMappingId)), method: "PUT", contentType: "application/json", responseFormat: Box.Sdk.Gen.ResponseFormat.Json) { Headers = headersMap, Data = SimpleJsonSerializer.Serialize(requestBody), Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
184+
return SimpleJsonSerializer.Deserialize<IntegrationMappingTeams>(NullableUtils.Unwrap(response.Data));
185+
}
186+
187+
/// <summary>
188+
/// Deletes a [Teams integration mapping](https://support.box.com/hc/en-us/articles/360044681474-Using-Box-for-Teams).
189+
/// You need Admin or Co-Admin role to
190+
/// use this endpoint.
191+
/// </summary>
192+
/// <param name="integrationMappingId">
193+
/// An ID of an integration mapping
194+
/// Example: "11235432"
195+
/// </param>
196+
/// <param name="headers">
197+
/// Headers of deleteIntegrationMappingTeamsById method
198+
/// </param>
199+
/// <param name="cancellationToken">
200+
/// Token used for request cancellation.
201+
/// </param>
202+
public async System.Threading.Tasks.Task DeleteIntegrationMappingTeamsByIdAsync(string integrationMappingId, DeleteIntegrationMappingTeamsByIdHeaders? headers = default, System.Threading.CancellationToken? cancellationToken = null) {
203+
headers = headers ?? new DeleteIntegrationMappingTeamsByIdHeaders();
204+
Dictionary<string, string> headersMap = Utils.PrepareParams(map: DictionaryUtils.MergeDictionaries(new Dictionary<string, string?>() { }, headers.ExtraHeaders));
205+
FetchResponse response = await this.NetworkSession.NetworkClient.FetchAsync(options: new FetchOptions(url: string.Concat(this.NetworkSession.BaseUrls.BaseUrl, "/2.0/integration_mappings/teams/", StringUtils.ToStringRepresentation(integrationMappingId)), method: "DELETE", responseFormat: Box.Sdk.Gen.ResponseFormat.NoContent) { Headers = headersMap, Auth = this.Auth, NetworkSession = this.NetworkSession, CancellationToken = cancellationToken }).ConfigureAwait(false);
206+
}
207+
115208
}
116209
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Box.Sdk.Gen;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
using System.Text.Json.Serialization;
5+
using Box.Sdk.Gen.Internal;
6+
using Box.Sdk.Gen.Schemas;
7+
8+
namespace Box.Sdk.Gen.Managers {
9+
public class UpdateIntegrationMappingTeamsByIdHeaders {
10+
/// <summary>
11+
/// Extra headers that will be included in the HTTP request.
12+
/// </summary>
13+
public Dictionary<string, string?> ExtraHeaders { get; }
14+
15+
public UpdateIntegrationMappingTeamsByIdHeaders(Dictionary<string, string?>? extraHeaders = default) {
16+
ExtraHeaders = extraHeaders ?? new Dictionary<string, string?>() { };
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)