/// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     StoreAndForward       = new StoreAndForward(this);
     BaseUri               = new System.Uri("http://localhost:5000/storeandforward");
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
예제 #2
0
 /// <summary>
 /// Get all documents.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='startDate'>
 /// Filter start date
 /// </param>
 /// <param name='endDate'>
 /// Filter end date
 /// </param>
 /// <param name='documentStatus'>
 /// Comma separated list of document status
 /// </param>
 /// <param name='offset'>
 /// Page offset
 /// </param>
 /// <param name='limit'>
 /// Page limit
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <DocumentListModel> GetDocumentsAsync(this IStoreAndForward operations, System.DateTime?startDate = default(System.DateTime?), System.DateTime?endDate = default(System.DateTime?), string documentStatus = default(string), int?offset = default(int?), int?limit = default(int?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetDocumentsWithHttpMessagesAsync(startDate, endDate, documentStatus, offset, limit, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #3
0
 /// <summary>
 /// Get all document events.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Document ID
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <EventListModel> GetDocumentEventsAsync(this IStoreAndForward operations, int id, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetDocumentEventsWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #4
0
 /// <summary>
 /// Enqueue a document.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='document'>
 /// Document to enqueue
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <DocumentModel> AddDocumentAsync(this IStoreAndForward operations, DocumentModel document, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.AddDocumentWithHttpMessagesAsync(document, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #5
0
 /// <summary>
 /// Enqueue a document.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='document'>
 /// Document to enqueue
 /// </param>
 public static DocumentModel AddDocument(this IStoreAndForward operations, DocumentModel document)
 {
     return(operations.AddDocumentAsync(document).GetAwaiter().GetResult());
 }
예제 #6
0
 /// <summary>
 /// Get all documents.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='startDate'>
 /// Filter start date
 /// </param>
 /// <param name='endDate'>
 /// Filter end date
 /// </param>
 /// <param name='documentStatus'>
 /// Comma separated list of document status
 /// </param>
 /// <param name='offset'>
 /// Page offset
 /// </param>
 /// <param name='limit'>
 /// Page limit
 /// </param>
 public static DocumentListModel GetDocuments(this IStoreAndForward operations, System.DateTime?startDate = default(System.DateTime?), System.DateTime?endDate = default(System.DateTime?), string documentStatus = default(string), int?offset = default(int?), int?limit = default(int?))
 {
     return(operations.GetDocumentsAsync(startDate, endDate, documentStatus, offset, limit).GetAwaiter().GetResult());
 }
예제 #7
0
 /// <summary>
 /// Get all events.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='startDate'>
 /// Filter start date
 /// </param>
 /// <param name='endDate'>
 /// Filter end date
 /// </param>
 /// <param name='eventType'>
 /// Event type
 /// </param>
 /// <param name='offset'>
 /// Page offset
 /// </param>
 /// <param name='limit'>
 /// Page limit
 /// </param>
 public static TimelineModel GetEvents(this IStoreAndForward operations, System.DateTime?startDate = default(System.DateTime?), System.DateTime?endDate = default(System.DateTime?), string eventType = default(string), int?offset = default(int?), int?limit = default(int?))
 {
     return(operations.GetEventsAsync(startDate, endDate, eventType, offset, limit).GetAwaiter().GetResult());
 }
예제 #8
0
 /// <summary>
 /// Get all document events.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Document ID
 /// </param>
 public static EventListModel GetDocumentEvents(this IStoreAndForward operations, int id)
 {
     return(operations.GetDocumentEventsAsync(id).GetAwaiter().GetResult());
 }
예제 #9
0
 /// <summary>
 /// Delete a document.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Document ID
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteDocumentAsync(this IStoreAndForward operations, int id, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteDocumentWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
예제 #10
0
 /// <summary>
 /// Delete a document.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Document ID
 /// </param>
 public static void DeleteDocument(this IStoreAndForward operations, int id)
 {
     operations.DeleteDocumentAsync(id).GetAwaiter().GetResult();
 }