public async Task WhenAsync(MergePatchLocatorTypeDto c)
        {
            var idObj         = (c as IMergePatchLocatorType).LocatorTypeId;
            var uriParameters = new LocatorTypeUriParameters();

            uriParameters.Id = idObj;

            var req  = new LocatorTypePatchRequest(uriParameters, (MergePatchLocatorTypeDto)c);
            var resp = await _ramlClient.LocatorType.Patch(req);

            LocatorTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async Task <ILocatorTypeState> GetHistoryStateAsync(string locatorTypeId, long version)
        {
            var idObj         = locatorTypeId;
            var uriParameters = new LocatorTypeHistoryStateUriParameters();

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

            var req  = new LocatorTypeHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.LocatorTypeHistoryState.Get(req);

            LocatorTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToLocatorTypeState());
        }
        public async Task <ILocatorTypeEvent> GetStateEventAsync(string locatorTypeId, long version)
        {
            var idObj         = locatorTypeId;
            var uriParameters = new LocatorTypeStateEventUriParameters();

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

            var req  = new LocatorTypeStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.LocatorTypeStateEvent.Get(req);

            LocatorTypeProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <ILocatorTypeState> GetAsync(string locatorTypeId)
        {
            ILocatorTypeState state = null;
            var idObj         = locatorTypeId;
            var uriParameters = new LocatorTypeUriParameters();

            uriParameters.Id = idObj;

            var req = new LocatorTypeGetRequest(uriParameters);

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

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

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

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

            LocatorTypeProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToLocatorTypeState());
            return(states);
        }
        public async Task WhenAsync(DeleteLocatorTypeDto c)
        {
            var idObj         = (c as IDeleteLocatorType).LocatorTypeId;
            var uriParameters = new LocatorTypeUriParameters();

            uriParameters.Id = idObj;

            var q = new LocatorTypeDeleteQuery();

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

            var req = new LocatorTypeDeleteRequest(uriParameters);

            req.Query = q;

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

            LocatorTypeProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new LocatorTypesCountGetQuery();

            q.Filter = LocatorTypeProxyUtils.GetFilterQueryValueString(filter);
            var req = new LocatorTypesCountGetRequest();

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

            LocatorTypeProxyUtils.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));
        }