Beispiel #1
0
        public async Task WhenAsync(MergePatchContactMechDto c)
        {
            var idObj         = (c as IMergePatchContactMech).ContactMechId;
            var uriParameters = new ContactMechUriParameters();

            uriParameters.Id = idObj;

            var req  = new ContactMechPatchRequest(uriParameters, (MergePatchContactMechDto)c);
            var resp = await _ramlClient.ContactMech.Patch(req);

            ContactMechProxyUtils.ThrowOnHttpResponseError(resp);
        }
Beispiel #2
0
        public async Task <IContactMechState> GetHistoryStateAsync(string contactMechId, long version)
        {
            var idObj         = contactMechId;
            var uriParameters = new ContactMechHistoryStateUriParameters();

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

            var req  = new ContactMechHistoryStateGetRequest(uriParameters);
            var resp = await _ramlClient.ContactMechHistoryState.Get(req);

            ContactMechProxyUtils.ThrowOnHttpResponseError(resp);
            return((resp.Content == null) ? null : resp.Content.ToContactMechState());
        }
Beispiel #3
0
        public async Task <IContactMechEvent> GetStateEventAsync(string contactMechId, long version)
        {
            var idObj         = contactMechId;
            var uriParameters = new ContactMechStateEventUriParameters();

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

            var req  = new ContactMechStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.ContactMechStateEvent.Get(req);

            ContactMechProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
Beispiel #4
0
        public async Task <IContactMechState> GetAsync(string contactMechId)
        {
            IContactMechState state = null;
            var idObj         = contactMechId;
            var uriParameters = new ContactMechUriParameters();

            uriParameters.Id = idObj;

            var req = new ContactMechGetRequest(uriParameters);

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

            ContactMechProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToContactMechState();
            return(state);
        }
Beispiel #5
0
        public async Task <IEnumerable <IContactMechState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IContactMechState> states = null;
            var q = new ContactMechesGetQuery();

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

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

            ContactMechProxyUtils.ThrowOnHttpResponseError(resp);
            states = (resp.Content == null) ? null : resp.Content.Select(e => e.ToContactMechState());
            return(states);
        }
Beispiel #6
0
        public async Task WhenAsync(DeleteContactMechDto c)
        {
            var idObj         = (c as IDeleteContactMech).ContactMechId;
            var uriParameters = new ContactMechUriParameters();

            uriParameters.Id = idObj;

            var q = new ContactMechDeleteQuery();

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

            var req = new ContactMechDeleteRequest(uriParameters);

            req.Query = q;

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

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

            q.Filter = ContactMechProxyUtils.GetFilterQueryValueString(filter);
            var req = new ContactMechesCountGetRequest();

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

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