Ejemplo n.º 1
0
        public void UploadMedias(IPublishTweetParameters parameters)
        {
            if (parameters.Medias.Any(x => !x.HasBeenUploaded))
            {
                throw new OperationCanceledException("The tweet cannot be published as some of the medias could not be published!");
            }

            parameters.MediaIds.AddRange(parameters.Medias.Select(x => x.UploadedMediaInfo.MediaId));

            var uploadedMedias = parameters.MediaBinaries
                                 .Select(binary => { return(_uploadQueryExecutor.UploadBinary(binary)); }).ToArray();

            if (uploadedMedias.Any(x => x == null || !x.HasBeenUploaded))
            {
                throw new OperationCanceledException("The tweet cannot be published as some of the binaries could not be published!");
            }

            parameters.MediaIds.AddRange(uploadedMedias.Select(x => x.UploadedMediaInfo.MediaId));
        }
Ejemplo n.º 2
0
 public Task <IChunkUploadResult> UploadBinary(IUploadParameters parameters)
 {
     _uploadClientRequiredParametersValidator.Validate(parameters);
     return(ExecuteRequest(request => _uploadQueryExecutor.UploadBinary(parameters, request)));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Upload a video to twitter
 /// </summary>
 public static IMedia UploadImage(byte[] binary)
 {
     return(_uploadQueryExecutor.UploadBinary(binary));
 }