2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.so.rest.service;
23 import org.springframework.http.ResponseEntity;
25 import com.google.common.base.Optional;
28 * @author waqas.ikram@est.tech
30 public interface HttpRestServiceProvider {
33 * Execute the HTTP GET to the given URI template
36 * @param clazz the type of the return value
37 * @return Returns the body of this entity.
39 public <T> Optional<T> get(final String url, final Class<T> clazz);
42 * Execute the HTTP GET to the given URI template
45 * @param clazz the type of the return value
46 * @return Returns the {@link ResponseEntity}.
48 public <T> ResponseEntity<T> getHttpResponse(final String url, final Class<T> clazz);
52 * Execute the HTTP POST to the given URI template
54 * @param object the entity (i.e. body) to write to the request
56 * @param clazz the type of the return value
57 * @return Returns the body of this entity.
59 public <T> Optional<T> post(final Object object, final String url, final Class<T> clazz);
62 * Execute the HTTP POST to the given URI template
64 * @param object the entity (i.e. body) to write to the request
66 * @param clazz the type of the return value
67 * @return Returns the {@link ResponseEntity}.
69 public <T> ResponseEntity<T> postHttpRequest(final Object object, final String url, final Class<T> clazz);
72 * Execute the HTTP DELETE to the given URI template
75 * @param clazz the type of the return value
76 * @return Returns the {@link ResponseEntity}.
78 public <T> ResponseEntity<T> deleteHttpRequest(final String url, final Class<T> clazz);