(...args: unknown[])
| 188 | plugin: ZodiosPlugin |
| 189 | ): PluginId; |
| 190 | use(...args: unknown[]) { |
| 191 | if (typeof args[0] === "object") { |
| 192 | const plugins = this.getAnyEndpointPlugins()!; |
| 193 | return plugins.use(args[0] as ZodiosPlugin); |
| 194 | } else if (typeof args[0] === "string" && typeof args[1] === "object") { |
| 195 | const plugins = this.findAliasEndpointPlugins(args[0]); |
| 196 | if (!plugins) |
| 197 | throw new Error( |
| 198 | `Zodios: no alias '${args[0]}' found to register plugin` |
| 199 | ); |
| 200 | return plugins.use(args[1] as ZodiosPlugin); |
| 201 | } else if ( |
| 202 | typeof args[0] === "string" && |
| 203 | typeof args[1] === "string" && |
| 204 | typeof args[2] === "object" |
| 205 | ) { |
| 206 | const plugins = this.findEnpointPlugins(args[0] as Method, args[1]); |
| 207 | if (!plugins) |
| 208 | throw new Error( |
| 209 | `Zodios: no endpoint '${args[0]} ${args[1]}' found to register plugin` |
| 210 | ); |
| 211 | return plugins.use(args[2] as ZodiosPlugin); |
| 212 | } |
| 213 | throw new Error("Zodios: invalid plugin registration"); |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * unregister a plugin |
no test coverage detected