コード例 #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);
        }
コード例 #2
0
ファイル: UploadRequest.cs プロジェクト: k-boyle/Pusharp
        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));
        }
コード例 #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);
        }
コード例 #4
0
ファイル: Ephemerals.cs プロジェクト: k-boyle/Pusharp
 /// <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);
 }