001package co.codewizards.cloudstore.rest.client.request;
002
003import static java.util.Objects.*;
004
005import javax.ws.rs.core.Response;
006
007public class Copy extends VoidRequest {
008
009        private final String repositoryName;
010        private final String fromPath;
011        private final String toPath;
012
013        public Copy(final String repositoryName, final String fromPath, final String toPath) {
014                this.repositoryName = requireNonNull(repositoryName, "repositoryName");
015                this.fromPath = requireNonNull(fromPath, "fromPath");
016                this.toPath = requireNonNull(toPath, "toPath");
017        }
018
019        @Override
020        protected Response _execute() {
021                return assignCredentials(createWebTarget("_copy", urlEncode(repositoryName), encodePath(fromPath))
022                                .queryParam("to", encodePath(toPath))
023                                .request()).post(null);
024        }
025
026}