Skip to content

Instantly share code, notes, and snippets.

@cdoremus
Last active December 30, 2020 17:52
Show Gist options
  • Save cdoremus/558f65f732d2e502429744c61c5c17b3 to your computer and use it in GitHub Desktop.
Save cdoremus/558f65f732d2e502429744c61c5c17b3 to your computer and use it in GitHub Desktop.
TypeScript type definitions for the JSON-Placeholder sample data API (see https://jsonplaceholder.typicode.com/).
/**
* TypeScript type definitions for the JSON-Placeholder
* sample data API.
* @see https://jsonplaceholder.typicode.com/
*/
export interface User {
id: number;
name: string;
username: string;
email: string;
address: Address;
phone: string;
website: string;
company: Company;
}
export interface Address {
street: string;
suite: string;
city: string;
zipcode: string;
geo: Geolocation;
}
export interface Geolocation {
lat: string;
lng: string;
}
export interface Company {
name: string;
catchPhrase: string;
bs: string;
}
export interface Post {
id: number;
userId: number;
title: string;
body: string;
}
export interface Comment {
id: number;
postId: number;
name: string;
email: string;
body: string;
}
export interface Album {
id: number;
userId: number;
title: string;
}
export interface Photo {
id: number;
albumId: number;
title: string;
url: string;
thumbnailUrl: string;
}
export interface Todo {
id: number;
userId: number;
title: string;
completed: boolean;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment