diff --git a/resources/sdk/typescript/index.ts b/resources/sdk/typescript/index.ts index 3cee511..de4e712 100644 --- a/resources/sdk/typescript/index.ts +++ b/resources/sdk/typescript/index.ts @@ -960,79 +960,6 @@ export class GetResources< } } -export class SearchResources implements PromiseLike> -{ - private searchParamsObject: URLSearchParams; - resourceName: T; - fun: (params: URLSearchParams) => ResponsePromise; - - constructor(fun: (params: URLSearchParams) => ResponsePromise, resourceName: T) { - this.searchParamsObject = new URLSearchParams(); - this.resourceName = resourceName; - this.fun = fun; - } - - where< - K extends keyof SearchParams[T], - SP extends SearchParams[T][K], - PR extends PrefixWithArray, - >(key: K | string, value: SP | SP[], prefix?: PR): this; - - where< - K extends keyof SearchParams[T], - SP extends SearchParams[T][K], - PR extends Exclude, - >(key: K | string, value: SP, prefix?: PR): this; - - where< - K extends keyof SearchParams[T], - SP extends SearchParams[T][K], - PR extends SP extends number ? Prefix : never, - >(key: K | string, value: SP | SP[], prefix?: Prefix | never): this { - if (Array.isArray(value)) { - const val = value as SP[]; - if (prefix) { - if (prefix === 'eq') { - this.searchParamsObject.append(key.toString(), val.join(',')); - return this; - } - - val.forEach((item) => { - this.searchParamsObject.append(key.toString(), `${prefix}${item}`); - }); - - return this; - } - - const queryValues = val.join(','); - this.searchParamsObject.append(key.toString(), queryValues); - - return this; - } - const queryValue = `${prefix ?? ''}${value}`; - - this.searchParamsObject.append(key.toString(), queryValue); - return this; - } - - then, TResult2 = never>( - onfulfilled?: - | ((value: BaseResponseResource) => PromiseLike | TResult1) - | undefined - | null, - _onrejected?: - | ((reason: unknown) => PromiseLike | TResult2) - | undefined - | null, - ): PromiseLike { - - return this.fun(this.searchParamsObject) - .then((response) => { - return onfulfilled ? onfulfilled(response.json()) : (response.json() as TResult1); - }); - } -} - type EventType = | "awf.workflow.event/workflow-init" | "awf.workflow.event/task-completed";