@@ -4,6 +4,71 @@ export type ClientOptions = {
44 baseUrl : 'https://api.html2rss.dev/api/v1' | 'http://127.0.0.1:4000/api/v1' | ( string & { } ) ;
55} ;
66
7+ export type StructuredErrorResponse = {
8+ error : StructuredError ;
9+ success : boolean ;
10+ } ;
11+
12+ export type StructuredError = {
13+ code : string ;
14+ kind : 'auth' | 'input' | 'network' | 'server' ;
15+ message : string ;
16+ next_action : 'enter_token' | 'correct_input' | 'retry' | 'wait' | 'none' ;
17+ next_strategy ?: string ;
18+ retry_action : 'alternate' | 'primary' | 'none' ;
19+ retryable : boolean ;
20+ } ;
21+
22+ export type FeedCreationResponse = {
23+ data : {
24+ conversion : FeedConversionState ;
25+ feed : FeedMetadata ;
26+ } ;
27+ meta : {
28+ created : boolean ;
29+ } ;
30+ success : boolean ;
31+ } ;
32+
33+ export type FeedConversionState = {
34+ preview_status : 'pending' | 'ready' | 'degraded' | 'unavailable' ;
35+ readiness_phase : 'link_created' | 'feed_ready' | 'feed_not_ready_yet' | 'preview_unavailable' ;
36+ retry ?: FeedRetrySummary ;
37+ warnings : Array < FeedWarning > ;
38+ } ;
39+
40+ export type FeedMetadata = {
41+ created_at : string ;
42+ feed_token : string ;
43+ id : string ;
44+ json_public_url : string ;
45+ name : string ;
46+ public_url : string ;
47+ updated_at : string ;
48+ url : string ;
49+ } ;
50+
51+ export type FeedRetrySummary = {
52+ automatic : boolean ;
53+ from : string ;
54+ to : string ;
55+ } ;
56+
57+ export type FeedStatusResponse = {
58+ data : {
59+ conversion : FeedConversionState ;
60+ feed : FeedMetadata ;
61+ } ;
62+ success : boolean ;
63+ } ;
64+
65+ export type FeedWarning = {
66+ code : string ;
67+ message : string ;
68+ next_action : 'enter_token' | 'correct_input' | 'retry' | 'wait' | 'none' ;
69+ retryable : boolean ;
70+ } ;
71+
772export type GetApiMetadataData = {
873 body ?: never ;
974 path ?: never ;
@@ -42,7 +107,6 @@ export type GetApiMetadataResponse = GetApiMetadataResponses[keyof GetApiMetadat
42107
43108export type CreateFeedData = {
44109 body ?: {
45- strategy : string ;
46110 url : string ;
47111 } ;
48112 headers : {
@@ -54,26 +118,22 @@ export type CreateFeedData = {
54118} ;
55119
56120export type CreateFeedErrors = {
121+ /**
122+ * returns bad request for invalid input payloads
123+ */
124+ 400 : StructuredErrorResponse ;
57125 /**
58126 * returns 401 with UNAUTHORIZED error payload
59127 */
60- 401 : {
61- error : {
62- code : string ;
63- message : string ;
64- } ;
65- success : boolean ;
66- } ;
128+ 401 : StructuredErrorResponse ;
67129 /**
68130 * returns forbidden for authenticated requests when auto source is disabled
69131 */
70- 403 : {
71- error : {
72- code : string ;
73- message : string ;
74- } ;
75- success : boolean ;
76- } ;
132+ 403 : StructuredErrorResponse ;
133+ /**
134+ * returns error when feed creation fails
135+ */
136+ 500 : StructuredErrorResponse ;
77137} ;
78138
79139export type CreateFeedError = CreateFeedErrors [ keyof CreateFeedErrors ] ;
@@ -82,25 +142,7 @@ export type CreateFeedResponses = {
82142 /**
83143 * normalizes hostname-only input to https before feed creation
84144 */
85- 201 : {
86- data : {
87- feed : {
88- created_at : string ;
89- feed_token : string ;
90- id : string ;
91- json_public_url : string ;
92- name : string ;
93- public_url : string ;
94- strategy : string ;
95- updated_at : string ;
96- url : string ;
97- } ;
98- } ;
99- meta : {
100- created : boolean ;
101- } ;
102- success : boolean ;
103- } ;
145+ 201 : FeedCreationResponse ;
104146} ;
105147
106148export type CreateFeedResponse = CreateFeedResponses [ keyof CreateFeedResponses ] ;
@@ -140,6 +182,41 @@ export type RenderFeedByTokenResponses = {
140182
141183export type RenderFeedByTokenResponse = RenderFeedByTokenResponses [ keyof RenderFeedByTokenResponses ] ;
142184
185+ export type GetFeedStatusData = {
186+ body ?: never ;
187+ path : {
188+ token : string ;
189+ } ;
190+ query ?: never ;
191+ url : '/feeds/{token}/status' ;
192+ } ;
193+
194+ export type GetFeedStatusErrors = {
195+ /**
196+ * returns unauthorized for invalid tokens
197+ */
198+ 401 : StructuredErrorResponse ;
199+ /**
200+ * returns forbidden when auto source is disabled
201+ */
202+ 403 : StructuredErrorResponse ;
203+ /**
204+ * returns non-cacheable status errors when feed resolution fails
205+ */
206+ 500 : StructuredErrorResponse ;
207+ } ;
208+
209+ export type GetFeedStatusError = GetFeedStatusErrors [ keyof GetFeedStatusErrors ] ;
210+
211+ export type GetFeedStatusResponses = {
212+ /**
213+ * returns structured feed status and preview metadata
214+ */
215+ 200 : FeedStatusResponse ;
216+ } ;
217+
218+ export type GetFeedStatusResponse = GetFeedStatusResponses [ keyof GetFeedStatusResponses ] ;
219+
143220export type GetHealthStatusData = {
144221 body ?: never ;
145222 headers : {
@@ -154,23 +231,11 @@ export type GetHealthStatusErrors = {
154231 /**
155232 * returns 401 with UNAUTHORIZED error payload
156233 */
157- 401 : {
158- error : {
159- code : string ;
160- message : string ;
161- } ;
162- success : boolean ;
163- } ;
234+ 401 : StructuredErrorResponse ;
164235 /**
165236 * returns error when configuration fails
166237 */
167- 500 : {
168- error : {
169- code : string ;
170- message : string ;
171- } ;
172- success : boolean ;
173- } ;
238+ 500 : StructuredErrorResponse ;
174239} ;
175240
176241export type GetHealthStatusError = GetHealthStatusErrors [ keyof GetHealthStatusErrors ] ;
0 commit comments