/******************************************************************************* **NOTE** This code was generated by a tool and will occasionally be overwritten. We welcome comments and issues regarding this code; they will be addressed in the generation tool. If you wish to submit pull requests, please do so for the templates in that tool. This code was generated by Vipr (https://github.com/microsoft/vipr) using the T4TemplateWriter (https://github.com/msopentech/vipr-t4templatewriter). Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License 2.0; see LICENSE in the source repository root for authoritative license information. ******************************************************************************/ package com.microsoft.services.graph.fetchers; import com.microsoft.services.graph.*; import com.google.common.util.concurrent.*; import com.microsoft.services.orc.core.*; import com.microsoft.services.orc.http.*; import static com.microsoft.services.orc.core.Helpers.*; import com.microsoft.services.orc.serialization.JsonSerializer; /** * The type UserOperations. */ public class UserOperations extends DirectoryObjectOperations { /** * Instantiates a new UserOperations. * * @param urlComponent the url component * @param parent the parent */ public UserOperations(String urlComponent, OrcExecutable parent) { super(urlComponent, parent); } /** * Add parameter. * * @param name the name * @param value the value * @return the operations */ public UserOperations addParameter(String name, Object value) { addCustomParameter(name, value); return this; } /** * Add header. * * @param name the name * @param value the value * @return the operations */ public UserOperations addHeader(String name, String value) { addCustomHeader(name, value); return this; } /** * assignLicense listenable future. * @param addLicenses the addLicenses @param removeLicenses the removeLicenses * @return the listenable future */ public ListenableFuture<User> assignLicense(java.util.List<AssignedLicense> addLicenses, java.util.List<java.util.UUID> removeLicenses) { JsonSerializer serializer = getResolver().getJsonSerializer(); String serializedaddLicenses = serializer.serialize(addLicenses); String serializedremoveLicenses = serializer.serialize(removeLicenses); ListenableFuture<String> future = assignLicenseRaw(serializedaddLicenses, serializedremoveLicenses); return transformToEntityListenableFuture(future, User.class, getResolver()); } /** * assignLicenseRaw listenable future. * @param addLicenses the addLicenses @param removeLicenses the removeLicenses * @return the listenable future */ public ListenableFuture<String> assignLicenseRaw(String addLicenses, String removeLicenses){ java.util.Map<String, String> map = new java.util.HashMap<String, String>(); map.put("addLicenses", addLicenses); map.put("removeLicenses", removeLicenses); Request request = getResolver().createRequest(); request.setVerb(HttpVerb.POST); request.setContent(getResolver().getJsonSerializer() .jsonObjectFromJsonMap(map).getBytes(Constants.UTF8)); request.getUrl().appendPathComponent("Microsoft.Graph.assignLicense"); ListenableFuture<OrcResponse> future = oDataExecute(request); return transformToStringListenableFuture(future); } /** * SendMail listenable future. * @param message the message @param saveToSentItems the saveToSentItems * @return the listenable future */ public ListenableFuture<Integer> sendMail(Message message, Boolean saveToSentItems) { JsonSerializer serializer = getResolver().getJsonSerializer(); String serializedMessage = serializer.serialize(message); String serializedSaveToSentItems = serializer.serialize(saveToSentItems); ListenableFuture<String> future = sendMailRaw(serializedMessage, serializedSaveToSentItems); return transformToEntityListenableFuture(future, Integer.class, getResolver()); } /** * SendMailRaw listenable future. * @param message the message @param saveToSentItems the saveToSentItems * @return the listenable future */ public ListenableFuture<String> sendMailRaw(String message, String saveToSentItems){ java.util.Map<String, String> map = new java.util.HashMap<String, String>(); map.put("Message", message); map.put("SaveToSentItems", saveToSentItems); Request request = getResolver().createRequest(); request.setVerb(HttpVerb.POST); request.setContent(getResolver().getJsonSerializer() .jsonObjectFromJsonMap(map).getBytes(Constants.UTF8)); request.getUrl().appendPathComponent("Microsoft.Graph.SendMail"); ListenableFuture<OrcResponse> future = oDataExecute(request); return transformToStringListenableFuture(future); } }