Skip to content
Permalink
Browse files

fix maikebing/Gitea.VisualStudio#13

  • Loading branch information...
maikebing committed Jul 24, 2019
1 parent 0010f56 commit 9803148ae47231b3eccf262148aa667434f061cc
Showing with 15 additions and 1 deletion.
  1. +15 −1 Gitea.API/v1/Client.cs
@@ -44,7 +44,7 @@ public class Client : IDisposable
/// The default TCP port.
/// </summary>
public const int DEFAULT_PORT = 3000;

/// <summary>
/// Initializes a new instance of that class.
/// </summary>
@@ -95,6 +95,20 @@ public Client(string host = DEFAULT_HOST, int port = DEFAULT_PORT, bool isSecure
SetupEndpoints();
}

public Client(string username, string password, Uri uri)
{

Authorizer = new BasicAuth() { Username = username, Password = password };

if (uri.Port < IPEndPoint.MinPort || uri.Port > IPEndPoint.MaxPort)
{
throw new ArgumentOutOfRangeException(nameof(uri.Port));
}

BaseUrl = new Uri(uri, "api/v1/");
SetupEndpoints();
}

/// <summary>
/// Gets the authorizer.
/// </summary>

0 comments on commit 9803148

Please sign in to comment.
You can’t perform that action at this time.