Пример #1
0
        public async Task <IEnumerable <Account> > GetCompositeAsync(IEnumerable <string> ids, CancellationToken cancellationToken)
        {
            var Composite = new Composite
            {
                CompositeRequest = ids.Select((id, i) => new CompositeRequestItem
                {
                    Url         = $"/services/data/{Api.Version}/sobjects/account/{id}",
                    Method      = "GET",
                    ReferenceId = $"{i}"
                }),
                AllOrNone          = false,
                CollateSubrequests = false
            };
            var response = await _composite.PostAsync <Account>(Composite, cancellationToken);

            return(response.CompositeResponseItems
                   ?.Where(item => item?.HttpStatusCode == 200)
                   ?.Select(item => item.Body)
                   ?? Enumerable.Empty <Account>());
        }