/// <summary>
        /// Edits the <see cref="ReleaseAsset"/> for the specified release of the specified repository.
        /// </summary>
        /// <remarks>
        /// See the <a href="http://developer.github.com/v3/repos/releases/#edit-a-release-asset">API documentation</a> for more information.
        /// </remarks>
        /// <param name="owner">The repository's owner</param>
        /// <param name="name">The repository's name</param>
        /// <param name="assetId">The id of the <see cref="ReleaseAsset"/></param>
        /// <param name="data">Description of the asset with its amended data</param>
        public IObservable <ReleaseAsset> EditAsset(string owner, string name, int assetId, ReleaseAssetUpdate data)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(data, "data");

            return(_client.EditAsset(owner, name, assetId, data).ToObservable());
        }
예제 #2
0
        public async Task CanEditAnAssetLabel()
        {
            var releaseWithNoUpdate = new ReleaseUpdate("0.1")
            {
                Draft = true
            };
            var release = await _releaseClient.Create(_repositoryOwner, _repositoryName, releaseWithNoUpdate);

            var stream = Helper.LoadFixture("hello-world.txt");

            var newAsset = new ReleaseAssetUpload
            {
                ContentType = "text/plain",
                FileName    = "hello-world.txt",
                RawData     = stream
            };

            var result = await _releaseClient.UploadAsset(release, newAsset);

            var asset = await _releaseClient.GetAsset(_repositoryOwner, _repositoryName, result.Id);

            var updateAsset = asset.ToUpdate();

            updateAsset.Label = "some other thing";

            var updatedAsset = await _releaseClient.EditAsset(_repositoryOwner, _repositoryName, result.Id, updateAsset);

            Assert.Equal("some other thing", updatedAsset.Label);
        }