コード例 #1
0
 public static object fetchTeamArticle(string teamId, int pageNumber)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return TeamApi.FetchTeamArticle(teamId: teamId, pageNumber: pageNumber)
         .Then(teamArticleResponse => {
             var articles = teamArticleResponse.projects.FindAll(project => "article" == project.type);
             dispatcher.dispatch(new LikeMapAction {
                 likeMap = teamArticleResponse.likeMap
             });
             dispatcher.dispatch(new FetchTeamArticleSuccessAction {
                 articles = articles,
                 hasMore = teamArticleResponse.projectsHasMore,
                 pageNumber = pageNumber,
                 teamId = teamId
             });
         })
         .Catch(error => {
             var errorResponse = JsonConvert.DeserializeObject <ErrorResponse>(value: error.Message);
             var errorCode = errorResponse.errorCode;
             dispatcher.dispatch(new FetchTeamArticleFailureAction {
                 teamId = teamId,
                 errorCode = errorCode
             });
             Debuger.LogError(message: error);
         }
                );
     }));
 }
コード例 #2
0
 public static object fetchTeamFollower(string teamId, int offset) {
     return new ThunkAction<AppState>((dispatcher, getState) => {
         var team = getState().teamState.teamDict.ContainsKey(key: teamId)
             ? getState().teamState.teamDict[key: teamId]
             : new Team();
         var followerOffset = (team.followers ?? new List<User>()).Count;
         if (offset != 0 && offset != followerOffset) {
             offset = followerOffset;
         }
         return TeamApi.FetchTeamFollower(teamId, offset)
             .Then(teamFollowerResponse => {
                 dispatcher.dispatch(new FollowMapAction {followMap = teamFollowerResponse.followMap});
                 var userMap = new Dictionary<string, User>();
                 teamFollowerResponse.followers.ForEach(follower => {
                     userMap.Add(key: follower.id, value: follower);
                 });
                 dispatcher.dispatch(new UserMapAction { userMap = userMap });
                 dispatcher.dispatch(new FetchTeamFollowerSuccessAction {
                     followers = teamFollowerResponse.followers,
                     followersHasMore = teamFollowerResponse.followersHasMore,
                     offset = offset,
                     teamId = teamId
                 });
             })
             .Catch(error => {
                     dispatcher.dispatch(new FetchTeamFollowerFailureAction());
                     Debug.Log(error);
                 }
             );
     });
 }
コード例 #3
0
 public static object fetchTeamMember(string teamId, int pageNumber)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return TeamApi.FetchTeamMember(teamId, pageNumber)
         .Then(teamMemberResponse => {
             dispatcher.dispatch(new FollowMapAction {
                 followMap = teamMemberResponse.followMap
             });
             dispatcher.dispatch(new UserMapAction {
                 userMap = teamMemberResponse.userMap
             });
             dispatcher.dispatch(new FetchTeamMemberSuccessAction {
                 members = teamMemberResponse.members,
                 membersHasMore = teamMemberResponse.hasMore,
                 pageNumber = pageNumber,
                 teamId = teamId
             });
         })
         .Catch(error => {
             dispatcher.dispatch(new FetchTeamMemberFailureAction());
             Debuger.LogError(message: error);
         }
                );
     }));
 }
コード例 #4
0
 public static object fetchTeamArticle(string teamId, int offset) {
     return new ThunkAction<AppState>((dispatcher, getState) => {
         var team = getState().teamState.teamDict.ContainsKey(key: teamId)
             ? getState().teamState.teamDict[key: teamId]
             : null;
         var articleOffset = team == null ? 0 : team.articleIds == null ? 0 : team.articleIds.Count;
         if (offset != 0 && offset != articleOffset) {
             offset = articleOffset;
         }
         return TeamApi.FetchTeamArticle(teamId, offset)
             .Then(teamArticleResponse => {
                 var articles = teamArticleResponse.projects.FindAll(project => "article" == project.type);
                 dispatcher.dispatch(new LikeMapAction {likeMap = teamArticleResponse.likeMap});
                 dispatcher.dispatch(new FetchTeamArticleSuccessAction {
                     articles = articles,
                     hasMore = teamArticleResponse.projectsHasMore,
                     offset = offset,
                     teamId = teamId
                 });
             })
             .Catch(error => {
                     dispatcher.dispatch(new FetchTeamArticleFailureAction());
                     Debug.Log(error);
                 }
             );
     });
 }
