Exemple #1
0
        public static async Task SetupClient(TestContext context)
        {
            generalConfig = GeneralConfig.Instance.Value;
            var conf = new BacklogJpConfigure(generalConfig.SpaceKey);

            conf.ApiKey = generalConfig.ApiKey;
            client      = new BacklogClientFactory(conf).NewClient();
            var users = await client.GetUsersAsync();

            projectKey = generalConfig.ProjectKey;
            var project = await client.GetProjectAsync(projectKey);

            projectId = project.Id;

            gitConfig = GitConfig.Instance.Value;

            ownUser = await client.GetMyselfAsync();

            var numericUserIds = (await client.GetUsersAsync()).ToDictionary(x => x.UserId, x => x.Id);

            notifiedNumericUserIds = new[]
            { gitConfig.NotifiedUserId1, gitConfig.NotifiedUserId2, gitConfig.NotifiedUserId3 }
            .Select(x => numericUserIds[x])
            .ToArray();

            assigneeUserIds = new[]
            { gitConfig.AssigneeUserId1, gitConfig.AssigneeUserId2, gitConfig.AssigneeUserId3 }
            .Select(x => numericUserIds[x])
            .ToArray();
        }
        public static async Task SetupClient(TestContext context)
        {
            generalConfig = GeneralConfig.Instance.Value;
            var conf = new BacklogJpConfigure(generalConfig.SpaceKey);

            conf.ApiKey = generalConfig.ApiKey;
            client      = new BacklogClientFactory(conf).NewClient();
            var users = await client.GetUsersAsync();

            projectKey = generalConfig.ProjectKey;
            var project = await client.GetProjectAsync(projectKey);

            projectId = project.Id;
        }
Exemple #3
0
        /// <summary>
        /// プロジェクト情報の取得
        /// </summary>
        public async void LoadProjectInfo(Action onSuccess = null)
        {
            APIData = BacklogAPIData.Load();

            // エディタが再生中かつ一時停止中だと認証時にawaitで止まってしまうので、キャッシュがない時は一時停止を解除する
            bool isPaused = EditorApplication.isPaused;

            if (EditorApplication.isPlaying)
            {
                bool isCached = File.Exists($"{Application.dataPath}/../{APIData.CacheFileName}");
                if (!isCached)
                {
                    EditorApplication.isPaused = false;
                }
            }

            // 認証
            var client = new BacklogClient(APIData.SpaceKey, APIData.Domain);
            await client.AuthorizeAsync(new OAuth2App()
            {
                ClientId             = APIData.ClientId,
                ClientSecret         = APIData.ClientSecretId,
                RedirectUri          = APIData.RedirectURI,
                CredentialsCachePath = APIData.CacheFileName,
            });

            EditorApplication.isPaused = isPaused;

            // 各種データ取得
            Space            = client.GetSpaceAsync().Result.Content;
            Project          = client.GetProjectAsync(APIData.ProjectKey).Result.Content;
            Data.TicketTypes = Project.GetTicketTypesAsync().Result.Content;
            Data.Priorities  = client.GetPriorityTypesAsync().Result.Content;
            Data.Categories  = Project.GetCategoriesAsync().Result.Content;
            Data.Milestones  = Project.GetMilestonesAsync().Result.Content;
            Data.Users       = Project.GetUsersAsync().Result.Content;

            onSuccess?.Invoke();
        }