import { AddFeaturesResponse } from '../shared/addFeatures'; import { ApplyEditsResult } from '../shared/applyEdits'; import { CustomTermCategory, CustomTermStatus } from '../shared/config'; import { ItemInfoResponse } from '../shared/getItemInfo'; import { CustomTermsFeatureTableField } from './config'; /** * Custom term feature from the feature table */ export type CustomTermFeature = { /** * objectId of the feature */ objectId: number; /** * the term that is added by the user */ term: string; /** * the category of the term */ category: CustomTermCategory; /** * the status of the term */ status: CustomTermStatus; /** * title of the item that the term is added to, * this is used to provide context to the term * when it is reviewed by the Living Atlas team */ title: string; /** * snippet of the item that the term is added to, * this is used to provide context to the term * when it is reviewed by the Living Atlas team */ snippet: string; /** * itemId of the item that the term is added to, */ itemId: string; /** * note of this term */ note: string; /** * date when the term was created */ creationDate: number; /** * date when the term was last modified */ modifiedDate: number; /** * the user who created the term */ creator: string; /** * the user who edited the term */ editor: string; }; type GetCustomTermsOptions = { /** * The user IDs to filter the custom terms by creator. */ userIds: string[]; /** * The authentication token. */ token: string; /** * The status filter for the custom terms. */ status?: CustomTermStatus[]; /** * The fields to include in the response. */ fields?: CustomTermsFeatureTableField[]; /** * The maximum number of records to return. * If set, the function will stop fetching more records once this limit is reached. * If not set, the function will fetch all records. */ maxNumOfRecords?: number; /** * The offset for the result set. */ resultOffset?: number; }; /** * Fetches custom terms from the Custom Terms Feature Table based on the provided options. * * @param {Object} options - The options for fetching custom terms. * @param {string} options.token - The authentication token. * @param {string[]} [options.status] - The status filter for the custom terms. * @param {string[]} options.userIds - The user IDs to filter the custom terms by creator. * @param {string[]} [options.fields] - The fields to include in the response. * * @returns {Promise} A promise that resolves to an array of custom term features. * * @throws Will throw an error if the response contains an error. */ export declare const getCustomTerms: ({ token, status, userIds, fields, maxNumOfRecords, resultOffset, }: GetCustomTermsOptions) => Promise; /** * Retrieves the count of custom terms based on the provided criteria. * * @param {Object} params - The parameters for the request. * @param {string} params.token - The authentication token. * @param {CustomTermStatus[]} [params.status] - Optional array of custom term statuses to filter by. * @param {string[]} params.userIds - Array of user IDs to filter by. * * @returns {Promise} - A promise that resolves to the count of custom terms. */ export declare const getCountOfCustomTerms: ({ token, status, userIds, }: { token: string; status?: CustomTermStatus[]; userIds: string[]; }) => Promise; /** * Retrieves the custom terms that have been submitted by users for review. * The custom terms have a status of 'submitted' meaning they are **pending review** by the Living Atlas team. * * @param {Object} params - The parameters for retrieving submitted custom terms. * @param {string[]} [params.userIds] - Optional array of user IDs to filter the custom terms. * @param {boolean} [params.shouldIncludeAllFields=false] - Flag indicating whether to include all fields in the response. * @param {string} params.token - The authentication token required to access the custom terms. * @returns {Promise} A promise that resolves to an array of submitted custom term features. */ export declare const getSubmittedCustomTerms: ({ userIds, shouldIncludeAllFields, token, }: { userIds?: string[]; shouldIncludeAllFields?: boolean; token: string; }) => Promise; /** * Get custom terms that are added by the signed-in user. * * @param userId id of the user * @param token authentication token * @returns Promise array of custom term features that are added by the signed-in user. */ export declare const getMyCustomTerms: ({ userId, token, maxNumOfRecords, resultOffset, }: { userId: string; token: string; maxNumOfRecords?: number; resultOffset?: number; }) => Promise; /** * Get the count of custom terms that are added by the signed-in user. * * @param userId id of the user * @param token authentication token * @returns Promise count of custom terms that are added by the signed-in user. */ export declare const getCountOfMyCustomTerms: (userId: string, token: string) => Promise; /** * Add custom term to the feature table for the Living Atlas team to review * * @param customTermFeature - The custom term feature to be added. * @param token - The authentication token. * @returns A promise that resolves to an array of `AddCustomTermFeatureResponse` objects. * * @remark * Here is an example of a failed request with `rollbackOnFailure`. This is caused by the second feature containing invalid data for the `item_id` field. * * ``` * { * "addResults" : [ * { * "objectId" : 1010, * "uniqueId" : 1010, * "globalId" : "1F68", * "success" : false, * "error" : { * "code" : 1003, * "description" : "Operation rolled back." * } * }, * { * "objectId" : -1, * "uniqueId" : -1, * "globalId" : "AE186", * "success" : false, * "error" : { * "code" : 1000, * "description" : "String or binary data would be truncated.\r\nThe statement has been terminated." * } * } * ] * } * ``` */ export declare const addCustomTerms2FeatureTable: (data: { term: string; category: CustomTermCategory; title: string; snippet: string; itemId: string; }[], token: string) => Promise; /** * Updates the status of custom terms in the feature table. * * @param token - The authentication token required for the operation * @param data - An array of objects containing: * - objectId: The unique identifier of the custom term * - status: The decision made by the Living Atlas team about the term * - note: A comment/note left by the Living Atlas team * * @throws {Error} If token is missing, required fields are not provided, or other operation errors occur * @returns A promise that resolves to an array of ApplyEditsResult objects */ export declare const updateStatusOfCustomTermsInFeatureTable: (token: string, data: { objectId: number; /** * the status of the term, which is the decision made by the Living Atlas team */ status: CustomTermStatus; /** * note/comment left by the Living Atlas team */ note: string; }[]) => Promise; /** * Get the item info for the Custom Terms feature table. * @param token - The authentication token required to access the item info. * @returns A promise that resolves to an `ItemInfoResponse` object containing metadata about the feature table. */ export declare const getCustomTermsFeatureTableItemInfo: (token: string) => Promise; export {};