コード例 #5
0
        public void Given_GetIsNotOK_When_GetTeams_Then_TeamsNotFoundExceptionIsThrown()
        {
            //Arrange
            var mockHttpRequestFactory = new Mock <IHttpRequestFactory>();

            mockHttpRequestFactory.Setup(x => x.Get(
                                             It.IsAny <string>(), It.IsAny <string>()
                                             ))
            .ReturnsAsync(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.NotFound
            });

            var mockOptions = new Mock <IOptions <ApiSettings> >();

            mockOptions.SetupGet(x => x.Value).Returns(new ApiSettings());

            var sut = new TeamApi(
                mockHttpRequestFactory.Object,
                mockOptions.Object
                );

            //Act
            Func <Task> func = async() => await sut.GetTeams();

            //Assert
            func.Should().Throw <TeamsNotFoundException>();
        }
コード例 #6
0
        public async void Given_PutIsNotOK_When_Configure_Then_ReturnFalse()
        {
            //Arrange
            var mockHttpRequestFactory = new Mock <IHttpRequestFactory>();

            mockHttpRequestFactory.Setup(x => x.Put(
                                             It.IsAny <string>(), It.IsAny <object>(), It.IsAny <string>()
                                             ))
            .ReturnsAsync(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.NotFound
            });

            var mockOptions = new Mock <IOptions <ApiSettings> >();

            mockOptions.SetupGet(x => x.Value).Returns(new ApiSettings());

            var sut = new TeamApi(
                mockHttpRequestFactory.Object,
                mockOptions.Object
                );

            //Act
            var result = await sut.Configure(null, null);

            //Assert
            result.Should().BeFalse();
        }
コード例 #7
0
        public void TeamInfoShouldCallCorrectEndpoint()
        {
            var requestHandlerMock = ExecRequestMock <TeamResponse>("/team.info");

            var subject = new TeamApi(requestHandlerMock.Object);
            var result  = subject.Info();

            requestHandlerMock.Verify();
            Assert.NotNull(result);
        }
コード例 #8
0
        public void TeamAccessLogsShouldCallCorrectEndpoint()
        {
            var requestHandlerMock = PathAndExecRequestMock <TeamAccessLogs>("/team.accessLogs?");

            var subject = new TeamApi(requestHandlerMock.Object);
            var result  = subject.AccessLogs();

            requestHandlerMock.Verify();
            Assert.NotNull(result);
        }
コード例 #9
0
ファイル: TeamApiTests.cs プロジェクト: vampireneo/slack
        public void TeamInfoShouldCallCorrectEndpoint()
        {
            var requestHandlerMock = ExecRequestMock<TeamResponse>("/team.info");

            var subject = new TeamApi(requestHandlerMock.Object);
            var result = subject.Info();

            requestHandlerMock.Verify();
            Assert.NotNull(result);
        }
コード例 #10
0
ファイル: TeamApiTests.cs プロジェクト: vampireneo/slack
        public void TeamAccessLogsShouldCallCorrectEndpoint()
        {
            var requestHandlerMock = PathAndExecRequestMock<TeamAccessLogs>("/team.accessLogs?");

            var subject = new TeamApi(requestHandlerMock.Object);
            var result = subject.AccessLogs();

            requestHandlerMock.Verify();
            Assert.NotNull(result);
        }
コード例 #11
0
        public void TeamExists_AndATeamDoesntExist_ReturnsFalse(WireDataFormat format)
        {
            //arrange
            var client        = TestContext.CreateClientValidCredentials(format);
            var teamResources = new TeamApi(client.HttpChannel);

            //act
            var result = teamResources.TeamExists(Guid.NewGuid().ToString());

            //act
            Assert.That(result, Is.False);
        }
コード例 #12
0
        public void Create_ValidEvent_ReturnsEventRegistrationResponse(WireDataFormat format)
        {
            //arrange
            var client                   = TestContext.CreateClientValidCredentials(format);
            var teamResources            = new TeamApi(client.HttpChannel);
            var fundraiseResources       = new PageApi(client.HttpChannel);
            var validRegisterPageRequest = ValidRegisterPageRequest();
            var validRequest             = ValidTeamRequest(validRegisterPageRequest.PageShortName);

            fundraiseResources.Create(validRegisterPageRequest);

            //act
            var result = teamResources.CreateOrUpdate(validRequest);

            //assert
            Assert.That(result.Id, Is.Not.EqualTo(0));
        }
