Skip to content

Commit

Permalink
Merge pull request #450 from sreeise/workbook
Browse files Browse the repository at this point in the history
Drives Workbook And Worksheets
  • Loading branch information
sreeise authored Nov 14, 2023
2 parents c130104 + 716fc94 commit 1b16300
Show file tree
Hide file tree
Showing 18 changed files with 531 additions and 32 deletions.
32 changes: 32 additions & 0 deletions graph-codegen/src/settings/method_macro_modifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,20 @@ pub fn get_method_macro_modifiers(resource_identity: ResourceIdentity) -> Vec<Me
update: GeneratedMacroType::FnName("get_contacted_reviewers_count"),
}
],
ResourceIdentity::Drives => vec![
MethodMacroModifier::fn_name_and_path(
"special", "/drives/{{RID}}/special/$count",
GeneratedMacroType::FnName("get_special_count")
),
MethodMacroModifier::fn_name_and_path(
"following", "/drives/{{RID}}/following/$count",
GeneratedMacroType::FnName("get_following_count")
),
MethodMacroModifier::fn_name_and_path(
"bundles", "/drives/{{RID}}/bundles/$count",
GeneratedMacroType::FnName("get_bundles_count")
),
],
ResourceIdentity::DrivesItems => vec![
MethodMacroModifier {
matching: vec![
Expand Down Expand Up @@ -730,6 +744,24 @@ pub fn get_method_macro_modifiers(resource_identity: ResourceIdentity) -> Vec<Me
GeneratedMacroType::FnName("get_application_count")
)
],
ResourceIdentity::Worksheets => vec![
MethodMacroModifier::fn_name_and_path(
"workbook_worksheet", "/worksheets/{{RID}}/range()",
GeneratedMacroType::FnName("get_range_object")
),
MethodMacroModifier::fn_name_and_path(
"workbook_worksheet", "/worksheets/{{RID}}/range(address='{{id}}')",
GeneratedMacroType::FnName("get_range_object_by_address")
),
MethodMacroModifier::fn_name_and_path(
"workbook_worksheet", "/worksheets/{{RID}}/usedRange()",
GeneratedMacroType::FnName("get_used_range_object")
),
MethodMacroModifier::fn_name_and_path(
"workbook_worksheet", "/worksheets/{{RID}}/usedRange(valuesOnly={{id}})",
GeneratedMacroType::FnName("get_used_range_object_with_values_only")
)
],
_ => vec![],
}
}
50 changes: 43 additions & 7 deletions graph-codegen/src/settings/resource_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,18 @@ impl ResourceSettings {
path_name: path_name.to_string(),
ri,
imports: vec![
"crate::drives::{DrivesListApiClient, DrivesItemsApiClient, DrivesItemsIdApiClient}"
"crate::drives::{DrivesListApiClient, DrivesItemsApiClient, DrivesItemsIdApiClient, WorkbookApiClient, WorksheetsApiClient, WorksheetsIdApiClient, CreatedByUserApiClient, LastModifiedByUserApiClient}",
],
api_client_links: vec![
ApiClientLinkSettings(Some("DrivesIdApiClient"), vec![
ApiClientLink::StructId("list", "DrivesListApiClient"),
ApiClientLink::Struct("list", "DrivesListApiClient"),
ApiClientLink::StructId("items", "DrivesItemsApiClient"),
ApiClientLink::StructId("item", "DrivesItemsIdApiClient"),
ApiClientLink::Struct("workbook", "WorkbookApiClient"),
ApiClientLink::Struct("worksheets", "WorksheetsApiClient"),
ApiClientLink::StructId("worksheet", "WorksheetsIdApiClient"),
ApiClientLink::Struct("last_modified_by_user", "LastModifiedByUserApiClient"),
ApiClientLink::Struct("created_by_user", "CreatedByUserApiClient"),
])
],
},
Expand All @@ -348,17 +353,27 @@ impl ResourceSettings {
path_name: path_name.to_string(),
ri,
imports: vec![
"crate::drives::{DrivesListContentTypesApiClient, DrivesListContentTypesIdApiClient, DrivesItemsApiClient, DrivesItemsIdApiClient}"
"crate::drives::{DrivesListContentTypesApiClient, DrivesListContentTypesIdApiClient, DrivesItemsApiClient, DrivesItemsIdApiClient, CreatedByUserApiClient, LastModifiedByUserApiClient}"
],
api_client_links: vec![
ApiClientLinkSettings(Some("DrivesListApiClient"), vec![
ApiClientLink::Struct("content_types", "DrivesListContentTypesApiClient"),
ApiClientLink::StructId("content_type", "DrivesListContentTypesIdApiClient"),
ApiClientLink::Struct("items", "DrivesItemsApiClient"),
ApiClientLink::StructId("item", "DrivesItemsIdApiClient"),
ApiClientLink::Struct("last_modified_by_user", "LastModifiedByUserApiClient"),
ApiClientLink::Struct("created_by_user", "CreatedByUserApiClient"),
])
],
},
ResourceIdentity::DrivesItems => ResourceSettings::builder(path_name, ri)
.imports(vec!["crate::drives::{CreatedByUserApiClient, LastModifiedByUserApiClient}"])
.api_client_links(vec![
ApiClientLinkSettings(Some("DrivesItemsApiClient"), vec![
ApiClientLink::Struct("last_modified_by_user", "LastModifiedByUserApiClient"),
ApiClientLink::Struct("created_by_user", "CreatedByUserApiClient"),
])
]).build().unwrap(),
ResourceIdentity::Education => ResourceSettings::builder(path_name, ri)
.imports(vec!["crate::education::*"])
.api_client_links(vec![
Expand Down Expand Up @@ -1947,15 +1962,26 @@ pub fn get_write_configuration(resource_identity: ResourceIdentity) -> WriteConf
])
.build().unwrap(),

