Exemple #1
0
 public ElsaClient(
     IActivitiesApi activities,
     IWorkflowDefinitionsApi workflowDefinitions,
     IWorkflowRegistryApi workflowRegistry,
     IWorkflowInstancesApi workflowInstances,
     IWebhookDefinitionsApi webhookDefinitions)
 {
     Activities          = activities;
     WorkflowDefinitions = workflowDefinitions;
     WorkflowRegistry    = workflowRegistry;
     WorkflowInstances   = workflowInstances;
     WebhookDefinitions  = webhookDefinitions;
 }
Exemple #2
0
        public void Setup()
        {
            athleteApi = Substitute.For <IAthletesApi>();
            ActivityStats stats = new ActivityStats(
                allRideTotals: new ActivityTotal(count: totalRides),
                allRunTotals: new ActivityTotal(count: totalRuns),
                allSwimTotals: new ActivityTotal(count: totalSwims)
                );

            athleteApi.GetStatsAsync(Arg.Any <int>()).Returns(stats);

            activitiesApi = Substitute.For <IActivitiesApi>();

            List <SummaryActivity> activities = new List <SummaryActivity>
            {
                TestData.SummaryActivity1(),
                                   TestData.SummaryActivity2()
            };

            List <SummaryActivity> emptyActivities = new List <SummaryActivity>();

            activitiesApi.GetLoggedInAthleteActivitiesAsync(page: 1).Returns(Task.FromResult(activities));
            activitiesApi.GetLoggedInAthleteActivitiesAsync(page: 2).Returns(Task.FromResult(emptyActivities));

            List <SummaryActivity> activitiesAfter = new List <SummaryActivity>
            {
                TestData.SummaryActivity3(),
                                   TestData.SummaryActivity3(),
                                   TestData.SummaryActivity3(),
                                   TestData.SummaryActivity3(),
                                   TestData.SummaryActivity3(),
                                   TestData.SummaryActivity3(),
                                   TestData.SummaryActivity3(),
                                   TestData.SummaryActivity3(),
                                   TestData.SummaryActivity3()
            };

            activitiesApi.GetLoggedInAthleteActivitiesAsync(page: 1, after: Arg.Any <int>()).Returns(Task.FromResult(activitiesAfter));
            activitiesApi.GetLoggedInAthleteActivitiesAsync(page: 2, after: Arg.Any <int>()).Returns(Task.FromResult(emptyActivities));
        }
 public StravaClient(IActivitiesApi activitiesApi, IAthletesApi athletesApi)
 {
     this._activitiesApi = activitiesApi;
     this._athletesApi   = athletesApi;
 }
        public DesignAutomationClient(ForgeService service = null, IOptions <Configuration> configuration = null, IActivitiesApi activities = null, IAppBundlesApi appBundles = null, IEnginesApi engines = null, IForgeAppsApi forgeApps = null, IHealthApi health = null, IServiceLimitsApi serviceLimits = null, ISharesApi shares = null, IWorkItemsApi workItems = null)
        {
            this.Configuration = configuration?.Value ?? new Configuration();

            this.Service = service ?? ForgeService.CreateDefault();

            // set BaseAddress from configuration
            this.Service.Client.BaseAddress = Configuration.BaseAddress;

            this.ActivitiesApi    = activities ?? new ActivitiesApi(service, configuration);
            this.AppBundlesApi    = appBundles ?? new AppBundlesApi(service, configuration);
            this.EnginesApi       = engines ?? new EnginesApi(service, configuration);
            this.ForgeAppsApi     = forgeApps ?? new ForgeAppsApi(service, configuration);
            this.HealthApi        = health ?? new HealthApi(service, configuration);
            this.ServiceLimitsApi = serviceLimits ?? new ServiceLimitsApi(service, configuration);
            this.SharesApi        = shares ?? new SharesApi(service, configuration);
            this.WorkItemsApi     = workItems ?? new WorkItemsApi(service, configuration);
        }
        public DesignAutomationClient(ForgeService service = null, IOptions <Configuration> configuration = null, IActivitiesApi activitiesApi = null, IAppBundlesApi appBundlesApi = null, IEnginesApi enginesApi = null, IForgeAppsApi forgeAppsApi = null, IHealthApi healthApi = null, ISharesApi sharesApi = null, IWorkItemsApi workItemsApi = null)
        {
            this.Service = service ?? ForgeService.CreateDefault();

            // set BaseAddress from configuration or default
            this.Service.Client.BaseAddress = configuration?.Value.BaseAddress ?? new Configuration().BaseAddress;

            if (this.ActivitiesApi == null)
            {
                this.ActivitiesApi = new ActivitiesApi(service, configuration);
            }
            else
            {
                this.ActivitiesApi = activitiesApi;
            }

            if (this.AppBundlesApi == null)
            {
                this.AppBundlesApi = new AppBundlesApi(service, configuration);
            }
            else
            {
                this.AppBundlesApi = appBundlesApi;
            }

            if (this.EnginesApi == null)
            {
                this.EnginesApi = new EnginesApi(service, configuration);
            }
            else
            {
                this.EnginesApi = enginesApi;
            }

            if (this.ForgeAppsApi == null)
            {
                this.ForgeAppsApi = new ForgeAppsApi(service, configuration);
            }
            else
            {
                this.ForgeAppsApi = forgeAppsApi;
            }

            if (this.HealthApi == null)
            {
                this.HealthApi = new HealthApi(service, configuration);
            }
            else
            {
                this.HealthApi = healthApi;
            }

            if (this.SharesApi == null)
            {
                this.SharesApi = new SharesApi(service, configuration);
            }
            else
            {
                this.SharesApi = sharesApi;
            }

            if (this.WorkItemsApi == null)
            {
                this.WorkItemsApi = new WorkItemsApi(service, configuration);
            }
            else
            {
                this.WorkItemsApi = workItemsApi;
            }
        }
Exemple #6
0
 public ActivitiesService(BotDbContext dbContext, ILogger <ActivitiesService> logger, IActivitiesApi activitiesApi) : base(dbContext, logger)
 {
     _activitiesApi = activitiesApi;
 }