Exemplo n.º 1
0
        public void UploadMedias(IPublishTweetParameters parameters)
        {
            _uploadQueryExecutor.UploadMedias(parameters.Medias, false);

            if (parameters.Medias.Any(x => !x.HasBeenUploaded))
            {
                throw new OperationCanceledException("The tweet cannot be published as some of the medias could not be published!");
            }
            else
            {
                parameters.MediaIds.AddRange(parameters.Medias.Select(x => x.UploadedMediaInfo.MediaId));
            }

            var binariesMedia = _uploadQueryExecutor.UploadBinaries(parameters.MediaBinaries);

            if (binariesMedia.Any(x => !x.HasBeenUploaded))
            {
                throw new OperationCanceledException("The tweet cannot be published as some of the binaries could not be published!");
            }
            else
            {
                parameters.MediaIds.AddRange(binariesMedia.Select(x => x.UploadedMediaInfo.MediaId));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Upload a collection of media. The media uploaded info is updated.
 /// If the uploaded info is null the media failed to be uploaded.
 /// </summary>
 public static void UploadMedias(IEnumerable <IMedia> medias, bool forceReUpload)
 {
     _uploadQueryExecutor.UploadMedias(medias, forceReUpload);
 }