ResourceIdentity::CreatedByUser => WriteConfiguration::second_level_builder(ResourceIdentity::Drives, resource_identity)
.trim_path_start("/drives/{drive-id}")
.build()
.unwrap(),
ResourceIdentity::LastModifiedByUser => WriteConfiguration::second_level_builder(ResourceIdentity::Drives, resource_identity)
.trim_path_start("/drives/{drive-id}")
.build()
.unwrap(),

ResourceIdentity::Drives => WriteConfiguration::builder(resource_identity)
.filter_path(vec!["items", "list"])
.children(map_write_config(vec![ResourceIdentity::DrivesList, ResourceIdentity::DrivesItems, ResourceIdentity::DrivesListContentTypes]))
.filter_path(vec!["items", "list", "createdByUser", "lastModifiedByUser"])
.children(map_write_config(vec![
ResourceIdentity::DrivesList, ResourceIdentity::DrivesItems, ResourceIdentity::DrivesListContentTypes,
ResourceIdentity::Workbook, ResourceIdentity::Worksheets, ResourceIdentity::CreatedByUser, ResourceIdentity::LastModifiedByUser,
]))
.build()
.unwrap(),
ResourceIdentity::DrivesList => WriteConfiguration::second_level_builder(ResourceIdentity::Drives, resource_identity)
.trim_path_start("/drives/{drive-id}")
.filter_path(vec!["items", "contentTypes"])
.filter_path(vec!["items", "contentTypes", "createdByUser", "lastModifiedByUser"])
.build()
.unwrap(),
ResourceIdentity::DrivesListContentTypes => WriteConfiguration::second_level_builder(ResourceIdentity::Drives, resource_identity)
Expand All @@ -1964,7 +1990,17 @@ pub fn get_write_configuration(resource_identity: ResourceIdentity) -> WriteConf
.unwrap(),
ResourceIdentity::DrivesItems => WriteConfiguration::second_level_builder(ResourceIdentity::Drives, resource_identity)
.trim_path_start("/drives/{drive-id}")
.filter_path(vec!["workbook", "getActivitiesByInterval()"])
.filter_path(vec!["workbook", "getActivitiesByInterval()", "createdByUser", "lastModifiedByUser"])
.build()
.unwrap(),
ResourceIdentity::Workbook => WriteConfiguration::second_level_builder(ResourceIdentity::Drives, resource_identity)
.trim_path_start("/drives/{drive-id}/items/{driveItem-id}")
.filter_path(vec!["worksheets", "tables", "functions", "names", "comments"])
.build()
.unwrap(),
ResourceIdentity::Worksheets => WriteConfiguration::second_level_builder(ResourceIdentity::Drives, resource_identity)
.trim_path_start("/drives/{drive-id}/items/{driveItem-id}/workbook")
.filter_path(vec!["tables", "charts", "names", "pivotTables"])
.build()
.unwrap(),

