UpdateMetricPayload.ts•7.74 kB
/* tslint:disable */
/* eslint-disable */
/**
* Squad API
* API for managing Squad resources
*
* The version of the OpenAPI document: 4.0.0
* Contact: help@meetsquad.ai
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime.js';
import type { MetricTimeseriesPoint } from './MetricTimeseriesPoint.js';
import {
MetricTimeseriesPointFromJSON,
MetricTimeseriesPointFromJSONTyped,
MetricTimeseriesPointToJSON,
MetricTimeseriesPointToJSONTyped,
} from './MetricTimeseriesPoint.js';
/**
* Request schema for updating an metric
* @export
* @interface UpdateMetricPayload
*/
export interface UpdateMetricPayload {
/**
* Display name for the metric
* @type {string}
* @memberof UpdateMetricPayload
*/
title?: string;
/**
* Detailed description of the metric
* @type {string}
* @memberof UpdateMetricPayload
*/
description?: string;
/**
* Unit of measurement for the metric
* @type {string}
* @memberof UpdateMetricPayload
*/
unit?: string;
/**
* Category/type of the metric
* @type {string}
* @memberof UpdateMetricPayload
*/
type?: UpdateMetricPayloadTypeEnum;
/**
* Comparison operator for the target
* @type {string}
* @memberof UpdateMetricPayload
*/
targetOperator?: UpdateMetricPayloadTargetOperatorEnum;
/**
* Target value to achieve
* @type {number}
* @memberof UpdateMetricPayload
*/
targetValue?: number;
/**
* Direction of improvement (up = higher is better, down = lower is better)
* @type {string}
* @memberof UpdateMetricPayload
*/
targetDirection?: UpdateMetricPayloadTargetDirectionEnum;
/**
* Current value of the metric
* @type {number}
* @memberof UpdateMetricPayload
*/
currentValue?: number;
/**
* Previous value of the metric for comparison
* @type {number}
* @memberof UpdateMetricPayload
*/
previousValue?: number;
/**
* Type of period for metric comparison
* @type {string}
* @memberof UpdateMetricPayload
*/
periodType?: UpdateMetricPayloadPeriodTypeEnum;
/**
* Specific period value for metric comparison
* @type {string}
* @memberof UpdateMetricPayload
*/
periodValue?: UpdateMetricPayloadPeriodValueEnum;
/**
* UserId of the Owner/responsible person for this metric
* @type {string}
* @memberof UpdateMetricPayload
*/
ownerId?: string;
/**
* Historical values for trend analysis
* @type {Array<MetricTimeseriesPoint>}
* @memberof UpdateMetricPayload
*/
timeseries?: Array<MetricTimeseriesPoint>;
/**
* Related outcomes that use this metric
* @type {Array<any>}
* @memberof UpdateMetricPayload
*/
relatedOutcomes?: Array<any>;
/**
* Array of outcome IDs to associate with this metric
* @type {Array<string>}
* @memberof UpdateMetricPayload
*/
outcomeIds?: Array<string>;
}
/**
* @export
*/
export const UpdateMetricPayloadTypeEnum = {
Engagement: 'engagement',
Conversion: 'conversion',
Revenue: 'revenue',
Nps: 'nps',
Csat: 'csat',
Ces: 'ces',
Ratio: 'ratio',
Custom: 'custom'
} as const;
export type UpdateMetricPayloadTypeEnum = typeof UpdateMetricPayloadTypeEnum[keyof typeof UpdateMetricPayloadTypeEnum];
/**
* @export
*/
export const UpdateMetricPayloadTargetOperatorEnum = {
GreaterThan: 'greater_than',
LessThan: 'less_than',
EqualTo: 'equal_to'
} as const;
export type UpdateMetricPayloadTargetOperatorEnum = typeof UpdateMetricPayloadTargetOperatorEnum[keyof typeof UpdateMetricPayloadTargetOperatorEnum];
/**
* @export
*/
export const UpdateMetricPayloadTargetDirectionEnum = {
Up: 'up',
Down: 'down'
} as const;
export type UpdateMetricPayloadTargetDirectionEnum = typeof UpdateMetricPayloadTargetDirectionEnum[keyof typeof UpdateMetricPayloadTargetDirectionEnum];
/**
* @export
*/
export const UpdateMetricPayloadPeriodTypeEnum = {
Rolling: 'rolling',
Calendar: 'calendar'
} as const;
export type UpdateMetricPayloadPeriodTypeEnum = typeof UpdateMetricPayloadPeriodTypeEnum[keyof typeof UpdateMetricPayloadPeriodTypeEnum];
/**
* @export
*/
export const UpdateMetricPayloadPeriodValueEnum = {
Day: 'day',
Week: 'week',
Month: 'month',
Quarter: 'quarter',
Year: 'year',
_7Day: '7-day',
_30Day: '30-day',
_90Day: '90-day'
} as const;
export type UpdateMetricPayloadPeriodValueEnum = typeof UpdateMetricPayloadPeriodValueEnum[keyof typeof UpdateMetricPayloadPeriodValueEnum];
/**
* Check if a given object implements the UpdateMetricPayload interface.
*/
export function instanceOfUpdateMetricPayload(value: object): value is UpdateMetricPayload {
return true;
}
export function UpdateMetricPayloadFromJSON(json: any): UpdateMetricPayload {
return UpdateMetricPayloadFromJSONTyped(json, false);
}
export function UpdateMetricPayloadFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateMetricPayload {
if (json == null) {
return json;
}
return {
'title': json['title'] == null ? undefined : json['title'],
'description': json['description'] == null ? undefined : json['description'],
'unit': json['unit'] == null ? undefined : json['unit'],
'type': json['type'] == null ? undefined : json['type'],
'targetOperator': json['targetOperator'] == null ? undefined : json['targetOperator'],
'targetValue': json['targetValue'] == null ? undefined : json['targetValue'],
'targetDirection': json['targetDirection'] == null ? undefined : json['targetDirection'],
'currentValue': json['currentValue'] == null ? undefined : json['currentValue'],
'previousValue': json['previousValue'] == null ? undefined : json['previousValue'],
'periodType': json['periodType'] == null ? undefined : json['periodType'],
'periodValue': json['periodValue'] == null ? undefined : json['periodValue'],
'ownerId': json['ownerId'] == null ? undefined : json['ownerId'],
'timeseries': json['timeseries'] == null ? undefined : ((json['timeseries'] as Array<any>).map(MetricTimeseriesPointFromJSON)),
'relatedOutcomes': json['relatedOutcomes'] == null ? undefined : json['relatedOutcomes'],
'outcomeIds': json['outcomeIds'] == null ? undefined : json['outcomeIds'],
};
}
export function UpdateMetricPayloadToJSON(json: any): UpdateMetricPayload {
return UpdateMetricPayloadToJSONTyped(json, false);
}
export function UpdateMetricPayloadToJSONTyped(value?: UpdateMetricPayload | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'title': value['title'],
'description': value['description'],
'unit': value['unit'],
'type': value['type'],
'targetOperator': value['targetOperator'],
'targetValue': value['targetValue'],
'targetDirection': value['targetDirection'],
'currentValue': value['currentValue'],
'previousValue': value['previousValue'],
'periodType': value['periodType'],
'periodValue': value['periodValue'],
'ownerId': value['ownerId'],
'timeseries': value['timeseries'] == null ? undefined : ((value['timeseries'] as Array<any>).map(MetricTimeseriesPointToJSON)),
'relatedOutcomes': value['relatedOutcomes'],
'outcomeIds': value['outcomeIds'],
};
}