|
14 | 14 | use Keboola\StorageApi\Options\Components\ListConfigurationVersionsOptions; |
15 | 15 | use Keboola\StorageApi\Options\Components\ListConfigurationWorkspacesOptions; |
16 | 16 |
|
| 17 | +/** |
| 18 | + * @phpstan-type Component array{id: string, type: string, name: string, description: string, longDescription: string, version: int, complexity: string, categories: list<string>, hasUI: bool, hasRun: bool, ico32: string, ico64: string, ico128: string, data: array, flags: list<string>, configurationSchema: array, configurationRowSchema: array, emptyConfiguration: array, emptyConfigurationRow: array, createConfigurationRowSchema: array, uiOptions: array, configurationDescription: string, features: list<string>, expiredOn: string, dataTypesConfiguration: array, processorConfiguration: array, uri: string, documentationUrl: string} |
| 19 | + * @phpstan-type ComponentListItem array{id: string, type: string, name: string, description: string, longDescription: string, version: int, complexity: string, categories: list<string>, hasUI: bool, hasRun: bool, ico32: string, ico64: string, ico128: string, data: array, flags: list<string>, configurationSchema: array, configurationRowSchema: array, emptyConfiguration: array, emptyConfigurationRow: array, createConfigurationRowSchema: array, uiOptions: array, configurationDescription: string, features: list<string>, expiredOn: string, dataTypesConfiguration: array, configurations: array, processorConfiguration: array, uri: string, documentationUrl: string} |
| 20 | + */ |
17 | 21 | class Components |
18 | 22 | { |
19 | 23 | private string $branchPrefix = ''; |
@@ -118,109 +122,29 @@ public function resetToDefault($componentId, $configurationId) |
118 | 122 | return $this->client->apiPostJson($this->branchPrefix . "components/{$componentId}/configs/{$configurationId}/reset-to-default"); |
119 | 123 | } |
120 | 124 |
|
121 | | - public function listComponents(?ListComponentsOptions $options = null) |
| 125 | + /** @return ComponentListItem[] */ |
| 126 | + public function listComponents(?ListComponentsOptions $options = null): array |
122 | 127 | { |
123 | 128 | if (!$options) { |
124 | 129 | $options = new ListComponentsOptions(); |
125 | 130 | } |
126 | | - return $this->client->apiGet($this->branchPrefix . 'components?' . http_build_query($options->toParamsArray())); |
| 131 | + /** @var ComponentListItem[] $result */ |
| 132 | + $result = $this->client->apiGet($this->branchPrefix . 'components?' . http_build_query($options->toParamsArray())); |
| 133 | + return $result; |
127 | 134 | } |
128 | 135 |
|
129 | | - public function getComponent($componentId) |
| 136 | + /** @return Component */ |
| 137 | + public function getComponent($componentId): array |
130 | 138 | { |
131 | | - return $this->client->apiGet($this->branchPrefix . "components/{$componentId}"); |
| 139 | + /** @var Component $result */ |
| 140 | + $result = $this->client->apiGet($this->branchPrefix . "components/{$componentId}"); |
| 141 | + return $result; |
132 | 142 | } |
133 | 143 |
|
134 | | - /** |
135 | | - * Get public component detail |
136 | | - * @return array{ |
137 | | - * id: string, |
138 | | - * type: string, |
139 | | - * name: string, |
140 | | - * description: string, |
141 | | - * longDescription: string, |
142 | | - * hasUI: bool, |
143 | | - * hasRun: bool, |
144 | | - * ico32: string, |
145 | | - * ico64: string, |
146 | | - * ico128: string, |
147 | | - * data: array{ |
148 | | - * definition: array{ |
149 | | - * type: string, |
150 | | - * uri: string, |
151 | | - * tag: string, |
152 | | - * repository: array{ |
153 | | - * region: string |
154 | | - * } |
155 | | - * }, |
156 | | - * cpu_shares: int, |
157 | | - * memory: string, |
158 | | - * configuration_format: string, |
159 | | - * process_timeout: int |
160 | | - * }, |
161 | | - * flags: array<string>, |
162 | | - * configurationSchema: array{ |
163 | | - * title: string, |
164 | | - * type: string, |
165 | | - * properties: array<string, array{ |
166 | | - * type: string, |
167 | | - * title: string, |
168 | | - * description: string, |
169 | | - * default?: string |
170 | | - * }>, |
171 | | - * required: array<string> |
172 | | - * }, |
173 | | - * emptyConfiguration: array<mixed>, |
174 | | - * uiOptions: array<mixed>, |
175 | | - * configurationDescription: string, |
176 | | - * uri: string |
177 | | - * } |
178 | | - */ |
| 144 | + /** @return Component */ |
179 | 145 | public function getPublicComponentDetail(string $componentId): array |
180 | 146 | { |
181 | | - /** @var array{ |
182 | | - * id: string, |
183 | | - * type: string, |
184 | | - * name: string, |
185 | | - * description: string, |
186 | | - * longDescription: string, |
187 | | - * hasUI: bool, |
188 | | - * hasRun: bool, |
189 | | - * ico32: string, |
190 | | - * ico64: string, |
191 | | - * ico128: string, |
192 | | - * data: array{ |
193 | | - * definition: array{ |
194 | | - * type: string, |
195 | | - * uri: string, |
196 | | - * tag: string, |
197 | | - * repository: array{ |
198 | | - * region: string |
199 | | - * } |
200 | | - * }, |
201 | | - * cpu_shares: int, |
202 | | - * memory: string, |
203 | | - * configuration_format: string, |
204 | | - * process_timeout: int |
205 | | - * }, |
206 | | - * flags: array<string>, |
207 | | - * configurationSchema: array{ |
208 | | - * title: string, |
209 | | - * type: string, |
210 | | - * properties: array<string, array{ |
211 | | - * type: string, |
212 | | - * title: string, |
213 | | - * description: string, |
214 | | - * default?: string |
215 | | - * }>, |
216 | | - * required: array<string> |
217 | | - * }, |
218 | | - * emptyConfiguration: array<mixed>, |
219 | | - * uiOptions: array<mixed>, |
220 | | - * configurationDescription: string, |
221 | | - * uri: string |
222 | | - * } $result |
223 | | - */ |
| 147 | + /** @var Component $result */ |
224 | 148 | $result = $this->client->apiGet('components/'.$componentId); |
225 | 149 | return $result; |
226 | 150 | } |
|
0 commit comments