|
| 1 | +import Segment from './Segment'; |
| 2 | +import EncodedChar from './EncodedChar'; |
| 3 | +declare type SmsEncoding = 'GSM-7' | 'UCS-2'; |
| 4 | +declare type EncodedChars = Array<EncodedChar>; |
| 5 | +/** |
| 6 | + * Class representing a segmented SMS |
| 7 | + */ |
| 8 | +export declare class SegmentedMessage { |
| 9 | + encoding: SmsEncoding | 'auto'; |
| 10 | + segments: Segment[]; |
| 11 | + graphemes: string[]; |
| 12 | + encodingName: SmsEncoding; |
| 13 | + numberOfUnicodeScalars: number; |
| 14 | + numberOfCharacters: number; |
| 15 | + /** |
| 16 | + * |
| 17 | + * Create a new segmented message from a string |
| 18 | + * |
| 19 | + * @param {string} message Body of the message |
| 20 | + * @param {boolean} [encoding] Optional: encoding. It can be 'GSM-7', 'UCS-2', 'auto'. Default value: 'auto' |
| 21 | + * @property {number} numberOfUnicodeScalars Number of Unicode Scalars (i.e. unicode pairs) the message is made of |
| 22 | + * |
| 23 | + */ |
| 24 | + constructor(message: string, encoding?: SmsEncoding | 'auto'); |
| 25 | + /** |
| 26 | + * Internal method to check if the message has any non-GSM7 characters |
| 27 | + * |
| 28 | + * @param {string[]} graphemes Message body |
| 29 | + * @returns {boolean} True if there are non-GSM-7 characters |
| 30 | + * @private |
| 31 | + */ |
| 32 | + _hasAnyUCSCharacters(graphemes: string[]): boolean; |
| 33 | + /** |
| 34 | + * Internal method used to build message's segment(s) |
| 35 | + * |
| 36 | + * @param {object[]} encodedChars Array of EncodedChar |
| 37 | + * @returns {object[]} Array of Segment |
| 38 | + * @private |
| 39 | + */ |
| 40 | + _buildSegments(encodedChars: EncodedChars): Segment[]; |
| 41 | + /** |
| 42 | + * Return the encoding of the message segment |
| 43 | + * |
| 44 | + * @returns {string} Encoding for the message segment(s) |
| 45 | + */ |
| 46 | + getEncodingName(): string; |
| 47 | + /** |
| 48 | + * Internal method to create an array of EncodedChar from a string |
| 49 | + * |
| 50 | + * @param {string[]} graphemes Array of graphemes representing the message |
| 51 | + * @returns {object[]} Array of EncodedChar |
| 52 | + * @private |
| 53 | + */ |
| 54 | + _encodeChars(graphemes: string[]): EncodedChars; |
| 55 | + /** |
| 56 | + * @return {number} Total size of the message in bits (including User Data Header if present) |
| 57 | + */ |
| 58 | + get totalSize(): number; |
| 59 | + /** |
| 60 | + * @return {number} Total size of the message in bits (excluding User Data Header if present) |
| 61 | + */ |
| 62 | + get messageSize(): number; |
| 63 | + /** |
| 64 | + * |
| 65 | + * @return {number} Number of segments |
| 66 | + */ |
| 67 | + get segmentsCount(): number; |
| 68 | +} |
| 69 | +export {}; |
0 commit comments