OSDN Git Service

HttpTwitter.SendDirectMessageメソッドをTwitterApiクラスに置き換え
[opentween/open-tween.git] / OpenTween / Connection / IMediaUploadService.cs
1 // OpenTween - Client of Twitter
2 // Copyright (c) 2014 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
3 // All rights reserved.
4 //
5 // This file is part of OpenTween.
6 //
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)
10 // any later version.
11 //
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
15 // for more details.
16 //
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.
21
22 using System;
23 using System.Collections.Generic;
24 using System.IO;
25 using System.Linq;
26 using System.Text;
27 using System.Threading.Tasks;
28 using OpenTween.Api.DataModel;
29
30 namespace OpenTween.Connection
31 {
32     /// <summary>
33     /// Twitterでの画像の共有に使用できるサービスを表すインタフェース
34     /// </summary>
35     public interface IMediaUploadService
36     {
37         /// <summary>
38         /// アップロード可能なメディアの最大枚数
39         /// </summary>
40         int MaxMediaCount { get; }
41
42         /// <summary>
43         /// アップロード可能なファイルの種類を表す文字列 (OpenFileDialog.Filter に使用)
44         /// </summary>
45         string SupportedFormatsStrForDialog { get; }
46
47         /// <summary>
48         /// ファイルの拡張子からアップロード可能なフォーマットであるかを判定します
49         /// </summary>
50         /// <param name="fileExtension">アップロードするファイルの拡張子 (ピリオドを含む)</param>
51         bool CheckFileExtension(string fileExtension);
52
53         /// <summary>
54         /// ファイルサイズがアップロード可能な範囲内であるかを判定します
55         /// </summary>
56         /// <param name="fileExtension">アップロードするファイルの拡張子 (ピリオドを含む)</param>
57         /// <param name="fileSize">アップロードするファイルのサイズ (バイト単位)</param>
58         bool CheckFileSize(string fileExtension, long fileSize);
59
60         /// <summary>
61         /// アップロード可能なファイルサイズの上限を返します
62         /// </summary>
63         /// <param name="fileExtension">アップロードするファイルの拡張子 (ピリオドを含む)</param>
64         /// <returns>ファイルサイズの上限 (バイト単位, nullの場合は上限なし)</returns>
65         long? GetMaxFileSize(string fileExtension);
66
67         /// <summary>
68         /// メディアのアップロードとツイートの投稿を行います
69         /// </summary>
70         /// <exception cref="WebApiException"/>
71         Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems);
72
73         /// <summary>
74         /// 画像URLのために確保する必要のある文字数を返します
75         /// </summary>
76         /// <param name="mediaCount">アップロードするメディアの個数</param>
77         int GetReservedTextLength(int mediaCount);
78
79         /// <summary>
80         /// IMediaUploadService で使用する /help/configuration.json の値を更新します
81         /// </summary>
82         void UpdateTwitterConfiguration(TwitterConfiguration config);
83     }
84 }