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

com.foilen.infra.api.service.InfraUserHumanApiServiceImpl Maven / Gradle / Ivy

The newest version!
/*
    Foilen Infra API
    https://github.com/foilen/foilen-infra-api
    Copyright (c) 2017-2021 Foilen (https://foilen.com)

    The MIT License
    http://opensource.org/licenses/MIT

 */
package com.foilen.infra.api.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

import com.foilen.infra.api.model.user.UserHumanWithPagination;
import com.foilen.infra.api.model.user.UserRoleEditForm;
import com.foilen.smalltools.restapi.model.FormResult;

public class InfraUserHumanApiServiceImpl implements InfraUserHumanApiService {

    private InfraApiServiceImpl infraApiService;

    public InfraUserHumanApiServiceImpl(InfraApiServiceImpl infraApiService) {
        this.infraApiService = infraApiService;
    }

    @Override
    public FormResult userHumanCreateByEmail(String userEmail) {
        Map uriVariables = new HashMap<>();
        uriVariables.put("userEmail", userEmail);
        return infraApiService.post("/api/userHuman/createByEmail/{userEmail}", null, uriVariables, FormResult.class);
    }

    @Override
    public FormResult userHumanEdit(String userId, UserRoleEditForm form) {
        Map uriVariables = new HashMap<>();
        uriVariables.put("userId", userId);
        return infraApiService.post("/api/userHuman/{userId}/roles", form, uriVariables, FormResult.class);
    }

    @Override
    public UserHumanWithPagination userHumanFindAll(int pageId, String search) {
        MultiValueMap queryParams = new LinkedMultiValueMap<>();
        queryParams.add("pageId", String.valueOf(pageId));
        queryParams.add("search", search);
        return infraApiService.get("/api/userHuman/", UserHumanWithPagination.class, null, queryParams);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy