Skip to content

Instantly share code, notes, and snippets.

@vivainio
Created March 24, 2017 16:01
Show Gist options
  • Select an option

  • Save vivainio/d69007dbb3fca0794ace0e04c9954bd8 to your computer and use it in GitHub Desktop.

Select an option

Save vivainio/d69007dbb3fca0794ace0e04c9954bd8 to your computer and use it in GitHub Desktop.
// linked data (HateOAS) with types
interface HData<T> {
rel: string;
href: string;
data?: T;
}
interface HAction<T, U> {
rel: string;
href: string;
}
interface HService {
fetch<T>(resource: HData<T>): Promise<T>;
post<T,U>(action: HAction<T, U>, payload: T) : Promise<U>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment