You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: USE_CASES.md
+88Lines changed: 88 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@ This document provides examples for specific use cases. Please [open an issue](h
25
25
-[How to transform HTML into plain text](#how-to-transform-html-into-plain-text)
26
26
-[Send an Email With Twilio Email (Pilot)](#send-an-email-with-twilio-email-pilot)
27
27
-[Send an SMS Message](#send-an-sms-message)
28
+
-[Working With Permissions](#working-with-permissions)
28
29
29
30
<aname="attachments"></a>
30
31
# Attachments
@@ -1000,3 +1001,90 @@ namespace TwilioTest
1000
1001
}
1001
1002
}
1002
1003
```
1004
+
1005
+
<aname="working-with-permissions" ></a>
1006
+
# Working with permissions
1007
+
1008
+
The permissions builder is a convenient way to manipulate API key permissions when creating new API keys or managing existing API keys.
1009
+
1010
+
You can use the enums named according to the various [permissions](https://sendgrid.api-docs.io/v3.0/api-key-permissions) to add the scopes required for those permissions.
1011
+
1012
+
By default, all scopes for a given permission are added; however, You can filter out certain scopes by passing a ScopeOptions parameter or adding some filtering functions.
1013
+
1014
+
For example, to create an API key for all *Alerts* scopes and read only *Marketing Campaigns*:
1015
+
1016
+
```
1017
+
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
await client.CreateApiKey(builder, "Mail Send API Key");
1059
+
```
1060
+
1061
+
The builder filters out duplicate scopes by default but you can also add filters to the builder so that your application will never create keys with certain scopes.
1062
+
1063
+
For example, you may want to allow an API key to do just about anything EXCEPT create more API keys.
1064
+
1065
+
```
1066
+
var apiKey = Environment.GetEnvironmentVariable("NAME_OF_THE_ENVIRONMENT_VARIABLE_FOR_YOUR_SENDGRID_KEY");
0 commit comments