Skip to content

Commit

Permalink
Merge pull request #44 from pnp/version-4
Browse files Browse the repository at this point in the history
Update 20240112-2
  • Loading branch information
juliemturner authored Jan 12, 2024
2 parents 760122d + 07a7e39 commit 267e9d6
Show file tree
Hide file tree
Showing 8 changed files with 512 additions and 0 deletions.
152 changes: 152 additions & 0 deletions docs/graph/compliance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# @pnp/graph/compliance

The ability to interact with Microsoft Graph compliance and privacy APIs.

More information can be found in the official Graph documentation:

- [Compliance Resource Type](https://learn.microsoft.com/en-us/graph/api/resources/complianceapioverview?view=graph-rest-1.0)

## ICompliance, ISubjectRightsRequests, ISubjectRightsRequest, INotes

[![Invokable Banner](https://img.shields.io/badge/Invokable-informational.svg)](../concepts/invokable.md) [![Selective Imports Banner](https://img.shields.io/badge/Selective%20Imports-informational.svg)](../concepts/selective-imports.md)

## Subject rights request

### Get all Subject rights requests

Gets a list of Subject rights requests from Purview

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/compliance"

const graph = graphfi(...);

const requests = await graph.compliance.subjectRightsRequests();

```
### Get Subject rights request by id

Gets a Subject rights request by id

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/compliance"

const graph = graphfi(...);

const request = await graph.compliance.subjectRightsRequests.getById('efee1b77-fb3b-4f65-99d6-274c11914d12')();

```
### Create a Subject rights request

Creates a new Subject rights request

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/compliance"

const graph = graphfi(...);

const requestAdd = await graph.compliance.subjectRightsRequests.add({
"type": "export",
"contentQuery": "((\"Diego Siciliani\" OR \"Diego.Siciliani@contoso.com\") OR (participants:\"Diego.Siciliani@contoso.com\"))",
"dataSubjectType": "customer",
"externalId": "F53BF2DA-607D-412A-B568-FAA0F023AC0B",
"displayName": "Export report for customer Id: 12345",
"description": "This is a export request",
"includeAllVersions": false,
"includeAuthoredContent": true,
"internalDueDateTime": "2022-07-20T22:42:28Z",
"dataSubject": {
"firstName": "Diego",
"lastName": "Siciliani",
"email": "Diego.Siciliani@contoso.com",
"residency": "USA"
},
"mailboxLocations": null,
"pauseAfterEstimate": true,
"regulations": [
"CCPA"
],
"siteLocations": {
"@odata.type": "microsoft.graph.subjectRightsRequestAllSiteLocation"
}
});

```
### Update Subject rights request

Updates a Subject rights request

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/compliance"

const graph = graphfi(...);

const requestUpdate = await graph.compliance.subjectRightsRequests.getById('efee1b77-fb3b-4f65-99d6-274c11914d12').update({
description:"Updated description of request",
displayName:"Updated name of request",
internalDueDateTime:"2024-08-20T22:42:28Z"
});

```
### Get Subject rights request notes

Retrieves Subject rights request notes

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/compliance"

const graph = graphfi(...);

const notes = await graph.compliance.subjectRightsRequests.getById('efee1b77-fb3b-4f65-99d6-274c11914d12').notes();

```
### Create new Subject rights request note

Creates a new Subject rights request note

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/compliance"

const graph = graphfi(...);

const notes = await graph.compliance.subjectRightsRequests.getById('efee1b77-fb3b-4f65-99d6-274c11914d12').notes.add(
{
"content": {
"content": "Please take a look at the files tagged with follow up 1",
"contentType": "text"
}
});

```
### Get final report

Get the final report for a Subject rights request. The report is a text file that contains information about the files that were included by the privacy administrator.

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/compliance"

const graph = graphfi(...);

const finalReport = await graph.compliance.subjectRightsRequests.getById('efee1b77-fb3b-4f65-99d6-274c11914d12').finalReport();

```
### Get final attachment

Get the final attachment for a Subject rights request. The attachment is a zip file that contains all the files that were included by the privacy administrator.

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/compliance"

const graph = graphfi(...);

const finalAttachment = await graph.compliance.subjectRightsRequests.getById('efee1b77-fb3b-4f65-99d6-274c11914d12').finalAttachment();

```
77 changes: 77 additions & 0 deletions docs/graph/places.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# @pnp/graph/places

This module allows you to work with Exchange resources such as rooms and roomLists.

## IPlaces, Places, IPlace, Place, IRoom, Room, IRoomList, RoomList, IRoomLists, RoomLists

[![Selective Imports Banner](https://img.shields.io/badge/Selective%20Imports-informational.svg)](../concepts/selective-imports.md)

## Get all rooms in a Tenant

This example shows how to retrieve all rooms in a tenant

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/places";

const graph = graphfi(...);
const rooms = graph.places.rooms();
```
## Get all roomlists in a tenant

This example shows how to retrieve all roomlists in a tenant

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/places";

const graph = graphfi(...);
const roomLists = graph.places.roomlists();

```
## Get Rooms in room list

This example shows how to retrieve all rooms in a roomlist

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/places";

const graph = graphfi(...);
const roomsByList = await graph.places.roomLists.getById("05fb1ae2-6de6-4fa8-b852-fb0cf671b896").rooms();

```
## Get Place by Id

This example shows how to retrieve a place (room, roomlist) by id

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/places";

const graph = graphfi(...);

const roomById = await graph.places.getById("05fb1ae2-6de6-4fa8-b852-fb0cf671b896")();

```
## Update a place

This example shows how to update a place (room, roomlist)

```TypeScript
import { graphfi } from "@pnp/graph";
import "@pnp/graph/places";

const graph = graphfi(...);

var updatedRoom = await graph.places.getById("05fb1ae2-6de6-4fa8-b852-fb0cf671b896").update(
{
'@odata.type': "microsoft.graph.room",
"nickname": "Conf Room",
"building": "1",
"label": "100",
"capacity": 50,
"isWheelChairAccessible": false,
});

```
27 changes: 27 additions & 0 deletions packages/graph/compliance/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { GraphFI } from "../fi.js";
import { Compliance, ICompliance} from "./types.js";

export {
Compliance,
ICompliance,
Notes,
INotes,
SubjectRightsRequests,
ISubjectRightsRequests,
SubjectRightsRequest,
ISubjectRightsRequest,
} from "./types.js";

declare module "../fi" {
interface GraphFI {
readonly compliance: ICompliance;
}
}

Reflect.defineProperty(GraphFI.prototype, "compliance", {
configurable: true,
enumerable: true,
get: function (this: GraphFI) {
return this.create(Compliance);
},
});
74 changes: 74 additions & 0 deletions packages/graph/compliance/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import {
Privacy as IPrivacyType,
SubjectRightsRequest as ISubjectRightsRequestType,
AuthoredNote as IAuthoredNoteType,
ItemBody as ItemBodyType } from "@microsoft/microsoft-graph-types";
import { _GraphCollection, graphInvokableFactory, _GraphInstance, graphGet, _GraphQueryable, GraphQueryable } from "../graphqueryable.js";
import { IAddable, IGetById, IUpdateable, addable, defaultPath, getById, updateable } from "../decorators.js";
import { BlobParse } from "@pnp/queryable/index.js";

/**
* Compliance
*/
@defaultPath("security")
export class _Compliance extends _GraphQueryable<IPrivacyType> {
/**
* Get subject rights requests
*
*/
public get subjectRightsRequests(): ISubjectRightsRequests {
return SubjectRightsRequests(this);
}

}
export interface ICompliance extends _Compliance {}
export const Compliance = graphInvokableFactory<ICompliance>(_Compliance);

/**
* SubjectRightsRequest
*/
@defaultPath("/")
@updateable()
export class _SubjectRightsRequest extends _GraphInstance<ISubjectRightsRequestType> {
/**
* Get the final report for a subject rights request as a Blob
*/
public async finalReport(): Promise<Blob>{
return graphGet(GraphQueryable(this, "getFinalReport").using(BlobParse()));
}

/**
* Get the final attachment for a subject rights request as a Blob
*/
public async finalAttachment(): Promise<Blob>{
return graphGet(GraphQueryable(this, "getFinalAttachment").using(BlobParse()));
}

/**
* Get the list of authored notes assoicated with a subject rights request.
*/
public get notes(): INotes {
return Notes(this);
}
}
export interface ISubjectRightsRequest extends _SubjectRightsRequest, IUpdateable<ISubjectRightsRequestType> { }
export const SubjectRightsRequest = graphInvokableFactory<ISubjectRightsRequest>(_SubjectRightsRequest);

/**
* SubjectRightsRequests
*/
@defaultPath("subjectRightsRequests")
@getById(SubjectRightsRequest)
@addable()
export class _SubjectRightsRequests extends _GraphCollection<ISubjectRightsRequestType[]> {}
export interface ISubjectRightsRequests extends _SubjectRightsRequests, IGetById<ISubjectRightsRequest>, IAddable<ISubjectRightsRequestType, ISubjectRightsRequestType> {}
export const SubjectRightsRequests = graphInvokableFactory<ISubjectRightsRequests>(_SubjectRightsRequests);

/**
* Notes
*/
@defaultPath("notes")
@addable()
export class _Notes extends _GraphCollection<IAuthoredNoteType[]> {}
export interface INotes extends _Notes, IAddable<ItemBodyType, IAuthoredNoteType> {}
export const Notes = graphInvokableFactory<INotes>(_Notes);
29 changes: 29 additions & 0 deletions packages/graph/places/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { GraphFI } from "../fi.js";
import { IPlaces, Places } from "./types.js";

export {
Places,
IPlaces,
Place,
IPlace,
Room,
IRoom,
RoomList,
IRoomlist,
RoomLists,
IRoomlists,
} from "./types.js";

declare module "../fi" {
interface GraphFI {
readonly places: IPlaces;
}
}

Reflect.defineProperty(GraphFI.prototype, "places", {
configurable: true,
enumerable: true,
get: function (this: GraphFI) {
return this.create(Places);
},
});
Loading

0 comments on commit 267e9d6

Please sign in to comment.