Beispiel #1
0
        public void FixtureSetup()
        {
            _config = new Dictionary<string, string>() { { "url", this.PostUrl }, { "content-type", "json" } };
            _events = new[] { SupportedEvents.Push };

            Api = GitHubApi.Create();

            Authorize(new[] { Scopes.Repo })
                .ContinueWith(t =>
                    this.ClearHooks())
                .ContinueWith(
                    t =>
                    {
                        Task.Delay(10000);
                        _tempHook =
                            Api.Hooks.Create(
                                _testUsername,
                                _testRepo,
                                new HookBase()
                                {
                                    Name = HookName.Web,
                                    IsActive = true,
                                    Events = _events,
                                    Config = _config
                                }).Result;
                    }).Wait();
        }
Beispiel #2
0
        /// <summary>
        /// Edits a hook for the owner on the given repository
        /// </summary>
        /// <param name="owner">The username of the owner of the hook</param>
        /// <param name="repo">The repository where the hooks should be created</param>
        /// <param name="id">The id of the individual hook to edit</param>
        /// <param name="hook">
        /// The information to update the existing hook with. *Every property is optional*
        /// If you set the 'Events' property of hook then the values will replace all
        /// existing events for this hook.
        /// </param>
        /// <returns>The complete hook returned by GitHub</returns>
        async public Task<Hook> Edit(string owner, string repo, int id, Hook.PatchHook hook)
        {
            var request = CreateRequest(string.Format("/repos/{0}/{1}/hooks/{2}", owner, repo, id));

            var response = await Patch<Hook.PatchHook, Hook>(request, hook);

            return response.Result;
        }