Skip to content

Commit

Permalink
Merge pull request #1 from liblaber/09-16-23
Browse files Browse the repository at this point in the history
  • Loading branch information
AdiBarHalevi authored Sep 16, 2024
2 parents bf70282 + a77347f commit 4a35f62
Show file tree
Hide file tree
Showing 33 changed files with 368 additions and 129 deletions.
16 changes: 9 additions & 7 deletions .manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"liblabVersion": "2.1.23",
"date": "2024-07-25T13:49:43.911Z",
"liblabVersion": "2.3.2",
"date": "2024-09-16T20:07:12.439Z",
"config": {
"apiId": 414,
"apiId": 1169,
"sdkName": "voyado_engage",
"sdkVersion": "1.0.0",
"liblabVersion": "2",
"deliveryMethods": ["zip"],
"languages": ["csharp"],
"apiVersion": "1.0.0",
"apiName": "voyado",
"specFilePath": "./voyao_engage_swagger.json",
"specFilePath": "./apis/voyado.json",
"auth": ["bearer"],
"languageOptions": {
"csharp": {
Expand Down Expand Up @@ -40,7 +40,7 @@
"prefix": "Bearer"
}
},
"devContainer": false,
"devContainer": true,
"generateEnv": true,
"includeOptionalSnippetParameters": true,
"inferServiceNames": false,
Expand All @@ -62,7 +62,6 @@
"httpMethodsToRetry": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]
},
"multiTenant": true,
"specUrl": "https://dev-liblab-api-stack-specs.s3.us-east-1.amazonaws.com/414/open-api-spec.json?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA3C2RXH7MWUCMN7ON%2F20240725%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240725T134938Z&X-Amz-Expires=43200&X-Amz-Signature=94492284738682e64b236f7d036939fe88d998d80ac3837429aad88f6abaa9b6&X-Amz-SignedHeaders=host&x-id=GetObject",
"includeWatermark": true,
"packageId": "",
"githubRepoName": "",
Expand All @@ -79,7 +78,7 @@
"httpLibrary": {
"name": "axios",
"packages": {
"axios": "^1.6.8"
"axios": "^1.7.4"
},
"languages": ["typescript"]
},
Expand Down Expand Up @@ -206,6 +205,9 @@
"documentation/models/ReceiptUsedPromotion.md",
"documentation/models/ReceiptExtraDataItem.md",
"documentation/models/ReceiptItemDiscount.md",
".devcontainer/devcontainer.json",
"VoyadoEngage/Http/ApiException.cs",
"VoyadoEngage/Http/HttpResponseMessageExtensions.ejs';}.cs",
"VoyadoEngage/Services/TransactionsService.cs",
"VoyadoEngage/Models/ApiAchievementValue.cs",
"VoyadoEngage/Models/PagedResultOfApiAchievementDefinition.cs",
Expand Down
148 changes: 147 additions & 1 deletion README.md

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions VoyadoEngage/Http/ApiException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This file was generated by liblab | https://liblab.com/

namespace VoyadoEngage.Http.Exceptions;

public class ApiException : HttpRequestException
{
public HttpResponseMessage Response { get; }

public ApiException(HttpResponseMessage responseMessage)
: base(
$"Response status code does not indicate success: {(int)responseMessage.StatusCode} ({responseMessage.StatusCode}).",
null,
responseMessage.StatusCode
)
{
Response = responseMessage;
}
}
17 changes: 17 additions & 0 deletions VoyadoEngage/Http/HttpResponseMessageExtensions.ejs';}.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// This file was generated by liblab | https://liblab.com/

using VoyadoEngage.Http.Exceptions;

namespace VoyadoEngage.Http.Extensions;

public static class HttpResponseMessageExtensions
{
public static HttpResponseMessage EnsureSuccessfulResponse(this HttpResponseMessage response)
{
if (!response.IsSuccessStatusCode)
{
throw new ApiException(response);
}
return response;
}
}
9 changes: 7 additions & 2 deletions VoyadoEngage/Http/RequestBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This file was generated by liblab | https://liblab.com/

