1 // OpenTween - Client of Twitter
2 // Copyright (c) 2014 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3 // All rights reserved.
5 // This file is part of OpenTween.
7 // This program is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by the Free
9 // Software Foundation; either version 3 of the License, or (at your option)
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 // You should have received a copy of the GNU General Public License along
18 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
19 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
20 // Boston, MA 02110-1301, USA.
25 using System.Collections.Generic;
29 using System.Threading.Tasks;
30 using OpenTween.Api.DataModel;
32 namespace OpenTween.Connection
35 /// Twitterでの画像の共有に使用できるサービスを表すインタフェース
37 public interface IMediaUploadService
40 /// アップロード可能なメディアの最大枚数
42 int MaxMediaCount { get; }
45 /// アップロード可能なファイルの種類を表す文字列 (OpenFileDialog.Filter に使用)
47 string SupportedFormatsStrForDialog { get; }
50 /// 代替テキストの設定が可能なサービスであるか
52 bool CanUseAltText { get; }
55 /// ファイルの拡張子からアップロード可能なフォーマットであるかを判定します
57 /// <param name="fileExtension">アップロードするファイルの拡張子 (ピリオドを含む)</param>
58 bool CheckFileExtension(string fileExtension);
61 /// ファイルサイズがアップロード可能な範囲内であるかを判定します
63 /// <param name="fileExtension">アップロードするファイルの拡張子 (ピリオドを含む)</param>
64 /// <param name="fileSize">アップロードするファイルのサイズ (バイト単位)</param>
65 bool CheckFileSize(string fileExtension, long fileSize);
68 /// アップロード可能なファイルサイズの上限を返します
70 /// <param name="fileExtension">アップロードするファイルの拡張子 (ピリオドを含む)</param>
71 /// <returns>ファイルサイズの上限 (バイト単位, nullの場合は上限なし)</returns>
72 long? GetMaxFileSize(string fileExtension);
75 /// メディアのアップロードを行い、結果の URL 等を <paramref name="postParams"/> に追加します
77 /// <exception cref="WebApiException"/>
78 Task<PostStatusParams> UploadAsync(IMediaItem[] mediaItems, PostStatusParams postParams);
81 /// 画像URLのために確保する必要のある文字数を返します
83 /// <param name="mediaCount">アップロードするメディアの個数</param>
84 int GetReservedTextLength(int mediaCount);
87 /// IMediaUploadService で使用する /help/configuration.json の値を更新します
89 void UpdateTwitterConfiguration(TwitterConfiguration config);