@@ -38,9 +38,7 @@ With this library, you will be able to:
38
38
39
39
## Install Package
40
40
41
- ``` csharp
42
- TBD
43
- ```
41
+ To use sendsecure-csharp in your C# project, clone or download the SendSecure C# .NET libraries directly from our GitHub repository.
44
42
45
43
<a name =" quickstart " ></a >
46
44
# Quick Start
@@ -51,26 +49,104 @@ Authentication is done using an API Token, which must be first obtained based on
51
49
Here is the minimum code to get such a user-based API Token.
52
50
53
51
``` csharp
54
- TBD
52
+ using System ;
53
+ using System .Collections .Generic ;
54
+ using System .IO ;
55
+ using System .Linq ;
56
+ using System .Text ;
57
+ using System .Threading .Tasks ;
58
+ using XMedius .SendSecure ;
59
+
60
+ namespace SendSecureClient
61
+ {
62
+ class Program
63
+ {
64
+ static void Main (string [] args )
65
+ {
66
+ try
67
+ {
68
+ string token = GetUserToken ().Result ;
69
+ }
70
+ catch (XMedius .SendSecure .Exceptions .SendSecureException e )
71
+ {
72
+ Console .WriteLine (e .Message );
73
+ if (! String .IsNullOrEmpty (e .Response ))
74
+ {
75
+ Console .WriteLine (" Server response: " + e .Response );
76
+ }
77
+ }
78
+ }
79
+
80
+ public static async Task <string > GetUserToken ()
81
+ {
82
+ string token = await XMedius .SendSecure .Client .GetUserToken (" deathstar" , " darthvader" , " d@Rk$1De" , " DV-TIE/x1" , " TIE Advanced x1" , " The Force App" , new Uri (" https://portal.xmedius.com" ));
83
+
84
+ Console .WriteLine (token );
85
+ return token ;
86
+ }
87
+ }
88
+ }
55
89
```
56
90
57
- ## SafeBox Creation
91
+ ## SafeBox Creation (Using SafeBox Helper Class)
58
92
59
93
Here is the minimum required code to create a SafeBox – with 1 recipient, a subject, a message and 1 attachment.
60
94
This example uses the user's * default* security profile (which requires to be set in the account).
61
95
62
- ### With SafeBox Helper Class
63
-
64
96
``` csharp
65
- TBD
97
+ using System ;
98
+ using System .Collections .Generic ;
99
+ using System .IO ;
100
+ using System .Linq ;
101
+ using System .Text ;
102
+ using System .Threading .Tasks ;
103
+ using XMedius .SendSecure ;
104
+
105
+ namespace SendSecureClient
106
+ {
107
+ class Program
108
+ {
109
+ static void Main (string [] args )
110
+ {
111
+ try
112
+ {
113
+ string token = " USER|1d495165-4953-4457-8b5b-4fcf801e621a" ;
114
+
115
+ string previewUrl = SubmitSafebox (token ).GetAwaiter ().GetResult ();
116
+ }
117
+ catch (XMedius .SendSecure .Exceptions .SendSecureException e )
118
+ {
119
+ Console .WriteLine (e .Message );
120
+ if (! String .IsNullOrEmpty (e .Response ))
121
+ {
122
+ Console .WriteLine (" Server response: " + e .Response );
123
+ }
124
+ }
125
+ }
126
+
127
+ public static async Task <string > SubmitSafebox (string token )
128
+ {
129
+ var safebox2 = new XMedius .
SendSecure .
Helpers .
Safebox (
" [email protected] " );
130
+ safebox2 .Subject = " Family matters" ;
131
+ safebox2 .Message = " Son, you will find attached the evidence." ;
132
+
133
+ safebox2 .Attachments .Add (new XMedius .SendSecure .Helpers .Attachment (" d:\\ Birth_Certificate.pdf" ));
134
+
135
+ var recipient = new XMedius .
SendSecure .
Helpers .
Recipient (
" [email protected] " );
136
+ var contactMethod = new XMedius .SendSecure .Helpers .ContactMethod { Destination = " 555-232-5334" , DestinationType = XMedius .SendSecure .Helpers .ContactMethod .DestinationTypeT .CellPhone };
137
+ recipient .ContactMethods .Add (contactMethod );
138
+ safebox2 .Recipients .Add (recipient );
139
+
140
+ XMedius .SendSecure .Client client = new Client (token , " deathstar" , new Uri (" https://portal.xmedius.com" ));
141
+ XMedius .SendSecure .Helpers .SafeboxResponse safeboxResponse = await client .SubmitSafebox (safebox2 );
142
+
143
+ Console .WriteLine (safeboxResponse .PreviewUrl );
144
+ return safeboxResponse .PreviewUrl ;
145
+ }
146
+ }
147
+ }
66
148
```
67
149
68
- <!-- ### Without SafeBox Helper Class
69
-
70
- ```csharp
71
- TBD
72
- ```
73
- -->
74
150
<a name =" usage " ></a >
75
151
# Usage
76
152
@@ -83,16 +159,17 @@ GetUserToken(enterpriseAccount, username, password, deviceId, deviceName, applic
83
159
Creates and returns an API Token for a specific user within a SendSecure enterprise account.
84
160
Calling this method again with the exact same params will always return the same Token.
85
161
86
- Param | Type | Definition
87
- ------------------|--------|-----------
88
- enterpriseAccount | String | The SendSecure enterprise account
89
- username | String | The username of a SendSecure user of the current enterprise account
90
- password | String | The password of this user
91
- deviceId | String | The unique ID of the device used to get the Token
92
- deviceName | String | The name of the device used to get the Token
93
- applicationType | String | The type/name of the application used to get the Token ("SendSecure C#" will be used by default if empty)
94
- endpoint | Uri | The URL to the SendSecure service ("https://portal.xmedius.com " will be used by default if empty)
95
- oneTimePassword | String | The one-time password of this user (if any)
162
+ Param | Type | Definition
163
+ ------------------|-------------------|-----------
164
+ enterpriseAccount | String | The SendSecure enterprise account
165
+ username | String | The username of a SendSecure user of the current enterprise account
166
+ password | String | The password of this user
167
+ deviceId | String | The unique ID of the device used to get the Token
168
+ deviceName | String | The name of the device used to get the Token
169
+ applicationType | String | The type/name of the application used to get the Token ("SendSecure C#" will be used by default if empty)
170
+ endpoint | Uri | The URL to the SendSecure service ("https://portal.xmedius.com " will be used by default if empty)
171
+ oneTimePassword | String | The one-time password of this user (if any)
172
+ cancellationToken | CancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation
96
173
97
174
### Client Object Constructor
98
175
```
@@ -112,46 +189,54 @@ EnterpriseSettings(cancellationToken)
112
189
```
113
190
Returns all values/properties of the enterprise account's settings specific to SendSecure.
114
191
192
+ Param | Type | Definition
193
+ ------------------|-------------------|-----------
194
+ cancellationToken | CancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation
195
+
115
196
### Get Default Security Profile
116
197
```
117
198
DefaultSecurityProfile(userEmail, cancellationToken)
118
199
```
119
200
Returns the default security profile (if it has been set) for a specific user, with all its setting values/properties.
120
201
121
- Param | Type | Definition
122
- -----------|--------|-----------
123
- userEmail | String | The email address of a SendSecure user of the current enterprise account
202
+ Param | Type | Definition
203
+ ------------------|-------------------|-----------
204
+ userEmail | String | The email address of a SendSecure user of the current enterprise account
205
+ cancellationToken | CancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation
124
206
125
207
### Get Security Profiles
126
208
```
127
209
SecurityProfiles(userEmail, cancellationToken)
128
210
```
129
211
Returns the list of all security profiles available to a specific user, with all their setting values/properties.
130
212
131
- Param | Type | Definition
132
- -----------|--------|-----------
133
- userEmail | String | The email address of a SendSecure user of the current enterprise account
213
+ Param | Type | Definition
214
+ ------------------|-------------------|-----------
215
+ userEmail | String | The email address of a SendSecure user of the current enterprise account
216
+ cancellationToken | CancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation
134
217
135
218
### Initialize SafeBox
136
219
```
137
220
InitializeSafebox(safebox, cancellationToken)
138
221
```
139
222
Pre-creates a SafeBox on the SendSecure system and returns the updated Safebox object with the necessary system parameters filled out (GUID, public encryption key, upload URL).
140
223
141
- Param | Type | Definition
142
- -----------|---------|-----------
143
- safebox | Safebox | A Safebox object to be initialized by the SendSecure system
224
+ Param | Type | Definition
225
+ ------------------|-------------------|-----------
226
+ safebox | String | A Safebox object to be initialized by the SendSecure system
227
+ cancellationToken | CancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation
144
228
145
229
### Upload Attachment
146
230
```
147
231
UploadAttachment(safebox, attachment, cancellationToken)
148
232
```
149
233
Uploads the specified file as an Attachment of the specified SafeBox and returns the updated Attachment object with the GUID parameter filled out.
150
234
151
- Param | Type | Definition
152
- -----------|------------|-----------
153
- safebox | Safebox | An initialized Safebox object
154
- attachment | Attachment | An Attachment object - the file to upload to the SendSecure system
235
+ Param | Type | Definition
236
+ ------------------|-------------------|-----------
237
+ safebox | Safebox | An initialized Safebox object
238
+ attachment | Attachment | An Attachment object - the file to upload to the SendSecure system
239
+ cancellationToken | CancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation
155
240
156
241
### Commit SafeBox
157
242
```
@@ -160,19 +245,21 @@ CommitSafebox(safebox, cancellationToken)
160
245
Finalizes the creation (commit) of the SafeBox on the SendSecure system.
161
246
This actually "Sends" the SafeBox with all content and contact info previously specified.
162
247
163
- Param | Type | Definition
164
- -----------|---------|-----------
165
- safebox | Safebox | A Safebox object already initialized, with security profile, recipient(s), subject and message already defined, and attachments already uploaded.
248
+ Param | Type | Definition
249
+ ------------------|-------------------|-----------
250
+ safebox | Safebox | A Safebox object already initialized, with security profile, recipient(s), subject and message already defined, and attachments already uploaded.
251
+ cancellationToken | CancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation
166
252
167
253
### Submit SafeBox
168
254
```
169
255
SubmitSafebox(safebox, cancellationToken)
170
256
```
171
257
This method is a high-level combo that initializes the SafeBox, uploads all attachments and commits the SafeBox.
172
258
173
- Param | Type | Definition
174
- -----------|---------|-----------
175
- safebox | Safebox | A non-initialized Safebox object with security profile, recipient(s), subject, message and attachments (not yet uploaded) already defined.
259
+ Param | Type | Definition
260
+ ------------------|-------------------|-----------
261
+ safebox | Safebox | A non-initialized Safebox object with security profile, recipient(s), subject, message and attachments (not yet uploaded) already defined.
262
+ cancellationToken | CancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation
176
263
177
264
178
265
## Helper Modules
0 commit comments