using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using VoyadoEngage.Http.Serialization;
Expand Down Expand Up @@ -110,9 +111,13 @@ public RequestBuilder SetOptionalHeader(string key, object? value, bool explode
/// <summary>
/// Sets the content of the request as JSON.
/// </summary>
public RequestBuilder SetContentAsJson(object content, JsonSerializerOptions? options = null)
public RequestBuilder SetContentAsJson(
object content,
JsonSerializerOptions? options = null,
MediaTypeHeaderValue? mediaType = null
)
{
_content = JsonContent.Create(content, options: options);
_content = JsonContent.Create(content, mediaType, options);
return this;
}

Expand Down
12 changes: 8 additions & 4 deletions VoyadoEngage/Services/AchievementsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

using System.Net.Http.Json;
using VoyadoEngage.Http;
using VoyadoEngage.Http.Exceptions;
using VoyadoEngage.Http.Extensions;
using VoyadoEngage.Http.Serialization;
using VoyadoEngage.Models;

Expand All @@ -26,9 +28,9 @@ public async Task<List<ApiAchievementValue>> AchievementsGetAchievementsForConta
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<List<ApiAchievementValue>>(
_jsonSerializerOptions,
cancellationToken
Expand All @@ -50,9 +52,9 @@ public async Task<PagedResultOfApiAchievementDefinition> AchievementsGetAllAchie
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<PagedResultOfApiAchievementDefinition>(
_jsonSerializerOptions,
cancellationToken
Expand Down Expand Up @@ -83,7 +85,8 @@ public async Task AchievementsSetAchievementAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

response.EnsureSuccessfulResponse();
}

public async Task AchievementsRemoveAchievementAsync(
Expand All @@ -106,6 +109,7 @@ public async Task AchievementsRemoveAchievementAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

response.EnsureSuccessfulResponse();
}
}
10 changes: 6 additions & 4 deletions VoyadoEngage/Services/AutomationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

using System.Net.Http.Json;
using VoyadoEngage.Http;
using VoyadoEngage.Http.Exceptions;
using VoyadoEngage.Http.Extensions;
using VoyadoEngage.Http.Serialization;

namespace VoyadoEngage.Services;
Expand Down Expand Up @@ -34,9 +36,9 @@ public async Task<object> CustomTriggersTriggerByContactIdAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<object>(_jsonSerializerOptions, cancellationToken)
.ConfigureAwait(false) ?? throw new Exception("Failed to deserialize response.");
}
Expand Down Expand Up @@ -64,9 +66,9 @@ public async Task<object> CustomTriggersTriggerBySocialSecurityNumberAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<object>(_jsonSerializerOptions, cancellationToken)
.ConfigureAwait(false) ?? throw new Exception("Failed to deserialize response.");
}
Expand Down Expand Up @@ -94,9 +96,9 @@ public async Task<object> CustomTriggersTriggerByExternalContactIdAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<object>(_jsonSerializerOptions, cancellationToken)
.ConfigureAwait(false) ?? throw new Exception("Failed to deserialize response.");
}
Expand Down Expand Up @@ -127,9 +129,9 @@ public async Task<object> CustomTriggersTriggerByContactTypeAndKeyAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<object>(_jsonSerializerOptions, cancellationToken)
.ConfigureAwait(false) ?? throw new Exception("Failed to deserialize response.");
}
Expand Down
4 changes: 3 additions & 1 deletion VoyadoEngage/Services/BisnodeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

using System.Net.Http.Json;
using VoyadoEngage.Http;
using VoyadoEngage.Http.Exceptions;
using VoyadoEngage.Http.Extensions;
using VoyadoEngage.Http.Serialization;
using VoyadoEngage.Models;

