示例#1
0
 public BatchedSessions(IConfiguration configuration, NotifierInfo notifier, App app, Device device, IEnumerable <KeyValuePair <string, long> > sessionData)
 {
     Endpoint = configuration.SessionEndpoint;
     Proxy    = configuration.Proxy;
     _headers = new KeyValuePair <string, string>[] {
         new KeyValuePair <string, string>(Payload.Headers.ApiKeyHeader, configuration.ApiKey),
         new KeyValuePair <string, string>(Payload.Headers.PayloadVersionHeader, "1.0")
     };
     this.AddToPayload("notifier", notifier);
     this.AddToPayload("device", device);
     this.AddToPayload("app", app);
     this.AddToPayload("sessionCounts", sessionData.Select(kv => new SessionCount(kv.Key, kv.Value)).ToArray());
 }
        private Notification CreateNotificationBase()
        {
            var notifierInfo = new NotifierInfo
            {
                Name = Notifier.Name,
                Version = Notifier.Version,
                Url = Notifier.Url.AbsoluteUri
            };

            var notification = new Notification
            {
                ApiKey = Config.ApiKey,
                Notifier = notifierInfo,
                Events = new List<EventInfo>()
            };
            return notification;
        }