// Path: src/main/java/org/springframework/social/bitbucket/api/BitBucketPrivilege.java
// public enum BitBucketPrivilege {
// 
//     read, write, admin;
// 
// }
// 
// Path: src/main/java/org/springframework/social/bitbucket/api/PrivilegeOperations.java
// public interface PrivilegeOperations {
// 
//     /**
//      * Get the privileges on a given repository.
//      * 
//      * @param user
//      *            repository owner
//      * @param repoSlug
//      *            name of the repository
//      */
//     public List<RepoPrivilege> getRepoPrivileges(String user, String repoSlug);
// 
//     /**
//      * Set or change the privilege for the given recipient on some repository.
//      * 
//      * @param owner
//      *            the repository owner
//      * @param repoSlug
//      *            the repository name
//      * @param recipient
//      *            user for which to set the privilege
//      * @param privilege
//      *            new privilege value to set
//      */
//     public RepoPrivilege setPrivilege(String owner, String repoSlug,
//             String recipient, BitBucketPrivilege privilege);
// 
//     /**
//      * Removes the current privilege of the given recipient from some
//      * repository.
//      * 
//      * @param owner
//      *            the repository owner
//      * @param repoSlug
//      *            the repository name
//      * @param recipient
//      *            user for which to remove the privilege
//      */
//     public void removePrivilege(String owner, String repoSlug, String recipient);
// 
// }
// 
// Path: src/main/java/org/springframework/social/bitbucket/api/RepoPrivilege.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class RepoPrivilege {
// 
//     @JsonProperty("repo")
//     private String repository;
// 
//     @JsonProperty
//     private BitBucketPrivilege privilege;
// 
//     @JsonProperty
//     private BitBucketUser user;
// 
//     public String getRepository() {
//         return repository;
//     }
// 
//     public BitBucketPrivilege getPrivilege() {
//         return privilege;
//     }
// 
//     public BitBucketUser getUser() {
//         return user;
//     }
// 
// }


import static java.util.Arrays.*;
import java.util.List;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.social.bitbucket.api.BitBucketPrivilege;
import org.springframework.social.bitbucket.api.PrivilegeOperations;
import org.springframework.social.bitbucket.api.RepoPrivilege;
import org.springframework.web.client.RestTemplate;
/**
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.social.bitbucket.api.impl;




public class PrivilegeTemplate extends AbstractBitBucketOperations implements
        PrivilegeOperations {

    public PrivilegeTemplate(RestTemplate restTemplate, boolean authorized) {
        super(restTemplate, authorized);
    }

    @Override
    public List<RepoPrivilege> getRepoPrivileges(String user, String repoSlug) {
        return asList(restTemplate.getForObject(
                buildUrl("/privileges/{user}/{repo_slug}"),
                RepoPrivilege[].class, user, repoSlug));
    }

    @Override
    public RepoPrivilege setPrivilege(String owner, String repoSlug,
// Path: src/main/java/org/springframework/social/bitbucket/api/BitBucketPrivilege.java
// public enum BitBucketPrivilege {
// 
//     read, write, admin;
// 
// }
// 
// Path: src/main/java/org/springframework/social/bitbucket/api/PrivilegeOperations.java
// public interface PrivilegeOperations {
// 
//     /**
//      * Get the privileges on a given repository.
//      * 
//      * @param user
//      *            repository owner
//      * @param repoSlug
//      *            name of the repository
//      */
//     public List<RepoPrivilege> getRepoPrivileges(String user, String repoSlug);
// 
//     /**
//      * Set or change the privilege for the given recipient on some repository.
//      * 
//      * @param owner
//      *            the repository owner
//      * @param repoSlug
//      *            the repository name
//      * @param recipient
//      *            user for which to set the privilege
//      * @param privilege
//      *            new privilege value to set
//      */
//     public RepoPrivilege setPrivilege(String owner, String repoSlug,
//             String recipient, BitBucketPrivilege privilege);
// 
//     /**
//      * Removes the current privilege of the given recipient from some
//      * repository.
//      * 
//      * @param owner
//      *            the repository owner
//      * @param repoSlug
//      *            the repository name
//      * @param recipient
//      *            user for which to remove the privilege
//      */
//     public void removePrivilege(String owner, String repoSlug, String recipient);
// 
// }
// 
// Path: src/main/java/org/springframework/social/bitbucket/api/RepoPrivilege.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class RepoPrivilege {
// 
//     @JsonProperty("repo")
//     private String repository;
// 
//     @JsonProperty
//     private BitBucketPrivilege privilege;
// 
//     @JsonProperty
//     private BitBucketUser user;
// 
//     public String getRepository() {
//         return repository;
//     }
// 
//     public BitBucketPrivilege getPrivilege() {
//         return privilege;
//     }
// 
//     public BitBucketUser getUser() {
//         return user;
//     }
// 
// }


// Path: src/main/java/org/springframework/social/bitbucket/api/impl/PrivilegeTemplate.java
import static java.util.Arrays.*;
import java.util.List;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.social.bitbucket.api.BitBucketPrivilege;
import org.springframework.social.bitbucket.api.PrivilegeOperations;
import org.springframework.social.bitbucket.api.RepoPrivilege;
import org.springframework.web.client.RestTemplate;

/**
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.social.bitbucket.api.impl;




public class PrivilegeTemplate extends AbstractBitBucketOperations implements
        PrivilegeOperations {

    public PrivilegeTemplate(RestTemplate restTemplate, boolean authorized) {
        super(restTemplate, authorized);
    }

    @Override
    public List<RepoPrivilege> getRepoPrivileges(String user, String repoSlug) {
        return asList(restTemplate.getForObject(
                buildUrl("/privileges/{user}/{repo_slug}"),
                RepoPrivilege[].class, user, repoSlug));
    }

    @Override
    public RepoPrivilege setPrivilege(String owner, String repoSlug,
            String recipient, BitBucketPrivilege privilege) {