Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

episerver/graph-source-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C# SDK for Content Graph Services api.

This SDK is a C# wrapper around the Optimizely Content Graph API.

Accessing the Package

The package is published to the Episerver package repository as Optimizely.Graph.Source.Sdk

Usage

Set up your Content Graph Instance and Keypair

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

Using the SDK

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.

Sync Content Types

// 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();

Sync Content

// 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);

Run Examples

In visual studio, set your startup project to the Optimizely.Graph.Source.Sdk.Sample project.

Issues

Log issues directly into GitHub. Pull Requests will be created to resolve those issues as soon as they are triaged.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp