Exemplo n.º 1
0
        internal async Task <IReadOnlyCollection <PushModel> > InternalGetPushesAsync(Action <PushFilterParameters> pushFilterParameters, double after)
        {
            var parameters = new PushFilterParameters();

            pushFilterParameters(parameters);

            var pushesModel = await RequestClient.SendAsync <PushesModel>($"/v2/pushes?modified_after={after}", HttpMethod.Get, parameters)
                              .ConfigureAwait(false);

            return(pushesModel.Pushes);
        }
Exemplo n.º 2
0
        public async Task <UploadRequest> CreateUploadRequestAsync(Action <UploadRequestParameters> uploadRequestParameters)
        {
            var parameters = new UploadRequestParameters();

            uploadRequestParameters(parameters);

            var uploadModel = await RequestClient
                              .SendAsync <UploadRequestModel>("/v2/upload-request", HttpMethod.Post, parameters)
                              .ConfigureAwait(false);

            return(new UploadRequest(uploadModel, RequestClient));
        }
Exemplo n.º 3
0
        public PushBulletClient(PushBulletClientConfig config)
        {
            if (string.IsNullOrWhiteSpace(config.Token))
            {
                throw new NoNullAllowedException("Token can't be null or empty");
            }

            _config     = config;
            _serializer = new JsonSerializer();

            _devices = new ConcurrentDictionary <string, Device>();
            _pushes  = new ConcurrentDictionary <string, Push>();

            RequestClient = new RequestClient(this, _config, _serializer);
        }
Exemplo n.º 4
0
 /// <summary>
 ///     Sends an SMS message to a device.
 /// </summary>
 /// <param name="smsParameters">The parameters to use when sending the message.</param>
 /// <returns>A <see cref="Task" /> representing the asynchronous send operation.</returns>
 public async Task SendSmsAsync(SmsParameters smsParameters)
 {
     await RequestClient.SendAsync("/v2/ephemerals", HttpMethod.Post, smsParameters)
     .ConfigureAwait(false);
 }