コード例 #13
0
 public static object fetchUnFollowTeam(string unFollowTeamId) {
     return new ThunkAction<AppState>((dispatcher, getState) => {
         return TeamApi.FetchUnFollowTeam(unFollowTeamId)
             .Then(success => {
                 dispatcher.dispatch(new FetchUnFollowTeamSuccessAction {
                     success = success,
                     currentUserId = getState().loginState.loginInfo.userId ?? "",
                     unFollowTeamId = unFollowTeamId
                 });
             })
             .Catch(error => {
                     dispatcher.dispatch(new FetchUnFollowTeamFailureAction {unFollowTeamId = unFollowTeamId});
                     Debug.Log(error);
                 }
             );
     });
 }
コード例 #14
0
        public async void Given_GetIsOK_When_GetTeams_Then_ReturnList()
        {
            //Arrange
            var list = new List <TeamDto>
            {
                new TeamDto
                {
                    Name = "Tottenham Hotspur"
                },
                new TeamDto
                {
                    Name = "Chelsea"
                },
                new TeamDto
                {
                    Name = "Manchester City"
                }
            };

            var mockHttpRequestFactory = new Mock <IHttpRequestFactory>();

            mockHttpRequestFactory.Setup(x => x.Get(
                                             It.IsAny <string>(), It.IsAny <string>()
                                             ))
            .ReturnsAsync(new HttpResponseMessage
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new JsonContent(list)
            });

            var mockOptions = new Mock <IOptions <ApiSettings> >();

            mockOptions.SetupGet(x => x.Value).Returns(new ApiSettings());

            var sut = new TeamApi(
                mockHttpRequestFactory.Object,
                mockOptions.Object
                );

            //Act
            var result = await sut.GetTeams();

            //Assert
            result.Should().NotBeNull();
            result.ToList().Count().Should().Be(3);
        }
コード例 #15
0
 public static object fetchTeam(string teamId) {
     return new ThunkAction<AppState>((dispatcher, getState) => {
         return TeamApi.FetchTeam(teamId)
             .Then(teamResponse => {
                 dispatcher.dispatch(new PlaceMapAction {placeMap = teamResponse.placeMap});
                 dispatcher.dispatch(new FollowMapAction {followMap = teamResponse.followMap});
                 dispatcher.dispatch(new FetchTeamSuccessAction {
                     team = teamResponse.team,
                     teamId = teamId
                 });
             })
             .Catch(error => {
                 dispatcher.dispatch(new FetchTeamFailureAction());
                 Debug.Log(error);
             }
         );
     });
 }
コード例 #16
0
        public void Retrieve_AndATeamExists_ReturnsTeam(WireDataFormat format)
        {
            //arrange
            var client                   = TestContext.CreateClientValidCredentials(format);
            var teamResources            = new TeamApi(client.HttpChannel);
            var fundraiseResources       = new PageApi(client.HttpChannel);
            var validRegisterPageRequest = ValidRegisterPageRequest();

            fundraiseResources.Create(validRegisterPageRequest);
            var validRequest = ValidTeamRequest(validRegisterPageRequest.PageShortName);
            var response     = teamResources.CreateOrUpdate(validRequest);

            //act
            var result = teamResources.Retrieve(validRequest.TeamShortName);

            //assert
            Assert.That(result.Id, Is.EqualTo(response.Id));
        }
コード例 #17
0
        static void DoTeamOnly(string clientId, string password, string subUnitId)
        {
            // Activities
            var eValueActivities = new ActivityApi(clientId, password, subUnitId, "https://api.e-value.net/Activity_1_0b.cfc");
            var activityMonkey   = eValueActivities.GetAllActivities();

            // Teams - are a child of an activity - must be part of an activity
            var eValueTeams = new TeamApi(clientId, password, subUnitId, "https://api.e-value.net/Team_1_0.cfc");

            foreach (var activity in activityMonkey.Activities)
            {
                Console.WriteLine($"~~~~ Activities: {activity.ActivityId} {activity.Abbreviation} {activity.Name} {activity.SiteId} ");
                var teamForActivity = eValueTeams.GetAllTeams(activity.ActivityId.ToString());

                foreach (var team in teamForActivity.Teams)
                {
                    Console.WriteLine($"~~~~ ~~~~ Team : {team.TeamId} {team.Name} ActivityId: {team.ActivityId} ");
                }
            }
        }