Expand All @@ -27,9 +29,9 @@ public async Task<List<EnrichmentVariableGroup>> BisnodeVGetEnrichmentsAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<List<EnrichmentVariableGroup>>(
_jsonSerializerOptions,
cancellationToken
Expand Down
10 changes: 6 additions & 4 deletions VoyadoEngage/Services/BonuschecksService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

using System.Net.Http.Json;
using VoyadoEngage.Http;
using VoyadoEngage.Http.Exceptions;
using VoyadoEngage.Http.Extensions;
using VoyadoEngage.Http.Serialization;
using VoyadoEngage.Models;

Expand Down Expand Up @@ -38,9 +40,9 @@ public async Task<PagedResultOfAllBonusCheckModel> BonusChecksGetBonusChecksForC
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<PagedResultOfAllBonusCheckModel>(
_jsonSerializerOptions,
cancellationToken
Expand Down Expand Up @@ -77,9 +79,9 @@ public async Task<PagedResultOfRedeemedBonusCheckModel> BonusChecksGetRedeemedBo
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<PagedResultOfRedeemedBonusCheckModel>(
_jsonSerializerOptions,
cancellationToken
Expand Down Expand Up @@ -119,9 +121,9 @@ public async Task<PagedResultOfAvailableBonusCheckModel> BonusChecksGetAvailable
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<PagedResultOfAvailableBonusCheckModel>(
_jsonSerializerOptions,
cancellationToken
Expand Down Expand Up @@ -152,9 +154,9 @@ public async Task<RedeemedBonusCheckModel> BonusChecksRedeemBonusCheckAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<RedeemedBonusCheckModel>(
_jsonSerializerOptions,
cancellationToken
Expand Down
14 changes: 8 additions & 6 deletions VoyadoEngage/Services/ChallengesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

using System.Net.Http.Json;
using VoyadoEngage.Http;
using VoyadoEngage.Http.Exceptions;
using VoyadoEngage.Http.Extensions;
using VoyadoEngage.Http.Serialization;
using VoyadoEngage.Models;

Expand All @@ -28,9 +30,9 @@ public async Task<ChallengeAssignmentModel> ChallengeGetChallengeByIdAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<ChallengeAssignmentModel>(
_jsonSerializerOptions,
cancellationToken
Expand All @@ -54,9 +56,9 @@ public async Task<ChallengeDefinitionModel> ChallengeGetChallengeDefinitionByIdA
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<ChallengeDefinitionModel>(
_jsonSerializerOptions,
cancellationToken
Expand Down Expand Up @@ -84,9 +86,9 @@ public async Task<ChallengeDefinitionModelsResult> ChallengeGetChallengeDefiniti
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<ChallengeDefinitionModelsResult>(
_jsonSerializerOptions,
cancellationToken
Expand Down Expand Up @@ -122,9 +124,9 @@ public async Task<ChallengeAssignmentModelsResult> ChallengeGetChallengesAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<ChallengeAssignmentModelsResult>(
_jsonSerializerOptions,
cancellationToken
Expand Down Expand Up @@ -161,9 +163,9 @@ public async Task<AddCheckpointToChallengeAssignmentResult> ChallengeAddChalleng
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<AddCheckpointToChallengeAssignmentResult>(
_jsonSerializerOptions,
cancellationToken
Expand Down Expand Up @@ -197,9 +199,9 @@ public async Task<bool> ChallengeConsentAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<bool>(_jsonSerializerOptions, cancellationToken)
.ConfigureAwait(false);
}
Expand Down
4 changes: 3 additions & 1 deletion VoyadoEngage/Services/ConsentsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

using System.Net.Http.Json;
using VoyadoEngage.Http;
using VoyadoEngage.Http.Exceptions;
using VoyadoEngage.Http.Extensions;
using VoyadoEngage.Http.Serialization;
using VoyadoEngage.Models;

Expand Down Expand Up @@ -41,9 +43,9 @@ public async Task<List<ApiConsentDefinition>> ConsentsGetConsentsAsync(
var response = await _httpClient
.SendAsync(request, cancellationToken)
.ConfigureAwait(false);
response.EnsureSuccessStatusCode();

return await response
.EnsureSuccessfulResponse()
.Content.ReadFromJsonAsync<List<ApiConsentDefinition>>(
_jsonSerializerOptions,
cancellationToken
Expand Down
Loading

0 comments on commit 4a35f62

Please sign in to comment.