|
| 1 | +import { ID, SCOPES } from '../config.js'; |
| 2 | +import { HTTP_METHODS, serviceRequest } from '../../shared.js'; |
| 3 | +import { createServiceMethodFactory } from '../../factory.js'; |
| 4 | +import { RESOURCE_SERVERS } from '../../auth/config.js'; |
| 5 | + |
| 6 | +import type { OpenAPI } from '../index.js'; |
| 7 | +import type { |
| 8 | + JSONFetchResponse, |
| 9 | + ServiceMethod, |
| 10 | + ServiceMethodDynamicSegments, |
| 11 | +} from '../../types.js'; |
| 12 | + |
| 13 | +export const get = function ( |
| 14 | + web_input_id: string, |
| 15 | + options?, |
| 16 | + sdkOptions?, |
| 17 | +): Promise< |
| 18 | + JSONFetchResponse< |
| 19 | + OpenAPI.paths['/web_inputs/{web_input_id}']['get']['responses']['200']['content']['application/json'] |
| 20 | + > |
| 21 | +> { |
| 22 | + return serviceRequest( |
| 23 | + { |
| 24 | + service: ID, |
| 25 | + scope: SCOPES.WEB_INPUT_VIEW, |
| 26 | + path: `/web_inputs/${web_input_id}`, |
| 27 | + }, |
| 28 | + options, |
| 29 | + sdkOptions, |
| 30 | + ); |
| 31 | +} satisfies ServiceMethodDynamicSegments< |
| 32 | + string, |
| 33 | + { |
| 34 | + query?: OpenAPI.paths['/web_inputs/{web_input_id}']['get']['parameters']['query']; |
| 35 | + }, |
| 36 | + JSONFetchResponse< |
| 37 | + OpenAPI.paths['/web_inputs/{web_input_id}']['get']['responses']['200']['content']['application/json'] |
| 38 | + > |
| 39 | +>; |
| 40 | + |
| 41 | +/** |
| 42 | + * @see https://flows.globus.org/redoc#tag/Web-Inputs/paths/~1web_inputs/get |
| 43 | + */ |
| 44 | +export const getAll = function ( |
| 45 | + options?, |
| 46 | + sdkOptions?, |
| 47 | +): Promise< |
| 48 | + JSONFetchResponse< |
| 49 | + OpenAPI.paths['/web_inputs']['get']['responses']['200']['content']['application/json'] |
| 50 | + > |
| 51 | +> { |
| 52 | + return serviceRequest( |
| 53 | + { |
| 54 | + service: ID, |
| 55 | + scope: SCOPES.WEB_INPUT_VIEW, |
| 56 | + path: `/web_inputs`, |
| 57 | + }, |
| 58 | + options, |
| 59 | + sdkOptions, |
| 60 | + ); |
| 61 | +} satisfies ServiceMethod<{ |
| 62 | + query?: OpenAPI.paths['/web_inputs']['get']['parameters']['query']; |
| 63 | +}>; |
| 64 | + |
| 65 | +/** |
| 66 | + * @see https://flows.globus.org/redoc#tag/Web-Inputs/paths/~1web_inputs~1%7Bweb_input_id%7D~1response/post |
| 67 | + */ |
| 68 | +export const respond = function ( |
| 69 | + web_input_id: string, |
| 70 | + options?, |
| 71 | + sdkOptions?, |
| 72 | +): Promise< |
| 73 | + JSONFetchResponse< |
| 74 | + OpenAPI.paths['/web_inputs/{web_input_id}/response']['post']['responses']['200']['content']['application/json'] |
| 75 | + > |
| 76 | +> { |
| 77 | + return serviceRequest( |
| 78 | + { |
| 79 | + service: ID, |
| 80 | + scope: SCOPES.WEB_INPUT_RESPOND, |
| 81 | + path: `/web_inputs/${web_input_id}/response`, |
| 82 | + method: HTTP_METHODS.POST, |
| 83 | + }, |
| 84 | + options, |
| 85 | + sdkOptions, |
| 86 | + ); |
| 87 | +} satisfies ServiceMethodDynamicSegments< |
| 88 | + string, |
| 89 | + { |
| 90 | + body: OpenAPI.paths['/web_inputs/{web_input_id}/response']['post']['requestBody']['content']['application/json']; |
| 91 | + }, |
| 92 | + JSONFetchResponse< |
| 93 | + OpenAPI.paths['/web_inputs/{web_input_id}/response']['post']['responses']['200']['content']['application/json'] |
| 94 | + > |
| 95 | +>; |
| 96 | + |
| 97 | +/** |
| 98 | + * @private |
| 99 | + */ |
| 100 | +export const next = { |
| 101 | + get: createServiceMethodFactory({ |
| 102 | + service: ID, |
| 103 | + resource_server: RESOURCE_SERVERS.FLOWS, |
| 104 | + path: `/web_inputs/{web_input_id}`, |
| 105 | + }).generate< |
| 106 | + { |
| 107 | + request?: { |
| 108 | + query?: OpenAPI.paths['/web_inputs/{web_input_id}']['get']['parameters']['query']; |
| 109 | + }; |
| 110 | + }, |
| 111 | + JSONFetchResponse< |
| 112 | + OpenAPI.paths['/web_inputs/{web_input_id}']['get']['responses']['200']['content']['application/json'] |
| 113 | + > |
| 114 | + >(), |
| 115 | + getAll: createServiceMethodFactory({ |
| 116 | + service: ID, |
| 117 | + resource_server: RESOURCE_SERVERS.FLOWS, |
| 118 | + path: `/web_inputs`, |
| 119 | + }).generate< |
| 120 | + { |
| 121 | + request?: { |
| 122 | + query?: OpenAPI.paths['/web_inputs']['get']['parameters']['query']; |
| 123 | + }; |
| 124 | + }, |
| 125 | + JSONFetchResponse< |
| 126 | + OpenAPI.paths['/web_inputs']['get']['responses']['200']['content']['application/json'] |
| 127 | + > |
| 128 | + >(), |
| 129 | + respond: createServiceMethodFactory({ |
| 130 | + service: ID, |
| 131 | + resource_server: RESOURCE_SERVERS.FLOWS, |
| 132 | + path: `/web_inputs/{web_input_id}/response`, |
| 133 | + }).generate< |
| 134 | + { |
| 135 | + request?: { |
| 136 | + query?: OpenAPI.paths['/web_inputs/{web_input_id}/response']['post']['parameters']['query']; |
| 137 | + data?: OpenAPI.paths['/web_inputs/{web_input_id}/response']['post']['requestBody']['content']['application/json']; |
| 138 | + }; |
| 139 | + }, |
| 140 | + JSONFetchResponse< |
| 141 | + OpenAPI.paths['/web_inputs/{web_input_id}/response']['post']['responses']['200']['content']['application/json'] |
| 142 | + > |
| 143 | + >(), |
| 144 | +}; |
0 commit comments