Expand Down
6 changes: 4 additions & 2 deletions graph-core/src/resource/resource_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub enum ResourceIdentity {
ContentTypes,
Contracts,
Conversations,
CreatedByUser,
CreatedObjects,
Custom,
DataPolicyOperations,
Expand Down Expand Up @@ -139,6 +140,7 @@ pub enum ResourceIdentity {
Invitations,
IosManagedAppProtections,
JoinedTeams,
LastModifiedByUser,
LicenseDetails,
List,
Localizations,
Expand Down Expand Up @@ -243,7 +245,8 @@ pub enum ResourceIdentity {
VppTokens,
WindowsAutopilotDeviceIdentities,
WindowsInformationProtectionPolicies,
Workbooks,
Workbook,
Worksheets,
}

impl ToString for ResourceIdentity {
Expand Down Expand Up @@ -478,7 +481,6 @@ pub enum TopLevelResource {
TeamsTemplates,
Teamwork,
Users,
Workbooks,
}

impl ToString for TopLevelResource {
Expand Down
3 changes: 3 additions & 0 deletions src/drives/created_by_user/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod request;

pub use request::*;
34 changes: 34 additions & 0 deletions src/drives/created_by_user/request.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// GENERATED CODE

use crate::api_default_imports::*;

resource_api_client!(CreatedByUserApiClient, ResourceIdentity::CreatedByUser);

impl CreatedByUserApiClient {
get!(
doc: "Get createdByUser from drives",
name: get_created_by_user,
path: "/createdByUser"
);
get!(
doc: "Get mailboxSettings property value",
name: get_mailbox_settings,
path: "/createdByUser/mailboxSettings"
);
patch!(
doc: "Update property mailboxSettings value.",
name: update_mailbox_settings,
path: "/createdByUser/mailboxSettings",
body: true
);
get!(
doc: "Get serviceProvisioningErrors property value",
name: list_service_provisioning_errors,
path: "/createdByUser/serviceProvisioningErrors"
);
get!(
doc: "Get the number of the resource",
name: service_provisioning_errors,
path: "/createdByUser/serviceProvisioningErrors/$count"
);
}
32 changes: 26 additions & 6 deletions src/drives/drives_items/request.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// GENERATED CODE

use crate::api_default_imports::*;
use crate::drives::{CreatedByUserApiClient, LastModifiedByUserApiClient};

resource_api_client!(
DrivesItemsApiClient,
Expand Down Expand Up @@ -28,8 +29,11 @@ impl DrivesItemsApiClient {
}

impl DrivesItemsIdApiClient {
api_client_link!(last_modified_by_user, LastModifiedByUserApiClient);
api_client_link!(created_by_user, CreatedByUserApiClient);

delete!(
doc: "Delete navigation property items for drives",
doc: "Delete a DriveItem",
name: delete_items,
path: "/items/{{RID}}"
);
Expand All @@ -39,7 +43,7 @@ impl DrivesItemsIdApiClient {
path: "/items/{{RID}}"
);
patch!(
doc: "Update the navigation property items in drives",
doc: "Move a DriveItem to a new folder",
name: update_items,
path: "/items/{{RID}}",
body: true
Expand Down Expand Up @@ -162,6 +166,12 @@ impl DrivesItemsIdApiClient {
name: get_last_seven_days,
path: "/items/{{RID}}/analytics/lastSevenDays"
);
post!(
doc: "Invoke action assignSensitivityLabel",
name: assign_sensitivity_label,
path: "/items/{{RID}}/assignSensitivityLabel",
body: true
);
post!(
doc: "Invoke action checkin",
name: checkin,
Expand Down Expand Up @@ -248,6 +258,11 @@ impl DrivesItemsIdApiClient {
path: "/items/{{RID}}/delta(token='{{id}}')",
params: token
);
post!(
doc: "Invoke action extractSensitivityLabels",
name: extract_sensitivity_labels,
path: "/items/{{RID}}/extractSensitivityLabels"
);
post!(
doc: "Invoke action follow",
name: follow,
Expand All @@ -270,6 +285,11 @@ impl DrivesItemsIdApiClient {
name: get_list_item,
path: "/items/{{RID}}/listItem"
);
post!(
doc: "Invoke action permanentDelete",
name: permanent_delete,
path: "/items/{{RID}}/permanentDelete"
);
post!(
doc: "Create new navigation property to permissions for drives",
name: create_permissions,
Expand All @@ -287,19 +307,19 @@ impl DrivesItemsIdApiClient {
path: "/items/{{RID}}/permissions/$count"
);
delete!(
doc: "Delete navigation property permissions for drives",
doc: "Delete a sharing permission from a file or folder",
name: delete_permissions,
path: "/items/{{RID}}/permissions/{{id}}",
params: permission_id
);
get!(
doc: "Get permissions from drives",
doc: "Get sharing permission for a file or folder",
name: get_permissions,
path: "/items/{{RID}}/permissions/{{id}}",
params: permission_id
);
patch!(
doc: "Update the navigation property permissions in drives",
doc: "Update sharing permission",
name: update_permissions,
path: "/items/{{RID}}/permissions/{{id}}",
body: true,
Expand Down Expand Up @@ -440,7 +460,7 @@ impl DrivesItemsIdApiClient {
params: drive_item_version_id
);
get!(
doc: "Get versions from drives",
doc: "Get a DriveItemVersion resource",
name: get_versions,
path: "/items/{{RID}}/versions/{{id}}",
params: drive_item_version_id
Expand Down
12 changes: 9 additions & 3 deletions src/drives/drives_list/request.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
// GENERATED CODE

use crate::api_default_imports::*;
use crate::drives::*;
use crate::drives::{
CreatedByUserApiClient, DrivesItemsApiClient, DrivesItemsIdApiClient,
DrivesListContentTypesApiClient, DrivesListContentTypesIdApiClient,
LastModifiedByUserApiClient,
};

resource_api_client!(DrivesListApiClient, ResourceIdentity::DrivesList);

impl DrivesListApiClient {
api_client_link_id!(item, DrivesItemsIdApiClient);
api_client_link!(content_types, DrivesListContentTypesApiClient);
api_client_link_id!(content_type, DrivesListContentTypesIdApiClient);
api_client_link!(items, DrivesItemsApiClient);
api_client_link!(created_by_user, CreatedByUserApiClient);
api_client_link!(content_types, DrivesListContentTypesApiClient);
api_client_link_id!(item, DrivesItemsIdApiClient);
api_client_link!(last_modified_by_user, LastModifiedByUserApiClient);

delete!(
doc: "Delete navigation property list for drives",
Expand Down
6 changes: 3 additions & 3 deletions src/drives/drives_list_content_types/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,19 @@ impl DrivesListContentTypesIdApiClient {
path: "/contentTypes/{{RID}}/columns/$count"
);
delete!(
doc: "Delete navigation property columns for drives",
doc: "Delete columnDefinition",
name: delete_columns,
path: "/contentTypes/{{RID}}/columns/{{id}}",
params: column_definition_id
);
get!(
doc: "Get columns from drives",
doc: "Get columnDefinition",
name: get_columns,
path: "/contentTypes/{{RID}}/columns/{{id}}",
params: column_definition_id
);
patch!(
doc: "Update the navigation property columns in drives",
doc: "Update columnDefinition",
name: update_columns,
path: "/contentTypes/{{RID}}/columns/{{id}}",
body: true,
Expand Down
3 changes: 3 additions & 0 deletions src/drives/last_modified_by_user/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod request;

pub use request::*;
Loading

0 comments on commit 1b16300

Please sign in to comment.