Beispiel #1
0
        /// <summary>
        /// Constructor for a user
        /// </summary>
        /// <param name="username">the username of the current user</param>
        /// <param name="password">the password of the current user</param>
        public User(string username, string password)
        {
            logged        = false;
            this.username = username;
            this.password = password;


            //Sharp bucket has two versions of API so we authenticate with both as well as our own RESTSHARP client
            v1Api = new SharpBucketV1();
            v1Api.BasicAuthentication(username, password);
            try
            {
                this.accountName = v1Api.UserEndPoint().GetInfo().user.username;
                logged           = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }
            v2Api = new SharpBucketV2();
            v2Api.BasicAuthentication(username, password);

            client = new RestClient("https://api.bitbucket.org/");
            client.Authenticator = new HttpBasicAuthenticator(username, password);
        }
Beispiel #2
0
 private static void TestUserEndPoint(SharpBucketV1 sharpBucket)
 {
     var userEndPoint            = sharpBucket.UserEndPoint();
     var info                    = userEndPoint.GetInfo();
     var privileges              = userEndPoint.ListPrivileges();
     var follows                 = userEndPoint.ListFollows();
     var userRepos               = userEndPoint.ListRepositories();
     var userReposOverview       = userEndPoint.RepositoriesOverview();
     var userRepositoryDashboard = userEndPoint.GetRepositoryDasboard();
 }