Skip to content

Commit

Permalink
Documentation additions
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedsweden committed Jan 18, 2024
1 parent 5170a8f commit 519dc10
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 32 deletions.
27 changes: 22 additions & 5 deletions src/Sinch/Faxes/Barcode.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
namespace Sinch.Faxes
{

public class Barcode

public enum BarCodeType
{
CODE_128,
DATA_MATRIX
}
/// <summary>
/// The bar codes found in the fax. This field is populated when sinch detects bar codes on incoming faxes.
/// </summary>
public class Barcode
{
public string Type { get; set; }
public int page { get; set; }
public string value { get; set; }
/// <summary>
/// The type of barcode found.
/// </summary>
public BarCodeType Type { get; set; }
/// <summary>
/// The page number on which the barcode was found.
/// </summary>
public int page { get; set; }
/// <summary>
/// The information of the barcode.
/// </summary>
public string value { get; set; }
}

}
21 changes: 16 additions & 5 deletions src/Sinch/Faxes/Direction.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
namespace Sinch.Faxes
{

public enum Direction


/// <summary>
/// The direction of the fax.
/// </summary>
///
public enum Direction
{
INBOUND,
OUTBOUND
}
/// <summary>
/// The fax was received on one of your sinch numbers.
/// </summary>
INBOUND,
/// <summary>
/// The fax was sent by you via the api.
/// </summary>
OUTBOUND
}

}
5 changes: 5 additions & 0 deletions src/Sinch/Faxes/ErrorType.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
namespace Sinch.Faxes
{
/// <summary>
/// When your receive a callback from the fax api notifying you of a failure, it will contain two values that can help you understand what went wrong: an errorCode and an type.
/// The type will give you a general idea of why the operation failed, whereas the errorCode describes the issue in more detail.Below we list the error_codes for the API, segmented by their corresponding error_type.
/// </summary>
///
public enum ErrorType
{
DOCUMENT_CONVERSION_ERROR,
Expand Down
18 changes: 9 additions & 9 deletions src/Sinch/Faxes/FaxClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ namespace Sinch.Faxes
{
public class FaxClient
{
private readonly string projectId;
private readonly Uri uri;
private readonly LoggerFactory loggerFactory;
private readonly Http httpClient;
private readonly string _projectId;
private readonly Uri _uri;
private readonly LoggerFactory _loggerFactory;
private readonly Http _httpClient;

internal FaxClient(string projectId, Uri uri, Logger.LoggerFactory _loggerFactory, Core.Http httpClient) {
this.projectId = projectId;
this.uri = uri;
loggerFactory = _loggerFactory;
this.httpClient = httpClient;
Faxes = new Faxes(projectId, uri, loggerFactory?.Create<Faxes>(), httpClient);
this._projectId = projectId;
this._uri = uri;
this._loggerFactory = _loggerFactory;
this._httpClient = httpClient;
Faxes = new Faxes(_projectId, _uri, this._loggerFactory?.Create<Faxes>(), _httpClient);
// Services = new Services(projectId, uri, loggerFactory?.Create<Services>(), httpSnakeCase);
}
public Faxes Faxes { get; }
Expand Down
16 changes: 16 additions & 0 deletions src/Sinch/Faxes/FaxStatus.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
namespace Sinch.Faxes
{
/// <summary>
/// The status of the fax
/// </summary>
public enum FaxStatus
{
/// <summary>
/// The operation is currently in a queue on a server and should be executed very soon.
/// </summary>
QUEUED,
/// <summary>
/// The fax is currently being sent (OUTBOUND) or received (INBOUND).
/// </summary>
IN_PROGRESS,
/// <summary>
/// The fax operation succeeded. Everything went as normally planned.
/// </summary>
COMPLETED,
/// <summary>
/// The fax operation failed. Details of the error can be found in the error_code field. For OUTBOUND fax, this means that NONE of the recipients received the fax.
/// </summary>
/// <see cref="ErrorType"/>"/>
FAILURE

}
Expand Down
22 changes: 11 additions & 11 deletions src/Sinch/Faxes/Faxes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ namespace Sinch.Faxes
{
public partial class Faxes
{
private readonly string projectId;
private readonly Uri uri;
private readonly string _projectId;
private readonly Uri _uri;

private readonly Http http;
private ILoggerAdapter<Faxes> loggerAdapter;
private FileExtensionContentTypeProvider mimeMapper;
private readonly Http _http;
private ILoggerAdapter<Faxes> _loggerAdapter;
private FileExtensionContentTypeProvider _mimeMapper;


internal Faxes(string projectId, Uri uri, ILoggerAdapter<Faxes> loggerAdapter, Http httpClient)
{
this.projectId = projectId;
this.uri = uri;
this.loggerAdapter = loggerAdapter;
this.http = httpClient;
mimeMapper = new FileExtensionContentTypeProvider();
this._projectId = projectId;
this._uri = uri;
this._loggerAdapter = loggerAdapter;
this._http = httpClient;
_mimeMapper = new FileExtensionContentTypeProvider();
uri = new Uri(uri, $"/v3/projects/{projectId}/faxes");
}
/// <summary>
Expand Down Expand Up @@ -67,7 +67,7 @@ public async Task<Fax> Send(string to, string filePath, string from = "", string
public async Task<Fax> Send(Fax fax, Stream fileContent, string fileName)
{

Fax result = await http.SendMultipart<Fax,Fax>(uri, fax, fileContent, fileName);
Fax result = await _http.SendMultipart<Fax,Fax>(_uri, fax, fileContent, fileName);
return result;
}

Expand Down
3 changes: 3 additions & 0 deletions src/Sinch/Faxes/ImageConversionMethod.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Sinch.Faxes
{
/// <summary>
/// When sending a fax, you can choose between two different methods of converting the document to a faxable image. Default is Halftone and should be used for most documents. Monochrome should be used for documents that are already black and white.
/// </summary>
public enum ImageConversionMethod
{
HALFTONE,
Expand Down
4 changes: 4 additions & 0 deletions src/Sinch/Faxes/Money.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
namespace Sinch.Faxes
{

/// <summary>
/// The generic sinch money object from the Sinc API documentation, do we have this already somewhere?
/// </summary>
public class Money

{
Expand Down
4 changes: 2 additions & 2 deletions src/Sinch/Faxes/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace Sinch.Faxes
{
internal class FileExtensionContentTypeProvider
{
//

// Summary:
// The cross reference table of file extensions and content-types.
private IDictionary<string, string> Mappings { get; private set; }
private IDictionary<string, string> Mappings { get; set; }

//
// Summary:
Expand Down

0 comments on commit 519dc10

Please sign in to comment.