Skip to content

Instantly share code, notes, and snippets.

@lomeat
Created March 1, 2023 04:34
Show Gist options
  • Save lomeat/2ddd1c626597304311cf036c02fe3858 to your computer and use it in GitHub Desktop.
Save lomeat/2ddd1c626597304311cf036c02fe3858 to your computer and use it in GitHub Desktop.
// GET /cities?city='qweqwe'
type CitiesReq = {
city: string;
};
type CitiesRes = Array<{
city: string;
country: string;
}>;
// POST /search
type searchReq = {
trip: {
from: string;
to: string;
};
date: {
// ISO string
from: string;
to: string;
};
count: number;
};
// Either we get from post and put to store...
type searchRes = Array<{
id: number;
title: string;
date: {
from: string;
to: string;
};
}>;
// GET /filters
type filters = {
[k: string]: number[] | string[] | number | string | boolean;
};
type filtersReq = {};
type filtersRes = filters;
// POST /filters
type searchFiltersReq = {
token: string;
filters;
};
type searchFiltersReq2 = searchReq & {
filters;
};
// GET /results?token='qweqwe'
type ResultsReq = {
token: string;
};
type ResultsReq2 = searchReq;
// ...or we make new request
type ResultsRes = searchRes;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment