public async Task WhenAsync(MergePatchAttributeDto c) { var idObj = (c as IMergePatchAttribute).AttributeId; var uriParameters = new AttributeUriParameters(); uriParameters.Id = idObj; var req = new AttributePatchRequest(uriParameters, (MergePatchAttributeDto)c); var resp = await _ramlClient.Attribute.Patch(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); }
public async virtual Task <IAttributeValueState> GetAttributeValueAsync(string attributeId, string value) { var uriParameters = new AttributeValueUriParameters(); uriParameters.AttributeId = attributeId; uriParameters.Value = value; var req = new AttributeValueGetRequest(uriParameters); var resp = await _ramlClient.AttributeValue.Get(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); return(resp.Content); }
public async virtual Task <long> GetCountAsync(ICriterion filter) { var q = new AttributesCountGetQuery(); q.Filter = AttributeProxyUtils.GetFilterQueryValueString(filter); var req = new AttributesCountGetRequest(); req.Query = q; var resp = await _ramlClient.AttributesCount.Get(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); return(long.Parse(await resp.RawContent.ReadAsStringAsync())); }
public async virtual Task <IAttributeAliasState> GetAttributeAliasAsync(string attributeId, string code) { var uriParameters = new AttributeAliasUriParameters(); uriParameters.AttributeId = attributeId; uriParameters.Code = code; var req = new AttributeAliasGetRequest(uriParameters); var resp = await _ramlClient.AttributeAlias.Get(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); return((resp.Content == null) ? null : resp.Content.ToAttributeAliasState()); }
public async Task <IAttributeStateEvent> GetStateEventAsync(string attributeId, long version) { var idObj = attributeId; var uriParameters = new AttributeStateEventUriParameters(); uriParameters.Id = idObj; uriParameters.Version = version.ToString(); var req = new AttributeStateEventGetRequest(uriParameters); var resp = await _ramlClient.AttributeStateEvent.Get(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); return(resp.Content); }
public async Task <IAttributeState> GetHistoryStateAsync(string attributeId, long version) { var idObj = attributeId; var uriParameters = new AttributeHistoryStateUriParameters(); uriParameters.Id = idObj; uriParameters.Version = version.ToString(); var req = new AttributeHistoryStateGetRequest(uriParameters); var resp = await _ramlClient.AttributeHistoryState.Get(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); return((resp.Content == null) ? null : resp.Content.ToAttributeState()); }
public async Task <IAttributeState> GetAsync(string attributeId) { IAttributeState state = null; var idObj = attributeId; var uriParameters = new AttributeUriParameters(); uriParameters.Id = idObj; var req = new AttributeGetRequest(uriParameters); var resp = await _ramlClient.Attribute.Get(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); state = resp.Content; return(state); }
public async Task <IEnumerable <IAttributeState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null) { IEnumerable <IAttributeState> states = null; var q = new AttributesGetQuery(); q.FirstResult = firstResult; q.MaxResults = maxResults; q.Sort = AttributeProxyUtils.GetOrdersQueryValueString(orders); q.Fields = AttributeProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator); q.Filter = AttributeProxyUtils.GetFilterQueryValueString(filter); var req = new AttributesGetRequest(); req.Query = q; var resp = await _ramlClient.Attributes.Get(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); states = resp.Content; return(states); }
public async Task WhenAsync(DeleteAttributeDto c) { var idObj = (c as IDeleteAttribute).AttributeId; var uriParameters = new AttributeUriParameters(); uriParameters.Id = idObj; var q = new AttributeDeleteQuery(); q.CommandId = c.CommandId; q.RequesterId = c.RequesterId; q.Version = Convert.ToString(c.Version); var req = new AttributeDeleteRequest(uriParameters); req.Query = q; var resp = await _ramlClient.Attribute.Delete(req); AttributeProxyUtils.ThrowOnHttpResponseError(resp); }
public async virtual Task <long> GetCountAsync(ICriterion filter) { var q = new AttributesCountGetQuery(); q.Filter = AttributeProxyUtils.GetFilterQueryValueString(filter); var req = new AttributesCountGetRequest(); req.Query = q; var resp = await _ramlClient.AttributesCount.Get(req); AttributeProxyUtils.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)); }