use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class LogStreamsEntity method delete.
/**
* Creates a request to delete a Log Stream.
* See the <a href="https://auth0.com/docs/api/management/v2#!/Log_Streams/delete_log_streams_by_id">API Documentation for more information.</a>
*
* @param logStreamId The ID of the Log Stream to delete.
* @return the request to execute.
*/
public Request<Void> delete(String logStreamId) {
Asserts.assertNotNull(logStreamId, "log stream id");
String url = baseUrl.newBuilder().addPathSegments(LOG_STREAMS_PATH).addPathSegment(logStreamId).build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
return request;
}
use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class OrganizationsEntity method deleteRoles.
/**
* Delete roles from a member of an organization. A token with {@code delete:organization_member_roles} scope is required.
*
* @param orgId the ID of the organization
* @param userId the ID of the user
* @param roles the roles to delete
* @return a Request to execute
*
* @see <a href="https://auth0.com/docs/api/management/v2#!/Organizations/delete_organization_member_roles">https://auth0.com/docs/api/management/v2#!/Organizations/delete_organization_member_roles</a>
*/
public Request<Void> deleteRoles(String orgId, String userId, Roles roles) {
Asserts.assertNotNull(orgId, "organization ID");
Asserts.assertNotNull(userId, "user ID");
Asserts.assertNotNull(roles, "roles");
String url = baseUrl.newBuilder().addPathSegments(ORGS_PATH).addPathSegment(orgId).addPathSegment("members").addPathSegment(userId).addPathSegment("roles").build().toString();
VoidRequest request = new VoidRequest(client, url, "DELETE");
request.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
request.setBody(roles);
return request;
}
use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class OrganizationsEntity method delete.
/**
* Delete an organization. A token with {@code delete:organizations} scope is required.
*
* @param orgId the ID of the organization to delete
* @return a Request to execute
*
* @see <a href="https://auth0.com/docs/api/management/v2#!/Organizations/delete_organizations_by_id">https://auth0.com/docs/api/management/v2#!/Organizations/delete_organizations_by_id</a>
*/
public Request<Void> delete(String orgId) {
Asserts.assertNotNull(orgId, "organization ID");
String url = baseUrl.newBuilder().addPathSegments(ORGS_PATH).addPathSegment(orgId).build().toString();
VoidRequest voidRequest = new VoidRequest(client, url, "DELETE");
voidRequest.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
return voidRequest;
}
use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class OrganizationsEntity method addRoles.
/**
* Add roles for a member of an organization. A token with {@code create:organization_member_roles} scope is required.
*
* @param orgId the ID of the organization
* @param userId the ID of the user
* @param roles the roles to add
* @return a Request to execute
*
* @see <a href="https://auth0.com/docs/api/management/v2#!/Organizations/post_organization_member_roles">https://auth0.com/docs/api/management/v2#!/Organizations/post_organization_member_roles</a>
*/
public Request<Void> addRoles(String orgId, String userId, Roles roles) {
Asserts.assertNotNull(orgId, "organization ID");
Asserts.assertNotNull(userId, "user ID");
Asserts.assertNotNull(roles, "roles");
String url = baseUrl.newBuilder().addPathSegments(ORGS_PATH).addPathSegment(orgId).addPathSegment("members").addPathSegment(userId).addPathSegment("roles").build().toString();
VoidRequest request = new VoidRequest(client, url, "POST");
request.addHeader(AUTHORIZATION_HEADER, "Bearer " + apiToken);
request.setBody(roles);
return request;
}
use of com.auth0.net.VoidRequest in project auth0-java by auth0.
the class RolesEntity method assignUsers.
/**
* Assign users to a role.
* A token with update:roles is needed.
* See https://auth0.com/docs/api/management/v2#!/Roles/post_role_users
*
* @param roleId the role id
* @param userIds a list of user ids to assign to the role
* @return a Request to execute.
*/
public Request<Void> assignUsers(String roleId, List<String> userIds) {
Asserts.assertNotNull(roleId, "role id");
Asserts.assertNotEmpty(userIds, "user ids");
Map<String, List<String>> body = new HashMap<>();
body.put("users", userIds);
String url = baseUrl.newBuilder().addEncodedPathSegments("api/v2/roles").addEncodedPathSegments(roleId).addEncodedPathSegments("users").build().toString();
VoidRequest request = new VoidRequest(this.client, url, "POST");
request.addHeader("Authorization", "Bearer " + apiToken);
request.setBody(body);
return request;
}
Aggregations