All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yodlee.sdk.client.ApiContext Maven / Gradle / Ivy

There is a newer version: 1.0.31
Show newest version
/**
 * Copyright (c) 2019 Yodlee, Inc. All Rights Reserved.
 *
 * Licensed under the MIT License. See LICENSE file in the project root for license information.
 */
package com.yodlee.sdk.client;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ApiContext {

	private String path;

	private HttpMethod httpMethod;

	private final List queryParams;

	private final List collectionQueryParams;

	private final Object body;

	private final Map headerParams;

	private final Map formParams;

	private String[] authNames;

	public ApiContext(String path, HttpMethod httpMethod, Object body) {
		this.path = path;
		this.httpMethod = httpMethod;
		this.body = body;
		queryParams = new ArrayList<>();
		collectionQueryParams = new ArrayList<>();
		headerParams = new HashMap<>();
		formParams = new HashMap<>();
		headerParams.put("Accept", "application/json");
		headerParams.put("Content-Type", "application/json");
	}

	public String getPath() {
		return path;
	}

	public HttpMethod getHttpMethod() {
		return httpMethod;
	}

	public List getQueryParams() {
		return Collections.unmodifiableList(queryParams);
	}

	public void addQueryParam(Pair queryParam) {
		queryParams.add(queryParam);
	}

	public void removeQueryParam(Pair queryParam) {
		queryParams.remove(queryParam);
	}

	public void clearQueryParams() {
		queryParams.clear();
	}

	public List getCollectionQueryParams() {
		return Collections.unmodifiableList(collectionQueryParams);
	}

	public Object getBody() {
		return body;
	}

	public Map getHeaderParams() {
		return Collections.unmodifiableMap(headerParams);
	}

	public String addHeaderParam(String key, String value) {
		return headerParams.put(key, value);
	}

	public String removeHeaderParam(String key) {
		return headerParams.remove(key);
	}

	public void clearHeaderParams() {
		headerParams.clear();
	}

	public Map getFormParams() {
		return Collections.unmodifiableMap(formParams);
	}

	public Object addFormParam(String key, Object value) {
		return formParams.put(key, value);
	}

	public Object removeFormParam(String key) {
		return formParams.remove(key);
	}

	public void clearFormParams() {
		formParams.clear();
	}

	public String[] getAuthNames() {
		return authNames;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy