mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
21 lines
462 B
TypeScript
21 lines
462 B
TypeScript
import {Client} from 'sentry/api';
|
|
|
|
type TSDBField = 'sentry_app_viewed' | 'sentry_app_component_interacted';
|
|
|
|
export const recordInteraction = async (
|
|
sentryAppSlug: string,
|
|
field: TSDBField,
|
|
data?: object
|
|
): Promise<void> => {
|
|
const api = new Client();
|
|
const endpoint = `/sentry-apps/${sentryAppSlug}/interaction/`;
|
|
|
|
return await api.requestPromise(endpoint, {
|
|
method: 'POST',
|
|
data: {
|
|
tsdbField: field,
|
|
...data,
|
|
},
|
|
});
|
|
};
|