1
1
using FikaAmazonAPI . AmazonSpApiSDK . Models . Feeds ;
2
+ using FikaAmazonAPI . ConstructFeed ;
3
+ using FikaAmazonAPI . ConstructFeed . Messages ;
2
4
using FikaAmazonAPI . Parameter . Feed ;
3
5
using FikaAmazonAPI . Utils ;
4
6
using System ;
@@ -57,7 +59,7 @@ private GetFeedsResponseV00 GetFeedsByNextToken(string nextToken)
57
59
58
60
public CreateFeedResult CreateFeed ( CreateFeedSpecification createFeedSpecification )
59
61
{
60
- CreateAuthorizedRequest ( FeedsApiUrls . CreateFeed , RestSharp . Method . POST , postJsonObj : createFeedSpecification ) ;
62
+ CreateAuthorizedRequest ( FeedsApiUrls . CreateFeed , RestSharp . Method . POST , postJsonObj : createFeedSpecification ) ;
61
63
var response = ExecuteRequest < CreateFeedResult > ( ) ;
62
64
63
65
return response ;
@@ -66,7 +68,7 @@ public Feed GetFeed(string feedId)
66
68
{
67
69
CreateAuthorizedRequest ( FeedsApiUrls . GetFeed ( feedId ) , RestSharp . Method . GET ) ;
68
70
var response = ExecuteRequest < Feed > ( ) ;
69
- if ( response != null )
71
+ if ( response != null )
70
72
return response ;
71
73
return null ;
72
74
}
@@ -88,6 +90,24 @@ public FeedDocument GetFeedDocument(string feedDocumentId)
88
90
return null ;
89
91
}
90
92
93
+ public ProcessingReportMessage GetFeedDocumentProcessingReport ( string url )
94
+ {
95
+ ProcessingReportMessage processingReport = null ;
96
+ try
97
+ {
98
+ var stream = GetStreamFromUrl ( url ) ;
99
+ var xmlSerializer = new System . Xml . Serialization . XmlSerializer ( typeof ( FeedAmazonEnvelope ) ) ;
100
+ var response = ( FeedAmazonEnvelope ) xmlSerializer . Deserialize ( stream ) ;
101
+ processingReport = response . Message [ 0 ] . ProcessingReport ;
102
+ }
103
+ catch ( Exception ex )
104
+ {
105
+
106
+ }
107
+ return processingReport ;
108
+
109
+ }
110
+
91
111
public CreateFeedDocumentResult CreateFeedDocument ( ContentType contentType )
92
112
{
93
113
var contxt = LinqHelper . GetEnumMemberValue ( contentType ) ;
@@ -106,7 +126,7 @@ public CreateFeedDocumentResult CreateFeedDocument(ContentType contentType)
106
126
/// <param name="xml"></param>
107
127
/// <param name="feedType"></param>
108
128
/// <returns></returns>
109
- public string SubmitFeed ( string xml , FeedType feedType , FeedOptions feedOptions = null )
129
+ public string SubmitFeed ( string xml , FeedType feedType , FeedOptions feedOptions = null )
110
130
{
111
131
112
132
//FIrst Step get doc
@@ -120,14 +140,23 @@ public string SubmitFeed(string xml, FeedType feedType,FeedOptions feedOptions=n
120
140
FeedType = feedType . ToString ( ) ,
121
141
InputFeedDocumentId = feedCreate . FeedDocumentId ,
122
142
MarketplaceIds = new List < string > { MarketPlace . ID } ,
123
- FeedOptions = feedOptions
143
+ FeedOptions = feedOptions
124
144
} ;
125
145
126
146
//Submit XML
127
- var feed = CreateFeed ( createFeedSpecification ) ;
147
+ var feed = CreateFeed ( createFeedSpecification ) ;
128
148
129
149
return feed . FeedId ;
130
150
}
151
+ private static Stream GetStreamFromUrl ( string url )
152
+ {
153
+ byte [ ] imageData = null ;
154
+
155
+ using ( var wc = new System . Net . WebClient ( ) )
156
+ imageData = wc . DownloadData ( url ) ;
157
+
158
+ return new MemoryStream ( imageData ) ;
159
+ }
131
160
132
161
private string postXMLData ( string destinationUrl , string requestXml )
133
162
{
0 commit comments