UNPKG

@microsoft/kiota-abstractions

Version:

Core abstractions for kiota generated libraries in TypeScript and JavaScript

91 lines 2.55 kB
/** * Represents a duration value. ISO 8601. */ export declare class Duration implements DurationInterface { /** * Creates a new Duration value from the given parameters. * @param root0 The years, months, weeks, days, hours, minutes, seconds, and negative flag * @param root0.years The years * @param root0.months The months * @param root0.weeks The weeks * @param root0.days The days * @param root0.hours The hours * @param root0.minutes The minutes * @param root0.seconds The seconds * @param root0.negative The negative flag * @returns The new Duration * @throws An error if years is invalid * @throws An error if months is invalid * @throws An error if weeks is invalid * @throws An error if days is invalid * @throws An error if hours is invalid * @throws An error if minutes is invalid * @throws An error if seconds is invalid * @throws An error if weeks is used in combination with years or months */ constructor({ years, months, weeks, days, hours, minutes, seconds, negative }: Partial<DurationInterface>); years: number; months: number; weeks: number; days: number; hours: number; minutes: number; seconds: number; negative: boolean; /** * Parses a string into a Duration. The string can be of the ISO 8601 duration format. * @param value The value to parse * @returns The parsed Duration. * @throws An error if the value is invalid */ static parse(value: string | undefined): Duration | undefined; /** * Serializes the duration to a string in the ISO 8601 duration format. * @returns The serialized duration. */ toString(): string; } interface DurationInterface { /** * Years of the duration * @default 0 */ years: number; /** * Months of the duration * @default 0 */ months: number; /** * Weeks of the duration, can't be used together with years or months * @default 0 */ weeks: number; /** * Days of the duration * @default 0 */ days: number; /** * Hours of the duration * @default 0 */ hours: number; /** * Minutes of the duration * @default 0 */ minutes: number; /** * Seconds of the duration * @default 0 */ seconds: number; /** * Whether the duration is negative * @default false */ negative: boolean; } export {}; //# sourceMappingURL=duration.d.ts.map