// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/dto/BitBucketError.java
// public class BitBucketError {
//     private String message;
//     private String context;
//     private String exceptionName;
// 
//     public BitBucketError(String message, String context, String exceptionName) {
//         this.context = context;
//         this.message = message;
//         this.exceptionName = exceptionName;
//     }
// 
//     @Nullable
//     public String getContext() {
//         return context;
//     }
// 
//     @Nullable
//     public String getMessage() {
//         return message;
//     }
// 
//     @Nullable
//     public String getExceptionName() {
//         return exceptionName;
//     }
// 
//     @Override
//     public String toString() {
//         return "BitBucketError{" +
//                 "message='" + message + '\'' +
//                 ", context='" + context + '\'' +
//                 ", exceptionName='" + exceptionName + '\'' +
//                 '}';
//     }
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static Function<JsonElement, BitBucketError> errorParser() {
//     return ERROR_PARSER;
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static <T> Function<JsonElement, List<T>> listParser(Function<JsonElement, T> elementParser) {
//     return new ListParser<>(elementParser);
// }


import com.ccreanga.bitbucket.rest.client.http.dto.BitBucketError;
import java.util.function.Function;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.List;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.errorParser;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.listParser;
/*
 *
 *  *
 *  * 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 com.ccreanga.bitbucket.rest.client.http.responseparsers;





public class ErrorsParser implements Function<JsonElement, List<BitBucketError>> {
    @Override
    public List<BitBucketError> apply(JsonElement input) {
        JsonObject jsonObject = input.getAsJsonObject();
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/dto/BitBucketError.java
// public class BitBucketError {
//     private String message;
//     private String context;
//     private String exceptionName;
// 
//     public BitBucketError(String message, String context, String exceptionName) {
//         this.context = context;
//         this.message = message;
//         this.exceptionName = exceptionName;
//     }
// 
//     @Nullable
//     public String getContext() {
//         return context;
//     }
// 
//     @Nullable
//     public String getMessage() {
//         return message;
//     }
// 
//     @Nullable
//     public String getExceptionName() {
//         return exceptionName;
//     }
// 
//     @Override
//     public String toString() {
//         return "BitBucketError{" +
//                 "message='" + message + '\'' +
//                 ", context='" + context + '\'' +
//                 ", exceptionName='" + exceptionName + '\'' +
//                 '}';
//     }
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static Function<JsonElement, BitBucketError> errorParser() {
//     return ERROR_PARSER;
// }
// 
// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/Parsers.java
// public static <T> Function<JsonElement, List<T>> listParser(Function<JsonElement, T> elementParser) {
//     return new ListParser<>(elementParser);
// }


// Path: src/main/java/com/ccreanga/bitbucket/rest/client/http/responseparsers/ErrorsParser.java
import com.ccreanga.bitbucket.rest.client.http.dto.BitBucketError;
import java.util.function.Function;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.List;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.errorParser;
import static com.ccreanga.bitbucket.rest.client.http.responseparsers.Parsers.listParser;

/*
 *
 *  *
 *  * 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 com.ccreanga.bitbucket.rest.client.http.responseparsers;





public class ErrorsParser implements Function<JsonElement, List<BitBucketError>> {
    @Override
    public List<BitBucketError> apply(JsonElement input) {
        JsonObject jsonObject = input.getAsJsonObject();
        return listParser(errorParser()).apply(jsonObject.get("error"));