// Path: spring-wpapi-core/src/main/java/org/kamranzafar/spring/wpapi/PostStatus.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class PostStatus implements Serializable {
//     private String name;
//     @JsonProperty("public")
//     private boolean postPublic;
//     @JsonProperty("private")
//     private boolean postPrivate;
//     @JsonProperty("protected")
//     private boolean postProtected;
//     private boolean queryable;
//     @JsonProperty("show_in_list")
//     private boolean showInList;
//     private String slug;
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public boolean isPostPublic() {
//         return postPublic;
//     }
// 
//     public void setPostPublic(boolean postPublic) {
//         this.postPublic = postPublic;
//     }
// 
//     public boolean isPostPrivate() {
//         return postPrivate;
//     }
// 
//     public void setPostPrivate(boolean postPrivate) {
//         this.postPrivate = postPrivate;
//     }
// 
//     public boolean isPostProtected() {
//         return postProtected;
//     }
// 
//     public void setPostProtected(boolean postProtected) {
//         this.postProtected = postProtected;
//     }
// 
//     public boolean isQueryable() {
//         return queryable;
//     }
// 
//     public void setQueryable(boolean queryable) {
//         this.queryable = queryable;
//     }
// 
//     public boolean isShowInList() {
//         return showInList;
//     }
// 
//     public void setShowInList(boolean showInList) {
//         this.showInList = showInList;
//     }
// 
//     public String getSlug() {
//         return slug;
//     }
// 
//     public void setSlug(String slug) {
//         this.slug = slug;
//     }
// }
// 
// Path: spring-wpapi-client/src/main/java/org/kamranzafar/spring/wpapi/client/BaseService.java
// public abstract class BaseService<T> implements WpApiService<T> {
//     @Autowired
//     protected WpApiConfig wpApiConfig;
// 
//     @Autowired
//     protected RestTemplate restTemplate;
// 
//     @Override
//     public T get(int id) {
//         return restTemplate.getForObject(buildUri() + "/" + id, getType());
//     }
// 
//     @Override
//     public T get(int id, Map<String, String> params) {
//         return restTemplate.getForObject(buildUri(buildUri() + "/" + id, params), getType());
//     }
// 
//     @Override
//     public void create(T obj) {
//         restTemplate.postForLocation(buildUri(), obj);
//     }
// 
//     @Override
//     public void update(T obj) {
//         restTemplate.postForLocation(buildUri(), obj);
//     }
// 
//     @Override
//     public void delete(int id) {
//         restTemplate.delete(buildUri() + "/" + id);
//     }
// 
//     protected String buildUri() {
//         return (wpApiConfig.isHttps() ? "https://" : "http://") + wpApiConfig.getHost() + ":" + wpApiConfig.getPort() + "/" + wpApiConfig.getApiBase() + "/" + getUrlPostfix();
//     }
// 
//     protected URI buildUri(String uri, Map<String, String> params) {
//         UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(uri);
// 
//         params.forEach((k, v) -> uriComponentsBuilder.queryParam(k, v));
// 
//         return uriComponentsBuilder.build().toUri();
//     }
// 
//     protected URI buildUri(Map<String, String> params) {
//         return buildUri(buildUri(), params);
//     }
// 
//     protected abstract String getUrlPostfix();
// }
// 
// Path: spring-wpapi-client/src/main/java/org/kamranzafar/spring/wpapi/client/WpApiException.java
// public class WpApiException extends RuntimeException {
//     public WpApiException(String message) {
//         super(message);
//     }
// 
//     public WpApiException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }


import org.kamranzafar.spring.wpapi.PostStatus;
import org.kamranzafar.spring.wpapi.client.BaseService;
import org.kamranzafar.spring.wpapi.client.WpApiException;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
 * Copyright 2016 Kamran Zafar
 *
 * 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.kamranzafar.spring.wpapi.client.impl;



/**
 * Created by kamran on 07/08/16.
 */
@Service
public class PostStatusService extends BaseService<PostStatus> {
    @Override
    public PostStatus[] getAll() {
        return restTemplate.getForObject(buildUri(), PostStatus[].class);
    }

    @Override
    public PostStatus[] getAll(Map<String, String> params) {
        return restTemplate.getForObject(buildUri(params), PostStatus[].class);
    }

    @Override
    public void create(PostStatus obj) {
// Path: spring-wpapi-core/src/main/java/org/kamranzafar/spring/wpapi/PostStatus.java
// @JsonIgnoreProperties(ignoreUnknown = true)
// public class PostStatus implements Serializable {
//     private String name;
//     @JsonProperty("public")
//     private boolean postPublic;
//     @JsonProperty("private")
//     private boolean postPrivate;
//     @JsonProperty("protected")
//     private boolean postProtected;
//     private boolean queryable;
//     @JsonProperty("show_in_list")
//     private boolean showInList;
//     private String slug;
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public boolean isPostPublic() {
//         return postPublic;
//     }
// 
//     public void setPostPublic(boolean postPublic) {
//         this.postPublic = postPublic;
//     }
// 
//     public boolean isPostPrivate() {
//         return postPrivate;
//     }
// 
//     public void setPostPrivate(boolean postPrivate) {
//         this.postPrivate = postPrivate;
//     }
// 
//     public boolean isPostProtected() {
//         return postProtected;
//     }
// 
//     public void setPostProtected(boolean postProtected) {
//         this.postProtected = postProtected;
//     }
// 
//     public boolean isQueryable() {
//         return queryable;
//     }
// 
//     public void setQueryable(boolean queryable) {
//         this.queryable = queryable;
//     }
// 
//     public boolean isShowInList() {
//         return showInList;
//     }
// 
//     public void setShowInList(boolean showInList) {
//         this.showInList = showInList;
//     }
// 
//     public String getSlug() {
//         return slug;
//     }
// 
//     public void setSlug(String slug) {
//         this.slug = slug;
//     }
// }
// 
// Path: spring-wpapi-client/src/main/java/org/kamranzafar/spring/wpapi/client/BaseService.java
// public abstract class BaseService<T> implements WpApiService<T> {
//     @Autowired
//     protected WpApiConfig wpApiConfig;
// 
//     @Autowired
//     protected RestTemplate restTemplate;
// 
//     @Override
//     public T get(int id) {
//         return restTemplate.getForObject(buildUri() + "/" + id, getType());
//     }
// 
//     @Override
//     public T get(int id, Map<String, String> params) {
//         return restTemplate.getForObject(buildUri(buildUri() + "/" + id, params), getType());
//     }
// 
//     @Override
//     public void create(T obj) {
//         restTemplate.postForLocation(buildUri(), obj);
//     }
// 
//     @Override
//     public void update(T obj) {
//         restTemplate.postForLocation(buildUri(), obj);
//     }
// 
//     @Override
//     public void delete(int id) {
//         restTemplate.delete(buildUri() + "/" + id);
//     }
// 
//     protected String buildUri() {
//         return (wpApiConfig.isHttps() ? "https://" : "http://") + wpApiConfig.getHost() + ":" + wpApiConfig.getPort() + "/" + wpApiConfig.getApiBase() + "/" + getUrlPostfix();
//     }
// 
//     protected URI buildUri(String uri, Map<String, String> params) {
//         UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromUriString(uri);
// 
//         params.forEach((k, v) -> uriComponentsBuilder.queryParam(k, v));
// 
//         return uriComponentsBuilder.build().toUri();
//     }
// 
//     protected URI buildUri(Map<String, String> params) {
//         return buildUri(buildUri(), params);
//     }
// 
//     protected abstract String getUrlPostfix();
// }
// 
// Path: spring-wpapi-client/src/main/java/org/kamranzafar/spring/wpapi/client/WpApiException.java
// public class WpApiException extends RuntimeException {
//     public WpApiException(String message) {
//         super(message);
//     }
// 
//     public WpApiException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }


// Path: spring-wpapi-client/src/main/java/org/kamranzafar/spring/wpapi/client/impl/PostStatusService.java
import org.kamranzafar.spring.wpapi.PostStatus;
import org.kamranzafar.spring.wpapi.client.BaseService;
import org.kamranzafar.spring.wpapi.client.WpApiException;
import org.springframework.stereotype.Service;
import java.util.Map;

/**
 * Copyright 2016 Kamran Zafar
 *
 * 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.kamranzafar.spring.wpapi.client.impl;



/**
 * Created by kamran on 07/08/16.
 */
@Service
public class PostStatusService extends BaseService<PostStatus> {
    @Override
    public PostStatus[] getAll() {
        return restTemplate.getForObject(buildUri(), PostStatus[].class);
    }

    @Override
    public PostStatus[] getAll(Map<String, String> params) {
        return restTemplate.getForObject(buildUri(params), PostStatus[].class);
    }

    @Override
    public void create(PostStatus obj) {
        throw new WpApiException("Not supported");