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

io.sphere.sdk.customers.commands.CustomerCreateTokenCommand Maven / Gradle / Ivy

There is a newer version: 1.0.0-M12
Show newest version
package io.sphere.sdk.customers.commands;

import com.fasterxml.jackson.core.type.TypeReference;
import io.sphere.sdk.commands.CommandImpl;
import io.sphere.sdk.customers.CustomerToken;
import io.sphere.sdk.http.HttpRequest;
import io.sphere.sdk.utils.JsonUtils;

import static io.sphere.sdk.http.HttpMethod.POST;

public class CustomerCreateTokenCommand extends CommandImpl {
    private final String email;

    private CustomerCreateTokenCommand(final String customerEmail) {
        this.email = customerEmail;
    }

    public static CustomerCreateTokenCommand of(final String customerEmail) {
        return new CustomerCreateTokenCommand(customerEmail);
    }

    @Override
    protected TypeReference typeReference() {
        return CustomerToken.typeReference();
    }

    @Override
    public HttpRequest httpRequest() {
        return HttpRequest.of(POST, "/customers/password-token", JsonUtils.toJson(this));
    }

    public String getEmail() {
        return email;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy