/** * リクエストパラメータ、レスポンスのフォーマット設定 */ export type ApiPayloadOptions = { parameters?: { /** * key を camelCase -> snake_case に変換するか * * default: camelToSnake */ case?: 'camelToSnake' | 'none'; /** * 数値や日付を範囲や比較で指定したとき、valueを文字列に結合するかオブジェクトのままにするか * onChangeSearchParamsの引数にも適用される * * 'objectWithSort'の場合は、 sortQueryKey パラメータへ SortOptionType 型を渡すことができる * * default: text */ condition?: 'text' | 'object' | 'objectWithSort'; }; queryString?: { /** * key を camelCase -> snake_case に変換するか * * default: camelToSnake */ case?: 'camelToSnake' | 'none'; /** * 配列変換のフォーマット * comma: foo=1,2 * bracket: foo[]=1&foo[]=2 * * default: comma */ array?: 'comma' | 'bracket'; }; response?: { /** * key を snake_case -> camelCase に変換するか * * default: snakeToCamel */ case?: 'snakeToCamel' | 'none'; }; }; type FetcherParams
= {
method?: string;
requestHeaders?: Record ({ method, ...params }: FetcherParams ) => {
[x: string]: string;
};
/**
* /の重複を排除し、GETの場合はクエリパラメータを付与する
*/
export declare const createUrl: (resource: Parameters ) => string | URL | Request;
export declare const createUrlQueryString: ({ params, apiPayloadOptions, encodeParams, }: FetcherParams ) => string;
export declare const createRequestBody: ({ params, method, encodeParams, apiPayloadOptions, }: FetcherParams ) => Promise (response: Response, { errorResponseToJSON, apiPayloadOptions, decodeResponse, }: FetcherParams ) => Promise (resource: Parameters ) => Promise