in packages/gitlab-api-client/src/endpoints/declareEndpoint.ts [85:118]
path: resolvePathParams(path, params),
};
},
};
}
}
// region: builder classes (GET) ---------------------------------------
class GetEndpointBuilder<
TReturnType = DefaultReturnType,
TPathParams extends PathParams = DefaultPathParams,
> extends BaseEndpointBuilder {
withReturnType<X>(): GetEndpointBuilder<X, TPathParams> {
return this;
}
withBufferReturnType(): GetBufferEndpointBuilder<TPathParams> {
return new GetBufferEndpointBuilder<TPathParams>(this.path);
}
withPathParams<X extends PathParams>(): GetEndpointBuilder<TReturnType, X> {
// what: Cast to unknown first since TS doesn't like us changing a generic.
// why: This is safe because we don't actually "use" the generic until "build".
return this as unknown as GetEndpointBuilder<TReturnType, X>;
}
build(): GetEndpoint<TReturnType, TPathParams> {
// what: Pull variables out of `this` so they are owned by createRequest closure
const { path } = this;
return {
createRequest(params: TPathParams) {
return {