Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"transform": {
"\\.(ts)$": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "/.*.test.+(unit|int).ts$",
"testRegex": "/.*.test.+(unit).ts$",
"clearMocks": true,
"bail": false,
"testPathIgnorePatterns": [
Expand Down
13 changes: 13 additions & 0 deletions src/sdk/model/o365/__json__/o365-marked-purge-mailbox-json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { O365PurgeMailboxJson } from './o365-purge-mailbox-json';

/**
* O365 marked purge mailbox JSON properties
*/
export interface O365MarkedPurgeMailboxJson extends O365PurgeMailboxJson {
organization_uuid: string;
active: boolean;
purge_date: number;
purge_status: string;
initiated_date: number;
error_msg?: string;
}
7 changes: 7 additions & 0 deletions src/sdk/model/o365/__json__/o365-purge-mailbox-json.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* O365 purge mailbox JSON properties
*/
export interface O365PurgeMailboxJson {
mailbox: string;
user_native_uuid: string;
}
91 changes: 91 additions & 0 deletions src/sdk/model/o365/o365-marked-purge-mailbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { O365MarkedPurgeMailboxJson } from './__json__/o365-marked-purge-mailbox-json';

/**
* O365 marked purge mailbox
*/
/* istanbul ignore next: autogenerated */
export class O365MarkedPurgeMailbox {

constructor(private _json: O365MarkedPurgeMailboxJson) {
}

/**
* Get the mailbox (email) that is marked for purging.
* @returns {string}
*/
get mailbox(): string {
return this._json.mailbox;
}

/**
* Get the user native uuid for the mailbox that was marked for purging.
* @returns {string}
*/
get userNativeUuid(): string {
return this._json.user_native_uuid;
}

/**
* Get the org platform uuid associated with this mailbox.
* @returns {string}
*/
get organizationUuid(): string {
return this._json.organization_uuid;
}

/**
* Get whether this user / mailbox will be purged at all (cancel use case).
* @returns {string}
*/
get isActive(): boolean {
return this._json.active;
}

/**
* Get the purge date associated with this mailbox.
* @returns {number}
*/
get purgeDate(): number {
return this._json.purge_date;
}

/**
* Get the status of this purge user request - Completed, Running, Cancelled or Failed.
* @returns {string}
*/
get purgeStatus(): string {
return this._json.purge_status;
}

/**
* Get the purge initiated date associated with this mailbox.
* @returns {number}
*/
get initiatedDate(): number {
return this._json.initiated_date;
}

/**
* Get the error message if any on this purge request (would come from monocle)
* @returns {string | undefined}
*/
get errorMsg(): string | undefined {
return this._json.error_msg;
}

/**
* Get the json representation of this class.
* @returns {O365MarkedPurgeMailboxJson}
*/
get json(): O365MarkedPurgeMailboxJson {
return Object.assign({}, this._json);
}

/**
* Get the string representation of this class.
* @returns {string}
*/
toString(): string {
return JSON.stringify(this._json, undefined, 2);
}
}
28 changes: 28 additions & 0 deletions src/sdk/model/o365/o365-organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import { O365SharePointSite } from './o365-sharepoint-site';
import { O365SharePointSiteJson } from './__json__/o365-sharepoint-site-json';
import { O365BackupRepository } from '../company/o365-backup-repository';
import { O365BackupRepositoryJson } from '../company/__json__/o365-backup-repository-json';
import { O365PurgeMailboxJson } from './__json__/o365-purge-mailbox-json';
import { O365PurgeMailbox } from './o365-purge-mailbox';
import { O365MarkedPurgeMailboxJson } from './__json__/o365-marked-purge-mailbox-json';
import { O365MarkedPurgeMailbox } from './o365-marked-purge-mailbox';
import { Http } from '../../service/http/http';

/**
Expand Down Expand Up @@ -411,4 +415,28 @@ export class O365Organization extends Entity {
return new Blob([response.data], { type: 'text/csv' });
});
}

/**
* Get the O365 Organization's active purge mailboxes
* @returns {Promise<Array<O365MarkedPurgeMailbox>>}
*/
/* istanbul ignore next: autogenerated */
async getPurgeMailboxes(): Promise<Array<O365MarkedPurgeMailbox>> {
return Iland.getHttp().get(`/o365-organizations/${this.uuid}/actions/purge-mailboxes`)
.then((response) => {
const json = response.data.data as Array<O365MarkedPurgeMailboxJson>;
return json.map(it => new O365MarkedPurgeMailbox(it));
});
}

/**
* Submits a purge request for the given mailboxes of the given organization.
* @param mailboxes {Array<O365PurgeMailbox>}
* @returns {Promise<unknown>}
*/
/* istanbul ignore next: autogenerated */
async purgeMailboxes(mailboxes: Array<O365PurgeMailbox>): Promise<unknown> {
const mailboxesJson: Array<O365PurgeMailboxJson> = mailboxes.map(m => m.json);
return Iland.getHttp().post(`/o365-organizations/${this.uuid}/actions/purge-mailboxes`, mailboxesJson);
}
}
43 changes: 43 additions & 0 deletions src/sdk/model/o365/o365-purge-mailbox.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { O365PurgeMailboxJson } from './__json__/o365-purge-mailbox-json';

/**
* O365 purge mailbox
*/
/* istanbul ignore next: autogenerated */
export class O365PurgeMailbox {

constructor(private _json: O365PurgeMailboxJson) {
}

/**
* Get the mailbox / username marked for purging.
* @returns {string}
*/
get mailbox(): string {
return this._json.mailbox;
}

/**
* Get the user native uuid for the mailbox marked for purging.
* @returns {string}
*/
get userNativeUuid(): string {
return this._json.user_native_uuid;
}

/**
* Get the json representation of this class.
* @returns {O365PurgeMailboxJson}
*/
get json(): O365PurgeMailboxJson {
return Object.assign({}, this._json);
}

/**
* Get the string representation of this class.
* @returns {string}
*/
toString(): string {
return JSON.stringify(this._json, undefined, 2);
}
}