22 * @api -ts/response
33 */
44
5- // HTTP | GRPC | Response
6- // ----------------------------|--------------------|---------------------------
7- // 400 (bad request) | INVALID_ARGUMENT | Response.invalidRequest
8- // 401 (unauthorized) | UNAUTHENTICATED | Response.unauthenticated
9- // 403 (forbidden) | PERMISSION_DENIED | Response.permissionDenied
10- // 404 (not found) | NOT_FOUND | Response.notFound
11- // 405 (method not allowed) | NOT_FOUND | Response.notFound
12- // 409 (conflict) | ALREADY_EXISTS | Response.conflict
13- // 429 (rate-limit) | RESOURCE_EXHAUSTED | Response.rateLimitExceeded
14- // 500 (internal server error) | INTERNAL | Response.internalError
15- // 503 (service unavailable) | UNAVAILABLE | Response.serviceUnavailable
16-
175export type KeyedStatus =
6+ | 'continue'
7+ | 'switchingProtocols'
8+ | 'processing'
189 | 'ok'
10+ | 'created'
11+ | 'accepted'
12+ | 'nonAuthoritativeInformation'
13+ | 'noContent'
14+ | 'resetContent'
15+ | 'partialContent'
16+ | 'multiStatus'
17+ | 'alreadyReported'
18+ | 'imUsed'
19+ | 'multipleChoices'
20+ | 'movedPermanently'
21+ | 'found'
22+ | 'seeOther'
23+ | 'notModified'
24+ | 'temporaryRedirect'
25+ | 'permanentRedirect'
1926 | 'invalidRequest'
2027 | 'unauthenticated'
28+ | 'paymentRequired'
2129 | 'permissionDenied'
2230 | 'notFound'
31+ | 'methodNotAllowed'
32+ | 'notAcceptable'
33+ | 'proxyAuthenticationRequired'
34+ | 'requestTimeout'
2335 | 'conflict'
36+ | 'gone'
37+ | 'lengthRequired'
38+ | 'preconditionFailed'
39+ | 'contentTooLarge'
40+ | 'uriTooLong'
41+ | 'unsupportedMediaType'
42+ | 'rangeNotSatisfiable'
43+ | 'exceptionFailed'
44+ | 'imATeapot'
45+ | 'misdirectedRequest'
46+ | 'unprocessableContent'
47+ | 'locked'
48+ | 'failedDependency'
49+ | 'tooEarly'
50+ | 'upgradeRequired'
51+ | 'preconditionRequired'
2452 | 'rateLimitExceeded'
53+ | 'requestHeaderFieldsTooLarge'
54+ | 'unavailableForLegalReasons'
2555 | 'internalError'
26- | 'serviceUnavailable' ;
56+ | 'notImplemented'
57+ | 'badGateway'
58+ | 'serviceUnavailable'
59+ | 'gatewayTimeout'
60+ | 'httpVersionNotSupported'
61+ | 'variantAlsoNegotiates'
62+ | 'insufficientStorage'
63+ | 'loopDetected'
64+ | 'notExtended'
65+ | 'networkAuthenticationRequired' ;
2766
2867export type KeyedResponse = { type : KeyedStatus ; payload : unknown } ;
2968
@@ -32,13 +71,64 @@ const responseFunction =
3271 < T > ( payload : T ) => ( { type : status , payload } ) ;
3372
3473export const KeyedResponse = {
74+ continue : responseFunction ( 'continue' ) ,
75+ switchingProtocols : responseFunction ( 'switchingProtocols' ) ,
76+ processing : responseFunction ( 'processing' ) ,
3577 ok : responseFunction ( 'ok' ) ,
78+ created : responseFunction ( 'created' ) ,
79+ accepted : responseFunction ( 'accepted' ) ,
80+ nonAuthoritativeInformation : responseFunction ( 'nonAuthoritativeInformation' ) ,
81+ noContent : responseFunction ( 'noContent' ) ,
82+ resetContent : responseFunction ( 'resetContent' ) ,
83+ partialContent : responseFunction ( 'partialContent' ) ,
84+ multiStatus : responseFunction ( 'multiStatus' ) ,
85+ alreadyReported : responseFunction ( 'alreadyReported' ) ,
86+ imUsed : responseFunction ( 'imUsed' ) ,
87+ multipleChoices : responseFunction ( 'multipleChoices' ) ,
88+ movedPermanently : responseFunction ( 'movedPermanently' ) ,
89+ found : responseFunction ( 'found' ) ,
90+ seeOther : responseFunction ( 'seeOther' ) ,
91+ notModified : responseFunction ( 'notModified' ) ,
92+ temporaryRedirect : responseFunction ( 'temporaryRedirect' ) ,
93+ permanentRedirect : responseFunction ( 'permanentRedirect' ) ,
3694 invalidRequest : responseFunction ( 'invalidRequest' ) ,
3795 unauthenticated : responseFunction ( 'unauthenticated' ) ,
96+ paymentRequired : responseFunction ( 'paymentRequired' ) ,
3897 permissionDenied : responseFunction ( 'permissionDenied' ) ,
3998 notFound : responseFunction ( 'notFound' ) ,
99+ methodNotAllowed : responseFunction ( 'methodNotAllowed' ) ,
100+ notAcceptable : responseFunction ( 'notAcceptable' ) ,
101+ proxyAuthenticationRequired : responseFunction ( 'proxyAuthenticationRequired' ) ,
102+ requestTimeout : responseFunction ( 'requestTimeout' ) ,
40103 conflict : responseFunction ( 'conflict' ) ,
104+ gone : responseFunction ( 'gone' ) ,
105+ lengthRequired : responseFunction ( 'lengthRequired' ) ,
106+ preconditionFailed : responseFunction ( 'preconditionFailed' ) ,
107+ contentTooLarge : responseFunction ( 'contentTooLarge' ) ,
108+ uriTooLong : responseFunction ( 'uriTooLong' ) ,
109+ unsupportedMediaType : responseFunction ( 'unsupportedMediaType' ) ,
110+ rangeNotSatisfiable : responseFunction ( 'rangeNotSatisfiable' ) ,
111+ exceptionFailed : responseFunction ( 'exceptionFailed' ) ,
112+ imATeapot : responseFunction ( 'imATeapot' ) ,
113+ misdirectedRequest : responseFunction ( 'misdirectedRequest' ) ,
114+ unprocessableContent : responseFunction ( 'unprocessableContent' ) ,
115+ locked : responseFunction ( 'locked' ) ,
116+ failedDependency : responseFunction ( 'failedDependency' ) ,
117+ tooEarly : responseFunction ( 'tooEarly' ) ,
118+ upgradeRequired : responseFunction ( 'upgradeRequired' ) ,
119+ preconditionRequired : responseFunction ( 'preconditionRequired' ) ,
41120 rateLimitExceeded : responseFunction ( 'rateLimitExceeded' ) ,
121+ requestHeaderFieldsTooLarge : responseFunction ( 'requestHeaderFieldsTooLarge' ) ,
122+ unavailableForLegalReasons : responseFunction ( 'unavailableForLegalReasons' ) ,
42123 internalError : responseFunction ( 'internalError' ) ,
124+ notImplemented : responseFunction ( 'notImplemented' ) ,
125+ badGateway : responseFunction ( 'badGateway' ) ,
43126 serviceUnavailable : responseFunction ( 'serviceUnavailable' ) ,
127+ gatewayTimeout : responseFunction ( 'gatewayTimeout' ) ,
128+ httpVersionNotSupported : responseFunction ( 'httpVersionNotSupported' ) ,
129+ variantAlsoNegotiates : responseFunction ( 'variantAlsoNegotiates' ) ,
130+ insufficientStorage : responseFunction ( 'insufficientStorage' ) ,
131+ loopDetected : responseFunction ( 'loopDetected' ) ,
132+ notExtended : responseFunction ( 'notExtended' ) ,
133+ networkAuthenticationRequired : responseFunction ( 'networkAuthenticationRequired' ) ,
44134} ;
0 commit comments