コード例 #1
0
        public IMultipartWebRequest GenerateMultipartWebRequest(ITwitterQuery twitterQuery, string contentId, IEnumerable <IMedia> medias)
        {
            var baseURL = _webHelper.GetBaseURL(twitterQuery.QueryURL);
            var requestConfiguration = new MultipartRequestConfiguration();
            var multipartElements    = medias.Select(media => GenerateMultipartElement(media, contentId, requestConfiguration));

            var requestContent = _webRequestGenerator.GenerateMultipartContent(twitterQuery.QueryURL, twitterQuery.HttpMethod, requestConfiguration, multipartElements);

            var baseTwitterQuery = twitterQuery.Clone();

            baseTwitterQuery.QueryURL = baseURL;

            var request = GetQueryWebRequest(baseTwitterQuery);

            request.ContentType = "multipart/form-data;boundary=" + requestConfiguration.Boundary;

            return(new MultipartWebRequest(request, requestContent, _tweetinviSettingsAccessor));
        }
コード例 #2
0
        public IMultipartWebRequest GenerateMultipartWebRequest(ITwitterQuery twitterQuery, string contentId, IEnumerable<IMedia> medias)
        {
            var baseURL = _webHelper.GetBaseURL(twitterQuery.QueryURL);
            var requestConfiguration = new MultipartRequestConfiguration();
            var multipartElements = medias.Select(media => GenerateMultipartElement(media, contentId, requestConfiguration));

            var requestContent = _webRequestGenerator.GenerateMultipartContent(twitterQuery.QueryURL, twitterQuery.HttpMethod, requestConfiguration, multipartElements);

            var baseTwitterQuery = twitterQuery.Clone();
            baseTwitterQuery.QueryURL = baseURL;

            var request = GetQueryWebRequest(baseTwitterQuery);
            request.ContentType = "multipart/form-data;boundary=" + requestConfiguration.Boundary;

            return new MultipartWebRequest(request, requestContent, _tweetinviSettingsAccessor);
        }