-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dominik Zogg
committed
Mar 29, 2020
1 parent
5d5c601
commit 27040ee
Showing
7 changed files
with
41 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import PetResponse from './PetResponse'; | ||
|
||
interface Embedded { | ||
class Embedded { | ||
items: Array<PetResponse>; | ||
constructor({ items }: { items: Array<PetResponse> }) { | ||
this.items = items; | ||
} | ||
}; | ||
|
||
export default Embedded; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
interface PetFilters { | ||
class PetFilters { | ||
name?: string; | ||
constructor({ name }: { name?: string }) { | ||
this.name = name; | ||
} | ||
}; | ||
|
||
export default PetFilters; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
import Embedded from './Embedded'; | ||
import Links from './Links'; | ||
|
||
interface PetList { | ||
class PetList { | ||
offset: number; | ||
limit: number; | ||
count: number; | ||
_embedded: Embedded; | ||
_links: Links; | ||
constructor({ offset, limit, count, _embedded, _links }: { offset: number, limit: number, count: number, _embedded: Embedded, _links: Links }) { | ||
this.offset = offset; | ||
this.limit = limit; | ||
this.count = count; | ||
this._embedded = _embedded; | ||
this._links = _links; | ||
} | ||
}; | ||
|
||
export default PetList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
import Vaccination from './Vaccination'; | ||
import Links from './Links'; | ||
|
||
interface PetRequest { | ||
class PetRequest { | ||
name: string; | ||
tag?: string; | ||
vaccinations: Array<Vaccination>; | ||
constructor({ name, tag, vaccinations }: { name: string, tag?: string, vaccinations: Array<Vaccination> }) { | ||
this.name = name; | ||
this.tag = tag; | ||
this.vaccinations = vaccinations; | ||
} | ||
}; | ||
|
||
export default PetRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import Links from './Links'; | ||
import PetRequest from './PetRequest'; | ||
import Vaccination from './Vaccination'; | ||
|
||
interface PetResponse extends PetRequest { | ||
class PetResponse extends PetRequest { | ||
id: string; | ||
createdAt: string, | ||
updatedAt?: string, | ||
createdAt: string; | ||
updatedAt?: string; | ||
_links: Links; | ||
constructor({ id, createdAt, updatedAt, name, tag, vaccinations, _links }: { id: string, createdAt: string, updatedAt?: string, name: string, tag?: string, vaccinations: Array<Vaccination>, _links: Links; }) { | ||
super({ name, tag, vaccinations }); | ||
this.id = id; | ||
this.createdAt = createdAt; | ||
this.updatedAt = updatedAt; | ||
this._links = _links; | ||
} | ||
}; | ||
|
||
export default PetResponse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
interface Vaccination { | ||
class Vaccination { | ||
name: string; | ||
constructor({ name }: { name: string }) { | ||
this.name = name; | ||
} | ||
}; | ||
|
||
export default Vaccination; |