-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement CreateMember in Conversations
- Loading branch information
Showing
21 changed files
with
1,134 additions
and
17 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
Vonage.Test/Conversations/CreateMember/Data/ShouldDeserialize200-response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"id": "MEM-63f61863-4a51-4f6b-86e1-46edebio0391", | ||
"conversation_id": "CON-d66d47de-5bcb-4300-94f0-0c9d4b948e9a", | ||
"_embedded": { | ||
"user": { | ||
"id": "USR-82e028d9-5201-4f1e-8188-604b2d3471ec", | ||
"name": "my_user_name", | ||
"display_name": "My User Name", | ||
"_links": { | ||
"self": { | ||
"href": "https://api.nexmo.com/v1/users/USR-82e028d9-5201-4f1e-8188-604b2d3471ec" | ||
} | ||
} | ||
} | ||
}, | ||
"state": "JOINED", | ||
"timestamp": { | ||
"invited": "2020-01-01T14:00:00.00Z", | ||
"joined": "2020-01-01T14:00:00.00Z", | ||
"left": "2020-01-01T14:00:00.00Z" | ||
}, | ||
"initiator": { | ||
"joined": { | ||
"is_system": true, | ||
"user_id": "USR-82e028d9-5201-4f1e-8188-604b2d3471ec", | ||
"member_id": "MEM-63f61863-4a51-4f6b-86e1-46edebio0391" | ||
} | ||
}, | ||
"channel": { | ||
"type": "app", | ||
"from": { | ||
"type": "app" | ||
}, | ||
"to": { | ||
"type": "app", | ||
"user": "string" | ||
} | ||
}, | ||
"media": { | ||
"audio_settings": { | ||
"enabled": true, | ||
"earmuffed": true, | ||
"muted": true | ||
}, | ||
"audio": true | ||
}, | ||
"knocking_id": "string", | ||
"invited_by": "MEM-63f61863-4a51-4f6b-86e1-46edebio0378", | ||
"_links": { | ||
"href": "https://api.nexmo.com/v1/conversations/CON-63f61863-4a51-4f6b-86e1-46edebio0391/members/MEM-63f61863-4a51-4f6b-86e1-46edebio0391" | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Vonage.Test/Conversations/CreateMember/Data/ShouldSerializeApp-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"state": "invited", | ||
"user": { | ||
"id": "USR-123", | ||
"name": "User 123" | ||
}, | ||
"channel": { | ||
"type": "app", | ||
"from": { | ||
"type": "app,phone,sms" | ||
}, | ||
"to": { | ||
"type": "app", | ||
"user": "USR-123" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Vonage.Test/Conversations/CreateMember/Data/ShouldSerializeMessenger-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"state": "invited", | ||
"user": { | ||
"id": "USR-123", | ||
"name": "User 123" | ||
}, | ||
"channel": { | ||
"type": "messenger", | ||
"from": { | ||
"type": "app,phone,sms" | ||
}, | ||
"to": { | ||
"type": "messenger", | ||
"id": "1" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Vonage.Test/Conversations/CreateMember/Data/ShouldSerializeMms-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"state": "invited", | ||
"user": { | ||
"id": "USR-123", | ||
"name": "User 123" | ||
}, | ||
"channel": { | ||
"type": "mms", | ||
"from": { | ||
"type": "app,phone,sms" | ||
}, | ||
"to": { | ||
"type": "mms", | ||
"number": "123456789" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Vonage.Test/Conversations/CreateMember/Data/ShouldSerializePhone-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"state": "invited", | ||
"user": { | ||
"id": "USR-123", | ||
"name": "User 123" | ||
}, | ||
"channel": { | ||
"type": "phone", | ||
"from": { | ||
"type": "app,phone,sms" | ||
}, | ||
"to": { | ||
"type": "phone", | ||
"number": "123456789" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Vonage.Test/Conversations/CreateMember/Data/ShouldSerializeSms-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"state": "invited", | ||
"user": { | ||
"id": "USR-123", | ||
"name": "User 123" | ||
}, | ||
"channel": { | ||
"type": "sms", | ||
"from": { | ||
"type": "app,phone,sms" | ||
}, | ||
"to": { | ||
"type": "sms", | ||
"number": "123456789" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Vonage.Test/Conversations/CreateMember/Data/ShouldSerializeViber-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"state": "invited", | ||
"user": { | ||
"id": "USR-123", | ||
"name": "User 123" | ||
}, | ||
"channel": { | ||
"type": "viber", | ||
"from": { | ||
"type": "app,phone,sms" | ||
}, | ||
"to": { | ||
"type": "viber", | ||
"id": "1" | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Vonage.Test/Conversations/CreateMember/Data/ShouldSerializeWhatsApp-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"state": "invited", | ||
"user": { | ||
"id": "USR-123", | ||
"name": "User 123" | ||
}, | ||
"channel": { | ||
"type": "whatsapp", | ||
"from": { | ||
"type": "app,phone,sms" | ||
}, | ||
"to": { | ||
"type": "whatsapp", | ||
"number": "123456789" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Net; | ||
using System.Threading.Tasks; | ||
using Vonage.Common.Monads; | ||
using Vonage.Conversations.CreateMember; | ||
using Vonage.Test.Common.Extensions; | ||
using WireMock.ResponseBuilders; | ||
using Xunit; | ||
|
||
namespace Vonage.Test.Conversations.CreateMember; | ||
|
||
[Trait("Category", "E2E")] | ||
public class E2ETest : E2EBase | ||
{ | ||
public E2ETest() : base(typeof(E2ETest).Namespace) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public Task CreateMember_WithApp() => | ||
this.CreateConversationAsync(this.Serialization.GetRequestJson(nameof(SerializationTest.ShouldSerializeApp)), | ||
SerializationTest.BuildAppRequest()); | ||
|
||
private async Task CreateConversationAsync(string jsonRequest, Result<CreateMemberRequest> request) | ||
{ | ||
this.Helper.Server.Given(WireMock.RequestBuilders.Request.Create() | ||
.WithPath("/v1/conversations/CON-123/members") | ||
.WithHeader("Authorization", this.Helper.ExpectedAuthorizationHeaderValue) | ||
.WithBody(jsonRequest) | ||
.UsingPost()) | ||
.RespondWith(Response.Create().WithStatusCode(HttpStatusCode.OK) | ||
.WithBody(this.Serialization.GetResponseJson(nameof(SerializationTest.ShouldDeserialize200)))); | ||
await this.Helper.VonageClient.ConversationsClient | ||
.CreateMemberAsync(request) | ||
.Should() | ||
.BeSuccessAsync(SerializationTest.VerifyResponse); | ||
} | ||
} |
Oops, something went wrong.