Skip to content

Commit

Permalink
Merge pull request #3 from SendSafely/v3.0.3
Browse files Browse the repository at this point in the history
Updates for v3.0.3 release
  • Loading branch information
SendSafely-GitHub authored Jul 26, 2019
2 parents ca699ac + b114d5b commit e3a9b08
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 11 deletions.
47 changes: 39 additions & 8 deletions SendsafelyAPI/ClientAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,7 @@ public void DeletePackage(String packageId)
}

/// <summary>
/// Deletes a temporary package. This action must be called before the package is finalized. Before this function can be called, the package must have been created with
/// <seealso cref="CreatePackage()">CreatePackage()</seealso>.
/// Deletes a temporary package, which is a package that has not yet been finalized.
/// </summary>
/// <param name="packageId"> The unique package id of the package to be deleted.</param>
/// <exception cref="APINotInitializedException">Thrown when the API has not been initialized.</exception>
Expand Down Expand Up @@ -853,6 +852,15 @@ public List<PackageInformation> GetArchivedPackages()
/// <returns>
/// List<ContactGroup> object of Contact Groups and email addresses.
/// </returns>
public List<ContactGroup> GetContactGroups()
{
EnforceInitialized();

PackageUtility pu = new PackageUtility(connection);
return pu.GetContactGroups(false);
}

[Obsolete("getContactGroups is deprecated, please use GetContactGroups instead", false)]
public List<ContactGroup> getContactGroups()
{
EnforceInitialized();
Expand Down Expand Up @@ -897,6 +905,15 @@ public List<String> GetDropzoneRecipients()
/// <returns>
/// List<ContactGroup> object of Contact Groups and email addresses.
/// </returns>
public List<ContactGroup> GetEnterpriseContactGroups()
{
EnforceInitialized();

PackageUtility pu = new PackageUtility(connection);
return pu.GetContactGroups(true);
}

[Obsolete("getEnterpriseContactGroups is deprecated, please use GetEnterpriseContactGroups instead", false)]
public List<ContactGroup> getEnterpriseContactGroups()
{
EnforceInitialized();
Expand Down Expand Up @@ -940,9 +957,9 @@ public FileInformation GetFileInformation(String packageId, String directoryId,
}

/// <summary>
/// Downloads and decrypts a keycode from the Server given a packageId and a private key.
/// Downloads and decrypts a keycode from the server for a given packageId and RSA Key pair.
/// </summary>
/// <param name="privateKey">The private key associated with the package for the keycode.</param>
/// <param name="privateKey">The private key associated with the RSA Key pair used to encrypt the package keycode.</param>
/// <param name="packageId">The package id for the keycode.</param>
/// <exception cref="APINotInitializedException">Thrown when the API has not been initialized.</exception>
/// <exception cref="GettingKeycodeFailedException">Will be thrown if the server returns an error message while downloading the keycode.</exception>
Expand Down Expand Up @@ -1035,6 +1052,20 @@ public PackageInformation GetPackageInformation(String packageId)
/// <returns>
/// A PackageInformation object containing information about the package.
/// </returns>
public PackageInformation GetPackageInformationFromLink(Uri link)
{
EnforceInitialized();

if (link == null)
{
throw new InvalidPackageException("The supplied link is null");
}

PackageUtility pu = new PackageUtility(connection);
return pu.GetPackageInformationFromLink(link);
}

[Obsolete("getPackageInformationFromLink is deprecated, please use GetPackageInformationFromLink instead", false)]
public PackageInformation getPackageInformationFromLink(Uri link)
{
EnforceInitialized();
Expand Down Expand Up @@ -1094,7 +1125,7 @@ public String GetPackageLink(String packageId, String keyCode)
}

/// <summary>
/// Retrieves a list of all active received packages for the given API User.
/// Retrieves a list of all active packages received for the given API User.
/// </summary>
/// <exception cref="APINotInitializedException">Thrown when the API has not been initialized.</exception>
/// <exception cref="InvalidCredentialsException">Thrown when the API credentials are incorrect.</exception>
Expand Down Expand Up @@ -1130,11 +1161,11 @@ public Recipient GetRecipient(String packageId, String recipientId)
}

/// <summary>
/// Retrieves all packages belonging to the given Recipient.
/// Retrieves a list of packages where the passed in email address is a package recipient.
/// </summary>
/// <param name="recipientEmail"> The recipient Email for which the packages information should be fetched.</param>
/// <param name="recipientEmail"> The email address of the recipient.</param>
/// <returns>
/// A PackageInfo object containing information about the package.
/// A PackageInfo object containing information about each package retrieved, including confirmed downloads for the recipient.
/// </returns>
public List<RecipientHistory> GetRecipientHistory(String recipientEmail)
{
Expand Down
6 changes: 4 additions & 2 deletions SendsafelyAPI/CountryCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public enum CountryCode
ES = 34,
SE = 46,
CH = 41,
AE = 971
AE = 971,
OT
};

/// <summary>
Expand Down Expand Up @@ -76,7 +77,8 @@ public enum CountryCode
{ CountryCode.ES, "Spain" },
{ CountryCode.SE, "Sweden" },
{ CountryCode.CH, "Switzerland" },
{ CountryCode.AE, "United Arab Emirates" }
{ CountryCode.AE, "United Arab Emirates" },
{ CountryCode.OT, "Other" }
};
}
}
20 changes: 20 additions & 0 deletions SendsafelyAPI/Exceptions/TwoFAEnforcedException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace SendSafely.Exceptions
{
/// <summary>
/// Thrown when an organization enforce two fa flag is true
/// </summary>
[Serializable]
public class TwoFAEnforcedException : BaseException
{
public TwoFAEnforcedException(String message)
: base(message)
{
;
}
}

}
3 changes: 2 additions & 1 deletion SendsafelyAPI/SendsafelyAPI.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -54,6 +54,7 @@
<Compile Include="Confirmation.cs" />
<Compile Include="CountryCodes.cs" />
<Compile Include="Directory.cs" />
<Compile Include="Exceptions\TwoFAEnforcedException.cs" />
<Compile Include="File.cs" />
<Compile Include="ISendSafelyProgress.cs" />
<Compile Include="EnterpriseInformation.cs" />
Expand Down

0 comments on commit e3a9b08

Please sign in to comment.