Skip to content

Commit

Permalink
Merge branch 'version-3' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
juliemturner committed Dec 11, 2023
2 parents a8aa55b + e62c30d commit 02261db
Show file tree
Hide file tree
Showing 18 changed files with 286 additions and 8,484 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 3.21.0 - 2023-Dec-11

- graph
- Adding Photos with Dimension support
- Addressing #2836 - Rework Caching and Pagination Logic

- sp
- Addresses #2847 - Add missing ItemId to IListItemFormUpdateValue
- Addressing #2840 - Add missing parameter to AddUsingPath

## 3.20.1 - 2023-Nov-20

- graph
- Addresses #2833 - Revert of a previous PR #2730 that was meant for V4.
- Addresses #2833 - Revert of a previous PR #2730 that was meant for V4.

## 3.20.0 - 2023-Nov-14

Expand Down
67 changes: 66 additions & 1 deletion docs/graph/photos.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ const blobUrl = url.createObjectURL(photoValue);
document.getElementById("photoElement").setAttribute("src", blobUrl);
```

## Current User Photo by Size

This example shows the getBlob() endpoint, there is also a getBuffer() endpoint to support node.js

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

const graph = graphfi(...);

const photoValue = await graph.me.photos.getBySize("48x48").getBlob();
const url = window.URL || window.webkitURL;
const blobUrl = url.createObjectURL(photoValue);
document.getElementById("photoElement").setAttribute("src", blobUrl);
```

## Current Group Photo

This example shows the getBlob() endpoint, there is also a getBuffer() endpoint to support node.js
Expand All @@ -42,6 +59,40 @@ const blobUrl = url.createObjectURL(photoValue);
document.getElementById("photoElement").setAttribute("src", blobUrl);
```

## Current Group Photo by Size

This example shows the getBlob() endpoint, there is also a getBuffer() endpoint to support node.js

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

const graph = graphfi(...);

const photoValue = await graph.groups.getById("7d2b9355-0891-47d3-84c8-bf2cd9c62177").photos.getBySize("120x120").getBlob();
const url = window.URL || window.webkitURL;
const blobUrl = url.createObjectURL(photoValue);
document.getElementById("photoElement").setAttribute("src", blobUrl);
```

## Current Team Photo

This example shows the getBlob() endpoint, there is also a getBuffer() endpoint to support node.js

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

const graph = graphfi(...);

const photoValue = await graph.teams.getById("7d2b9355-0891-47d3-84c8-bf2cd9c62177").photo.getBlob();
const url = window.URL || window.webkitURL;
const blobUrl = url.createObjectURL(photoValue);
document.getElementById("photoElement").setAttribute("src", blobUrl);
```

## Set User Photo

```TypeScript
Expand All @@ -67,5 +118,19 @@ const graph = graphfi(...);

const input = <HTMLInputElement>document.getElementById("thefileinput");
const file = input.files[0];
await graph.me.photo.setContent(file);
await graph.groups.getById("7d2b9355-0891-47d3-84c8-bf2cd9c62177").photo.setContent(file);
```

## Set Team Photo

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

const graph = graphfi(...);

const input = <HTMLInputElement>document.getElementById("thefileinput");
const file = input.files[0];
await graph.teams.getById("7d2b9355-0891-47d3-84c8-bf2cd9c62177").photo.setContent(file);
```
20 changes: 10 additions & 10 deletions docs/queryable/behaviors.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,20 @@ export function Caching(props?: ICachingProps): TimelinePipe<Queryable> {

const cached = getCachedValue();

// we need to ensure that result stays "undefined" unless we mean to set null as the result
// we need to ensure that result stays "undefined" unless we mean to set null as the result
if (cached === null) {

// if we don't have a cached result we need to get it after the request is sent and parsed
this.on.post(async function (url: URL, result: any) {

setCachedValue(result);

return [url, result];
});
// if we don't have a cached result we need to get it after the request is sent. Get the raw value (un-parsed) to store into cache
this.on.rawData(noInherit(async function (response) {
setCachedValue(response);
}));

} else {

result = cached;
// if we find it in cache, override send request, and continue flow through timeline and parsers.
this.on.auth.clear();
this.on.send.replace(async function (this: Queryable) {
return new Response(cached, {});
});
}
}

Expand Down
2 changes: 2 additions & 0 deletions docs/sp/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ Likewise you can add files using one of two methods, addUsingPath or addChunked.

The addUsingPath method, supports the percent or pound characters in file names.

When using EnsureUniqueFileName property, you must omit the Overwrite parameter.

```TypeScript
import { spfi } from "@pnp/sp";
import "@pnp/sp/webs";
Expand Down
Loading

0 comments on commit 02261db

Please sign in to comment.