Rest.Param.new_with_owner
Description: Reference for Rest.Param.new_with_owner

### Function

# Rest Paramnew_with_owner

#### Declaration [src]

    RestParam*
    rest_param_new_with_owner (
      const char* name,
      gconstpointer data,
      gsize length,
      const char* content_type,
      const char* filename,
      gpointer owner,
      GDestroyNotify owner_dnotify
    )

#### Description [src]

Create a new `RestParam` called `name` with `length` bytes of `data` as the value. `content_type` is the type of the data as a MIME type, for example “text/plain” for simple string parameters.

If the parameter is a file upload it can be passed as `filename`.

When the `RestParam` is freed, it will call `owner_dnotify`, passing `owner` to it. This allows you to do something like this:

    GMappedFile *map = g_mapped_file_new (filename, FALSE, &error);
    RestParam *param = rest_param_new_with_owner ("media",
                                                  g_mapped_file_get_contents (map),
                                                  g_mapped_file_get_length (map),
                                                  "image/jpeg",
                                                  filename,
                                                  map,
                                                  (GDestroyNotify)g_mapped_file_unref);

#### Parameters

`name`

  Type: `const char*`

  The parameter name.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`data`

  Type: An array of `guint8`

  A pointer to the start of the data.

  The length of the array is specified in the `length` argument.

`length`

  Type: `gsize`

  The length of the data.

`content_type`

  Type: `const char*`

  The content type of the data.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`filename`

  Type: `const char*`

  The original filename, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`owner`

  Type: `gpointer`

  Pointer to an object that owns `data`.

  The argument can be `NULL`.
  The called function takes ownership of the data, and is responsible for freeing it.

`owner_dnotify`

  Type: `GDestroyNotify`

  A function to free/unref `owner` when the buffer is freed.

#### Return value

Type: `RestParam`

A new `RestParam`.

The caller of the function takes ownership of the data, and is responsible for freeing it.