1. MClientFactory

Class MClientFactory

Defines the M client factory.

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

Methods

CreateMClient(string)

Creates a new instance of the IWebMClient implementation.

Declaration
public static IWebMClient CreateMClient(string connectionString)
Parameters
TypeNameDescription
stringconnectionString

Connection string to the instance.

Returns
TypeDescription
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, OAuthPasswordGrant)

Creates a new instance of the IWebMClient implementation.

Declaration
public static IWebMClient CreateMClient(Uri endpoint, OAuthPasswordGrant passwordGrant)
Parameters
TypeNameDescription
Uriendpoint

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

OAuthPasswordGrantpasswordGrant

OAuth authentication details.

Returns
TypeDescription
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
TypeNameDescription
Uriendpoint

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

OAuthRefreshTokenGrantrefreshTokenGrant

OAuth authentication details.

Returns
TypeDescription
IWebMClient

A new IWebMClient instance.

CreateMClient(Uri)

Creates a new instance of the IWebMClient implementation.

Declaration
public static IWebMClient CreateMClient(Uri endpoint)
Parameters
TypeNameDescription
Uriendpoint

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

Returns
TypeDescription
IWebMClient

A new IWebMClient instance.

If you have suggestions for improving this article, let us know!