예제 #1
0
        public static DotMailerCoreClient CreateDotMailerCoreClientWithResponse <T>(IRestResponse restResponse)
        {
            BaseClient          baseClient          = CreateBaseClientWithResponse <T>(restResponse);
            DotMailerCoreClient dotMailerCoreClient = new DotMailerCoreClient(baseClient, _jsonSerializer, _nullLoggerFactory);

            return(dotMailerCoreClient);
        }
예제 #2
0
        public static DotMailerCoreClient CreateDotMailerCoreClient()
        {
            NewtonsoftJsonRestSerializer jsonSerializer = new NewtonsoftJsonRestSerializer();
            IEnumerable <string>         contentTypes   = new List <string>()
            {
                "application/json",
                "text/json",
                "text/x-json"
            };

            IOptions <DotMailerCoreOptions> options = Options.Create <DotMailerCoreOptions>(new DotMailerCoreOptions()
            {
                BaseUrl       = "https://api.dotmailer.com/v2/",
                Authenticator = new HttpBasicAuthenticator("*****@*****.**", "demo"),
                Deserializer  = jsonSerializer,
                ContentTypes  = contentTypes
            }
                                                                                            );


            InMemoryCache     inMemoryCache     = new InMemoryCache();
            NullLoggerFactory nullLoggerFactory = new NullLoggerFactory();


            DotMailerCoreClient dotMailerCoreClient = new DotMailerCoreClient(inMemoryCache, jsonSerializer, options, nullLoggerFactory);

            return(dotMailerCoreClient);
        }