###前提・実現したいこと
こんにちは。いつもたいへんお世話になります。
本日はVisual Studio 2017 Communityで開発して困っていることがあります。
Slackからファイルをダウンロードするときの引数の設定で困っています。
https://github.com/Inumedia/SlackAPI
からAPI一式をダウンロードしてためしています。
画像のアップロードはできました。
そこで次にダウンロードしようと思っています。
C#
1namespace SlackAPI 2{ 3 public partial class SlackClient 4 { 5 readonly string APIToken; 6 public SlackClient(string token) 7 { 8 APIToken = token; 9 } 10 } 11}
C#
1string token= ""; 2var slackclient = new Slack.SlackClient(token); 3slackclient.GetFiles(null, "myid@mailaddress.com", DateTime.Now.AddDays(-5), DateTime.Now, 10);
これで初期化したあと、次のメソッドに飛びます。
このAction<FileListResponse> callbackになにを入れればよいのかを教えてほしいです。
とりあえずnullを入れてますが、うまくいっていないです。うまくいっていないというのは、ファイルをダウンロードするはずなのですが、処理が終わってしまってファイルをダウンロードしません。
Action<FileListResponse> callbackにはなにを渡したらよいでしょうか?
ちなみにUploadも同様にAction<FileUploadResponse> callbackという引数ですが、こちらはnullを渡してアップロードできました。
C#
1public void GetFiles(Action<FileListResponse> callback, string userId = null, DateTime? from = null, DateTime? to = null, int? count = null, int? page = null, FileTypes types = FileTypes.all) 2{ 3 //この処理にいくようです。 4 APIRequestWithToken(callback, parameters.ToArray()); 5} 6 7この処理を経過して、 8 public void APIRequestWithToken<K>(Action<K> callback, params Tuple<string,string>[] getParameters) 9 where K : Response 10 { 11 Tuple<string, string>[] tokenArray = new Tuple<string, string>[]{ 12 new Tuple<string,string>("token", APIToken) 13 }; 14 15 if (getParameters != null && getParameters.Length > 0) 16 tokenArray = tokenArray.Concat(getParameters).ToArray(); 17 18 APIRequest(callback, tokenArray, new Tuple<string, string>[0]); 19 } 20 21 22//この処理にいきます。 23public static void APIRequest<K>(Action<K> callback, Tuple<string, string>[] getParameters, Tuple<string, string>[] postParameters) 24 where K : Response 25{ 26 RequestPath path = RequestPath.GetRequestPath<K>(); 27 Uri requestUri = GetSlackUri(Path.Combine(APIBaseLocation, path.Path), getParameters); 28 HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(requestUri); 29 RequestState<K> state = new RequestState<K>(request, postParameters, callback); 30 //このあたりで処理するのかと思うのですが、どこにどういくのか見失っています。 31 state.Begin(); 32}
###発生している問題・エラーメッセージ
callbackにとりあえずnullを入れてますが、うまくいっていないです。うまくいっていないというのは、ファイルをダウンロードするはずなのですが、処理が終わってしまってファイルをダウンロードしません。
###補足情報(言語/FW/ツール等のバージョンなど)
Windows10 Home 1709 64bit
Microsoft Visual Studio Community 2017
Version 15.1 (26403.3) Release
VisualStudio.15.Release/15.1.0+26403.3
Microsoft .NET Framework
Version 4.7.02556
インストールされているバージョン:Community
Visual C# 2017 00369-60000-00001-AA631
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。