Exemplo n.º 1
0
        public Task <DocumentList> GetDocumentsAsync([NotNull] string authToken, [NotNull] DocumentsFilter filter)
        {
            var qsb = new PathAndQueryBuilder("/V3/GetDocuments");

            qsb.AddParameter("boxId", filter.BoxId);
            qsb.AddParameter("filterCategory", filter.FilterCategory);
            if (!string.IsNullOrEmpty(filter.CounteragentBoxId))
            {
                qsb.AddParameter("counteragentBoxId", filter.CounteragentBoxId);
            }
            if (filter.TimestampFrom.HasValue)
            {
                qsb.AddParameter("timestampFromTicks", filter.TimestampFrom.Value.ToUniversalTime().Ticks.ToString(CultureInfo.InvariantCulture));
            }
            if (filter.TimestampTo.HasValue)
            {
                qsb.AddParameter("timestampToTicks", filter.TimestampTo.Value.ToUniversalTime().Ticks.ToString(CultureInfo.InvariantCulture));
            }
            if (!string.IsNullOrEmpty(filter.FromDocumentDate))
            {
                qsb.AddParameter("fromDocumentDate", filter.FromDocumentDate);
            }
            if (!string.IsNullOrEmpty(filter.ToDocumentDate))
            {
                qsb.AddParameter("toDocumentDate", filter.ToDocumentDate);
            }
            if (!string.IsNullOrEmpty(filter.DocumentNumber))
            {
                qsb.AddParameter("documentNumber", filter.DocumentNumber);
            }
            if (!string.IsNullOrEmpty(filter.DepartmentId))
            {
                qsb.AddParameter("departmentId", filter.DepartmentId);
            }
            if (!string.IsNullOrEmpty(filter.FromDepartmentId))
            {
                qsb.AddParameter("fromDepartmentId", filter.FromDepartmentId);
            }
            if (!string.IsNullOrEmpty(filter.ToDepartmentId))
            {
                qsb.AddParameter("toDepartmentId", filter.ToDepartmentId);
            }
            if (filter.ExcludeSubdepartments)
            {
                qsb.AddParameter("excludeSubdepartments");
            }
            if (!string.IsNullOrEmpty(filter.AfterIndexKey))
            {
                qsb.AddParameter("afterIndexKey", filter.AfterIndexKey);
            }
            if (!string.IsNullOrEmpty(filter.SortDirection))
            {
                qsb.AddParameter("sortDirection", filter.SortDirection);
            }
            if (filter.Count.HasValue)
            {
                qsb.AddParameter("count", filter.Count.ToString());
            }
            return(PerformHttpRequestAsync <DocumentList>(authToken, "GET", qsb.BuildPathAndQuery()));
        }
Exemplo n.º 2
0
 public DocumentList GetDocuments(string authToken, DocumentsFilter filter)
 {
     return(diadocHttpApi.GetDocuments(authToken, filter));
 }