Beispiel #1
0
        public async Task WhenAsync(MergePatchAttributeSetInstanceDto c)
        {
            var idObj         = (c as IMergePatchAttributeSetInstance).AttributeSetInstanceId;
            var uriParameters = new AttributeSetInstanceUriParameters();

            uriParameters.Id = idObj;

            var req  = new AttributeSetInstancePatchRequest(uriParameters, (MergePatchAttributeSetInstanceDto)c);
            var resp = await _ramlClient.AttributeSetInstance.Patch(req);

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);
        }
Beispiel #2
0
        public async Task <string> CreateWithoutIdAsync(CreateAttributeSetInstanceDto c)
        {
            var req = new AttributeSetInstancesPostRequest(c);

            var resp = await _ramlClient.AttributeSetInstances.Post(req);

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);

            var result = await resp.RawContent.ReadAsAsync <string>();

            return(result);
        }
Beispiel #3
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new AttributeSetInstancesCountGetQuery();

            q.Filter = AttributeSetInstanceProxyUtils.GetFilterQueryValueString(filter);
            var req = new AttributeSetInstancesCountGetRequest();

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

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);
            return(long.Parse(await resp.RawContent.ReadAsStringAsync()));
        }
Beispiel #4
0
        public async Task <IAttributeSetInstanceStateEvent> GetStateEventAsync(string attributeSetInstanceId, long version)
        {
            var idObj         = attributeSetInstanceId;
            var uriParameters = new AttributeSetInstanceStateEventUriParameters();

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

            var req  = new AttributeSetInstanceStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.AttributeSetInstanceStateEvent.Get(req);

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Beispiel #5
0
        public async Task <IAttributeSetInstanceState> GetHistoryStateAsync(string attributeSetInstanceId, long version)
        {
            var idObj         = attributeSetInstanceId;
            var uriParameters = new AttributeSetInstanceHistoryStateUriParameters();

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

            var req  = new AttributeSetInstanceHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.AttributeSetInstanceHistoryState.Get(req);

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToAttributeSetInstanceState());
        }
Beispiel #6
0
        public async Task <IAttributeSetInstanceState> GetAsync(string attributeSetInstanceId)
        {
            IAttributeSetInstanceState state = null;
            var idObj         = attributeSetInstanceId;
            var uriParameters = new AttributeSetInstanceUriParameters();

            uriParameters.Id = idObj;

            var req = new AttributeSetInstanceGetRequest(uriParameters);

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

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);
            state = resp.Content;
            return(state);
        }
Beispiel #7
0
        public async Task <IEnumerable <IAttributeSetInstanceState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IAttributeSetInstanceState> states = null;
            var q = new AttributeSetInstancesGetQuery();

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

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

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(states);
        }
Beispiel #8
0
        public async Task WhenAsync(DeleteAttributeSetInstanceDto c)
        {
            var idObj         = (c as IDeleteAttributeSetInstance).AttributeSetInstanceId;
            var uriParameters = new AttributeSetInstanceUriParameters();

            uriParameters.Id = idObj;

            var q = new AttributeSetInstanceDeleteQuery();

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

            var req = new AttributeSetInstanceDeleteRequest(uriParameters);

            req.Query = q;

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

            AttributeSetInstanceProxyUtils.ThrowOnHttpResponseError(resp);
        }
Beispiel #9
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new AttributeSetInstancesCountGetQuery();

            q.Filter = AttributeSetInstanceProxyUtils.GetFilterQueryValueString(filter);
            var req = new AttributeSetInstancesCountGetRequest();

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

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