All files / src/Connector OutlookCreateEvent.ts

100% Statements 56/56
100% Branches 14/14
100% Functions 9/9
100% Lines 56/56

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 2117x 7x     7x   7x 7x 7x 7x 7x 7x 7x     7x 7x 7x 7x     7x 7x 7x 7x 7x     7x 7x 7x 7x 7x     7x 7x 7x 7x 7x     7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x     7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x     7x     7x       1x             1x   1x                                                                                                                                                                                                                                                            
import AConnector from '@orchesty/nodejs-sdk/dist/lib/Connector/AConnector';
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
 
export const NAME = 'outlook-create-event';
 
export enum ShowAsEnum {
    FREE = 'free',
    TENTATIVE = 'tentative',
    BUSY = 'busy',
    OOF = 'oof',
    WORKING_ELSEWHERE = 'workingElsewhere',
    UNKNOWN = 'unknown',
}
 
export enum ImportanceEnum {
    LOW = 'low',
    NORMAL = 'normal',
    HIGH = 'high',
}
 
export enum OnlineMeetingProviderEnum {
    TEAMS_FOR_BUSINESS = 'teamsForBusiness',
    SKYPE_FOR_BUSINESS = 'skypeForBusiness',
    SKYPE_FOR_CONSUMER = 'skypeForConsumer',
    UNKNOWN = 'unknown',
}
 
export enum SensitivityEnum {
    NORMAL = 'normal',
    PERSONAL = 'personal',
    PRIVATE = 'private',
    CONFIDENTIAL = 'confidential',
}
 
export enum TypeEnum {
    SINGLE_INSTANCE = 'singleInstance',
    OCCURRENCE = 'occurrence',
    EXCEPTION = 'exception',
    SERIES_MASTER = 'seriesMaster',
}
 
export enum LocationTypeEnum {
    DEFAULT = 'default',
    CONFERENCE_ROOM = 'conferenceRoom',
    HOME_ADDRESS = 'homeAddress',
    BUSINESS_ADDRESS = 'businessAddress',
    GEO_COORDINATES = 'geoCoordinates',
    STREET_ADDRESS = 'streetAddress',
    HOTEL = 'hotel',
    RESTAURANT = 'restaurant',
    LOCAL_BUSINESS = 'localBusiness',
    POSTAL_ADDRESS = 'postalAddress',
}
 
export enum PhoneType {
    HOME = 'home',
    BUSINESS = 'business',
    MOBILE = 'mobile',
    OTHER = 'other',
    ASSISTANT = 'assistant',
    HOME_FAX = 'homeFax',
    BUSINESS_FAX = 'businessFax',
    OTHER_FAX = 'otherFax',
    PAPER = 'pager',
    RADIO = 'radio',
}
 
export default class OutlookCreateEvent extends AConnector {
 
    public getName(): string {
        return NAME;
    }
 
    public async processAction(dto: ProcessDto<IInput>): Promise<ProcessDto<IInput>> {
        const req = await this.getApplication().getRequestDto(
            dto,
            await this.getApplicationInstallFromProcess(dto),
            HttpMethods.POST,
            '/me/events',
            dto.getJsonData(),
        );
        const resp = await this.getSender().send<IInput>(req, [201]);
 
        return dto.setNewJsonData(resp.getJsonBody());
    }
 
}
 
export interface IInput {
    id?: string;
    allowNewTimeProposals?: boolean;
    attendees?: {
        emailAddress?: IEmailAddress,
        proposedNewTime?: {
            start?: IDateTimeZone;
            end?: IDateTimeZone;
        }
        status?: IResponseStatus,
        type?: string;
    }[];
    body?: {
        content?: string;
        contentType?: string;
    };
    bodyPreview?: string;
    categories?: string;
    changeKey?: string;
    createdDateTime?: string;
    end?: IDateTimeZone;
    hasAttachments?: boolean;
    hideAttendees?: boolean;
    iCalUId?: string;
    importance?: ImportanceEnum;
    isAllDay?: boolean;
    isCancelled?: boolean;
    isDraft?: boolean;
    isOnlineMeeting?: boolean;
    isOrganizer?: boolean;
    isReminderOn?: boolean;
    lastModifiedDateTime?: string;
    location?: ILocation;
    locations?: ILocation[];
    onlineMeeting?: {
        conferenceId?: string;
        joinUrl?: string;
        phones?: {
            number?: string;
            type?: PhoneType;
        }[];
        quickDial?: string;
        tollFreeNumbers?: string[];
        tollNumber?: string;
    };
    onlineMeetingProvider?: OnlineMeetingProviderEnum;
    onlineMeetingUrl?: string;
    organizer?: {
        emailAddress?: IEmailAddress;
    };
    originalEndTimeZone?: string;
    originalStart?: string;
    originalStartTimeZone?: string;
    recurrence?: {
        pattern?: {
            dayOfMonth?: number;
            daysOfWeek?: string[];
            firstDayOfWeek?: string;
            index?: string;
            interval?: number;
            month?: number;
            type?: string;
        },
        range?: {
            endDate?: IDateTimeZone;
            numberOfOccurrences?: number;
            recurrenceTimeZone?: string;
            startDate?: IDateTimeZone;
            type?: string;
        },
    };
    reminderMinutesBeforeStart?: number;
    responseRequested?: boolean;
    responseStatus?: IResponseStatus;
    sensitivity?: SensitivityEnum;
    seriesMasterId?: string;
    showAs?: ShowAsEnum;
    start?: IDateTimeZone;
    subject?: string;
    transactionId?: string;
    type?: TypeEnum;
    webLink?: string;
}
 
export interface IDateTimeZone {
    dateTime: string;
    timeZone?: string;
}
 
export interface ILocation {
    address?: {
        city?: string;
        countryOrRegion?: string;
        postalCode?: string;
        state?: string;
        street?: string;
    },
    coordinates?: {
        accuracy?: number;
        altitude?: number;
        altitudeAccuracy?: number;
        latitude?: number;
        longitude?: number;
    },
    displayName?: string;
    locationEmailAddress?: string;
    locationUri?: string;
    locationType?: LocationTypeEnum;
    uniqueId?: string;
    uniqueIdType?: string;
}
 
export interface IEmailAddress {
    address?: string;
    name?: string;
}
 
export interface IResponseStatus {
    response?: string;
    time?: string;
}