Skip to content

Commit 5014772

Browse files
committed
Updated ReadMe.
1 parent 33dbfe5 commit 5014772

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ You can find more information https://docs.developers.optimizely.com/platform-op
1616

1717
You can use the client by calling `Create()` 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.
1818

19+
#### Sync Content Types
1920
```csharp
2021
// Initialize the GraphSourceClient by calling the Create method
2122
var client = GraphSourceClient.Create(new Uri("https://cg.optimizely.com"), "", "", "");
@@ -57,6 +58,26 @@ client.ConfigurePropertyType<ExampleClassObject.SubType1>()
5758
var result = await graphSourceClient.SaveTypesAsync();
5859
```
5960

61+
#### Sync Content
62+
```csharp
63+
// Instantiate custom C# object and assign values
64+
var exampleData = new ExampleClassObject
65+
{
66+
FirstName = "First",
67+
LastName = "Last",
68+
Age = 30,
69+
SubType = new SubType1
70+
{
71+
One = "One",
72+
Two = 2,
73+
}
74+
};
75+
76+
// Use the client to sync content
77+
// Parameters are generated id, language, and data object
78+
await client.SaveContentAsync(generateId: (x) => $"{x.FirstName}_{x.LastName}", "en", exampleData);
79+
```
80+
6081
## Run Examples
6182
In visual studio, set your startup project to the Optimizely.Graph.Source.Sdk.Sample project.
6283

0 commit comments

Comments
 (0)