public TransactionalContext(AuthenticationDetails auth, ICreateSendOptions options) { classicEmail = new ClassicEmailContext(auth, options); smartEmail = new SmartEmailContext(auth, options); messages = new MessagesContext(auth, options); statistics = new StatisticsContext(auth, options); }
protected BaseApiClient(string baseUrl, AuthenticationDetails authenticationDetails, string userAgent = null) { Api = new ApiRequestExecutor(baseUrl, userAgent) { Authenticator = authenticationDetails.Authenticator }; }
public void Connect_CorrectAuthType_SpecificMFilesUser() { // Arrange. var mock = new Mock <IMFilesServerApplication>(); mock.Setup(a => a.ConnectEx4(It.IsAny <TimeZoneInformation>(), It.IsAny <MFAuthType>(), It.IsAny <object>(), It.IsAny <object>(), It.IsAny <object>(), It.IsAny <object>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <bool>(), It.IsAny <string>(), It.IsAny <string>())) .Callback((TimeZoneInformation timeZoneInformation, MFAuthType authType, object username, object password, object domain, object spn, string protocolSequence, string networkAddress, string endPoint, bool encryptedConnection, string localComputerName, bool allowAnonymousConnection, bool allowAuthenticationUsingPlugins, string logicalTargetServer, string clientCulture) => { // Assert. Assert.AreEqual(MFAuthType.MFAuthTypeSpecificMFilesUser, authType); Assert.AreEqual("hello", username); Assert.AreEqual("world", password); }); var connectionDetails = this.CreateConnectionDetails(); connectionDetails.AuthenticationDetails = AuthenticationDetails.CreateForSpecificMFilesUser("hello", "world"); // Act. mock.Object.Connect(connectionDetails); }
public KeyPayApiV2Client(string baseUrl, AuthenticationDetails authenticationDetails) { var api = new ApiRequestExecutor(baseUrl) { Authenticator = authenticationDetails.Authenticator }; Business = new BusinessFunction(api); PayCategory = new PayCategoryFunction(api); PaySchedule = new PayScheduleFunction(api); Employee = new EmployeeFunction(api); Location = new LocationFunction(api); PayRun = new PayRunFunction(api); LeaveCategory = new LeaveCategoryFunction(api); Report = new ReportFunction(api); Timesheet = new TimesheetFunction(api); User = new UserFunction(api); PayRateTemplates = new PayRateTemplateFunction(api); DeductionCategory = new DeductionCategoryFunction(api); ExpenseCategory = new ExpenseCategoryFunction(api); WorkType = new WorkTypeFunction(api); Document = new DocumentFunction(api); EmployeeGroup = new EmployeeGroupFunction(api); EmployingEntity = new EmployingEntityFunction(api); PaymentSummary = new PaymentSummaryFunction(api); RosterShift = new RosterShiftFunction(api); Manager = new ManagerFunction(api); Kiosk = new KioskFunction(api); TimeAndAttendance = new TimeAndAttendanceFunction(api); Unavailability = new UnavailabilityFunction(api); }
public TransactionalContext(AuthenticationDetails auth, ICreateSendOptions options) { classicEmail = new ClassicEmailContext(auth, options); smartEmail = new SmartEmailContext(auth, options); messages = new MessagesContext(auth, options); statistics = new StatisticsContext(auth, options); }
public static U Get<U>( AuthenticationDetails auth, string path, NameValueCollection queryArguments) { return Get<U, ErrorResult>(auth, path, queryArguments); }
public static U Get<U, EX>( AuthenticationDetails auth, string path, NameValueCollection queryArguments) where EX : ErrorResult { return MakeRequest<string, U, EX>("GET", auth, path, queryArguments, null); }
public static U Get<U, EX>( AuthenticationDetails auth, string baseUri, string path, NameValueCollection queryArguments) where EX : ErrorResult { return MakeRequest<string, U, EX>("GET", auth, path, queryArguments, null, baseUri, APPLICATION_JSON_CONTENT_TYPE); }
public static U Post<T, U>( AuthenticationDetails auth, string path, NameValueCollection queryArguments, T payload) where T : class { return Post<T, U, ErrorResult>(auth, path, queryArguments, payload); }
public ClientProvider(ILogger logger, IExternalServicesSettings settings) { Check.If(settings).IsNotNull(); Check.If(logger).IsNotNull(); _logger = logger; _auth = new ApiKeyAuthenticationDetails(settings.CampaignMonitorApiKey); _clientId = settings.CampaignMonitorClientId; }
protected BaseApiClient(string baseUrl, AuthenticationDetails authenticationDetails) { JsonConvert.DefaultSettings = () => { var settings = new JsonSerializerSettings(); settings.Converters.Add(new StringEnumConverter()); return(settings); }; }
public static bool IsValidApiKeyCampaignMonitor(AuthenticationDetails auth) { try { return(new General(auth).SystemDate() != null ? true : false); } catch (Exception) { return(false); } }
/// <summary> /// Authentication record is used in multiple requests /// </summary> /// <param name="userkey"> user id</param> /// <param name="community">community id</param> /// <returns>auth record </returns> private static AuthenticationDetails GetExternalAuthenticationRecord(string userkey, string community) { var authenticationDetails = new AuthenticationDetails { CommunityCode = community, UserKey = userkey }; return(authenticationDetails); }
public static U Post<T, U, EX>( AuthenticationDetails auth, string path, NameValueCollection queryArguments, T payload) where T : class where EX : ErrorResult { return MakeRequest<T, U, EX>("POST", auth, path, queryArguments, payload); }
public CampaignMonitorService(CampaignMonitorConfiguration config, IOrganizationService orgService) { if (config == null) { throw new ArgumentNullException("config"); } _config = config; auth = Authenticator.GetAuthentication(config, orgService); }
public SendMessageLogic(IOrganizationService organizationService, ITracingService trace) { orgService = organizationService; tracer = trace; ConfigurationService configService = new ConfigurationService(orgService, tracer); campaignMonitorConfig = configService.VerifyAndLoadConfig(); authDetails = Authenticator.GetAuthentication(campaignMonitorConfig, orgService); }
public static string Create(AuthenticationDetails auth, string companyName, string country, string timezone) { return(HttpHelper.Post <ClientDetail, string>( auth, "/clients.json", null, new ClientDetail() { CompanyName = companyName, Country = country, TimeZone = timezone })); }
public SgApiClient(string baseUrl, AuthenticationDetails authenticationDetails, string userAgent = null) : base(baseUrl, authenticationDetails, userAgent) { Other = new OtherFunction(Api); Brand = new BrandFunction(Api); Invoices = new InvoicesFunction(Api); Business = new BusinessFunction(Api); ChartOfAccounts = new ChartOfAccountsFunction(Api); DeductionCategories = new DeductionCategoriesFunction(Api); Employee = new EmployeeFunction(Api); EmployeeAccess = new EmployeeAccessFunction(Api); EmployeeRecurringTransactions = new EmployeeRecurringTransactionsFunction(Api); EmployeeBankAccount = new EmployeeBankAccountFunction(Api); EmployeeBenefitsInKind = new EmployeeBenefitsInKindFunction(Api); EmployeeDocument = new EmployeeDocumentFunction(Api); EmployeeEarningsLineSplit = new EmployeeEarningsLineSplitFunction(Api); EmployeeExpenseRequest = new EmployeeExpenseRequestFunction(Api); EmployeeGainsOrProfitsEmployeeSharePlan = new EmployeeGainsOrProfitsEmployeeSharePlanFunction(Api); EmployeeIncomeFromOverseasSubjectToTaxRemission = new EmployeeIncomeFromOverseasSubjectToTaxRemissionFunction(Api); EmployeeIncomeTaxBorneByEmployer = new EmployeeIncomeTaxBorneByEmployerFunction(Api); EmployeeLeaveAllowances = new EmployeeLeaveAllowancesFunction(Api); LeaveAllowance = new LeaveAllowanceFunction(Api); LeaveRequests = new LeaveRequestsFunction(Api); Location = new LocationFunction(Api); EmployeePayRateSchedule = new EmployeePayRateScheduleFunction(Api); PayRun = new PayRunFunction(Api); EmployeeQualifications = new EmployeeQualificationsFunction(Api); Authentication = new AuthenticationFunction(Api); EmploymentAgreement = new EmploymentAgreementFunction(Api); EmployeeExpenseCategories = new EmployeeExpenseCategoriesFunction(Api); EmployeeGroups = new EmployeeGroupsFunction(Api); EmployeeOnboarding = new EmployeeOnboardingFunction(Api); EmployerLiabilityCategories = new EmployerLiabilityCategoriesFunction(Api); EmployingEntities = new EmployingEntitiesFunction(Api); TimeAndAttendance = new TimeAndAttendanceFunction(Api); LeaveCategories = new LeaveCategoriesFunction(Api); LookupData = new LookupDataFunction(Api); Manager = new ManagerFunction(Api); PayCategory = new PayCategoryFunction(Api); PayRateTemplate = new PayRateTemplateFunction(Api); PaySchedule = new PayScheduleFunction(Api); PublicHoliday = new PublicHolidayFunction(Api); Qualifications = new QualificationsFunction(Api); Reporting = new ReportingFunction(Api); RosterShift = new RosterShiftFunction(Api); TieredLeaveAllowance = new TieredLeaveAllowanceFunction(Api); Timesheets = new TimesheetsFunction(Api); Unavailability = new UnavailabilityFunction(Api); Webhook = new WebhookFunction(Api); WorkType = new WorkTypeFunction(Api); Ess = new EssFunction(Api); Reseller = new ResellerFunction(Api); User = new UserFunction(Api); WhiteLabel = new WhiteLabelFunction(Api); }
public AuApiClient(string baseUrl, AuthenticationDetails authenticationDetails, string userAgent = null) : base(baseUrl, authenticationDetails, userAgent) { Brand = new BrandFunction(Api); Invoices = new InvoicesFunction(Api); Business = new BusinessFunction(Api); AbaSettings = new AbaSettingsFunction(Api); ChartOfAccounts = new ChartOfAccountsFunction(Api); DeductionCategories = new DeductionCategoriesFunction(Api); Employee = new EmployeeFunction(Api); EmployeeAccess = new EmployeeAccessFunction(Api); EmployeeRecurringTransactions = new EmployeeRecurringTransactionsFunction(Api); EmployeeBankAccount = new EmployeeBankAccountFunction(Api); EmployeeDocument = new EmployeeDocumentFunction(Api); EmployeeEarningsLineSplit = new EmployeeEarningsLineSplitFunction(Api); EmployeeExpenseRequest = new EmployeeExpenseRequestFunction(Api); EmployeeLeaveAllowances = new EmployeeLeaveAllowancesFunction(Api); LeaveAllowance = new LeaveAllowanceFunction(Api); LeaveRequests = new LeaveRequestsFunction(Api); Location = new LocationFunction(Api); EmployeePayRateSchedule = new EmployeePayRateScheduleFunction(Api); PayRun = new PayRunFunction(Api); EmployeeQualifications = new EmployeeQualificationsFunction(Api); EmployeeSelfManagedSuperFund = new EmployeeSelfManagedSuperFundFunction(Api); Authentication = new AuthenticationFunction(Api); EmployeeSuperFund = new EmployeeSuperFundFunction(Api); EmploymentAgreement = new EmploymentAgreementFunction(Api); EmployeeExpenseCategories = new EmployeeExpenseCategoriesFunction(Api); EmployeeGroups = new EmployeeGroupsFunction(Api); EmployeeOnboarding = new EmployeeOnboardingFunction(Api); EmployerLiabilityCategories = new EmployerLiabilityCategoriesFunction(Api); EmployingEntities = new EmployingEntitiesFunction(Api); TimeAndAttendance = new TimeAndAttendanceFunction(Api); LeaveCategories = new LeaveCategoriesFunction(Api); LookupData = new LookupDataFunction(Api); Manager = new ManagerFunction(Api); PayCategory = new PayCategoryFunction(Api); PaymentSummary = new PaymentSummaryFunction(Api); PayRateTemplate = new PayRateTemplateFunction(Api); Other = new OtherFunction(Api); PaySchedule = new PayScheduleFunction(Api); PublicHoliday = new PublicHolidayFunction(Api); Qualifications = new QualificationsFunction(Api); Reporting = new ReportingFunction(Api); RosterShift = new RosterShiftFunction(Api); SuperFund = new SuperFundFunction(Api); Timesheets = new TimesheetsFunction(Api); Unavailability = new UnavailabilityFunction(Api); Webhook = new WebhookFunction(Api); WorkType = new WorkTypeFunction(Api); Ess = new EssFunction(Api); Reseller = new ResellerFunction(Api); User = new UserFunction(Api); WhiteLabel = new WhiteLabelFunction(Api); }
public void SetUp() { this.RawDetails = new AuthenticationDetails { Email = "*****@*****.**", Password = "******" }; this.HashedDetails = new AuthenticationDetails { Email = "*****@*****.**", Password = AuthenticationServiceHelper.Md5Hash("let-me-in") }; }
public static string Create(AuthenticationDetails auth, string companyName, string country, string timezone) { return HttpHelper.Post<ClientDetail, string>( auth, "/clients.json", null, new ClientDetail() { CompanyName = companyName, Country = country, TimeZone = timezone }); }
public static string Create(AuthenticationDetails auth, string clientID, string name, string htmlPageUrl, string zipUrl) { return(HttpHelper.Post <Dictionary <string, object>, string>( auth, string.Format("/templates/{0}.json", clientID), null, new Dictionary <string, object>() { { "Name", name }, { "HtmlPageURL", htmlPageUrl }, { "ZipFileUrl", zipUrl } })); }
static U MakeRequest<T, U, EX>( string method, AuthenticationDetails auth, string path, NameValueCollection queryArguments, T payload) where T : class where EX : ErrorResult { return MakeRequest<T, U, EX>(method, auth, path, queryArguments, payload, CreateSendOptions.BaseUri, APPLICATION_JSON_CONTENT_TYPE); }
public void Insert(AuthenticationDetails details) { this.Context.Set <AuthenticationDetailsEntity>() .Add( new AuthenticationDetailsEntity { Id = Guid.NewGuid(), Email = details.Email, Password = details.Password }); this.Context.SaveChanges(); }
public static string Create( AuthenticationDetails auth, string listID, string title, SegmentRuleGroups ruleGroups) { return(HttpHelper.Post <Dictionary <string, object>, string, ErrorResult <RuleErrorResults> >( auth, string.Format("/segments/{0}.json", listID), null, new Dictionary <string, object>() { { "ListID", listID }, { "Title", title }, { "RuleGroups", ruleGroups } })); }
public static string Create( AuthenticationDetails auth, string listID, string title, SegmentRuleGroups ruleGroups) { return HttpHelper.Post<Dictionary<string, object>, string, ErrorResult<RuleErrorResults>>( auth, string.Format("/segments/{0}.json", listID), null, new Dictionary<string, object>() { { "ListID", listID }, { "Title", title }, { "RuleGroups", ruleGroups } }); }
public static string Create(AuthenticationDetails auth, string clientID, string name, string htmlPageUrl, string zipUrl) { return HttpHelper.Post<Dictionary<string, object>, string>( auth, string.Format("/templates/{0}.json", clientID), null, new Dictionary<string, object>() { { "Name", name }, { "HtmlPageURL", htmlPageUrl }, { "ZipFileUrl", zipUrl } }); }
public static U Post <T, U, EX>( AuthenticationDetails auth, string path, NameValueCollection queryArguments, T payload, string baseUri, string contentType) where T : class where EX : ErrorResult { return(MakeRequestAsync <T, U, EX>("POST", auth, path, queryArguments, payload, baseUri, contentType).Result); }
public CampaignRepository(string apiKey, string listId, int timePeriod) { _auth = new ApiKeyAuthenticationDetails(apiKey); _listId = listId; _past = DateTime.Now.AddDays(-timePeriod); _verbsDict = new Dictionary <string, int>() { { "Active", 16 }, { "Unsubscribed", 20 }, { "Deleted", 24 }, { "Bounced", 22 } }; }
private string CreateTemplateFromCosmosDocument(AuthenticationDetails auth, string clientID, CampaignDocument campaign) { string template = string.Empty; try { var htmlText = WebUtility.HtmlDecode(GenerateTemplateCampaignMonitorFromCosmosDocument(campaign)); var templateID = BlobManager.CreateHtmlTemplateAzure(htmlText); template = Template.Create(auth, clientID, "TEMPLATE " + campaign.Name, templateID, ""); } catch (Exception e) { var messageException = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name); telemetria.Critical(messageException); } return(template); }
private string CreateTemplate(AuthenticationDetails auth, string clientID, CAMPAIGN campaign) { string template = string.Empty; try { var htmlText = HttpUtility.HtmlDecode(GenerateTemplateCampaignMonitor(campaign)); var templateID = Helpers.AzureStorageHelper.CreateHtmlTemplateAzure(htmlText); template = Template.Create(auth, clientID, "TEMPLATE " + campaign.Name, templateID, ""); } catch (Exception e) { var messageException = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name); telemetria.Critical(messageException); } return(template); }
private static AuthenticationDetails GetAuthenticationDetails(AuthenticationType authenticationType, string userName, string password, byte[] content, string ppkPassword = null) { AuthenticationDetails authenticationDetails = new AuthenticationDetails(); authenticationDetails.AuthenticationType = authenticationType.ToString(); authenticationDetails.UserName = userName; authenticationDetails.Password = password; if (authenticationType == AuthenticationType.PrivateKey || authenticationType == AuthenticationType.MultiFactor) { authenticationDetails.Content = Convert.ToBase64String(content); authenticationDetails.PpkFilePassword = ppkPassword; // Harcoding this, as this is used only in UX to display. authenticationDetails.PpkFileName = "DummyName.ppk"; } return(authenticationDetails); }
/// <summary> /// Creates a campaign using the API key and campaign details provided. /// </summary> /// <param name="apiKey">API key to use</param> /// <param name="clientID">Client ID of the client for whom the /// campaign should be created</param> /// <param name="subject">A subject for the campaign</param> /// <param name="name">A name for the campaign</param> /// <param name="fromName">From name for the campaign</param> /// <param name="fromEmail">From email address for the campaign</param> /// <param name="replyTo">Reply-to address for the campaign</param> /// <param name="htmlUrl">URL for the HTML content for the /// campaign</param> /// <param name="textUrl">URL for the text content for the campaign. /// Note that you may provide textUrl as null or an empty string and /// the text content for the campaign will be generated from the HTML /// content.</param> /// <param name="listIDs">IDs of the lists to which the campaign /// will be sent</param> /// <param name="segmentIDs">IDs of the segments to which the /// campaign will be sent</param> /// <returns>The ID of the newly created campaign</returns> public static string Create(AuthenticationDetails auth, string clientID, string subject, string name, string fromName, string fromEmail, string replyTo, string htmlUrl, string textUrl, List<string> listIDs, List<string> segmentIDs) { return HttpHelper.Post<Dictionary<string, object>, string>( auth, string.Format("/campaigns/{0}.json", clientID), null, new Dictionary<string, object>() { { "Subject", subject }, { "Name", name }, { "FromName", fromName}, { "FromEmail", fromEmail }, { "ReplyTo", replyTo }, { "HtmlUrl", htmlUrl }, { "TextUrl", textUrl }, { "ListIDs", listIDs }, { "SegmentIDs", segmentIDs } }); }
static void Main(string[] args) { AuthenticationDetails details; try { details = AuthenticationDetails.LoadFromJson("AuthDetails.json"); } catch (FileNotFoundException) { Console.WriteLine("Could not find AuthDetails.json.\nExiting..."); return; } SecurityApi.Init(); var message = Authenticate(details.EGatewayUrl, details.Username, details.DecryptedPassword, details.Organization, details.ServiceHostId, details.WorkstationServiceId); Console.WriteLine(message); }
public static string CreateFromTemplate(AuthenticationDetails auth, string clientID, string subject, string name, string fromName, string fromEmail, string replyTo, List<string> listIDs, List<string> segmentIDs, string templateID, TemplateContent templateContent) { return HttpHelper.Post<Dictionary<string, object>, string>( auth, string.Format("/campaigns/{0}/fromtemplate.json", clientID), null, new Dictionary<string, object>() { { "Subject", subject }, { "Name", name }, { "FromName", fromName}, { "FromEmail", fromEmail }, { "ReplyTo", replyTo }, { "ListIDs", listIDs }, { "SegmentIDs", segmentIDs }, { "TemplateID", templateID }, { "TemplateContent", templateContent } }); }
public static string Create( AuthenticationDetails auth, string clientID, string title, string unsubscribePage, bool confirmedOptIn, string confirmationSuccessPage, UnsubscribeSetting unsubscribeSetting) { return HttpHelper.Post<ListDetail, string>( auth, string.Format("/lists/{0}.json", clientID), null, new ListDetail() { Title = title, UnsubscribePage = unsubscribePage, ConfirmedOptIn = confirmedOptIn, ConfirmationSuccessPage = confirmationSuccessPage, UnsubscribeSetting = unsubscribeSetting.ToString() }); }
public static string CreateFromTemplate(AuthenticationDetails auth, string clientID, string subject, string name, string fromName, string fromEmail, string replyTo, List <string> listIDs, List <string> segmentIDs, string templateID, TemplateContent templateContent) { return(HttpHelper.Post <Dictionary <string, object>, string>( auth, string.Format("/campaigns/{0}/fromtemplate.json", clientID), null, new Dictionary <string, object>() { { "Subject", subject }, { "Name", name }, { "FromName", fromName }, { "FromEmail", fromEmail }, { "ReplyTo", replyTo }, { "ListIDs", listIDs }, { "SegmentIDs", segmentIDs }, { "TemplateID", templateID }, { "TemplateContent", templateContent } })); }
public static string Create( AuthenticationDetails auth, string clientID, string title, string unsubscribePage, bool confirmedOptIn, string confirmationSuccessPage, UnsubscribeSetting unsubscribeSetting) { return(HttpHelper.Post <ListDetail, string>( auth, string.Format("/lists/{0}.json", clientID), null, new ListDetail() { Title = title, UnsubscribePage = unsubscribePage, ConfirmedOptIn = confirmedOptIn, ConfirmationSuccessPage = confirmationSuccessPage, UnsubscribeSetting = unsubscribeSetting.ToString() })); }
public Segment(AuthenticationDetails auth, string segmentID) : base(auth) { SegmentID = segmentID; }
public Person(AuthenticationDetails auth, string clientID) : base(auth) { this.clientID = clientID; }
public Campaign(AuthenticationDetails auth, string campaignID) : base(auth) { CampaignID = campaignID; }
public MessagesContext(AuthenticationDetails authenticationDetails, ICreateSendOptions options) : base(authenticationDetails, options) { }
public Template(AuthenticationDetails auth, string templateID) : base(auth) { TemplateID = templateID; }
public Subscriber(AuthenticationDetails auth, string listID) : base(auth) { ListID = listID; }
public Client(AuthenticationDetails auth, string clientID) : base(auth) { ClientID = clientID; }
public SmartEmailContext(AuthenticationDetails authenticationDetails, ICreateSendOptions options) : base(authenticationDetails, options) { }
public General(AuthenticationDetails auth) : base(auth) { }
public List(AuthenticationDetails auth, string listID) : base(auth) { ListID = listID; }
public Account(AuthenticationDetails auth) : base(auth) { }