- Notifications
You must be signed in to change notification settings - Fork1
episerver/graph-source-sdk
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
C# SDK for Content Graph Services api.
This SDK is a C# wrapper around the Optimizely Content Graph API.
The package is published to the Episerver package repository as Optimizely.Graph.Source.Sdk
You will need an application key and secret key provided by your Turnstile credential to get started.You can find more informationhttps://docs.developers.optimizely.com/platform-optimizely/v1.4.0-optimizely-graph/docs/introduction-optimizely-graph
You can use the client by callingCreate() and providing your base url, Content Graph source, application key and secret, then calling one of the provided functions for synchronizing Content Types and Content Data.
// Initialize the GraphSourceClient by calling the Create methodvarclient=GraphSourceClient.Create(newUri("https://cg.optimizely.com"),"","","");// Add a language preferenceclient.AddLanguage("en");// Build any C# class objectpublicclassExampleClassObject{publicstringFirstName{get;set;}publicstringLastName{get;set;}publicintAge{get;set;}publicSubType1SubType{get;set;}publicclassSubType1{publicstringOne{get;set;}publicintTwo{get;set;}}}// Use the client to configure content typesclient.ConfigureContentType<ExampleClassObject>().Field(x=>x.FirstName,IndexingType.Searchable).Field(x=>x.LastName,IndexingType.Searchable).Field(x=>x.Age,IndexingType.Queryable).Field(x=>x.SubType,IndexingType.PropertyType);client.ConfigurePropertyType<ExampleClassObject.SubType1>().Field(x=>x.One,IndexingType.Searchable).Field(x=>x.Two,IndexingType.Queryable);// Save content types to Optimizely Graphvarresult=awaitgraphSourceClient.SaveTypesAsync();
// Instantiate custom C# object and assign valuesvarexampleData=newExampleClassObject{FirstName="First",LastName="Last",Age=30,SubType=newSubType1{One="One",Two=2,}};// Use the client to sync content// Parameters are generated id, language, and data objectawaitclient.SaveContentAsync(generateId:(x)=>$"{x.FirstName}_{x.LastName}","en",exampleData);
In visual studio, set your startup project to the Optimizely.Graph.Source.Sdk.Sample project.
Log issues directly into GitHub. Pull Requests will be created to resolve those issues as soon as they are triaged.
About
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.