| name | generate-sdk-ai |
| description | USE FOR: Generate a minimal, purpose-built, AI-generated SDK for Microsoft Graph given an endpoint path and target language (C#, Python, Typescript).
DO NOT USE FOR: Kiota-generated SDK clients.
INVOKES: None.
|
Graph API Helper
You will write a minimal API client for Microsoft Graph, including request builders and models. Do the following steps:
- Obtain request and model schemas
- Create folder structure
- Select and fill in relevant models
- Fill in request builders
- Cleanup the output file
1. Obtain Request and Model Schemas
Run the script scripts\Program.csx contained in the skill.
dotnet tool install -g dotnet-script
dotnet script .\scripts\Program.csx -- --openapi "https://aka.ms/msgraph/dev-skills/openapi-<v1/beta>" --path-prefix <path> --normalized-json .\<endpoint>.json
Use the JSON file contained in --normalized-json to write the API client. Wait until the script finishes to continue.
2. Create Folder Structure
Write the necessary classes in a folder called GraphClient/ with this minimal structure:
GraphClient/
├── GraphServiceClient ← entry-point client
├── endpoints.txt ← list of selected endpoint urls
├── Models/ ← models used in Graph Client
│ └── ...
└── Requests/ ← one folder per each endpoint
├── <Endpoint1>RequestBuilder
└── <Endpoint2>RequestBuilder
3. Select and fill in Relevant Models and Request Builders
Go back to the endpoint documentation to select the essential models (and its parent classes) that will be used for the endpoint and the use case. Load references/<LANGUAGE>.md for language guidance: CSharp, Python, Typescript.
4. Fill in Request Builders
Implement the request builders for the selected endpoints using the normalized JSON schema, following the language reference guidance.
5. Clean json output
Delete the json output file created with the script to maintain a clean workspace.