コード例 #18
0
 public static object fetchFollowTeam(string followTeamId)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return TeamApi.FetchFollowTeam(followTeamId)
         .Then(success => {
             dispatcher.dispatch(new FetchFollowTeamSuccessAction {
                 success = success,
                 currentUserId = getState().loginState.loginInfo.userId ?? "",
                 followTeamId = followTeamId
             });
         })
         .Catch(error => {
             dispatcher.dispatch(new FetchFollowTeamFailureAction {
                 followTeamId = followTeamId
             });
             Debuger.LogError(message: error);
         }
                );
     }));
 }
コード例 #19
0
 public static object fetchTeamArticle(string teamId, int pageNumber)
 {
     return(new ThunkAction <AppState>((dispatcher, getState) => {
         return TeamApi.FetchTeamArticle(teamId: teamId, pageNumber: pageNumber)
         .Then(teamArticleResponse => {
             var articles = teamArticleResponse.projects.FindAll(project => "article" == project.type);
             dispatcher.dispatch(new LikeMapAction {
                 likeMap = teamArticleResponse.likeMap
             });
             dispatcher.dispatch(new FetchTeamArticleSuccessAction {
                 articles = articles,
                 hasMore = teamArticleResponse.projectsHasMore,
                 pageNumber = pageNumber,
                 teamId = teamId
             });
         })
         .Catch(error => {
             dispatcher.dispatch(new FetchTeamArticleFailureAction());
             Debug.Log(error);
         }
                );
     }));
 }
コード例 #20
0
        public void JointTeam_WhenProvidedValidRequestAndValidCredentials_ReturnTrue(WireDataFormat format)
        {
            //arrange
            var client                   = TestContext.CreateClientValidCredentials(format);
            var teamResources            = new TeamApi(client.HttpChannel);
            var fundraisingResources     = new PageApi(client.HttpChannel);
            var validRegisterPageRequest = ValidRegisterPageRequest();

            fundraisingResources.Create(validRegisterPageRequest);
            var validTeamRequest = ValidTeamRequest(validRegisterPageRequest.PageShortName);

            teamResources.CreateOrUpdate(validTeamRequest);
            var validRegisterPageRequestSecond = ValidRegisterPageRequest();

            fundraisingResources.Create(validRegisterPageRequestSecond);
            var validJoinTeamRequest = ValidJoinTeamRequest(validRegisterPageRequestSecond.PageShortName);

            //act
            var result = teamResources.JointTeam(validTeamRequest.TeamShortName, validJoinTeamRequest);

            //assert
            Assert.IsTrue(result);
        }
コード例 #21
0
 public void Init()
 {
     instance = new TeamApi();
 }
