public async Task WhenAsync(MergePatchPartyDto c) { var idObj = (c as IMergePatchParty).PartyId; var uriParameters = new PartyUriParameters(); uriParameters.Id = idObj; var req = new PartyPatchRequest(uriParameters, (MergePatchPartyDto)c); var resp = await _ramlClient.Party.Patch(req); PartyProxyUtils.ThrowOnHttpResponseError(resp); }
public async Task <IPartyState> GetHistoryStateAsync(string partyId, long version) { var idObj = partyId; var uriParameters = new PartyHistoryStateUriParameters(); uriParameters.Id = idObj; uriParameters.Version = version.ToString(); var req = new PartyHistoryStateGetRequest(uriParameters); var resp = await _ramlClient.PartyHistoryState.Get(req); PartyProxyUtils.ThrowOnHttpResponseError(resp); return((resp.Content == null) ? null : resp.Content.ToPartyState()); }
} //todo public async Task <IPartyEvent> GetStateEventAsync(string partyId, long version) { var idObj = partyId; var uriParameters = new PartyStateEventUriParameters(); uriParameters.Id = idObj; uriParameters.Version = version.ToString(); var req = new PartyStateEventGetRequest(uriParameters); var resp = await _ramlClient.PartyStateEvent.Get(req); PartyProxyUtils.ThrowOnHttpResponseError(resp); return(resp.Content); }
public async Task <IPartyState> GetAsync(string partyId) { IPartyState state = null; var idObj = partyId; var uriParameters = new PartyUriParameters(); uriParameters.Id = idObj; var req = new PartyGetRequest(uriParameters); var resp = await _ramlClient.Party.Get(req); PartyProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToPartyState(); return(state); }
public async Task <IEnumerable <IPartyState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null) { IEnumerable <IPartyState> states = null; var q = new PartiesGetQuery(); q.FirstResult = firstResult; q.MaxResults = maxResults; q.Sort = PartyProxyUtils.GetOrdersQueryValueString(orders); q.Fields = PartyProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator); q.Filter = PartyProxyUtils.GetFilterQueryValueString(filter); var req = new PartiesGetRequest(); req.Query = q; var resp = await _ramlClient.Parties.Get(req); PartyProxyUtils.ThrowOnHttpResponseError(resp); states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToPartyState()); 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 <IOrganizationState> states = null; var q = new OrganizationTreesGetQuery(); q.FirstResult = firstResult; q.MaxResults = maxResults; q.Sort = PartyProxyUtils.GetOrdersQueryValueString(orders); q.Fields = PartyProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator); q.FilterTag = PartyProxyUtils.GetFilterTagQueryValueString(filter); var req = new OrganizationTreesGetRequest(); req.Query = q; var resp = await _ramlClient.OrganizationTrees.Get(req); PartyProxyUtils.ThrowOnHttpResponseError(resp); states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToOrganizationState()); return(PartyProxyUtils.ToIdCollection(states)); }
public async Task WhenAsync(DeletePartyDto c) { var idObj = (c as IDeleteParty).PartyId; var uriParameters = new PartyUriParameters(); uriParameters.Id = idObj; var q = new PartyDeleteQuery(); q.CommandId = c.CommandId; q.RequesterId = c.RequesterId; q.Version = Convert.ToString(c.Version); var req = new PartyDeleteRequest(uriParameters); req.Query = q; var resp = await _ramlClient.Party.Delete(req); PartyProxyUtils.ThrowOnHttpResponseError(resp); }
public async virtual Task <long> GetCountAsync(ICriterion filter) { var q = new PartiesCountGetQuery(); q.Filter = PartyProxyUtils.GetFilterQueryValueString(filter); var req = new PartiesCountGetRequest(); req.Query = q; var resp = await _ramlClient.PartiesCount.Get(req); PartyProxyUtils.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)); }