rest-client-sdk
Advanced tools
Comparing version 5.0.0-rc.5 to 5.0.0-rc.6
# Changelog | ||
## 5.0.0-rc.6 | ||
### Changed | ||
- Improve JSDoc | ||
## 5.0.0-rc.5 | ||
@@ -4,0 +10,0 @@ |
@@ -15,7 +15,50 @@ import URI from 'urijs'; | ||
getEntityURI(entity: D['entity']): string; | ||
/** | ||
* get an entity by its id | ||
* | ||
* @param {string|number} id the entity identifier | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} pathParameters path parameters, will be pass to the `getPathBase` method | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
find(id: string | number, queryParam?: {}, pathParameters?: {}, requestParams?: {}): Promise<D['entity']>; | ||
/** | ||
* get a list of entities by some parameters | ||
* | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} pathParameters path parameters, will be pass to the `getPathBase` method | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
findBy(queryParam: object, pathParameters?: {}, requestParams?: {}): Promise<D['list']>; | ||
/** | ||
* get a list of all entities | ||
* | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} pathParameters path parameters, will be pass to the `getPathBase` method | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
findAll(queryParam?: {}, pathParameters?: {}, requestParams?: {}): Promise<D['list']>; | ||
/** | ||
* create an entity | ||
* | ||
* @param {object} entity the entity to persist | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} pathParameters path parameters, will be pass to the `getPathBase` method | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
create(entity: D['entity'], queryParam?: {}, pathParameters?: {}, requestParams?: {}): Promise<D['entity']>; | ||
/** | ||
* update an entity | ||
* | ||
* @param {object} entity the entity to update | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
update(entity: D['entity'], queryParam?: {}, requestParams?: {}): Promise<D['entity']>; | ||
/** | ||
* delete an entity | ||
* | ||
* @param {object} the entity to delete | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
delete(entity: D['entity'], requestParams?: {}): Promise<Response>; | ||
@@ -22,0 +65,0 @@ deserializeResponse<LOR extends 'list' | 'item'>(requestPromise: Promise<Response>, listOrItem: LOR): Promise<D['entity'] | D['list']>; |
@@ -6,4 +6,10 @@ declare class Attribute { | ||
readonly isIdentifier: boolean; | ||
/** | ||
* @param {string} serializedKey the key returned from your API | ||
* @param {null|string} attributeName the name in your entity, default to the `serializedKey` attribute | ||
* @param {string} type type of the attribute | ||
* @param {boolean} isIdentifier is this attribute the entity identifier | ||
*/ | ||
constructor(serializedKey: string, attributeName?: null | string, type?: string, isIdentifier?: boolean); | ||
} | ||
export default Attribute; |
@@ -15,2 +15,7 @@ import AbstractClient from '../client/AbstractClient'; | ||
repositoryClass: typeof AbstractClient; | ||
/** | ||
* @param {string} key mandatory, will be passed in your serializer | ||
* @param {string|null} pathRoot the endpoint of your API: will be added to the mapping prefix ('/v1' here) | ||
* @param {typeof AbstractClient} repositoryClass [Overriding repository]{@link https://github.com/mapado/rest-client-js-sdk/tree/5.x#overriding-repository} for more detail | ||
*/ | ||
constructor(key: string, pathRoot?: string | null, repositoryClass?: typeof AbstractClient); | ||
@@ -17,0 +22,0 @@ getAttribute(name: string): Attribute; |
@@ -12,2 +12,8 @@ declare enum RelationTypes { | ||
readonly attributeName: string; | ||
/** | ||
* @param {RelationTypes} type the type of relation | ||
* @param {string} targetMetadataKey must match the first argument of `ClassMetadata` constructor of the target entity | ||
* @param {string} serializedKey the key returned from your API | ||
* @param {string|null} attributeName the name in your entity, default to the `serializedKey` attribute | ||
*/ | ||
constructor(type: RelationTypes, targetMetadataKey: string, serializedKey: string, attributeName?: string | null); | ||
@@ -14,0 +20,0 @@ isOneToMany(): boolean; |
@@ -29,2 +29,7 @@ import UnitOfWork from './UnitOfWork'; | ||
constructor(tokenStorage: TokenStorage<Token>, config: Config, mapping: Mapping, serializer?: SerializerInterface); | ||
/** | ||
* get a repository by it's metadata "key" attribute | ||
* | ||
* @param {string} key the repository "key" (the first argument of `new ClassMetadata`) | ||
*/ | ||
getRepository<K extends keyof M & string>(key: K): AbstractClient<M[K]>; | ||
@@ -31,0 +36,0 @@ private _mergeWithBaseConfig; |
{ | ||
"name": "rest-client-sdk", | ||
"version": "5.0.0-rc.5", | ||
"version": "5.0.0-rc.6", | ||
"description": "Rest Client SDK for API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -62,2 +62,10 @@ import URI from 'urijs'; | ||
/** | ||
* get an entity by its id | ||
* | ||
* @param {string|number} id the entity identifier | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} pathParameters path parameters, will be pass to the `getPathBase` method | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
find( | ||
@@ -77,2 +85,9 @@ id: string | number, | ||
/** | ||
* get a list of entities by some parameters | ||
* | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} pathParameters path parameters, will be pass to the `getPathBase` method | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
findBy( | ||
@@ -91,2 +106,9 @@ queryParam: object, | ||
/** | ||
* get a list of all entities | ||
* | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} pathParameters path parameters, will be pass to the `getPathBase` method | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
findAll( | ||
@@ -100,2 +122,10 @@ queryParam = {}, | ||
/** | ||
* create an entity | ||
* | ||
* @param {object} entity the entity to persist | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} pathParameters path parameters, will be pass to the `getPathBase` method | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
create( | ||
@@ -132,2 +162,9 @@ entity: D['entity'], | ||
/** | ||
* update an entity | ||
* | ||
* @param {object} entity the entity to update | ||
* @param {object} queryParam query parameters that will be added to the request | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
update( | ||
@@ -170,2 +207,8 @@ entity: D['entity'], | ||
/** | ||
* delete an entity | ||
* | ||
* @param {object} the entity to delete | ||
* @param {object} requestParams parameters that will be send as second parameter to the `fetch` call | ||
*/ | ||
delete(entity: D['entity'], requestParams = {}): Promise<Response> { | ||
@@ -172,0 +215,0 @@ const url = this.getEntityURI(entity); |
@@ -10,3 +10,3 @@ import ClassMetadata from './Mapping/ClassMetadata'; | ||
#config: object; | ||
#config!: object; | ||
@@ -20,3 +20,3 @@ #classMetadataList: ClassMetadata[]; | ||
this.#config = { ...DEFAULT_CONFIG, ...config }; // might be a call to setConfig but TypeScript report an error on #config | ||
this.setConfig(config); | ||
} | ||
@@ -23,0 +23,0 @@ |
@@ -10,2 +10,8 @@ class Attribute { | ||
/** | ||
* @param {string} serializedKey the key returned from your API | ||
* @param {null|string} attributeName the name in your entity, default to the `serializedKey` attribute | ||
* @param {string} type type of the attribute | ||
* @param {boolean} isIdentifier is this attribute the entity identifier | ||
*/ | ||
constructor( | ||
@@ -12,0 +18,0 @@ serializedKey: string, |
@@ -24,2 +24,7 @@ import AbstractClient from '../client/AbstractClient'; | ||
/** | ||
* @param {string} key mandatory, will be passed in your serializer | ||
* @param {string|null} pathRoot the endpoint of your API: will be added to the mapping prefix ('/v1' here) | ||
* @param {typeof AbstractClient} repositoryClass [Overriding repository]{@link https://github.com/mapado/rest-client-js-sdk/tree/5.x#overriding-repository} for more detail | ||
*/ | ||
constructor( | ||
@@ -26,0 +31,0 @@ key: string, |
@@ -19,2 +19,8 @@ enum RelationTypes { | ||
/** | ||
* @param {RelationTypes} type the type of relation | ||
* @param {string} targetMetadataKey must match the first argument of `ClassMetadata` constructor of the target entity | ||
* @param {string} serializedKey the key returned from your API | ||
* @param {string|null} attributeName the name in your entity, default to the `serializedKey` attribute | ||
*/ | ||
constructor( | ||
@@ -21,0 +27,0 @@ type: RelationTypes, |
@@ -66,2 +66,7 @@ import JsSerializer from './serializer/JsSerializer'; | ||
/** | ||
* get a repository by it's metadata "key" attribute | ||
* | ||
* @param {string} key the repository "key" (the first argument of `new ClassMetadata`) | ||
*/ | ||
getRepository<K extends keyof M & string>(key: K): AbstractClient<M[K]> { | ||
@@ -68,0 +73,0 @@ if (!this.#repositoryList[key]) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
519044
6834