public async Task WhenAsync(MergePatchLocatorDto c)
        {
            var idObj         = (c as IMergePatchLocator).LocatorId;
            var uriParameters = new LocatorUriParameters();

            uriParameters.Id = idObj;

            var req  = new LocatorPatchRequest(uriParameters, (MergePatchLocatorDto)c);
            var resp = await _ramlClient.Locator.Patch(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
        }
Esempio n. 2
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new LocatorsCountGetQuery();

            q.Filter = LocatorProxyUtils.GetFilterQueryValueString(filter);
            var req = new LocatorsCountGetRequest();

            req.Query = q;
            var resp = await _ramlClient.LocatorsCount.Get(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
            return(long.Parse(await resp.RawContent.ReadAsStringAsync()));
        }
        public async Task <ILocatorState> GetHistoryStateAsync(string locatorId, long version)
        {
            var idObj         = locatorId;
            var uriParameters = new LocatorHistoryStateUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new LocatorHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.LocatorHistoryState.Get(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToLocatorState());
        }
        public async Task <ILocatorEvent> GetStateEventAsync(string locatorId, long version)
        {
            var idObj         = locatorId;
            var uriParameters = new LocatorStateEventUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new LocatorStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.LocatorStateEvent.Get(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <ILocatorState> GetAsync(string locatorId)
        {
            ILocatorState state         = null;
            var           idObj         = locatorId;
            var           uriParameters = new LocatorUriParameters();

            uriParameters.Id = idObj;

            var req = new LocatorGetRequest(uriParameters);

            var resp = await _ramlClient.Locator.Get(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToLocatorState();
            return(state);
        }
        public async Task <IEnumerable <ILocatorState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <ILocatorState> states = null;
            var q = new LocatorsGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = LocatorProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = LocatorProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.Filter      = LocatorProxyUtils.GetFilterQueryValueString(filter);
            var req = new LocatorsGetRequest();

            req.Query = q;
            var resp = await _ramlClient.Locators.Get(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToLocatorState());
            return(states);
        }
        public async Task <IEnumerable <string> > GetRootIdsAsync(IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <ILocatorState> states = null;
            var q = new LocatorTreesGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = LocatorProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = LocatorProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.FilterTag   = LocatorProxyUtils.GetFilterTagQueryValueString(filter);
            var req = new LocatorTreesGetRequest();

            req.Query = q;
            var resp = await _ramlClient.LocatorTrees.Get(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(LocatorProxyUtils.ToIdCollection(states));
        }
        public async Task WhenAsync(DeleteLocatorDto c)
        {
            var idObj         = (c as IDeleteLocator).LocatorId;
            var uriParameters = new LocatorUriParameters();

            uriParameters.Id = idObj;

            var q = new LocatorDeleteQuery();

            q.CommandId   = c.CommandId;
            q.RequesterId = c.RequesterId;
            q.Version     = Convert.ToString(c.Version);

            var req = new LocatorDeleteRequest(uriParameters);

            req.Query = q;

            var resp = await _ramlClient.Locator.Delete(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
        }
Esempio n. 9
0
        public async Task <IEnumerable <ILocatorState> > GetChildrenAsync(string parentId, IEnumerable <KeyValuePair <string, object> > filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <ILocatorState> states = null;
            var q           = new LocatorTreesGetQuery();
            var parentIdObj = (parentId);

            q.ParentId    = parentIdObj;
            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = LocatorProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = LocatorProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.FilterTag   = LocatorProxyUtils.GetFilterTagQueryValueString(filter);
            var req = new LocatorTreesGetRequest();

            req.Query = q;
            var resp = await _ramlClient.LocatorTrees.Get(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToLocatorState());
            return(states);
        }
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new LocatorsCountGetQuery();

            q.Filter = LocatorProxyUtils.GetFilterQueryValueString(filter);
            var req = new LocatorsCountGetRequest();

            req.Query = q;
            var resp = await _ramlClient.LocatorsCount.Get(req);

            LocatorProxyUtils.ThrowOnHttpResponseError(resp);
            string str = await resp.RawContent.ReadAsStringAsync();

            if (str.StartsWith("\""))
            {
                str = str.Substring(1);
            }
            if (str.EndsWith("\""))
            {
                str = str.Substring(0, str.Length - 1);
            }
            return(long.Parse(str));
        }