data.d.ts 814 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. type AnyJson = Record<string, any>
  2. export const enum HTTP_METHOD {
  3. POST = 'POST',
  4. PUT = 'PUT',
  5. GET = 'GET',
  6. DELETE = 'DELETE'
  7. }
  8. interface AssociativeArray {
  9. [key: string]: any;
  10. }
  11. interface Connector {
  12. request(
  13. method: HTTP_METHOD,
  14. url: string,
  15. body: null | any,
  16. params: null | AssociativeArray,
  17. query: null | AssociativeArray
  18. )
  19. }
  20. export const enum METADATA_TYPE {
  21. ITEM,
  22. COLLECTION
  23. }
  24. interface HydraMetadata {
  25. readonly totalItems?: number
  26. firstPage?: number
  27. lastPage?: number
  28. nextPage?: number
  29. previousPage?: number
  30. type?: METADATA_TYPE
  31. }
  32. interface ApiResponse {
  33. data: AnyJson
  34. metadata: HydraMetadata
  35. }
  36. interface ApiCollection extends ApiResponse {
  37. data: AnyJson
  38. metadata: HydraMetadata
  39. }