Example #1
0
 /// <summary>
 /// Create a new request object.
 /// </summary>
 /// <param name="accountId">The B2 account ID.</param>
 /// <param name="bucketId">The ID of the bucket to delete.</param>
 public DeleteBucketV1Request(string accountId, string bucketId)
     : base(UrlParams.Empty, HeaderParams.Empty, new BodyParams(
                RequiredParam.Of("accountId", accountId),
                RequiredParam.Of("bucketId", bucketId)
                ))
 {
 }
 /// <summary>
 /// Create a new authorization request.
 /// </summary>
 /// <param name="accountId">The identifier of the B2 account.</param>
 /// <param name="accountKey">The application key to use for the specified account.</param>
 public AuthorizeAccountV1Request(string accountId, string accountKey)
     : base(UrlParams.Empty,
            new HeaderParams(
                RequiredParam.Of("Authorization",
                                 "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(accountId + ":" + accountKey)))
                ),
            BodyParams.Empty)
 {
 }
Example #3
0
 /// <summary>
 /// Creawte a new request object.
 /// </summary>
 /// <param name="accountId">The account ID.</param>
 /// <param name="bucketName">The bucket name.</param>
 /// <param name="bucketType">The bucket type.</param>
 public CreateBucketV1Request(string accountId, string bucketName, BucketType bucketType)
     : base(UrlParams.Empty,
            HeaderParams.Empty,
            new BodyParams(
                RequiredParam.Of("accountId", accountId),
                RequiredParam.Of("bucketName", bucketName),
                RequiredParam.Of("bucketType", bucketType)
                )
            )
 {
 }
 /// <summary>
 /// Create a new list buckets request.
 /// </summary>
 /// <param name="accountId">The ID of the account to list buckets for.</param>
 public ListBucketsV1Request(string accountId)
     : base(UrlParams.Empty,
            HeaderParams.Empty,
            new BodyParams(RequiredParam.Of("accountId", accountId)))
 {
 }
Example #5
0
 /// <summary>
 /// Create a new <see cref="B2AuthenticationToken"/>.
 /// </summary>
 /// <param name="authString">The string representing the authorization token returned from a B2 authorize account request.</param>
 /// <param name="endpoint">The B2 endpoint for authorized API calls.</param>
 public B2AuthenticationToken(string authString, Uri endpoint)
 {
     Headers  = new HeaderParams(RequiredParam.Of("Authorization", authString));
     Endpoint = endpoint;
 }