コード例 #22
0
        static void Main(string[] args)
        {
            string clientId  = ConfigurationManager.AppSettings["ClientId"];
            string password  = ConfigurationManager.AppSettings["ClientPassword"];
            string subUnitId = ConfigurationManager.AppSettings["SubUnitId"];

            if (args != null && args.Length > 0)
            {
                switch (args[0])
                {
                case "personal-records":

                    new PersonalRecordsTest(clientId, password, subUnitId);
                    break;

                default:

                    break;
                }
            }
            else
            {
                //DoAllSchedules
                DoAllSchedules(clientId, password, subUnitId);

                // Use this to only test a single evaluation - uncomment for fixing this.
                DoSingleEvaluationOnly(clientId, password, subUnitId);

                // Use this to only test evaluations - uncomment for fixing this.
                //DoAllEvaluations(clientId, password, subUnitId);

                // Use this to only test teams
                DoTeamOnly(clientId, password, subUnitId);

                // EvaluationActions
                var eValueEvaluationActions = new ScheduleApi(clientId, password, subUnitId, "https://test-api.e-value.net/Schedule_1_0b.cfc");

                foreach (var options in eValueEvaluationActions.GetEvaluationActions().EvaluationActions)
                {
                    Console.WriteLine($"(^&)(^&) Evaluation Actions: {options.EvaluationActionId} {options.Description} ");
                }


                // Personal Records Options
                var eValuePersonalRecordOptions = new PersonalRecordOptionApi(clientId, password, subUnitId, "https://test-api.e-value.net/IandCOptions_1_0.cfc");

                foreach (var options in eValuePersonalRecordOptions.GetAllRequirementOptions().RequirementOptions)
                {
                    Console.WriteLine($"~!~!~! Personal Records Option: {options.RequirementId} {options.RequirementLabel} ");
                }

                foreach (var options in eValuePersonalRecordOptions.GetAllRequirementStatusOptions().RequirementStatusOptions)
                {
                    Console.WriteLine($"~!~!~!~!~! Personal Records Status Option: {options.StatusId} {options.StatusLabel} ");
                }

                foreach (var options in eValuePersonalRecordOptions.GetAllRequirementTypeOptions().RequirementTypeOptions)
                {
                    Console.WriteLine($"~!~!~!~!~!~!~! Personal Records Type Option: {options.TypeId} {options.TypeLabel} ");
                }

                // Statuses
                var eValuePeopleGroup = new PeopleGroupApi(clientId, password, subUnitId, "https://test-api.e-value.net/PeopleGroup_1_0.cfc");

                foreach (var groups in eValuePeopleGroup.GetAll().PeopleGroups)
                {
                    Console.WriteLine($"%%%% People Groups: {groups.GroupId} {groups.Name} ");

                    var peopleInGroup = eValuePeopleGroup.GetUsers(groups.GroupId.ToString());

                    foreach (var institutionUser in peopleInGroup.IntitutionUsers ?? Enumerable.Empty <InstitutionUser>())
                    {
                        Console.WriteLine($"%%%% %%%% People In the Group: {institutionUser.UserId} {institutionUser.FirstName} {institutionUser.LastName} ");
                    }
                }

                // Statuses
                var eValueStatus = new StatusApi(clientId, password, subUnitId, "https://test-api.e-value.net/Status_1_0.cfc");

                foreach (var status in eValueStatus.GetAll().Statuses)
                {
                    Console.WriteLine($"@@@@ Statuses: {status.StatusId} {status.Label} ");
                }

                // Ranks
                var eValueRanks = new RankApi(clientId, password, subUnitId, "https://api.e-value.net/Rank_1_0.cfc");

                foreach (var rank in eValueRanks.GetAll().Ranks)
                {
                    Console.WriteLine($"==== Ranks: {rank.RankId} {rank.Label} ");
                }

                // Roles
                var eValueRoles = new RoleApi(clientId, password, subUnitId, "https://api.e-value.net/Role_1_0.cfc");

                foreach (var role in eValueRoles.GetAll().Roles)
                {
                    Console.WriteLine($"++++ Roles: {role.RoleId} {role.Label} ");
                }

                // Schedules - used later in User info
                var eValueShedules = new ScheduleApi(clientId, password, subUnitId, "https://test-api.e-value.net/Schedule_1_0b.cfc");

                // Evaluations - used later in User info
                var eValueEval = new EvaluationApi(clientId, password, subUnitId, "https://test-api.e-value.net/Evaluation_1_0b.cfc");

                // Activities
                var eValueActivities = new ActivityApi(clientId, password, subUnitId, "https://test-api.e-value.net/Activity_1_0b.cfc");
                var activityMonkey   = eValueActivities.GetAllActivities();

                // Teams - are a child of an activity - must be part of an activity
                var eValueTeams = new TeamApi(clientId, password, subUnitId, "https://test-api.e-value.net/Team_1_0.cfc");
                foreach (var activity in activityMonkey.Activities)
                {
                    Console.WriteLine($"~~~~ Activities: {activity.ActivityId} {activity.Abbreviation} {activity.Name} {activity.SiteId} ");
                    var teamForActivity = eValueTeams.GetAllTeams(activity.ActivityId.ToString());
                }

                // Time Frames
                var eValueTimeFrame = new TimeFrameApi(clientId, password, subUnitId, "https://test-api.e-value.net/TimeFrame_1_0.cfc");
                var timeFrameInfo   = eValueTimeFrame.GetAllTimeFrames(DateTime.MinValue, DateTime.MaxValue);

                foreach (var timeFrame in timeFrameInfo.TimeFrames)
                {
                    var frame = eValueTimeFrame.Get(timeFrame.TimeFrameId);

                    Console.WriteLine($">>>> Time Frames: {frame.TimeFrame.TimeFrameId} {frame.TimeFrame.TimeFrameLabel} {frame.TimeFrame.TimeFrameBegin} {frame.TimeFrame.TimeFrameEnd} ");
                }

                // User - individual
                var eValueUser = new UserApi(clientId, password, subUnitId, "https://test-api.e-value.net/User_1_0b.cfc");
                var user       = eValueUser.Get("79491668");

                // Sites - all
                var eValueSiteApi = new SiteApi(clientId, password, subUnitId, "https://test-api.e-value.net/Site_1_0.cfc");
                var sites         = eValueSiteApi.GetAllSites();

                foreach (var site in sites.Sites)
                {
                    Console.WriteLine($"^^^^^ sites: {site.SiteId} {site.SiteName} ");
                }

                // User - all
                var institution = new InstitutionApi(clientId, password, subUnitId, "https://test-api.e-value.net/Institution_1_0.cfc");
                var userList    = institution.GetSubUnitUsers(1);

                // *************************************
                // User and Personal Records
                // *************************************
                var eValuePersonalRecords = new PersonalRecordApi(clientId, password, subUnitId, "https://test-api.e-value.net/IandC_1_0.cfc");
                var record = eValuePersonalRecords.GetUserPersonalRecords("1193570");       // Haley Artz - should have a lot of them - test this in production or on Tuesday after transfer has occurred.

                foreach (var monkeyUser in userList.IntitutionUsers)
                {
                    Console.WriteLine($"***************************");
                    Console.WriteLine($"User List Item: {monkeyUser.UserId}-{monkeyUser.FirstName} {monkeyUser.LastName} : {monkeyUser.RankLabel}");
                    Console.WriteLine($"***************************");
                    Console.WriteLine(String.Empty);

                    // *************************************
                    // Get the personal records for the given user
                    // *************************************
                    var records = eValuePersonalRecords.GetUserPersonalRecords(monkeyUser.UserId.ToString());

                    foreach (var personalRecord in records.PeronalRecords)
                    {
                        Console.WriteLine($"##### ##### Personal Records: {personalRecord.RequirementId} {personalRecord.EventDate} {personalRecord.StatusId} ");
                    }

                    // *************************************
                    // Get the schedules for the given user
                    // *************************************
                    var schedule = eValueShedules.GetAll(monkeyUser.UserId.ToString());

                    foreach (var scheduleItem in schedule.Schedules)
                    {
                        Console.WriteLine($"----- Schedule Item: {scheduleItem.ActivityId}-{scheduleItem.BeginDate} {scheduleItem.EndDate} {scheduleItem}");
                    }

                    // *************************************
                    // Get the schedules for the given user in the year 2017 - this time to get the evaluations.
                    // *************************************
                    var scheduleByDate = eValueShedules.GetAll(new DateTime(2017, 1, 1), new DateTime(2017, 12, 31),
                                                               monkeyUser.UserId.ToString());

                    int[] evalStatusList = { -1, 0, 1, 2, 3, 4, 5, 6, 7, 8 };

                    foreach (var scheduleItem in scheduleByDate.Schedules)
                    {
                        foreach (int statusValue in evalStatusList)
                        {
                            // Updated in the last 30 days
                            var evaluationItems = eValueEval.GetResponses(scheduleItem.ActivityId.ToString(), (DateTime)scheduleItem.BeginDate, (DateTime)scheduleItem.EndDate, statusValue, DateTime.Now.AddDays(-30));

                            foreach (var evaluationItem in evaluationItems.EvaluationItems)
                            {
                                Console.WriteLine($"----- ---- Evaluation Item: {evaluationItem.SiteName} {evaluationItem.Name} {evaluationItem.ActivityId}");
                            }
                        }
                    }
                }
            }
        }
コード例 #23
0
 public TeamApiTests()
 {
     instance = new TeamApi();
 }
コード例 #24
0
        public static TApi GetStaticApi(string key, string accessToken)
        {
            TApi apiClass = null;

            switch (key)
            {
            case "TeamApi":
                if (_cacheManager.Get <TApi>(key) != null)
                {
                    return(_cacheManager.Get <TApi>(key));
                }
                else
                {
                    apiClass = new TeamApi(accessToken);
                }
                break;

            case "BucketApi":
                if (_cacheManager.Get <TApi>(key) != null)
                {
                    return(_cacheManager.Get <TApi>(key));
                }
                else
                {
                    apiClass = new BucketApi(accessToken);
                }
                break;

            case "ChannelApi":
                if (_cacheManager.Get <TApi>(key) != null)
                {
                    return(_cacheManager.Get <TApi>(key));
                }
                else
                {
                    apiClass = new ChannelApi(accessToken);
                }
                break;

            case "PlannerApi":
                if (_cacheManager.Get <TApi>(key) != null)
                {
                    return(_cacheManager.Get <TApi>(key));
                }
                else
                {
                    apiClass = new PlannerApi(accessToken);
                }
                break;

            case "TaskApi":
                if (_cacheManager.Get <TApi>(key) != null)
                {
                    return(_cacheManager.Get <TApi>(key));
                }
                else
                {
                    apiClass = new TaskApi(accessToken);
                }
                break;

            default:
                break;
            }
            _cacheManager.Add(key, apiClass);
            return(apiClass);
        }