public async Task <bool> IsStarred(string id) { Ensure.ArgumentNotNullOrEmptyString(id, nameof(id)); try { var response = await Connection.Get <object>(ApiUrls.StarGist(id), null, null).ConfigureAwait(false); return(response.HttpResponse.IsTrue()); } catch (NotFoundException) { return(false); } }
/// <summary> /// Checks if the gist is starred /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#check-if-a-gist-is-starred /// </remarks> /// <param name="id">The id of the gist</param> public async Task <bool> IsStarred(string id) { Ensure.ArgumentNotNullOrEmptyString(id, "id"); try { var response = await Connection.GetAsync <object>(ApiUrls.StarGist(id), null, null) .ConfigureAwait(false); if (response.StatusCode != HttpStatusCode.NotFound && response.StatusCode != HttpStatusCode.NoContent) { throw new ApiException("Invalid Status Code returned. Expected a 204 or a 404", response.StatusCode); } return(response.StatusCode == HttpStatusCode.NoContent); } catch (NotFoundException) { return(false); } }
/// <summary> /// Unstars a gist /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#unstar-a-gist /// </remarks> /// <param name="id">The id of the gist</param> public Task Unstar(string id) { return(ApiConnection.Delete(ApiUrls.StarGist(id))); }
/// <summary> /// Stars a gist /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#star-a-gist /// </remarks> /// <param name="id">The id of the gist</param> public Task Star(string id) { return(ApiConnection.Put(ApiUrls.StarGist(id))); }
public Task Unstar(string id) { Ensure.ArgumentNotNullOrEmptyString(id, nameof(id)); return(ApiConnection.Delete(ApiUrls.StarGist(id))); }
/// <summary> /// Stars a gist /// </summary> /// <remarks> /// http://developer.github.com/v3/gists/#star-a-gist /// </remarks> /// <param name="id">The id of the gist</param> public Task Star(string id) { Ensure.ArgumentNotNullOrEmptyString(id, "id"); return(ApiConnection.Put(ApiUrls.StarGist(id))); }