Skip to content

Commit 00fefdb

Browse files
v3.0.7
- Pagining enhancements to multiple methods - Add recipient notification to FinalizePackage - Addresses #7
1 parent 417c55b commit 00fefdb

16 files changed

Lines changed: 624 additions & 234 deletions

SendsafelyAPI/ClientAPI.cs

Lines changed: 158 additions & 8 deletions
Large diffs are not rendered by default.

SendsafelyAPI/Objects/Connection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ private String generateUserAgent()
253253

254254
private String CreateSignature(String privateKey, String apiKey, String uri, String dateStr, String requestData)
255255
{
256-
String content = apiKey + uri + dateStr + requestData;
256+
String content = apiKey + uri.Split('?')[0] + dateStr + requestData;
257257
Logger.Log("-" + content + "-");
258258
CryptUtility cu = new CryptUtility();
259259
return cu.createSignature(privateKey, content);

SendsafelyAPI/Objects/ConnectionStrings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal class ConnectionStrings
1515
{"receivedPackages", new Endpoint("/api/v2.0/package/received/", HTTPMethod.GET, "application/json")},
1616
{"archivedPackages", new Endpoint("/api/v2.0/package/archived/", HTTPMethod.GET, "application/json")},
1717
{"organizationPackages", new Endpoint("/api/v2.0/package/organization/", HTTPMethod.POST, "application/json")},
18+
{"organizationPackagesSearch", new Endpoint("/api/v2.0/package/organization/search", HTTPMethod.POST, "application/json") },
1819
{"addRecipient", new Endpoint("/api/v2.0/package/{packageId}/recipient/", HTTPMethod.PUT, "application/json")},
1920
{"addRecipientPhonenumber", new Endpoint("/api/v2.0/package/{packageId}/recipient/{recipientId}/", HTTPMethod.POST, "application/json")},
2021
{"createFileId", new Endpoint("/api/v2.0/package/{packageId}/file/", HTTPMethod.PUT, "application/json")},
@@ -73,6 +74,7 @@ internal class ConnectionStrings
7374
{"addContactGroupsToPackage", new Endpoint("/api/v2.0/package/{packageId}/group/{groupId}/", HTTPMethod.PUT, "application/json")},
7475
{"removeContactGroupsToPackage", new Endpoint("/api/v2.0/package/{packageId}/group/{groupId}/", HTTPMethod.DELETE, "application/json")},
7576
{"removeRecipient", new Endpoint("/api/v2.0/package/{packageId}/recipient/{recipientId}/", HTTPMethod.DELETE, "application/json")},
77+
{"notifyRecipients", new Endpoint("/api/v2.0/package/{packageId}/notify", HTTPMethod.POST, "application/json") },
7678
};
7779
}
7880
}

SendsafelyAPI/Objects/DirectoryResponse.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ public class DirectoryResponse
1515
private ICollection<DirectoryResponse> subDirectories = new Collection<DirectoryResponse>();
1616

1717
[JsonProperty(PropertyName = "directoryId")]
18-
internal String DirectoryId
18+
public String DirectoryId
1919
{
2020
get { return directoryId; }
2121
set { directoryId = value; }
2222
}
2323
[JsonProperty(PropertyName = "name")]
24-
internal String Name
24+
public String Name
2525
{
2626
get { return name; }
2727
set { name = value; }
2828
}
2929
[JsonProperty(PropertyName = "created")]
30-
internal DateTime Created
30+
public DateTime Created
3131
{
3232
get { return created; }
3333
set { created = value; }
3434
}
3535
[JsonProperty(PropertyName = "subDirectories")]
36-
internal ICollection<DirectoryResponse> SubDirectories
36+
public ICollection<DirectoryResponse> SubDirectories
3737
{
3838
get { return subDirectories; }
3939
set { subDirectories = value; }

SendsafelyAPI/Objects/GetOrganizationPakagesResponse.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace SendSafely.Objects
77
{
8-
class GetOrganizationPakagesResponse : StandardResponse
8+
class GetOrganizationPakagesResponse : PaginationResponse
99
{
1010

1111
List<PackageDTO> packages;
@@ -18,13 +18,12 @@ public List<PackageDTO> Packages
1818
set { packages = value; }
1919
}
2020

21+
[Obsolete("capped is deprecated, please use Pagination property instead)",false)]
2122
[JsonProperty(PropertyName = "capped")]
2223
public bool Capped
2324
{
2425
get { return capped; }
2526
set { capped = value; }
2627
}
27-
28-
2928
}
3029
}

SendsafelyAPI/Objects/GetPackagesResponse.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,11 @@
66
namespace SendSafely.Objects
77
{
88
[JsonObject(MemberSerialization.OptIn)]
9-
class GetPackagesResponse
9+
class GetPackagesResponse : PaginationResponse
1010
{
11-
private APIResponse _response;
11+
1212
private List<PackageDTO> _packages;
1313

14-
[JsonProperty(PropertyName = "response")]
15-
internal APIResponse Response
16-
{
17-
get { return _response; }
18-
set { _response = value; }
19-
}
20-
2114
[JsonProperty(PropertyName = "packages")]
2215
public List<PackageDTO> Packages
2316
{

SendsafelyAPI/Objects/Keypair.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace SendSafely.Objects
66
{
7-
class Keypair
7+
public class Keypair
88
{
99
public String PrivateKey { get; set; }
1010
public String PublicKey { get; set; }
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using Newtonsoft.Json;
5+
6+
namespace SendSafely.Objects
7+
{
8+
[JsonObject(MemberSerialization.OptIn)]
9+
class NotifyPackageRecipientsRequest
10+
{
11+
private String _keycode;
12+
13+
[JsonProperty(PropertyName = "keycode")]
14+
public String Keycode { get; set; }
15+
}
16+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using Newtonsoft.Json;
5+
6+
namespace SendSafely.Objects
7+
{
8+
class PaginationResponse : StandardResponse
9+
{
10+
11+
private Dictionary<String, String> _pagination;
12+
13+
[JsonProperty(PropertyName = "pagination")]
14+
internal Dictionary<String, String> Pagination
15+
{
16+
get { return _pagination; }
17+
set { _pagination = value; }
18+
}
19+
}
20+
}

SendsafelyAPI/Objects/ProgressStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public ProgressStream(Stream inner, ISendSafelyProgress progress, String prefix,
2525
this._inner = inner;
2626
this._progress = progress;
2727
this._prefix = prefix;
28-
this._fileSize = size;
28+
this._fileSize = size < 1024 ? size * 1024 : size; // multiple file size by 1024 if fileSize is less than 1024 bytes.
2929
this._readSoFar = 0;
3030
this._offset = offset;
3131
_lastProgressCallback = DateTime.Now.Ticks - UPDATE_FREQUENCY; // Make sure we trigger it the first time.

0 commit comments

Comments
 (0)