-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Adding TaskRouterGrant file (#748)
* fix: Adding TaskRouterGrant file
- Loading branch information
1 parent
bc1401a
commit 4542584
Showing
4 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
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
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,67 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Twilio.Jwt.AccessToken | ||
{ | ||
/// <summary> | ||
/// Grant to use for Twilio TaskRouter | ||
/// </summary> | ||
public class TaskRouterGrant : IGrant | ||
{ | ||
/// <summary> | ||
/// Workspace SID | ||
/// </summary> | ||
public string WorkspaceSid { get; set; } | ||
|
||
/// <summary> | ||
/// Worker SID | ||
/// </summary> | ||
public string WorkerSid { get; set; } | ||
|
||
/// <summary> | ||
/// Role | ||
/// </summary> | ||
public string Role { get; set; } | ||
|
||
/// <summary> | ||
/// Get the grant name | ||
/// </summary> | ||
/// | ||
/// <returns>name of the grant</returns> | ||
public string Key | ||
{ | ||
get | ||
{ | ||
return "task_router"; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Get the grant payload | ||
/// </summary> | ||
/// | ||
/// <returns>payload of the grant</returns> | ||
public object Payload | ||
{ | ||
get | ||
{ | ||
var payload = new Dictionary<string, string>(); | ||
|
||
if (WorkspaceSid != null) | ||
{ | ||
payload.Add("workspace_sid", WorkspaceSid); | ||
} | ||
if (WorkerSid != null) | ||
{ | ||
payload.Add("worker_sid", WorkerSid); | ||
} | ||
if (Role != null) | ||
{ | ||
payload.Add("role", Role); | ||
} | ||
|
||
return payload; | ||
} | ||
} | ||
|
||
} | ||
} |
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
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