-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repository Contents API #649
Conversation
@@ -80,6 +79,7 @@ public interface IObservableRepositoriesClient | |||
/// <param name="owner">The owner of the repository</param> | |||
/// <param name="name">The name of the repository</param> | |||
/// <returns></returns> | |||
[Obsolete("This method has been obsoleted by Contents.GetReadme. Please use that instead.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the property below now is called Content
instead of Contents
, maybe these should be changed as well? 😄
Because we're pre 1.0, I'm inclined to just remove these methods rather than obsolete them. |
Could someone try this out? I think it's ready to merge. 🍰 |
I'll have a look at this when I'm back on the grid tomorrow ✌️ |
/// </summary> | ||
public string Content | ||
{ | ||
get { return EncodedContent.FromBase64String(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this guard against null
for EncodedContent
?
Code and tests look pretty great. Just a few nagging questions 🤘 |
Some APIs return either an object or an array. This is hard for us static typed languages. So what we do is normalize things to an array when we expect one.
But only ones with ParameterAttribute applied.
0b329f2
to
ca1ab1e
Compare
And fix whitespace
ca1ab1e
to
d769125
Compare
Something keeps fucking with the whitespace. I suspect it's the documentation rewriter. Anyways, this should be good I hope. I'm up too late again. 😄 so I'm going to sleep and hope the build is green. 📦 |
This incorporates and supersedes #434
I took a slightly different approach. In the interest of keeping close to the API, there's only one method called
GetContents
that maps to the "Get contents" API. I was able to accomplish this by changing the serializer a bit. When it's trying to deserialize a JSON object into anIEnumerable<T>
but the JSON text is clearly aT
and not an array, I simply wrap the json text with square brackets turning it into an array of one item and then deserialize it.The other bit I had to do is when creating content, the text of the content needs to be base64 encoded. Also, when requesting content, the data is base64 encoded. So I changed the serializer to handle this transparently by simply applying the
SerializeAsBase64
attribute. So the consumer of the client doesn't have to worry about this.