Added missing static helpers for fetching repositories

This commit is contained in:
Christopher Allford 2020-09-30 13:16:46 -07:00
parent fccf1fb66e
commit f6cbab8d07
4 changed files with 26 additions and 3 deletions

View File

@ -1 +1,4 @@
export { SimpleProduct } from './products/simple-product';
export { SettingGroup } from './settings/setting-group';
export { Setting } from './settings/setting';

View File

@ -1,6 +1,5 @@
import { AbstractProduct } from './abstract-product';
import { HTTPClient } from '../../http';
import { CreatesModels } from '../../framework/model-repository';
import { simpleProductRESTRepository } from '../../repositories/rest/products/simple-product';
/**
@ -21,9 +20,8 @@ export class SimpleProduct extends AbstractProduct {
* Creates a model repository configured for communicating via the REST API.
*
* @param {HTTPClient} httpClient The client for communicating via HTTP.
* @return {CreatesModels} The created repository.
*/
public static restRepository( httpClient: HTTPClient ): CreatesModels< SimpleProduct > {
public static restRepository( httpClient: HTTPClient ): ReturnType< typeof simpleProductRESTRepository > {
return simpleProductRESTRepository( httpClient );
}
}

View File

@ -1,4 +1,6 @@
import { Model, ModelID } from '../model';
import { HTTPClient } from '../../http';
import { settingGroupRESTRepository } from '../../repositories/rest/settings/setting-group';
/**
* A settings group object.
@ -34,4 +36,13 @@ export class SettingGroup extends Model {
super();
Object.assign( this, properties );
}
/**
* Returns the repository for interacting with this type of model.
*
* @param {HTTPClient} httpClient The client for communicating via HTTP.
*/
public static restRepository( httpClient: HTTPClient ): ReturnType< typeof settingGroupRESTRepository > {
return settingGroupRESTRepository( httpClient );
}
}

View File

@ -1,4 +1,6 @@
import { Model, ModelID, ModelParentID } from '../model';
import { HTTPClient } from '../../http';
import { settingRESTRepository } from '../../repositories/rest/settings/setting';
/**
* The default types of settings that are available.
@ -70,4 +72,13 @@ export class Setting extends Model {
super();
Object.assign( this, properties );
}
/**
* Returns the repository for interacting with this type of model.
*
* @param {HTTPClient} httpClient The client for communicating via HTTP.
*/
public static restRepository( httpClient: HTTPClient ): ReturnType< typeof settingRESTRepository > {
return settingRESTRepository( httpClient );
}
}