ts-japi
Version:
A highly-modular (typescript-friendly)-framework agnostic library for serializing data to the JSON:API specification
30 lines • 1.42 kB
TypeScript
import Linker from '../classes/linker';
import Metaizer from '../classes/metaizer';
import { Dictionary, nullish, SingleOrArray } from '../types/global.types';
export interface RelatorOptions<PrimaryType, RelatedType extends Dictionary<any> = any> {
/**
* A dictionary of {@link Linker}s to use for constructing links.
*
* @see {@link https://jsonapi.org/format/#document-resource-object-relationships | Resource object relationships} for more information.
*/
linkers: {
/**
* A {@link Linker} that gets the [self link](https://jsonapi.org/format/#document-resource-object-relationships)
* between the primary data and the (array of) related data.
*/
relationship?: Linker<[PrimaryType, SingleOrArray<RelatedType> | nullish]>;
/**
* A {@link Linker} that gets the [related link](https://jsonapi.org/format/#document-resource-object-relationships)
* between the primary data and the (array of) related data.
*/
related?: Linker<[PrimaryType, SingleOrArray<RelatedType> | nullish]>;
};
/**
* A {@link Metaizer} that gets the
* [meta](https://jsonapi.org/format/#document-resource-object-relationships)
* about the relationship.
*/
metaizer?: Metaizer<[PrimaryType, SingleOrArray<RelatedType> | nullish]>;
relatedName?: string;
}
//# sourceMappingURL=relator.interface.d.ts.map