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

com.revinate.sendgrid.resource.ApiKeyResource Maven / Gradle / Ivy

package com.revinate.sendgrid.resource;

import com.revinate.sendgrid.exception.SendGridException;
import com.revinate.sendgrid.model.ApiKey;
import com.revinate.sendgrid.net.SendGridHttpClient;
import com.revinate.sendgrid.net.SendGridHttpClient.RequestType;
import com.revinate.sendgrid.net.auth.Credential;

public class ApiKeyResource extends EntityResource {

    public ApiKeyResource(String baseUrl, SendGridHttpClient client, Credential credential, ApiKey apiKey) {
        super(baseUrl, client, credential, ApiKey.class, apiKey);
    }

    public ApiKeyResource(String baseUrl, SendGridHttpClient client, Credential credential, String id) {
        super(baseUrl, client, credential, ApiKey.class, id);
    }

    @Override
    public ApiKey update(ApiKey apiKey) throws SendGridException {
        ApiKey requestObject = new ApiKey(apiKey.getName());
        requestObject.setScopes(apiKey.getScopes());
        return client.put(getUrl(), ApiKey.class, credential, requestObject, RequestType.JSON);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy