|
| 1 | +/** |
| 2 | + * Open Bank Project - OBP-TypeScript |
| 3 | + * Copyright (C) 2011-2023, TESOBE GmbH |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + * |
| 17 | + |
| 18 | + * TESOBE GmbH |
| 19 | + * Osloerstrasse 16/17 |
| 20 | + * Berlin 13359, Germany |
| 21 | + * |
| 22 | + * This product includes software developed at |
| 23 | + * TESOBE (http://www.tesobe.com/) |
| 24 | + */ |
| 25 | + |
| 26 | +import { |
| 27 | + API, |
| 28 | + APIRequest, |
| 29 | + APIClientConfig, |
| 30 | + apiCallWithCustomURIPath, |
| 31 | +} from "./client"; |
| 32 | + |
| 33 | +/** |
| 34 | + * Get any data. |
| 35 | + * Returns the response of the requested endpoint. |
| 36 | + * |
| 37 | + * @param config - The APIClientConfig object |
| 38 | + * @param methodCall - A higher order function |
| 39 | + * @returns A curried function |
| 40 | + * |
| 41 | + * @see {@link APIClientConfig} |
| 42 | + * |
| 43 | + * @public |
| 44 | + */ |
| 45 | +export const GetAny = |
| 46 | + ( |
| 47 | + config: APIClientConfig, |
| 48 | + methodCall: (config: APIClientConfig, path: string) => Promise<any> |
| 49 | + ) => |
| 50 | + async (path: string) => { |
| 51 | + return await methodCall(config, path); |
| 52 | + }; |
| 53 | + |
| 54 | +/** |
| 55 | + * Returns an anonymous function for creating or getting Any data. |
| 56 | + * |
| 57 | + * @param config - The APIClientConfig object |
| 58 | + * @param methodCall - A higher order function |
| 59 | + * @returns A higher order function |
| 60 | + * |
| 61 | + * @see {@link APIClientConfig} |
| 62 | + * @see {@link APIRequest} |
| 63 | + * |
| 64 | + * @public |
| 65 | + */ |
| 66 | +export const Any: APIRequest<API.Any> = { |
| 67 | + get: ( |
| 68 | + config: APIClientConfig, |
| 69 | + methodCall: (config: APIClientConfig, path: string) => Promise<any> |
| 70 | + ) => { |
| 71 | + return apiCallWithCustomURIPath<API.Any>(config, methodCall); |
| 72 | + }, |
| 73 | +}; |
0 commit comments