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

com.withabound.resources.Users Maven / Gradle / Ivy

Go to download

The Abound Java SDK provides convenient access to the Abound API from applications written in Java.

The newest version!
package com.withabound.resources;

import com.withabound.AboundConfig;
import com.withabound.models.users.User;
import com.withabound.models.users.UserParams;
import com.withabound.models.users.UserRequest;
import com.withabound.resources.base.AboundBaseResource;
import com.withabound.resources.base.AboundBulkResponse;
import com.withabound.resources.base.AboundResponse;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import okhttp3.OkHttpClient;

/** See https://docs.withabound.com/reference/users */
public class Users extends AboundBaseResource {
  @Override
  protected String getPath() {
    return "/users";
  }

  public Users(final AboundConfig aboundConfig, final OkHttpClient httpClient) {
    super(aboundConfig, httpClient, User.class);
  }

  public AboundResponse create(final UserRequest toCreate) throws IOException {
    final Map requestPayload = Collections.singletonMap("user", toCreate);

    return super.create(requestPayload);
  }

  @Override
  public AboundBulkResponse list() throws IOException {
    return super.list();
  }

  public AboundBulkResponse list(final UserParams params) throws IOException {
    return super.list(params);
  }

  @Override
  public AboundResponse retrieve(final String userId) throws IOException {
    return super.retrieve(userId);
  }

  public AboundResponse update(final String userId, final UserRequest toUpdate)
      throws IOException {
    final Map requestPayload = Collections.singletonMap("user", toUpdate);

    return super.update(userId, requestPayload);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy