@@ -11,12 +11,12 @@ namespace PureCloud.Client.Apis;
1111/// <inheritdoc />
1212public sealed class WebDeploymentsApi : IWebDeploymentsApi
1313{
14- private readonly HttpClient _httpClient ;
14+ private readonly IHttpClientFactory _httpClientFactory ;
1515 private readonly PureCloudJsonSerializerOptions _options ;
1616
1717 public WebDeploymentsApi ( IHttpClientFactory httpClientFactory , IOptions < PureCloudJsonSerializerOptions > options )
1818 {
19- _httpClient = httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
19+ _httpClientFactory = httpClientFactory ;
2020 _options = options . Value ;
2121 }
2222
@@ -25,9 +25,9 @@ public async Task<bool> DeleteWebdeploymentsConfigurationAsync(string configurat
2525 {
2626 ArgumentException . ThrowIfNullOrEmpty ( configurationId ) ;
2727
28- var uri = $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } " ;
28+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
2929
30- var response = await _httpClient . DeleteAsync ( uri , cancellationToken ) ;
30+ var response = await client . DeleteAsync ( $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } " , cancellationToken ) ;
3131
3232 return response . IsSuccessStatusCode ;
3333 }
@@ -37,9 +37,9 @@ public async Task<bool> DeleteWebdeploymentsDeploymentAsync(string deploymentId,
3737 {
3838 ArgumentException . ThrowIfNullOrEmpty ( deploymentId ) ;
3939
40- var uri = $ "/api/v2/webdeployments/deployments/ { Uri . EscapeDataString ( deploymentId ) } " ;
40+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
4141
42- var response = await _httpClient . DeleteAsync ( uri , cancellationToken ) ;
42+ var response = await client . DeleteAsync ( $ "/api/v2/webdeployments/deployments/ { Uri . EscapeDataString ( deploymentId ) } " , cancellationToken ) ;
4343
4444 return response . IsSuccessStatusCode ;
4545 }
@@ -50,9 +50,9 @@ public async Task<bool> DeleteWebdeploymentsDeploymentCobrowseSessionIdAsync(str
5050 ArgumentException . ThrowIfNullOrEmpty ( deploymentId ) ;
5151 ArgumentException . ThrowIfNullOrEmpty ( sessionId ) ;
5252
53- var uri = $ "/api/v2/webdeployments/deployments/ { Uri . EscapeDataString ( deploymentId ) } /cobrowse/ { Uri . EscapeDataString ( sessionId ) } " ;
53+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
5454
55- var response = await _httpClient . DeleteAsync ( uri , cancellationToken ) ;
55+ var response = await client . DeleteAsync ( $ "/api/v2/webdeployments/deployments/ { Uri . EscapeDataString ( deploymentId ) } /cobrowse/ { Uri . EscapeDataString ( sessionId ) } " , cancellationToken ) ;
5656
5757 return response . IsSuccessStatusCode ;
5858 }
@@ -72,14 +72,15 @@ public async Task<bool> DeleteWebdeploymentsTokenRevokeAsync(string xJourneySess
7272 parameters . Add ( "X-Journey-Session-Type" , Uri . EscapeDataString ( xJourneySessionType ) ) ;
7373 }
7474
75+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
76+
7577 var uri = UriHelper . GetUri ( "/api/v2/webdeployments/token/revoke" , parameters ) ;
7678
77- var response = await _httpClient . DeleteAsync ( uri , cancellationToken ) ;
79+ var response = await client . DeleteAsync ( uri , cancellationToken ) ;
7880
7981 response . EnsureSuccessStatusCode ( ) ;
8082
8183 return true ;
82-
8384 }
8485
8586 /// <inheritdoc />
@@ -88,9 +89,9 @@ public async Task<WebDeploymentConfigurationVersion> GetWebdeploymentsConfigurat
8889 ArgumentException . ThrowIfNullOrEmpty ( configurationId ) ;
8990 ArgumentException . ThrowIfNullOrEmpty ( versionId ) ;
9091
91- var uri = $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } /versions/ { Uri . EscapeDataString ( versionId ) } " ;
92+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
9293
93- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
94+ var response = await client . GetAsync ( $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } /versions/ { Uri . EscapeDataString ( versionId ) } " , cancellationToken ) ;
9495
9596 response . EnsureSuccessStatusCode ( ) ;
9697
@@ -102,9 +103,9 @@ public async Task<WebDeploymentConfigurationVersionEntityListing> GetWebdeployme
102103 {
103104 ArgumentException . ThrowIfNullOrEmpty ( configurationId ) ;
104105
105- var uri = $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } /versions" ;
106+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
106107
107- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
108+ var response = await client . GetAsync ( $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } /versions" , cancellationToken ) ;
108109
109110 response . EnsureSuccessStatusCode ( ) ;
110111
@@ -116,9 +117,9 @@ public async Task<WebDeploymentConfigurationVersion> GetWebdeploymentsConfigurat
116117 {
117118 ArgumentException . ThrowIfNullOrEmpty ( configurationId ) ;
118119
119- var uri = $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } /versions/draft" ;
120+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
120121
121- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
122+ var response = await client . GetAsync ( $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } /versions/draft" , cancellationToken ) ;
122123
123124 response . EnsureSuccessStatusCode ( ) ;
124125
@@ -135,9 +136,11 @@ public async Task<WebDeploymentConfigurationVersionEntityListing> GetWebdeployme
135136 parameters . Add ( "showOnlyPublished" , UriHelper . ParameterToString ( showOnlyPublished . Value ) ) ;
136137 }
137138
139+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
140+
138141 var uri = UriHelper . GetUri ( "/api/v2/webdeployments/configurations" , parameters ) ;
139142
140- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
143+ var response = await client . GetAsync ( uri , cancellationToken ) ;
141144
142145 response . EnsureSuccessStatusCode ( ) ;
143146
@@ -159,9 +162,11 @@ public async Task<WebDeployment> GetWebdeploymentsDeploymentAsync(string deploym
159162 }
160163 }
161164
165+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
166+
162167 var uri = UriHelper . GetUri ( $ "/api/v2/webdeployments/deployments/{ Uri . EscapeDataString ( deploymentId ) } ", parameters ) ;
163168
164- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
169+ var response = await client . GetAsync ( uri , cancellationToken ) ;
165170
166171 response . EnsureSuccessStatusCode ( ) ;
167172
@@ -174,9 +179,9 @@ public async Task<CobrowseWebMessagingSession> GetWebdeploymentsDeploymentCobrow
174179 ArgumentException . ThrowIfNullOrEmpty ( deploymentId ) ;
175180 ArgumentException . ThrowIfNullOrEmpty ( sessionId ) ;
176181
177- var uri = $ "/api/v2/webdeployments/deployments/ { Uri . EscapeDataString ( deploymentId ) } /cobrowse/ { Uri . EscapeDataString ( sessionId ) } " ;
182+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
178183
179- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
184+ var response = await client . GetAsync ( $ "/api/v2/webdeployments/deployments/ { Uri . EscapeDataString ( deploymentId ) } /cobrowse/ { Uri . EscapeDataString ( sessionId ) } " , cancellationToken ) ;
180185
181186 response . EnsureSuccessStatusCode ( ) ;
182187
@@ -205,7 +210,11 @@ public async Task<WebDeploymentActiveConfigurationOnDeployment> GetWebdeployment
205210
206211 var uri = UriHelper . GetUri ( $ "/api/v2/webdeployments/deployments/{ Uri . EscapeDataString ( deploymentId ) } /configurations", parameters ) ;
207212
208- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
213+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
214+
215+
216+
217+ var response = await client . GetAsync ( uri , cancellationToken ) ;
209218
210219 response . EnsureSuccessStatusCode ( ) ;
211220
@@ -217,9 +226,11 @@ public async Task<IdentityResolutionConfig> GetWebdeploymentsDeploymentIdentityr
217226 {
218227 ArgumentException . ThrowIfNullOrEmpty ( deploymentId ) ;
219228
220- var uri = $ "/api/v2/webdeployments/deployments/{ Uri . EscapeDataString ( deploymentId ) } /identityresolution";
229+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
230+
221231
222- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
232+
233+ var response = await client . GetAsync ( $ "/api/v2/webdeployments/deployments/{ Uri . EscapeDataString ( deploymentId ) } /identityresolution", cancellationToken ) ;
223234
224235 response . EnsureSuccessStatusCode ( ) ;
225236
@@ -241,7 +252,11 @@ public async Task<ExpandableWebDeploymentEntityListing> GetWebdeploymentsDeploym
241252
242253 var uri = UriHelper . GetUri ( "/api/v2/webdeployments/deployments" , parameters ) ;
243254
244- var response = await _httpClient . GetAsync ( uri , cancellationToken ) ;
255+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
256+
257+
258+
259+ var response = await client . GetAsync ( uri , cancellationToken ) ;
245260
246261 response . EnsureSuccessStatusCode ( ) ;
247262
@@ -253,9 +268,11 @@ public async Task<WebDeploymentConfigurationVersion> CreateWebdeploymentsConfigu
253268 {
254269 ArgumentException . ThrowIfNullOrEmpty ( configurationId ) ;
255270
256- var uri = $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } /versions/draft/publish" ;
271+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
257272
258- var response = await _httpClient . PostAsync ( uri , null , cancellationToken ) ;
273+
274+
275+ var response = await client . PostAsync ( $ "/api/v2/webdeployments/configurations/{ Uri . EscapeDataString ( configurationId ) } /versions/draft/publish", null , cancellationToken ) ;
259276
260277 response . EnsureSuccessStatusCode ( ) ;
261278
@@ -269,7 +286,11 @@ public async Task<WebDeploymentConfigurationVersion> CreateWebdeploymentsConfigu
269286
270287 var uri = "/api/v2/webdeployments/configurations" ;
271288
272- var response = await _httpClient . PostAsJsonAsync ( uri , configurationVersion , _options . JsonSerializerOptions , cancellationToken ) ;
289+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
290+
291+
292+
293+ var response = await client . PostAsJsonAsync ( uri , configurationVersion , _options . JsonSerializerOptions , cancellationToken ) ;
273294
274295 response . EnsureSuccessStatusCode ( ) ;
275296
@@ -283,7 +304,11 @@ public async Task<WebDeployment> CreateWebdeploymentsDeploymentsAsync(WebDeploym
283304
284305 var uri = "/api/v2/webdeployments/deployments" ;
285306
286- var response = await _httpClient . PostAsJsonAsync ( uri , deployment , _options . JsonSerializerOptions , cancellationToken ) ;
307+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
308+
309+
310+
311+ var response = await client . PostAsJsonAsync ( uri , deployment , _options . JsonSerializerOptions , cancellationToken ) ;
287312
288313 response . EnsureSuccessStatusCode ( ) ;
289314
@@ -297,7 +322,11 @@ public async Task<WebDeploymentsAuthorizationResponse> CreateWebdeploymentsToken
297322
298323 var uri = "/api/v2/webdeployments/token/oauthcodegrantjwtexchange" ;
299324
300- var response = await _httpClient . PostAsJsonAsync ( uri , body , _options . JsonSerializerOptions , cancellationToken ) ;
325+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
326+
327+
328+
329+ var response = await client . PostAsJsonAsync ( uri , body , _options . JsonSerializerOptions , cancellationToken ) ;
301330
302331 response . EnsureSuccessStatusCode ( ) ;
303332
@@ -309,7 +338,11 @@ public async Task<SignedData> CreateWebdeploymentsTokenRefreshAsync(WebDeploymen
309338 {
310339 var uri = "/api/v2/webdeployments/token/refresh" ;
311340
312- var response = await _httpClient . PostAsJsonAsync ( uri , body , _options . JsonSerializerOptions , cancellationToken ) ;
341+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
342+
343+
344+
345+ var response = await client . PostAsJsonAsync ( uri , body , _options . JsonSerializerOptions , cancellationToken ) ;
313346
314347 response . EnsureSuccessStatusCode ( ) ;
315348
@@ -322,9 +355,11 @@ public async Task<WebDeploymentConfigurationVersion> UpdateWebdeploymentsConfigu
322355 ArgumentException . ThrowIfNullOrEmpty ( configurationId ) ;
323356 ArgumentNullException . ThrowIfNull ( configurationVersion ) ;
324357
325- var uri = $ "/api/v2/webdeployments/configurations/{ Uri . EscapeDataString ( configurationId ) } /versions/draft";
358+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
359+
360+
326361
327- var response = await _httpClient . PutAsJsonAsync ( uri , configurationVersion , _options . JsonSerializerOptions , cancellationToken ) ;
362+ var response = await client . PutAsJsonAsync ( $ "/api/v2/webdeployments/configurations/ { Uri . EscapeDataString ( configurationId ) } /versions/draft" , configurationVersion , _options . JsonSerializerOptions , cancellationToken ) ;
328363
329364 response . EnsureSuccessStatusCode ( ) ;
330365
@@ -337,9 +372,11 @@ public async Task<WebDeployment> UpdateWebdeploymentsDeploymentAsync(string depl
337372 ArgumentException . ThrowIfNullOrEmpty ( deploymentId ) ;
338373 ArgumentNullException . ThrowIfNull ( deployment ) ;
339374
340- var uri = $ "/api/v2/webdeployments/deployments/ { Uri . EscapeDataString ( deploymentId ) } " ;
375+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
341376
342- var response = await _httpClient . PutAsJsonAsync ( uri , deployment , _options . JsonSerializerOptions , cancellationToken ) ;
377+
378+
379+ var response = await client . PutAsJsonAsync ( $ "/api/v2/webdeployments/deployments/{ Uri . EscapeDataString ( deploymentId ) } ", deployment , _options . JsonSerializerOptions , cancellationToken ) ;
343380
344381 response . EnsureSuccessStatusCode ( ) ;
345382
@@ -352,9 +389,11 @@ public async Task<IdentityResolutionConfig> UpdateWebdeploymentsDeploymentIdenti
352389 ArgumentException . ThrowIfNullOrEmpty ( deploymentId ) ;
353390 ArgumentNullException . ThrowIfNull ( body ) ;
354391
355- var uri = $ "/api/v2/webdeployments/deployments/{ Uri . EscapeDataString ( deploymentId ) } /identityresolution";
392+ var client = _httpClientFactory . CreateClient ( PureCloudConstants . PureCloudClientName ) ;
393+
394+
356395
357- var response = await _httpClient . PutAsJsonAsync ( uri , body , _options . JsonSerializerOptions , cancellationToken ) ;
396+ var response = await client . PutAsJsonAsync ( $ "/api/v2/webdeployments/deployments/ { Uri . EscapeDataString ( deploymentId ) } /identityresolution" , body , _options . JsonSerializerOptions , cancellationToken ) ;
358397
359398 response . EnsureSuccessStatusCode ( ) ;
360399
0 commit comments