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

com.twilio.sdk.resource.list.KeyList Maven / Gradle / Ivy

There is a newer version: 7.0.0-rc-10
Show newest version
package com.twilio.sdk.resource.list;

import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.ListResource;
import com.twilio.sdk.resource.factory.ResourceFactory;
import com.twilio.sdk.resource.instance.Key;
import org.apache.http.NameValuePair;

import java.util.List;
import java.util.Map;

/**
 * List resource representation for a Auth Key
 */
public class KeyList extends ListResource implements ResourceFactory {

    /**
     * Instantiates a new key list.
     *
     * @param client Twilio client
     */
    public KeyList(final TwilioRestClient client) {
        this(client, null);
    }

    /**
     * Instantiates a new key list.
     *
     * @param client Twilio client
     * @param filters request filters
     */
    public KeyList(final TwilioRestClient client, final Map filters) {
        super(client, filters);
    }

    @Override
    protected Key makeNew(TwilioRestClient client, Map params) {
        return new Key(client, params);
    }

    @Override
    protected String getListKey() {
        return "keys";
    }

    @Override
    protected String getResourceLocation() {
        return "/" + TwilioRestClient.DEFAULT_VERSION + "/Accounts/" + getRequestAccountSid() + "/Keys.json";
    }

    @Override
    public Key create(Map params) throws TwilioRestException {
        return makeNew(getClient(), getClient().safeRequest(getResourceLocation(), "POST", params).toMap());
    }

    @Override
    public Key create(List params) throws TwilioRestException {
        return makeNew(getClient(), getClient().safeRequest(getResourceLocation(), "POST", params).toMap());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy