Skip to content

Commit b5fa302

Browse files
authored
Merge pull request #3 from infobip-community/feature/validation-align-with-docs
WhatsApp Channel Identity Change endpoints added, validation aligned with docs, and more tests added
2 parents 95b546c + c958e5f commit b5fa302

File tree

80 files changed

+5606
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+5606
-197
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"requestError": {
3+
"serviceException": {
4+
"messageId": "UNAUTHORIZED",
5+
"text": "You are not authorized to access this resource"
6+
}
7+
}
8+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"requestError": {
3+
"serviceException": {
4+
"messageId": "BAD_REQUEST",
5+
"text": "Bad request",
6+
"validationErrors": {
7+
"content.mediaUrl": [
8+
"size must be between 1 and 2048",
9+
"is not a valid url",
10+
"must not be blank"
11+
]
12+
}
13+
}
14+
}
15+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"id": "111",
3+
"businessAccountId": 222,
4+
"name": "exampleName",
5+
"language": "en",
6+
"status": "APPROVED",
7+
"category": "ACCOUNT_UPDATE",
8+
"structure": {
9+
"header": {
10+
"format": "IMAGE"
11+
},
12+
"body": "example {{1}} body",
13+
"footer": "exampleFooter",
14+
"type": "MEDIA"
15+
}
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"requestError": {
3+
"serviceException": {
4+
"messageId": "FORBIDDEN",
5+
"text": "Forbidden"
6+
}
7+
}
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"acknowledged": true,
3+
"hash": "eU2Fdi4EMUw=",
4+
"createdAt": "2022-02-18T08:12:26.422Z"
5+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"templates": [
3+
{
4+
"id": "111",
5+
"businessAccountId": 222,
6+
"name": "exampleName",
7+
"language": "en",
8+
"status": "APPROVED",
9+
"category": "ACCOUNT_UPDATE",
10+
"structure": {
11+
"header": {
12+
"format": "IMAGE"
13+
},
14+
"body": "example {{1}} body",
15+
"footer": "exampleFooter",
16+
"type": "MEDIA"
17+
}
18+
}
19+
]
20+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"error": "string"
3+
}

src/Infobip.Api.SDK.Tests/Data/WhatsApp/Unauthorized.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"requestError": {
33
"serviceException": {
44
"messageId": "UNAUTHORIZED",
5-
"text": "Invalid login details"
5+
"text": "You are not authorized to access this resource"
66
}
77
}
88
}
7.81 KB
Loading

src/Infobip.Api.SDK.Tests/Email/GetEmailDeliveryReportsTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,21 @@ public async Task GetEmailDeliveryReports_Call_With_BadRequestResponse_Throws_In
4949
// Assert
5050
var exception = await Assert.ThrowsAsync<InfobipBadRequestException>(act);
5151
}
52+
53+
[Fact]
54+
public async Task GetEmailDeliveryReports_Call_With_UnauthorizedResponse_Throws_InfobipUnauthorizedException()
55+
{
56+
// Arrange
57+
var responsePayloadFileName = "Data/Email/Unauthorized.json";
58+
var apiClient = new InfobipApiClient(_clientFixture.GetClient(responsePayloadFileName, HttpStatusCode.Unauthorized));
59+
60+
var request = new GetEmailDeliveryReportsRequest();
61+
62+
// Act
63+
Func<Task> act = () => apiClient.Email.GetEmailDeliveryReports(request);
64+
65+
// Assert
66+
var exception = await Assert.ThrowsAsync<InfobipUnauthorizedException>(act);
67+
}
5268
}
5369
}

0 commit comments

Comments
 (0)