Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TargetAttributes"/> class.
 /// </summary>
 /// <param name="response">Target Delivery response</param>
 public TargetAttributes(TargetDeliveryResponse response)
 {
     this.Response = response;
     this.content  = ToDictionary(response);
 }
Example #2
0
        private static IReadOnlyDictionary <string, IReadOnlyDictionary <string, object> > ToDictionary(TargetDeliveryResponse deliveryResponse)
        {
            if (deliveryResponse?.Response == null)
            {
                return(null);
            }

            var globalMbox       = deliveryResponse.Locations?.GlobalMbox ?? GlobalMbox;
            var prefetchResponse = deliveryResponse.Response.Prefetch;
            var executeResponse  = deliveryResponse.Response.Execute;
            var result           = new Dictionary <string, Dictionary <string, object> >();

            result = ProcessResponse(result, prefetchResponse?.PageLoad, prefetchResponse?.Mboxes, globalMbox);
            result = ProcessResponse(result, executeResponse?.PageLoad, executeResponse?.Mboxes, globalMbox);

            return(result.ToDictionary(pair => pair.Key, pair => (IReadOnlyDictionary <string, object>)pair.Value));
        }