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

com.starksign.utils.Api Maven / Gradle / Ivy

Go to download

Welcome to the Stark Sign Java SDK! This tool is made for Java developers who want to easily integrate with our API. This SDK version is compatible with the Stark Sign API v2.

The newest version!
package com.starksign.utils;


final class Api {
    static String endpoint(Resource.ClassData resource){
        return "/" + Case.camelToKebab(resource.name)
                         .replace("-log", "/log")
                         .replace("-attempt", "/attempt");
    }

    static String endpoint(Resource.ClassData resource, String id){
        return endpoint(resource) + "/" + id;
    }

    static String getLastNamePlural(Resource.ClassData resource){
        String lastName = getLastName(resource);
        if (lastName.endsWith("s"))
            return lastName;
        if (lastName.endsWith("ey"))
            return lastName + "s";
        if (lastName.endsWith("y"))
            return lastName.substring(0, lastName.length()-1) + "ies";
        return lastName + "s"; 
    }

    static String getLastName(Resource.ClassData resource){
        String kebabCase = Case.camelToKebab(resource.name);
        String[] kebabChunks = kebabCase.split("-");
        return kebabChunks[kebabChunks.length - 1];
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy