@ua/react-native-airship
Version:
Airship plugin for React Native apps.
80 lines • 2.19 kB
TypeScript
/**
* Attribute operation
* @hidden
*/
export interface AttributeOperation {
/**
* The operation name.
*/
action: string;
/**
* The attribute key.
*/
key: string;
/**
* The instance id.
*/
instance_id?: string;
/**
* Expiration for json attributes.
*/
expiration_milliseconds?: number;
/**
* The attribute value, if available.
*/
value?: any;
/**
* The attribute type, if available.
*/
type?: 'string' | 'number' | 'date' | 'json';
}
/**
* Editor for attributes.
*/
export declare class AttributeEditor {
onApply: (operations: AttributeOperation[]) => Promise<void>;
operations: AttributeOperation[];
/**
* AttributeEditor constructor
*
* @hidden
* @param onApply The apply function
*/
constructor(onApply: (operations: AttributeOperation[]) => Promise<void>);
/**
* Adds an attribute.
*
* @param value The attribute value.
* @param name The attribute name.
* @return The attribute editor instance.
*/
setAttribute(name: string, value: string | number | boolean | Date): AttributeEditor;
/**
* Adds a JSON attribute.
*
* @param name The attribute name.
* @param instanceId The instance ID.
* @param json The json value. Must not contain `exp` as top level key.
* @param expiration Optional expiration.
* @return The attribute editor instance.
*/
setJsonAttribute(name: string, instanceId: string, json: Record<string, any>, expiration?: Date): AttributeEditor;
/**
* Removes an attribute.
* @param name The name of the attribute to remove.
* @return The attribute editor instance.
*/
removeAttribute(name: string): AttributeEditor;
/**
* Removes a JSON attribute.
* @param name The name of the attribute to remove.
* @param instanceId The instance ID.
* @return The attribute editor instance.
*/
removeJsonAttribute(name: string, instanceId: string): AttributeEditor;
/**
* Applies the attribute operations.
*/
apply(): Promise<void>;
}
//# sourceMappingURL=AttributeEditor.d.ts.map