Class MultipartBody

java.lang.Object
com.microsoft.kiota.MultipartBody
All Implemented Interfaces:
Parsable

public class MultipartBody extends Object implements Parsable
Represents a multipart body for a request or a response.
  • Field Details

    • requestAdapter

      @Nullable public RequestAdapter requestAdapter
      The request adapter to use for the multipart body serialization.
  • Constructor Details

    • MultipartBody

      public MultipartBody()
      Creates a new instance of the MultipartBody class.
  • Method Details

    • getBoundary

      @Nonnull public String getBoundary()
      Gets the boundary string for the multipart body.
      Returns:
      the boundary string for the multipart body.
    • addOrReplacePart

      public <T> void addOrReplacePart(@Nonnull String name, @Nonnull String contentType, @Nonnull T value)
      Adds or replaces a part in the multipart body.
      Type Parameters:
      T - the type of the part to add or replace.
      Parameters:
      name - the name of the part to add or replace.
      contentType - the content type of the part to add or replace.
      value - the value of the part to add or replace.
    • addOrReplacePart

      public <T> void addOrReplacePart(@Nonnull String name, @Nonnull String contentType, @Nonnull T value, @Nullable String filename)
      Adds or replaces a part in the multipart body.
      Type Parameters:
      T - the type of the part to add or replace.
      Parameters:
      name - the name of the part to add or replace.
      contentType - the content type of the part to add or replace.
      value - the value of the part to add or replace.
      filename - the value of the filename directive.
    • getPartValue

      @Nullable public Object getPartValue(@Nonnull String partName)
      Gets the content type of the part with the specified name.
      Parameters:
      partName - the name of the part to get.
      Returns:
      the content type of the part with the specified name.
    • removePart

      public boolean removePart(@Nonnull String partName)
      Gets the content type of the part with the specified name.
      Parameters:
      partName - the name of the part to get.
      Returns:
      the content type of the part with the specified name.
    • getFieldDeserializers

      @Nonnull public Map<String,Consumer<ParseNode>> getFieldDeserializers()
      Gets the deserialization information for this object.
      Specified by:
      getFieldDeserializers in interface Parsable
      Returns:
      The deserialization information for this object where each entry is a property key with its deserialization callback.
    • serialize

      public void serialize(@Nonnull SerializationWriter writer)
      Writes the objects properties to the current writer.
      Specified by:
      serialize in interface Parsable
      Parameters:
      writer - The writer to write to.