There is no need for the current type to be an object, when it can be a function. In order to manage backwards compatibility, we can create this new type/implementation as required only for a future defined 'functions only' generator.
I envision this looking like
export type ModernHttpApiArgs = [
/** Conjure service name. Doesn't affect the network request. */
serviceName: string | undefined,
/** Conjure endpoint name. Doesn't affect the network request. */
endpointName: string | undefined,
/** HTTP method. */
method: string,
/** Path to make a request to, e.g. "/foo/{param1}/bar". */
endpointPath: string,
/** Data to send in the body. */
data?: any,
/** HTTP headers. */
headers?: {
[header: string]: string | number | boolean | undefined | null;
},
/** Key-value mappings to be appended to the request query string. */
queryArguments?: {
[paramName: string]: any;
},
/** Values to be interpolated into the endpointPath. */
pathArguments?: any[],
/** MIME type of the outgoing request, if absent defaults to "application/json" */
requestMediaType?: string,
/** MIME type of the expected server response, if absent defaults to "application/json" */
responseMediaType?: string
]
export type ModernHttpApiBridge<T> = (args: ModernHttpApiArgs) => Promise<T>;
Note: This is a tuple instead of an array of arguments. This will allow invocation like:
There is no need for the current type to be an object, when it can be a function. In order to manage backwards compatibility, we can create this new type/implementation as required only for a future defined 'functions only' generator.
I envision this looking like
Note: This is a tuple instead of an array of arguments. This will allow invocation like:
This will allow us to omit arguments without resorting to the
_undefined
hack we currently use to compress better.