[ CCode ( has_construct_function = false ) ]
public Param.with_owner (string name, uint8[] data, string content_type, string? filename, void* owner, DestroyNotify? owner_dnotify)
Create a new Param called name
with data.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 Param 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);
name |
the parameter name |
data |
a pointer to the start of the data |
content_type |
the content type of the data |
filename |
the original filename, or |
owner |
pointer to an object that owns |
owner_dnotify |
a function to free/unref |
length |
the length of the data |
a new Param. |