From 9d92a7b3cdc344f26b0fbd854c79d859c05d68bd Mon Sep 17 00:00:00 2001 From: Nikitha Chettiar Date: Tue, 18 Jan 2022 10:36:32 -0800 Subject: [PATCH 1/2] Create GraphClientsDesign.md --- design/GraphClientsDesign.md | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 design/GraphClientsDesign.md diff --git a/design/GraphClientsDesign.md b/design/GraphClientsDesign.md new file mode 100644 index 000000000..9e17b5b22 --- /dev/null +++ b/design/GraphClientsDesign.md @@ -0,0 +1,52 @@ + +### Graph JS Deliverables: + +Note: Package names yet to be decided + +1. `microsoftgraph/microsoft-graph-javascript-service`: + + - Generated library which the request builders. Generated using Kiota builder. + + - Will have dependencies on : + - @microsoftgraph/microsoft-graph-javascript-core + - @microsoft/kiota-abstractions + - @microsoft/kiota-http-fetchlibrary + - @microsoft/kiota-serialization-json + +2. `microsoftgraph/microsoft-graph-javascript-core`: + + - Contains Graph customizations and tasks such as PageIteration, LargeFileUpload. + + - Will have dependencies on : + - @microsoft/kiota-abstractions + - @microsoft/kiota-http-fetchlibrary + +### Usage of the two libraries : + +As mentioned in PR: #558 + +Goals: + +- A Graph JS SDK user should not be required to create separate client instances for Graph Service library or the Graph Core library. +- To achieve this, the `Graph Service Client` should also expose the features of `Graph Core Client`. + +Design: + +1. `Graph Service client` should extend from `Graph Core Client`: + +``` + +import { Client as GraphCoreClient } from `@microsoft/microsoft-graph-javascript-core`; + + +class GraphServiceClient extends GraphCoreClient { + + public api(){ + super.api(); + } +} +``` + +- To acheive the above design we will need to customize the auto-generated `GraphServiceClient`. + + From 612d9b2d6120501fa371612cc441c28cf2514aa9 Mon Sep 17 00:00:00 2001 From: Nikitha Chettiar Date: Tue, 18 Jan 2022 19:45:10 -0800 Subject: [PATCH 2/2] Update GraphClientsDesign.md --- design/GraphClientsDesign.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/design/GraphClientsDesign.md b/design/GraphClientsDesign.md index 9e17b5b22..af4eabecf 100644 --- a/design/GraphClientsDesign.md +++ b/design/GraphClientsDesign.md @@ -1,7 +1,7 @@ ### Graph JS Deliverables: -Note: Package names yet to be decided +Note: Package names yet to be decided. The names are just examples and `service` and `core` prefix in the package names are for clarity purposes. 1. `microsoftgraph/microsoft-graph-javascript-service`: @@ -25,6 +25,15 @@ Note: Package names yet to be decided As mentioned in PR: #558 +Also, tasks constructors such as `PageIterator` and `LargeFileUpload` tasks should accept both `GraphServiceClient` and `GraphCoreClient` + +``` +// both should work +const pageIterator = PageIterator(GraphServiceClient, options); +or +const pageIterator = PageIterator(GraphCoreClient, options); +``` + Goals: - A Graph JS SDK user should not be required to create separate client instances for Graph Service library or the Graph Core library. @@ -45,6 +54,7 @@ class GraphServiceClient extends GraphCoreClient { super.api(); } } + ``` - To acheive the above design we will need to customize the auto-generated `GraphServiceClient`.