@@ -48,6 +48,27 @@ public IObservable<Repository> CreateRepository(NewRepository repository, string
4848 return ( isUser ? client . Create ( repository ) : client . Create ( login , repository ) ) ;
4949 }
5050
51+ public IObservable < PullRequestReview > PostPullRequestReview (
52+ string owner ,
53+ string name ,
54+ int number ,
55+ string commitId ,
56+ string body ,
57+ PullRequestReviewEvent e )
58+ {
59+ Guard . ArgumentNotEmptyString ( owner , nameof ( owner ) ) ;
60+ Guard . ArgumentNotEmptyString ( name , nameof ( name ) ) ;
61+
62+ var review = new PullRequestReviewCreate
63+ {
64+ Body = body ,
65+ CommitId = commitId ,
66+ Event = e ,
67+ } ;
68+
69+ return gitHubClient . PullRequest . Review . Create ( owner , name , number , review ) ;
70+ }
71+
5172 public IObservable < PullRequestReviewComment > CreatePullRequestReviewComment (
5273 string owner ,
5374 string name ,
@@ -88,6 +109,11 @@ public IObservable<User> GetUser()
88109 return gitHubClient . User . Current ( ) ;
89110 }
90111
112+ public IObservable < User > GetUser ( string login )
113+ {
114+ return gitHubClient . User . Get ( login ) ;
115+ }
116+
91117 public IObservable < Organization > GetOrganizations ( )
92118 {
93119 // Organization.GetAllForCurrent doesn't return all of the information we need (we
@@ -123,30 +149,10 @@ public IObservable<LicenseMetadata> GetLicenses()
123149
124150 public HostAddress HostAddress { get ; }
125151
126- static string GetSha256Hash ( string input )
127- {
128- Guard . ArgumentNotEmptyString ( input , nameof ( input ) ) ;
129-
130- try
131- {
132- using ( var sha256 = SHA256 . Create ( ) )
133- {
134- var bytes = Encoding . UTF8 . GetBytes ( input ) ;
135- var hash = sha256 . ComputeHash ( bytes ) ;
136-
137- return string . Join ( "" , hash . Select ( b => b . ToString ( "x2" , CultureInfo . InvariantCulture ) ) ) ;
138- }
139- }
140- catch ( Exception e )
141- {
142- log . Error ( e , "IMPOSSIBLE! Generating Sha256 hash caused an exception" ) ;
143- return null ;
144- }
145- }
146-
147152 static string GetFingerprint ( )
148153 {
149- return GetSha256Hash ( ProductName + ":" + GetMachineIdentifier ( ) ) ;
154+ var fingerprint = ProductName + ":" + GetMachineIdentifier ( ) ;
155+ return fingerprint . GetSha256Hash ( ) ;
150156 }
151157
152158 static string GetMachineNameSafe ( )
@@ -269,11 +275,7 @@ public IObservable<Branch> GetBranches(string owner, string repo)
269275 Guard . ArgumentNotEmptyString ( owner , nameof ( owner ) ) ;
270276 Guard . ArgumentNotEmptyString ( repo , nameof ( repo ) ) ;
271277
272- #pragma warning disable 618
273- // GetAllBranches is obsolete, but don't want to introduce the change to fix the
274- // warning in the PR, so disabling for now.
275- return gitHubClient . Repository . GetAllBranches ( owner , repo ) ;
276- #pragma warning restore
278+ return gitHubClient . Repository . Branch . GetAll ( owner , repo ) ;
277279 }
278280
279281 public IObservable < Repository > GetRepository ( string owner , string repo )
0 commit comments