-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8ae457
commit 3c336bd
Showing
15 changed files
with
282 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Text.Json.Serialization; | ||
using Microsoft.Graph; | ||
|
||
namespace Graph.Community | ||
{ | ||
public class SitePageVersion : BaseItem | ||
{ | ||
public new int Id { get; set; } | ||
|
||
//public string CheckInComment { get; set; } | ||
public DateTime Created { get; set; } | ||
public bool IsCurrentVersion { get; set; } | ||
|
||
// Refer to https://github.com/pnp/pnpcore/issues/581 | ||
public string Length { get; set; } | ||
|
||
[JsonIgnore] | ||
public long Size | ||
{ | ||
get | ||
{ | ||
if (long.TryParse(Length, out var size)) | ||
{ | ||
return size; | ||
} | ||
return 0; | ||
} | ||
|
||
} | ||
|
||
public string VersionLabel { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using Microsoft.Graph; | ||
|
||
namespace Graph.Community | ||
{ | ||
[InterfaceConverter(typeof(InterfaceConverter<SitePageVersionCollectionPage>))] | ||
public interface ISitePageVersionCollectionPage : ICollectionPage<SitePageVersion> | ||
{ | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Requests/SitePages/ISitePageVersionCollectionRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Graph; | ||
|
||
namespace Graph.Community | ||
{ | ||
public interface ISitePageVersionCollectionRequest : IBaseRequest | ||
{ | ||
Task<ISitePageVersionCollectionPage> GetAsync(); | ||
Task<ISitePageVersionCollectionPage> GetAsync(CancellationToken cancellationToken); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/Requests/SitePages/ISitePageVersionCollectionRequestBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Collections.Generic; | ||
using Microsoft.Graph; | ||
|
||
namespace Graph.Community | ||
{ | ||
public interface ISitePageVersionCollectionRequestBuilder:IBaseRequestBuilder | ||
{ | ||
/// <summary> | ||
/// Builds the request. | ||
/// </summary> | ||
/// <returns>The built request.</returns> | ||
ISitePageVersionCollectionRequest Request(); | ||
|
||
/// <summary> | ||
/// Builds the request. | ||
/// </summary> | ||
/// <param name="options">The query and header options for the request.</param> | ||
/// <returns>The built request.</returns> | ||
ISitePageVersionCollectionRequest Request(IEnumerable<Option> options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using Microsoft.Graph; | ||
|
||
namespace Graph.Community | ||
{ | ||
public class SitePageVersionCollectionPage: CollectionPage<SitePageVersion>, ISitePageVersionCollectionPage | ||
{ | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/Requests/SitePages/SitePageVersionCollectionRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.Graph; | ||
|
||
namespace Graph.Community | ||
{ | ||
public class SitePageVersionCollectionRequest : BaseSharePointAPIRequest, ISitePageVersionCollectionRequest | ||
{ | ||
public SitePageVersionCollectionRequest( | ||
string requestUrl, | ||
IBaseClient client, | ||
IEnumerable<Option> options) | ||
: base("SitePageVersionCollection", requestUrl, client, options) | ||
{ | ||
this.Headers.Add(new HeaderOption(SharePointAPIRequestConstants.Headers.AcceptHeaderName, SharePointAPIRequestConstants.Headers.AcceptHeaderValue)); | ||
this.Headers.Add(new HeaderOption(SharePointAPIRequestConstants.Headers.ODataVersionHeaderName, SharePointAPIRequestConstants.Headers.ODataVersionHeaderValue)); | ||
} | ||
|
||
public async Task<ISitePageVersionCollectionPage> GetAsync() | ||
{ | ||
return await this.GetAsync(CancellationToken.None); | ||
} | ||
|
||
public async Task<ISitePageVersionCollectionPage> GetAsync(CancellationToken cancellationToken) | ||
{ | ||
this.ContentType = "application/json"; | ||
var response = await this.SendAsync<SharePointAPICollectionResponse<ISitePageVersionCollectionPage>>(null, cancellationToken).ConfigureAwait(false); | ||
|
||
if (response?.Value?.CurrentPage != null) | ||
{ | ||
return response.Value; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/Requests/SitePages/SitePageVersionCollectionRequestBuilder.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Collections.Generic; | ||
using Microsoft.Graph; | ||
|
||
namespace Graph.Community | ||
{ | ||
public class SitePageVersionCollectionRequestBuilder: BaseRequestBuilder, ISitePageVersionCollectionRequestBuilder | ||
{ | ||
private readonly IEnumerable<Option> options; | ||
|
||
public SitePageVersionCollectionRequestBuilder( | ||
string requestUrl, | ||
IBaseClient client, | ||
IEnumerable<Option> options = null) | ||
: base(requestUrl, client) | ||
{ | ||
this.options = options; | ||
} | ||
|
||
public ISitePageVersionCollectionRequest Request() | ||
{ | ||
return this.Request(options); | ||
} | ||
|
||
public ISitePageVersionCollectionRequest Request(IEnumerable<Option> options) | ||
{ | ||
return new SitePageVersionCollectionRequest(this.RequestUrl, this.Client, options); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"odata.metadata": "https://mock.sharepoint.com/sites/mockSite/_api/$metadata#SP.ApiData.FileVersions", | ||
"value": [ | ||
{ | ||
"odata.type": "SP.FileVersion", | ||
"odata.id": "https://mock.sharepoint.com/sites/mockSite/_api/SP.FileVersionc75ac36c-9b5b-4645-afac-ac14d63cb005", | ||
"odata.editLink": "SP.FileVersionc75ac36c-9b5b-4645-afac-ac14d63cb005", | ||
"CheckInComment": "", | ||
"Created": "2023-02-14T10:56:13Z", | ||
"ID": 512, | ||
"IsCurrentVersion": false, | ||
"Length": "26340", | ||
"Size": 26340, | ||
"Url": "_vti_history/512/SitePages/home.aspx.IgnoreExt?IgnoreExt=1", | ||
"VersionLabel": "1.0" | ||
}, | ||
{ | ||
"odata.type": "SP.FileVersion", | ||
"odata.id": "https://mock.sharepoint.com/sites/mockSite/_api/SP.FileVersion53bee446-0c9a-4cda-ad3e-c81b5a53a980", | ||
"odata.editLink": "SP.FileVersion53bee446-0c9a-4cda-ad3e-c81b5a53a980", | ||
"CheckInComment": "", | ||
"Created": "2023-02-20T21:33:06Z", | ||
"ID": 1024, | ||
"IsCurrentVersion": true, | ||
"Length": "27887", | ||
"Size": 27887, | ||
"Url": "_vti_history/1024/SitePages/home.aspx.IgnoreExt?IgnoreExt=1", | ||
"VersionLabel": "2.0" | ||
}, | ||
{ | ||
"odata.type": "SP.FileVersion", | ||
"odata.id": "https://mock.sharepoint.com/sites/mockSite/_api/SP.FileVersion744871d5-1b26-41a5-bd18-9923986e9fed", | ||
"odata.editLink": "SP.FileVersion744871d5-1b26-41a5-bd18-9923986e9fed", | ||
"CheckInComment": "", | ||
"Created": "2023-02-22T21:28:29Z", | ||
"ID": 1025, | ||
"IsCurrentVersion": false, | ||
"Length": "27744", | ||
"Size": 27744, | ||
"Url": "_vti_history/1025/SitePages/home.aspx.IgnoreExt?IgnoreExt=1", | ||
"VersionLabel": "2.1" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters