@kontent-ai/management-sdk
Version:
Official Kontent.ai management SDK
41 lines (35 loc) • 1.45 kB
text/typescript
import { IManagementClientConfig } from '../config';
import { Identifiers } from '../models';
import { ManagementQueryService } from '../services';
export class CollectionIdentifierQuery<TResult> {
constructor(
protected config: IManagementClientConfig,
protected queryService: ManagementQueryService,
protected buildResult: (
config: IManagementClientConfig,
queryService: ManagementQueryService,
identifier: Identifiers.CollectionIdentifier) => TResult
) {
}
/**
* Gets using internal Id
* @param id Internal Id of collection
*/
byCollectionId(id: string): TResult {
return this.buildResult(this.config, this.queryService, new Identifiers.CollectionIdentifier(Identifiers.CollectionIdentifierEnum.InternalId, id));
}
/**
* Gets query using external Id
* @param id External Id of collection
*/
byCollectionExternalId(id: string): TResult {
return this.buildResult(this.config, this.queryService, new Identifiers.CollectionIdentifier(Identifiers.CollectionIdentifierEnum.ExternalId, id));
}
/**
* Gets query using codename
* @param codename Codename of collection
*/
byCollectionCodename(codename: string): TResult {
return this.buildResult(this.config, this.queryService, new Identifiers.CollectionIdentifier(Identifiers.CollectionIdentifierEnum.Codename, codename));
}
}