All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cloudbees.api.CBAccount Maven / Gradle / Ivy

There is a newer version: 1.5.9
Show newest version
package com.cloudbees.api;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;

/**
 * Represents an account in the CloudBees platform.m
 * 

*

* An account is a unit of billing. * * @author Kohsuke Kawaguchi */ public class CBAccount extends CBObject { /** * This is the login ID of the account, a short alpha-numeric token without any special characters. */ String name; public List subscriptions; public CBUser addUser(CBUser user) throws IOException { return root.addUserToAccount(this, user); } /** * Adds the new subscription to the user. */ // this is what I want public CBSubscription addSubscription(CBSubscription sub) throws IOException { return root.jsonPOJORequest("v2/accounts/" + name + "/subscriptions", sub, CBSubscription.class, "POST"); } /** * @deprecated Use {@link #addSubscription(CBSubscription)} when it's ready */ // this is what we have today public CBSubscription addSubscription(String userid, CBSubscription sub) throws IOException { // TODO: why do we need to specify the user here? return root.jsonPOJORequest("v2/users/" + userid + "/accounts/" + name + "/subscriptions", sub, CBSubscription.class, "POST"); } public List getSubscriptions() throws IOException { return Arrays.asList(root.jsonPOJORequest("v2/accounts/" + name + "/subscriptions", null, CBSubscription[].class, "GET")); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy