logo
logo

Class MClientFactory

Defines the M client factory.

Inheritance
System.Object
MClientFactory
Namespace: Stylelabs.M.Sdk.WebClient
Assembly: Stylelabs.M.Sdk.WebClient.dll
Syntax
public static class MClientFactory : object

Methods

CreateMClient(String)

Creates a new instance of the IWebMClient implementation.

Declaration
public static IWebMClient CreateMClient(string connectionString)
Parameters
Type Name Description
System.String connectionString

Connection string to the instance.

Returns
Type Description
IWebMClient

A new IWebMClient instance.

Examples

This example shows how to create a IWebMClient instance using the OAuthPasswordGrant.

MClientFactory.CreateMClient("Endpoint=http://url/;ClientId=clientId;ClientSecret=clientSecret;UserName=userName;Password=password");

This example shows how to create a IWebMClient instance using the OAuthRefreshTokenGrant.

MClientFactory.CreateMClient("Endpoint=http://url/;ClientId=clientId;ClientSecret=clientSecret;RefreshToken=refreshToken");

CreateMClient(Uri)

Creates a new instance of the IWebMClient implementation.

Declaration
public static IWebMClient CreateMClient(Uri endpoint)
Parameters
Type Name Description
Uri endpoint

Base uri of the Sitecore Content Hub instance to connect to.

Returns
Type Description
IWebMClient

A new IWebMClient instance.

CreateMClient(Uri, OAuthPasswordGrant)

Creates a new instance of the IWebMClient implementation.

Declaration
public static IWebMClient CreateMClient(Uri endpoint, OAuthPasswordGrant passwordGrant)
Parameters
Type Name Description
Uri endpoint

Base URI of the Sitecore Content Hub instance to connect to.

OAuthPasswordGrant passwordGrant

OAuth authentication details.

Returns
Type Description
IWebMClient

A new IWebMClient instance.

CreateMClient(Uri, OAuthRefreshTokenGrant)

Creates a new instance of the IWebMClient implementation.

Declaration
public static IWebMClient CreateMClient(Uri endpoint, OAuthRefreshTokenGrant refreshTokenGrant)
Parameters
Type Name Description
Uri endpoint

Base uri of the Sitecore Content Hub instance to connect to.

OAuthRefreshTokenGrant refreshTokenGrant

OAuth authentication details.

Returns
Type Description
IWebMClient

A new IWebMClient instance.

Can we improve this article ? Provide feedback