Skip to content

Commit

Permalink
Merge pull request #2253 from MartinM85/CustomDriveItemItemRequestBui…
Browse files Browse the repository at this point in the history
…lder

Extend CustomDriveItemItemRequestBuilder
  • Loading branch information
andrueastman authored Dec 14, 2023
2 parents fb24776 + 817c16b commit b771e21
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,33 @@
using System.Linq;
using System.Reflection;
using Microsoft.Graph.Drives.Item.Items.Item.Analytics;
using Microsoft.Graph.Drives.Item.Items.Item.AssignSensitivityLabel;
using Microsoft.Graph.Drives.Item.Items.Item.Children;
using Microsoft.Graph.Drives.Item.Items.Item.Content;
using Microsoft.Graph.Drives.Item.Items.Item.ListItem;
using Microsoft.Graph.Drives.Item.Items.Item.Checkin;
using Microsoft.Graph.Drives.Item.Items.Item.Checkout;
using Microsoft.Graph.Drives.Item.Items.Item.Copy;
using Microsoft.Graph.Drives.Item.Items.Item.CreatedByUser;
using Microsoft.Graph.Drives.Item.Items.Item.CreateLink;
using Microsoft.Graph.Drives.Item.Items.Item.CreateUploadSession;
using Microsoft.Graph.Drives.Item.Items.Item.Delta;
using Microsoft.Graph.Drives.Item.Items.Item.DeltaWithToken;
using Microsoft.Graph.Drives.Item.Items.Item.Follow;
using Microsoft.Graph.Drives.Item.Items.Item.GetActivitiesByInterval;
using Microsoft.Graph.Drives.Item.Items.Item.GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval;
using Microsoft.Graph.Drives.Item.Items.Item.Invite;
using Microsoft.Graph.Drives.Item.Items.Item.LastModifiedByUser;
using Microsoft.Graph.Drives.Item.Items.Item.ListItem;
using Microsoft.Graph.Drives.Item.Items.Item.PermanentDelete;
using Microsoft.Graph.Drives.Item.Items.Item.Preview;
using Microsoft.Graph.Drives.Item.Items.Item.Restore;
using Microsoft.Graph.Drives.Item.Items.Item.Unfollow;
using Microsoft.Graph.Drives.Item.Items.Item.ValidatePermission;
using Microsoft.Graph.Drives.Item.Items.Item.RetentionLabel;
using Microsoft.Graph.Drives.Item.Items.Item.Permissions;
using Microsoft.Graph.Drives.Item.Items.Item.SearchWithQ;
using Microsoft.Graph.Drives.Item.Items.Item.Subscriptions;
using Microsoft.Graph.Drives.Item.Items.Item.Thumbnails;
using Microsoft.Graph.Drives.Item.Items.Item.Unfollow;
using Microsoft.Graph.Drives.Item.Items.Item.ValidatePermission;
using Microsoft.Graph.Drives.Item.Items.Item.Workbook;
using Microsoft.Graph.Drives.Item.List.Items.Item.Versions;
using Microsoft.Kiota.Abstractions;
Expand Down Expand Up @@ -131,6 +141,11 @@ public CustomDriveItemItemRequestBuilder(Dictionary<string, object> pathParamete
{
get => new AnalyticsRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to call the assignSensitivityLabel method.</summary>
public new AssignSensitivityLabelRequestBuilder AssignSensitivityLabel
{
get => new AssignSensitivityLabelRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to call the checkin method.</summary>
public new CheckinRequestBuilder Checkin
{
Expand Down Expand Up @@ -158,6 +173,11 @@ public CustomDriveItemItemRequestBuilder(Dictionary<string, object> pathParamete
{
get => new CopyRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to manage the createdByUser property of the microsoft.graph.baseItem entity.</summary>
public new CreatedByUserRequestBuilder CreatedByUser
{
get => new CreatedByUserRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to call the createLink method.</summary>
public new CreateLinkRequestBuilder CreateLink
{
Expand All @@ -168,20 +188,41 @@ public CustomDriveItemItemRequestBuilder(Dictionary<string, object> pathParamete
{
get => new CreateUploadSessionRequestBuilder(PathParameters , RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to call the delta method.</summary>
public new DeltaRequestBuilder Delta
{
get => new DeltaRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to call the follow method.</summary>
public new FollowRequestBuilder Follow
{
get => new FollowRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to call the getActivitiesByInterval method.</summary>
public new GetActivitiesByIntervalRequestBuilder GetActivitiesByInterval
{
get =>
new GetActivitiesByIntervalRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to call the invite method.</summary>
public new InviteRequestBuilder Invite
{
get => new InviteRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to manage the lastModifiedByUser property of the microsoft.graph.baseItem entity.</summary>
public new LastModifiedByUserRequestBuilder LastModifiedByUser
{
get => new LastModifiedByUserRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to manage the listItem property of the microsoft.graph.driveItem entity.</summary>
public new ListItemRequestBuilder ListItem {
get => new ListItemRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to call the permanentDelete method.</summary>
public new PermanentDeleteRequestBuilder PermanentDelete
{
get => new PermanentDeleteRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to manage the permissions property of the microsoft.graph.driveItem entity.</summary>
public new PermissionsRequestBuilder Permissions {
get => new PermissionsRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
Expand All @@ -196,6 +237,11 @@ public CustomDriveItemItemRequestBuilder(Dictionary<string, object> pathParamete
{
get => new RestoreRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to manage the retentionLabel property of the microsoft.graph.driveItem entity.</summary>
public new RetentionLabelRequestBuilder RetentionLabel
{
get => new RetentionLabelRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>Provides operations to manage the subscriptions property of the microsoft.graph.driveItem entity.</summary>
public new SubscriptionsRequestBuilder Subscriptions
{
Expand Down Expand Up @@ -226,4 +272,30 @@ public CustomDriveItemItemRequestBuilder(Dictionary<string, object> pathParamete
{
get => new WorkbookRequestBuilder(PathParameters, RequestAdapter).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>
/// Provides operations to call the delta method.
/// </summary>
/// <param name="token">Usage: token=&apos;{token}&apos;</param>
public new DeltaWithTokenRequestBuilder DeltaWithToken(string token)
{
return new DeltaWithTokenRequestBuilder(PathParameters, RequestAdapter, token).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>
/// Provides operations to call the getActivitiesByInterval method.
/// </summary>
/// <param name="endDateTime">Usage: endDateTime=&apos;{endDateTime}&apos;</param>
/// <param name="interval">Usage: interval=&apos;{interval}&apos;</param>
/// <param name="startDateTime">Usage: startDateTime=&apos;{startDateTime}&apos;</param>
public new GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval(string endDateTime, string interval, string startDateTime)
{
return new GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithIntervalRequestBuilder(PathParameters, RequestAdapter, endDateTime, interval, startDateTime).UpdateUrlTemplate(this.UrlTemplate);
}
/// <summary>
/// Provides operations to call the search method.
/// </summary>
/// <param name="q">Usage: q=&apos;{q}&apos;</param>
public new SearchWithQRequestBuilder SearchWithQ(string q)
{
return new SearchWithQRequestBuilder(PathParameters, RequestAdapter, q).UpdateUrlTemplate(this.UrlTemplate);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,27 @@ public void ItemByPath_BuildRequestWithNestedPathSlashAndQueryParameters2()
Assert.NotNull(itemRequestInformation);
Assert.Equal(expectedRequestUri, itemRequestInformation.URI);
}

[Fact]
public void ItemByPath_BuildRequestWithNestedPathSlashAndOneParameter()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "v1.0") + "/drives/driveId/root:/item/with/path:/search(q='doc.docx')");
var itemRequestInformation = graphServiceClient.Drives["driveId"].Root.ItemWithPath("/item/with/path").SearchWithQ("doc.docx").ToGetRequestInformation();

Assert.NotNull(itemRequestInformation);
Assert.Equal(expectedRequestUri, itemRequestInformation.URI);
}

[Fact]
public void ItemByPath_BuildRequestWithNestedPathSlashAndMoreThanOneParameter()
{
var graphServiceClient = new GraphServiceClient(new MockAuthenticationProvider().Object);
var expectedRequestUri = new Uri(string.Format(Constants.Url.GraphBaseUrlFormatString, "v1.0") + "/drives/driveId/root:/item/with/path:/getActivitiesByInterval(startDateTime='2023-12-11',endDateTime='2023-12-13',interval='week')");
var itemRequestInformation = graphServiceClient.Drives["driveId"].Root.ItemWithPath("/item/with/path").GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval("2023-12-13", "week", "2023-12-11").ToGetRequestInformation();

Assert.NotNull(itemRequestInformation);
Assert.Equal(expectedRequestUri, itemRequestInformation.URI);
}
}
}

0 comments on commit b771e21

Please sign in to comment.