Rest.Param¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
Details¶
- class Rest.Param¶
- classmethod new_full(name, use, data, content_type, filename)¶
- Parameters:
name (
str
) – the parameter nameuse (
Rest.MemoryUse
) – theRest.MemoryUse
describing how the memory can be useddata (
bytes
) – a pointer to the start of the datacontent_type (
str
) – the content type of the data
- Returns:
a new
Rest.Param
.- Return type:
Create a new
Rest.Param
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.
- classmethod new_string(name, use, string)¶
- Parameters:
name (
str
) – the parameter nameuse (
Rest.MemoryUse
) – theRest.MemoryUse
describing how the memory can be usedstring (
str
) – the parameter value
- Returns:
a new
Rest.Param
.- Return type:
A convience constructor to create a
Rest.Param
from a given UTF-8 string. The resultingRest.Param
will have a content type of “text/plain”.
- classmethod new_with_owner(name, data, content_type, filename, owner, owner_dnotify)¶
- Parameters:
- Returns:
a new
Rest.Param
.- Return type:
Create a new
Rest.Param
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
Rest.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);
- get_content()¶
-
Get the content of self. The content should be treated as read-only and not modified in any way.
- get_content_length()¶
- Returns:
the length of the content
- Return type:
Get the length of the content of self.
- get_content_type()¶
- Returns:
the MIME type
- Return type:
Get the MIME type of the parameter. For example, basic strings have the MIME type “text/plain”.
- get_file_name()¶
-
Get the original file name of the parameter, if one is available.
- is_string()¶
-
Determine if the parameter is a string value, i.e. the content type is “text/plain”.
- ref()¶
- Returns:
the
Rest.Param
- Return type:
Increase the reference count on self.
- unref()¶
Decrease the reference count on self, destroying it if the reference count reaches 0.