///
///
///
///
/**
* Type Definitions for Gjs (https://gjs.guide/)
*
* These type definitions are automatically generated, do not edit them by hand.
* If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
*
* The based EJS template file is used for the generated .d.ts file of each GIR module like Gtk-4.0, GObject-2.0, ...
*/
declare module 'gi://Soup?version=2.4' {
// Module dependencies
import type Gio from 'gi://Gio?version=2.0';
import type GObject from 'gi://GObject?version=2.0';
import type GLib from 'gi://GLib?version=2.0';
import type GModule from 'gi://GModule?version=2.0';
export namespace Soup {
/**
* Soup-2.4
*/
/**
* The supported address families.
*/
/**
* The supported address families.
*/
export namespace AddressFamily {
export const $gtype: GObject.GType;
}
enum AddressFamily {
/**
* an invalid %SoupAddress
*/
INVALID,
/**
* an IPv4 address
*/
IPV4,
/**
* an IPv6 address
*/
IPV6,
}
export namespace CacheResponse {
export const $gtype: GObject.GType;
}
enum CacheResponse {
FRESH,
NEEDS_VALIDATION,
STALE,
}
/**
* The type of cache; this affects what kinds of responses will be
* saved.
*/
/**
* The type of cache; this affects what kinds of responses will be
* saved.
*/
export namespace CacheType {
export const $gtype: GObject.GType;
}
enum CacheType {
/**
* a single-user cache
*/
SINGLE_USER,
/**
* a shared cache
*/
SHARED,
}
export namespace ConnectionState {
export const $gtype: GObject.GType;
}
enum ConnectionState {
NEW,
CONNECTING,
IDLE,
IN_USE,
REMOTE_DISCONNECTED,
DISCONNECTED,
}
/**
* The policy for accepting or rejecting cookies returned in
* responses.
*/
/**
* The policy for accepting or rejecting cookies returned in
* responses.
*/
export namespace CookieJarAcceptPolicy {
export const $gtype: GObject.GType;
}
enum CookieJarAcceptPolicy {
/**
* accept all cookies unconditionally.
*/
ALWAYS,
/**
* reject all cookies unconditionally.
*/
NEVER,
/**
* accept all cookies set by
* the main document loaded in the application using libsoup. An
* example of the most common case, web browsers, would be: If
* http://www.example.com is the page loaded, accept all cookies set
* by example.com, but if a resource from http://www.third-party.com
* is loaded from that page reject any cookie that it could try to
* set. For libsoup to be able to tell apart first party cookies from
* the rest, the application must call soup_message_set_first_party()
* on each outgoing #SoupMessage, setting the #SoupURI of the main
* document. If no first party is set in a message when this policy is
* in effect, cookies will be assumed to be third party by default.
*/
NO_THIRD_PARTY,
/**
* accept all cookies
* set by the main document loaded in the application using libsoup, and
* from domains that have previously set at least one cookie when loaded
* as the main document. An example of the most common case, web browsers,
* would be: if http://www.example.com is the page loaded, accept all
* cookies set by example.com, but if a resource from http://www.third-party.com
* is loaded from that page, reject any cookie that it could try to
* set unless it already has a cookie in the cookie jar. For libsoup to
* be able to tell apart first party cookies from the rest, the
* application must call soup_message_set_first_party() on each outgoing
* #SoupMessage, setting the #SoupURI of the main document. If no first
* party is set in a message when this policy is in effect, cookies will
* be assumed to be third party by default. Since 2.72.
*/
GRANDFATHERED_THIRD_PARTY,
}
/**
* Date formats that soup_date_to_string() can use.
*
* `SOUP_DATE_HTTP` and `SOUP_DATE_COOKIE` always coerce the time to
* UTC. `SOUP_DATE_ISO8`601_XMLRPC uses the time as given, ignoring the
* offset completely. `SOUP_DATE_RFC2`822 and the other ISO 8601
* variants use the local time, appending the offset information if
* available.
*
* This enum may be extended with more values in future releases.
*/
/**
* Date formats that soup_date_to_string() can use.
*
* `SOUP_DATE_HTTP` and `SOUP_DATE_COOKIE` always coerce the time to
* UTC. `SOUP_DATE_ISO8`601_XMLRPC uses the time as given, ignoring the
* offset completely. `SOUP_DATE_RFC2`822 and the other ISO 8601
* variants use the local time, appending the offset information if
* available.
*
* This enum may be extended with more values in future releases.
*/
export namespace DateFormat {
export const $gtype: GObject.GType;
}
enum DateFormat {
/**
* RFC 1123 format, used by the HTTP "Date" header. Eg
* "Sun, 06 Nov 1994 08:49:37 GMT"
*/
HTTP,
/**
* The format for the "Expires" timestamp in the
* Netscape cookie specification. Eg, "Sun, 06-Nov-1994 08:49:37 GMT".
*/
COOKIE,
/**
* RFC 2822 format, eg "Sun, 6 Nov 1994 09:49:37 -0100"
*/
RFC2822,
/**
* ISO 8601 date/time with no optional
* punctuation. Eg, "19941106T094937-0100".
*/
ISO8601_COMPACT,
/**
* ISO 8601 date/time with all optional
* punctuation. Eg, "1994-11-06T09:49:37-01:00".
*/
ISO8601_FULL,
/**
* An alias for `SOUP_DATE_ISO8`601_FULL.
*/
ISO8601,
/**
* ISO 8601 date/time as used by XML-RPC.
* Eg, "19941106T09:49:37".
*/
ISO8601_XMLRPC,
}
/**
* How a message body is encoded for transport
*/
/**
* How a message body is encoded for transport
*/
export namespace Encoding {
export const $gtype: GObject.GType;
}
enum Encoding {
/**
* unknown / error
*/
UNRECOGNIZED,
/**
* no body is present (which is not the same as a
* 0-length body, and only occurs in certain places)
*/
NONE,
/**
* Content-Length encoding
*/
CONTENT_LENGTH,
/**
* Response body ends when the connection is closed
*/
EOF,
/**
* chunked encoding (currently only supported
* for response)
*/
CHUNKED,
/**
* multipart/byteranges (Reserved for future
* use: NOT CURRENTLY IMPLEMENTED)
*/
BYTERANGES,
}
/**
* Indicates the HTTP protocol version being used.
*/
/**
* Indicates the HTTP protocol version being used.
*/
export namespace HTTPVersion {
export const $gtype: GObject.GType;
}
enum HTTPVersion {
/**
* HTTP 1.0 (RFC 1945)
*/
HTTP_1_0,
/**
* HTTP 1.1 (RFC 2616)
*/
HTTP_1_1,
}
export namespace KnownStatusCode {
export const $gtype: GObject.GType;
}
enum KnownStatusCode {
NONE,
CANCELLED,
CANT_RESOLVE,
CANT_RESOLVE_PROXY,
CANT_CONNECT,
CANT_CONNECT_PROXY,
SSL_FAILED,
IO_ERROR,
MALFORMED,
TRY_AGAIN,
TOO_MANY_REDIRECTS,
TLS_FAILED,
CONTINUE,
SWITCHING_PROTOCOLS,
PROCESSING,
OK,
CREATED,
ACCEPTED,
NON_AUTHORITATIVE,
NO_CONTENT,
RESET_CONTENT,
PARTIAL_CONTENT,
MULTI_STATUS,
MULTIPLE_CHOICES,
MOVED_PERMANENTLY,
FOUND,
MOVED_TEMPORARILY,
SEE_OTHER,
NOT_MODIFIED,
USE_PROXY,
NOT_APPEARING_IN_THIS_PROTOCOL,
TEMPORARY_REDIRECT,
BAD_REQUEST,
UNAUTHORIZED,
PAYMENT_REQUIRED,
FORBIDDEN,
NOT_FOUND,
METHOD_NOT_ALLOWED,
NOT_ACCEPTABLE,
PROXY_AUTHENTICATION_REQUIRED,
PROXY_UNAUTHORIZED,
REQUEST_TIMEOUT,
CONFLICT,
GONE,
LENGTH_REQUIRED,
PRECONDITION_FAILED,
REQUEST_ENTITY_TOO_LARGE,
REQUEST_URI_TOO_LONG,
UNSUPPORTED_MEDIA_TYPE,
REQUESTED_RANGE_NOT_SATISFIABLE,
INVALID_RANGE,
EXPECTATION_FAILED,
UNPROCESSABLE_ENTITY,
LOCKED,
FAILED_DEPENDENCY,
INTERNAL_SERVER_ERROR,
NOT_IMPLEMENTED,
BAD_GATEWAY,
SERVICE_UNAVAILABLE,
GATEWAY_TIMEOUT,
HTTP_VERSION_NOT_SUPPORTED,
INSUFFICIENT_STORAGE,
NOT_EXTENDED,
}
/**
* Describes the level of logging output to provide.
*/
/**
* Describes the level of logging output to provide.
*/
export namespace LoggerLogLevel {
export const $gtype: GObject.GType;
}
enum LoggerLogLevel {
/**
* No logging
*/
NONE,
/**
* Log the Request-Line or Status-Line and
* the Soup-Debug pseudo-headers
*/
MINIMAL,
/**
* Log the full request/response headers
*/
HEADERS,
/**
* Log the full headers and request/response
* bodies.
*/
BODY,
}
/**
* Describes how #SoupBuffer should use the data passed in by the
* caller.
*
* See also soup_buffer_new_with_owner(), which allows to you create a
* buffer containing data which is owned by another object.
*/
/**
* Describes how #SoupBuffer should use the data passed in by the
* caller.
*
* See also soup_buffer_new_with_owner(), which allows to you create a
* buffer containing data which is owned by another object.
*/
export namespace MemoryUse {
export const $gtype: GObject.GType;
}
enum MemoryUse {
/**
* The memory is statically allocated and
* constant; libsoup can use the passed-in buffer directly and not
* need to worry about it being modified or freed.
*/
STATIC,
/**
* The caller has allocated the memory for the
* #SoupBuffer's use; libsoup will assume ownership of it and free it
* (with g_free()) when it is done with it.
*/
TAKE,
/**
* The passed-in data belongs to the caller; the
* #SoupBuffer will copy it into new memory, leaving the caller free
* to reuse the original memory.
*/
COPY,
/**
* The passed-in data belongs to the caller,
* but will remain valid for the lifetime of the #SoupBuffer. The
* difference between this and `SOUP_MEMORY_STATIC` is that if you copy
* a `SOUP_MEMORY_TEMPORARY` buffer, it will make a copy of the memory
* as well, rather than reusing the original memory.
*/
TEMPORARY,
}
/**
* Value passed to soup_message_headers_new() to set certain default
* behaviors.
*/
/**
* Value passed to soup_message_headers_new() to set certain default
* behaviors.
*/
export namespace MessageHeadersType {
export const $gtype: GObject.GType;
}
enum MessageHeadersType {
/**
* request headers
*/
REQUEST,
/**
* response headers
*/
RESPONSE,
/**
* multipart body part headers
*/
MULTIPART,
}
/**
* Priorities that can be set on a #SoupMessage to instruct the
* message queue to process it before any other message with lower
* priority.
*/
/**
* Priorities that can be set on a #SoupMessage to instruct the
* message queue to process it before any other message with lower
* priority.
*/
export namespace MessagePriority {
export const $gtype: GObject.GType;
}
enum MessagePriority {
/**
* The lowest priority, the messages
* with this priority will be the last ones to be attended.
*/
VERY_LOW,
/**
* Use this for low priority messages, a
* #SoupMessage with the default priority will be processed first.
*/
LOW,
/**
* The default priotity, this is the
* priority assigned to the #SoupMessage by default.
*/
NORMAL,
/**
* High priority, a #SoupMessage with
* this priority will be processed before the ones with the default
* priority.
*/
HIGH,
/**
* The highest priority, use this
* for very urgent #SoupMessage as they will be the first ones to be
* attended.
*/
VERY_HIGH,
}
/**
* A #SoupRequest error.
*/
class RequestError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
/**
* the URI could not be parsed
*/
static BAD_URI: number;
/**
* the URI scheme is not
* supported by this #SoupSession
*/
static UNSUPPORTED_URI_SCHEME: number;
/**
* the server's response could not
* be parsed
*/
static PARSING: number;
/**
* the server's response was in an
* unsupported format
*/
static ENCODING: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
class RequesterError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
static BAD_URI: number;
static UNSUPPORTED_URI_SCHEME: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
export namespace SameSitePolicy {
export const $gtype: GObject.GType;
}
enum SameSitePolicy {
/**
* The cookie is exposed with both cross-site and same-site requests
*/
NONE,
/**
* The cookie is withheld on cross-site requests but exposed on cross-site navigations
*/
LAX,
/**
* The cookie is only exposed for same-site requests
*/
STRICT,
}
/**
* Return value from the #SoupSocket IO methods.
*/
/**
* Return value from the #SoupSocket IO methods.
*/
export namespace SocketIOStatus {
export const $gtype: GObject.GType;
}
enum SocketIOStatus {
/**
* Success
*/
OK,
/**
* Cannot read/write any more at this time
*/
WOULD_BLOCK,
/**
* End of file
*/
EOF,
/**
* Other error
*/
ERROR,
}
/**
* These represent the known HTTP status code values, plus various
* network and internal errors.
*
* Note that no libsoup functions take or return this type directly;
* any function that works with status codes will accept unrecognized
* status codes as well.
*
* Prior to 2.44 this type was called
* SoupKnownStatusCode, but the individual values
* have always had the names they have now.
*/
/**
* These represent the known HTTP status code values, plus various
* network and internal errors.
*
* Note that no libsoup functions take or return this type directly;
* any function that works with status codes will accept unrecognized
* status codes as well.
*
* Prior to 2.44 this type was called
* SoupKnownStatusCode, but the individual values
* have always had the names they have now.
*/
export namespace Status {
export const $gtype: GObject.GType;
}
enum Status {
/**
* No status available. (Eg, the message has not
* been sent yet)
*/
NONE,
/**
* Message was cancelled locally
*/
CANCELLED,
/**
* Unable to resolve destination host name
*/
CANT_RESOLVE,
/**
* Unable to resolve proxy host name
*/
CANT_RESOLVE_PROXY,
/**
* Unable to connect to remote host
*/
CANT_CONNECT,
/**
* Unable to connect to proxy
*/
CANT_CONNECT_PROXY,
/**
* SSL/TLS negotiation failed
*/
SSL_FAILED,
/**
* A network error occurred, or the other end
* closed the connection unexpectedly
*/
IO_ERROR,
/**
* Malformed data (usually a programmer error)
*/
MALFORMED,
/**
* Used internally
*/
TRY_AGAIN,
/**
* There were too many redirections
*/
TOO_MANY_REDIRECTS,
/**
* Used internally
*/
TLS_FAILED,
/**
* 100 Continue (HTTP)
*/
CONTINUE,
/**
* 101 Switching Protocols (HTTP)
*/
SWITCHING_PROTOCOLS,
/**
* 102 Processing (WebDAV)
*/
PROCESSING,
/**
* 200 Success (HTTP). Also used by many lower-level
* soup routines to indicate success.
*/
OK,
/**
* 201 Created (HTTP)
*/
CREATED,
/**
* 202 Accepted (HTTP)
*/
ACCEPTED,
/**
* 203 Non-Authoritative Information
* (HTTP)
*/
NON_AUTHORITATIVE,
/**
* 204 No Content (HTTP)
*/
NO_CONTENT,
/**
* 205 Reset Content (HTTP)
*/
RESET_CONTENT,
/**
* 206 Partial Content (HTTP)
*/
PARTIAL_CONTENT,
/**
* 207 Multi-Status (WebDAV)
*/
MULTI_STATUS,
/**
* 300 Multiple Choices (HTTP)
*/
MULTIPLE_CHOICES,
/**
* 301 Moved Permanently (HTTP)
*/
MOVED_PERMANENTLY,
/**
* 302 Found (HTTP)
*/
FOUND,
/**
* 302 Moved Temporarily (old name,
* RFC 2068)
*/
MOVED_TEMPORARILY,
/**
* 303 See Other (HTTP)
*/
SEE_OTHER,
/**
* 304 Not Modified (HTTP)
*/
NOT_MODIFIED,
/**
* 305 Use Proxy (HTTP)
*/
USE_PROXY,
/**
* 306 [Unused] (HTTP)
*/
NOT_APPEARING_IN_THIS_PROTOCOL,
/**
* 307 Temporary Redirect (HTTP)
*/
TEMPORARY_REDIRECT,
PERMANENT_REDIRECT,
/**
* 400 Bad Request (HTTP)
*/
BAD_REQUEST,
/**
* 401 Unauthorized (HTTP)
*/
UNAUTHORIZED,
/**
* 402 Payment Required (HTTP)
*/
PAYMENT_REQUIRED,
/**
* 403 Forbidden (HTTP)
*/
FORBIDDEN,
/**
* 404 Not Found (HTTP)
*/
NOT_FOUND,
/**
* 405 Method Not Allowed (HTTP)
*/
METHOD_NOT_ALLOWED,
/**
* 406 Not Acceptable (HTTP)
*/
NOT_ACCEPTABLE,
/**
* 407 Proxy Authentication
* Required (HTTP)
*/
PROXY_AUTHENTICATION_REQUIRED,
/**
* shorter alias for
* %SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED
*/
PROXY_UNAUTHORIZED,
/**
* 408 Request Timeout (HTTP)
*/
REQUEST_TIMEOUT,
/**
* 409 Conflict (HTTP)
*/
CONFLICT,
/**
* 410 Gone (HTTP)
*/
GONE,
/**
* 411 Length Required (HTTP)
*/
LENGTH_REQUIRED,
/**
* 412 Precondition Failed (HTTP)
*/
PRECONDITION_FAILED,
/**
* 413 Request Entity Too Large
* (HTTP)
*/
REQUEST_ENTITY_TOO_LARGE,
/**
* 414 Request-URI Too Long (HTTP)
*/
REQUEST_URI_TOO_LONG,
/**
* 415 Unsupported Media Type
* (HTTP)
*/
UNSUPPORTED_MEDIA_TYPE,
/**
* 416 Requested Range
* Not Satisfiable (HTTP)
*/
REQUESTED_RANGE_NOT_SATISFIABLE,
/**
* shorter alias for
* %SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE
*/
INVALID_RANGE,
/**
* 417 Expectation Failed (HTTP)
*/
EXPECTATION_FAILED,
/**
* 422 Unprocessable Entity
* (WebDAV)
*/
UNPROCESSABLE_ENTITY,
/**
* 423 Locked (WebDAV)
*/
LOCKED,
/**
* 424 Failed Dependency (WebDAV)
*/
FAILED_DEPENDENCY,
/**
* 500 Internal Server Error
* (HTTP)
*/
INTERNAL_SERVER_ERROR,
/**
* 501 Not Implemented (HTTP)
*/
NOT_IMPLEMENTED,
/**
* 502 Bad Gateway (HTTP)
*/
BAD_GATEWAY,
/**
* 503 Service Unavailable (HTTP)
*/
SERVICE_UNAVAILABLE,
/**
* 504 Gateway Timeout (HTTP)
*/
GATEWAY_TIMEOUT,
/**
* 505 HTTP Version Not
* Supported (HTTP)
*/
HTTP_VERSION_NOT_SUPPORTED,
/**
* 507 Insufficient Storage
* (WebDAV)
*/
INSUFFICIENT_STORAGE,
/**
* 510 Not Extended (RFC 2774)
*/
NOT_EXTENDED,
}
/**
* Error codes for %SOUP_TLD_ERROR.
*/
class TLDError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
/**
* A hostname was syntactically
* invalid.
*/
static INVALID_HOSTNAME: number;
/**
* The passed-in "hostname" was
* actually an IP address (and thus has no base domain or
* public suffix).
*/
static IS_IP_ADDRESS: number;
/**
* The passed-in hostname
* did not have enough components. Eg, calling
* soup_tld_get_base_domain() on "co.uk".
*/
static NOT_ENOUGH_DOMAINS: number;
/**
* The passed-in hostname has
* no recognized public suffix.
*/
static NO_BASE_DOMAIN: number;
static NO_PSL_DATA: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
/**
* Pre-defined close codes that can be passed to
* soup_websocket_connection_close() or received from
* soup_websocket_connection_get_close_code(). (However, other codes
* are also allowed.)
*/
/**
* Pre-defined close codes that can be passed to
* soup_websocket_connection_close() or received from
* soup_websocket_connection_get_close_code(). (However, other codes
* are also allowed.)
*/
export namespace WebsocketCloseCode {
export const $gtype: GObject.GType;
}
enum WebsocketCloseCode {
/**
* a normal, non-error close
*/
NORMAL,
/**
* the client/server is going away
*/
GOING_AWAY,
/**
* a protocol error occurred
*/
PROTOCOL_ERROR,
/**
* the endpoint received data
* of a type that it does not support.
*/
UNSUPPORTED_DATA,
/**
* reserved value indicating that
* no close code was present; must not be sent.
*/
NO_STATUS,
/**
* reserved value indicating that
* the connection was closed abnormally; must not be sent.
*/
ABNORMAL,
/**
* the endpoint received data that
* was invalid (eg, non-UTF-8 data in a text message).
*/
BAD_DATA,
/**
* generic error code
* indicating some sort of policy violation.
*/
POLICY_VIOLATION,
/**
* the endpoint received a message
* that is too big to process.
*/
TOO_BIG,
/**
* the client is closing the
* connection because the server failed to negotiate a required
* extension.
*/
NO_EXTENSION,
/**
* the server is closing the
* connection because it was unable to fulfill the request.
*/
SERVER_ERROR,
/**
* reserved value indicating that
* the TLS handshake failed; must not be sent.
*/
TLS_HANDSHAKE,
}
/**
* The type of a #SoupWebsocketConnection.
*/
/**
* The type of a #SoupWebsocketConnection.
*/
export namespace WebsocketConnectionType {
export const $gtype: GObject.GType;
}
enum WebsocketConnectionType {
/**
* unknown/invalid connection
*/
UNKNOWN,
/**
* a client-side connection
*/
CLIENT,
/**
* a server-side connection
*/
SERVER,
}
/**
* The type of data contained in a #SoupWebsocketConnection::message
* signal.
*/
/**
* The type of data contained in a #SoupWebsocketConnection::message
* signal.
*/
export namespace WebsocketDataType {
export const $gtype: GObject.GType;
}
enum WebsocketDataType {
/**
* UTF-8 text
*/
TEXT,
/**
* binary data
*/
BINARY,
}
/**
* WebSocket-related errors.
*/
/**
* WebSocket-related errors.
*/
export namespace WebsocketError {
export const $gtype: GObject.GType;
}
enum WebsocketError {
/**
* a generic error
*/
FAILED,
/**
* attempted to handshake with a
* server that does not appear to understand WebSockets.
*/
NOT_WEBSOCKET,
/**
* the WebSocket handshake failed
* because some detail was invalid (eg, incorrect accept key).
*/
BAD_HANDSHAKE,
/**
* the WebSocket handshake failed
* because the "Origin" header was not an allowed value.
*/
BAD_ORIGIN,
}
/**
* The state of the WebSocket connection.
*/
/**
* The state of the WebSocket connection.
*/
export namespace WebsocketState {
export const $gtype: GObject.GType;
}
enum WebsocketState {
/**
* the connection is ready to send messages
*/
OPEN,
/**
* the connection is in the process of
* closing down; messages may be received, but not sent
*/
CLOSING,
/**
* the connection is completely closed down
*/
CLOSED,
}
class XMLRPCError extends GLib.Error {
static $gtype: GObject.GType;
// Static fields
static ARGUMENTS: number;
static RETVAL: number;
// Constructors
constructor(options: { message: string; code: number });
_init(...args: any[]): void;
// Static methods
static quark(): GLib.Quark;
}
/**
* Pre-defined XML-RPC fault codes from http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php.
* These are an extension, not part of the XML-RPC spec; you can't
* assume servers will use them.
*/
/**
* Pre-defined XML-RPC fault codes from http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php.
* These are an extension, not part of the XML-RPC spec; you can't
* assume servers will use them.
*/
export namespace XMLRPCFault {
export const $gtype: GObject.GType;
}
enum XMLRPCFault {
/**
* request was not
* well-formed
*/
PARSE_ERROR_NOT_WELL_FORMED,
/**
* request was in
* an unsupported encoding
*/
PARSE_ERROR_UNSUPPORTED_ENCODING,
/**
* request contained an invalid character
*/
PARSE_ERROR_INVALID_CHARACTER_FOR_ENCODING,
/**
* request was not
* valid XML-RPC
*/
SERVER_ERROR_INVALID_XML_RPC,
/**
* method
* not found
*/
SERVER_ERROR_REQUESTED_METHOD_NOT_FOUND,
/**
* invalid
* parameters
*/
SERVER_ERROR_INVALID_METHOD_PARAMETERS,
/**
* internal
* error
*/
SERVER_ERROR_INTERNAL_XML_RPC_ERROR,
/**
* start of reserved range for
* application error codes
*/
APPLICATION_ERROR,
/**
* start of reserved range for
* system error codes
*/
SYSTEM_ERROR,
/**
* start of reserved range for
* transport error codes
*/
TRANSPORT_ERROR,
}
/**
* This can be passed to any #SoupAddress method that expects a port,
* to indicate that you don't care what port is used.
*/
const ADDRESS_ANY_PORT: number;
/**
* Alias for the #SoupAddress:family property. (The
* #SoupAddressFamily for this address.)
*/
const ADDRESS_FAMILY: string;
/**
* Alias for the #SoupAddress:name property. (The hostname for
* this address.)
*/
const ADDRESS_NAME: string;
/**
* An alias for the #SoupAddress:physical property. (The
* stringified IP address for this address.)
*/
const ADDRESS_PHYSICAL: string;
/**
* An alias for the #SoupAddress:port property. (The port for
* this address.)
*/
const ADDRESS_PORT: string;
/**
* Alias for the #SoupAddress:protocol property. (The URI scheme
* used with this address.)
*/
const ADDRESS_PROTOCOL: string;
/**
* An alias for the #SoupAddress:sockaddr property. (A pointer
* to the struct sockaddr for this address.)
*/
const ADDRESS_SOCKADDR: string;
/**
* Alias for the #SoupAuthDomain:add-path property. (Shortcut
* for calling soup_auth_domain_add_path().)
*/
const AUTH_DOMAIN_ADD_PATH: string;
/**
* Alias for the #SoupAuthDomainBasic:auth-callback property.
* (The #SoupAuthDomainBasicAuthCallback.)
*/
const AUTH_DOMAIN_BASIC_AUTH_CALLBACK: string;
/**
* Alias for the #SoupAuthDomainBasic:auth-data property.
* (The data to pass to the #SoupAuthDomainBasicAuthCallback.)
*/
const AUTH_DOMAIN_BASIC_AUTH_DATA: string;
/**
* Alias for the #SoupAuthDomainDigest:auth-callback property.
* (The #SoupAuthDomainDigestAuthCallback.)
*/
const AUTH_DOMAIN_DIGEST_AUTH_CALLBACK: string;
/**
* Alias for the #SoupAuthDomainDigest:auth-callback property.
* (The #SoupAuthDomainDigestAuthCallback.)
*/
const AUTH_DOMAIN_DIGEST_AUTH_DATA: string;
/**
* Alias for the #SoupAuthDomain:filter property. (The
* #SoupAuthDomainFilter for the domain.)
*/
const AUTH_DOMAIN_FILTER: string;
/**
* Alias for the #SoupAuthDomain:filter-data property. (Data
* to pass to the #SoupAuthDomainFilter.)
*/
const AUTH_DOMAIN_FILTER_DATA: string;
/**
* Alias for the #SoupAuthDomain:generic-auth-callback property.
* (The #SoupAuthDomainGenericAuthCallback.)
*/
const AUTH_DOMAIN_GENERIC_AUTH_CALLBACK: string;
/**
* Alias for the #SoupAuthDomain:generic-auth-data property.
* (The data to pass to the #SoupAuthDomainGenericAuthCallback.)
*/
const AUTH_DOMAIN_GENERIC_AUTH_DATA: string;
/**
* Alias for the #SoupAuthDomain:proxy property. (Whether or
* not this is a proxy auth domain.)
*/
const AUTH_DOMAIN_PROXY: string;
/**
* Alias for the #SoupAuthDomain:realm property. (The realm of
* this auth domain.)
*/
const AUTH_DOMAIN_REALM: string;
/**
* Alias for the #SoupAuthDomain:remove-path property.
* (Shortcut for calling soup_auth_domain_remove_path().)
*/
const AUTH_DOMAIN_REMOVE_PATH: string;
/**
* An alias for the #SoupAuth:host property. (The
* host being authenticated to.)
*/
const AUTH_HOST: string;
/**
* An alias for the #SoupAuth:is-authenticated property.
* (Whether or not the auth has been authenticated.)
*/
const AUTH_IS_AUTHENTICATED: string;
/**
* An alias for the #SoupAuth:is-for-proxy property. (Whether
* or not the auth is for a proxy server.)
*/
const AUTH_IS_FOR_PROXY: string;
/**
* An alias for the #SoupAuth:realm property. (The
* authentication realm.)
*/
const AUTH_REALM: string;
/**
* An alias for the #SoupAuth:scheme-name property. (The
* authentication scheme name.)
*/
const AUTH_SCHEME_NAME: string;
const CHAR_HTTP_CTL: number;
const CHAR_HTTP_SEPARATOR: number;
const CHAR_URI_GEN_DELIMS: number;
const CHAR_URI_PERCENT_ENCODED: number;
const CHAR_URI_SUB_DELIMS: number;
/**
* Alias for the #SoupCookieJar:accept-policy property.
*/
const COOKIE_JAR_ACCEPT_POLICY: string;
/**
* Alias for the #SoupCookieJarDB:filename property. (The
* cookie-storage filename.)
*/
const COOKIE_JAR_DB_FILENAME: string;
/**
* Alias for the #SoupCookieJar:read-only property. (Whether
* or not the cookie jar is read-only.)
*/
const COOKIE_JAR_READ_ONLY: string;
/**
* Alias for the #SoupCookieJarText:filename property. (The
* cookie-storage filename.)
*/
const COOKIE_JAR_TEXT_FILENAME: string;
/**
* A constant corresponding to 1 day, for use with soup_cookie_new()
* and soup_cookie_set_max_age().
*/
const COOKIE_MAX_AGE_ONE_DAY: number;
/**
* A constant corresponding to 1 hour, for use with soup_cookie_new()
* and soup_cookie_set_max_age().
*/
const COOKIE_MAX_AGE_ONE_HOUR: number;
/**
* A constant corresponding to 1 week, for use with soup_cookie_new()
* and soup_cookie_set_max_age().
*/
const COOKIE_MAX_AGE_ONE_WEEK: number;
/**
* A constant corresponding to 1 year, for use with soup_cookie_new()
* and soup_cookie_set_max_age().
*/
const COOKIE_MAX_AGE_ONE_YEAR: number;
/**
* A macro containing the value
* "multipart/form-data"; the MIME type used for
* posting form data that contains files to be uploaded.
*/
const FORM_MIME_TYPE_MULTIPART: string;
/**
* A macro containing the value
* "application/x-www-form-urlencoded"; the default
* MIME type for POSTing HTML form data.
*/
const FORM_MIME_TYPE_URLENCODED: string;
const HSTS_ENFORCER_DB_FILENAME: string;
const HSTS_POLICY_MAX_AGE_PAST: number;
/**
* Alias for the #SoupLogger:level property, qv.
*/
const LOGGER_LEVEL: string;
/**
* Alias for the #SoupLogger:max-body-size property, qv.
*/
const LOGGER_MAX_BODY_SIZE: string;
/**
* Like soup_get_major_version(), but from the headers used at
* application compile time, rather than from the library linked
* against at application run time.
*/
const MAJOR_VERSION: number;
/**
* Alias for the #SoupMessage:first-party property. (The
* #SoupURI loaded in the application when the message was
* queued.)
*/
const MESSAGE_FIRST_PARTY: string;
/**
* Alias for the #SoupMessage:flags property. (The message's
* #SoupMessageFlags.)
*/
const MESSAGE_FLAGS: string;
/**
* Alias for the #SoupMessage:http-version property. (The
* message's #SoupHTTPVersion.)
*/
const MESSAGE_HTTP_VERSION: string;
const MESSAGE_IS_TOP_LEVEL_NAVIGATION: string;
/**
* Alias for the #SoupMessage:method property. (The message's
* HTTP method.)
*/
const MESSAGE_METHOD: string;
/**
* Sets the priority of the #SoupMessage. See
* soup_message_set_priority() for further details.
*/
const MESSAGE_PRIORITY: string;
/**
* Alias for the #SoupMessage:reason-phrase property. (The
* message's HTTP response reason phrase.)
*/
const MESSAGE_REASON_PHRASE: string;
/**
* Alias for the #SoupMessage:request-body property. (The
* message's HTTP request body.)
*/
const MESSAGE_REQUEST_BODY: string;
/**
* Alias for the #SoupMessage:request-body-data property. (The
* message's HTTP request body, as a #GBytes.)
*/
const MESSAGE_REQUEST_BODY_DATA: string;
/**
* Alias for the #SoupMessage:request-headers property. (The
* message's HTTP request headers.)
*/
const MESSAGE_REQUEST_HEADERS: string;
/**
* Alias for the #SoupMessage:response-body property. (The
* message's HTTP response body.)
*/
const MESSAGE_RESPONSE_BODY: string;
/**
* Alias for the #SoupMessage:response-body-data property. (The
* message's HTTP response body, as a #GBytes.)
*/
const MESSAGE_RESPONSE_BODY_DATA: string;
/**
* Alias for the #SoupMessage:response-headers property. (The
* message's HTTP response headers.)
*/
const MESSAGE_RESPONSE_HEADERS: string;
/**
* Alias for the #SoupMessage:server-side property. (%TRUE if
* the message was created by #SoupServer.)
*/
const MESSAGE_SERVER_SIDE: string;
const MESSAGE_SITE_FOR_COOKIES: string;
/**
* Alias for the #SoupMessage:status-code property. (The
* message's HTTP response status code.)
*/
const MESSAGE_STATUS_CODE: string;
/**
* Alias for the #SoupMessage:tls-certificate property. (The
* TLS certificate associated with the message, if any.)
*/
const MESSAGE_TLS_CERTIFICATE: string;
/**
* Alias for the #SoupMessage:tls-errors property. (The
* verification errors on #SoupMessage:tls-certificate.)
*/
const MESSAGE_TLS_ERRORS: string;
/**
* Alias for the #SoupMessage:uri property. (The message's
* #SoupURI.)
*/
const MESSAGE_URI: string;
/**
* Like soup_get_micro_version(), but from the headers used at
* application compile time, rather than from the library linked
* against at application run time.
*/
const MICRO_VERSION: number;
/**
* Like soup_get_minor_version(), but from the headers used at
* application compile time, rather than from the library linked
* against at application run time.
*/
const MINOR_VERSION: number;
/**
* Alias for the #SoupRequest:session property, qv.
*/
const REQUEST_SESSION: string;
/**
* Alias for the #SoupRequest:uri property, qv.
*/
const REQUEST_URI: string;
/**
* Alias for the deprecated #SoupServer:async-context
* property, qv.
*/
const SERVER_ASYNC_CONTEXT: string;
/**
* Alias for the #SoupServer:https-aliases property, qv.
*/
const SERVER_HTTPS_ALIASES: string;
/**
* Alias for the #SoupServer:http-aliases property, qv.
*/
const SERVER_HTTP_ALIASES: string;
/**
* Alias for the #SoupServer:interface property, qv.
*/
const SERVER_INTERFACE: string;
/**
* Alias for the deprecated #SoupServer:port property, qv.
*/
const SERVER_PORT: string;
/**
* Alias for the #SoupServer:raw-paths property. (If %TRUE,
* percent-encoding in the Request-URI path will not be
* automatically decoded.)
*/
const SERVER_RAW_PATHS: string;
/**
* Alias for the #SoupServer:server-header property, qv.
*/
const SERVER_SERVER_HEADER: string;
/**
* Alias for the #SoupServer:ssl-cert-file property, qv.
*/
const SERVER_SSL_CERT_FILE: string;
/**
* Alias for the #SoupServer:ssl-key-file property, qv.
*/
const SERVER_SSL_KEY_FILE: string;
/**
* Alias for the #SoupServer:tls-certificate property, qv.
*/
const SERVER_TLS_CERTIFICATE: string;
/**
* Alias for the #SoupSession:accept-language property, qv.
*/
const SESSION_ACCEPT_LANGUAGE: string;
/**
* Alias for the #SoupSession:accept-language-auto property, qv.
*/
const SESSION_ACCEPT_LANGUAGE_AUTO: string;
/**
* Alias for the #SoupSession:async-context property, qv.
*/
const SESSION_ASYNC_CONTEXT: string;
/**
* Alias for the #SoupSession:https-aliases property, qv.
*/
const SESSION_HTTPS_ALIASES: string;
/**
* Alias for the #SoupSession:http-aliases property, qv.
*/
const SESSION_HTTP_ALIASES: string;
/**
* Alias for the #SoupSession:idle-timeout property, qv.
*/
const SESSION_IDLE_TIMEOUT: string;
/**
* Alias for the #SoupSession:local-address property, qv.
*/
const SESSION_LOCAL_ADDRESS: string;
/**
* Alias for the #SoupSession:max-conns property, qv.
*/
const SESSION_MAX_CONNS: string;
/**
* Alias for the #SoupSession:max-conns-per-host property, qv.
*/
const SESSION_MAX_CONNS_PER_HOST: string;
/**
* Alias for the #SoupSession:proxy-resolver property, qv.
*/
const SESSION_PROXY_RESOLVER: string;
/**
* Alias for the #SoupSession:proxy-uri property, qv.
*/
const SESSION_PROXY_URI: string;
/**
* Alias for the #SoupSession:ssl-ca-file property, qv.
*/
const SESSION_SSL_CA_FILE: string;
/**
* Alias for the #SoupSession:ssl-strict property, qv.
*/
const SESSION_SSL_STRICT: string;
/**
* Alias for the #SoupSession:ssl-use-system-ca-file property,
* qv.
*/
const SESSION_SSL_USE_SYSTEM_CA_FILE: string;
/**
* Alias for the #SoupSession:timeout property, qv.
*/
const SESSION_TIMEOUT: string;
/**
* Alias for the #SoupSession:tls-database property, qv.
*/
const SESSION_TLS_DATABASE: string;
/**
* Alias for the #SoupSession:tls-interaction property, qv.
*/
const SESSION_TLS_INTERACTION: string;
/**
* Alias for the #SoupSession:user-agent property, qv.
*/
const SESSION_USER_AGENT: string;
/**
* Alias for the #SoupSession:use-ntlm property, qv.
*/
const SESSION_USE_NTLM: string;
/**
* Alias for the #SoupSession:use-thread-context property, qv.
*/
const SESSION_USE_THREAD_CONTEXT: string;
/**
* Alias for the #SoupSocket:async-context property. (The
* socket's #GMainContext.)
*/
const SOCKET_ASYNC_CONTEXT: string;
/**
* Alias for the #SoupSocket:non-blocking property. (Whether
* or not the socket uses non-blocking I/O.)
*/
const SOCKET_FLAG_NONBLOCKING: string;
/**
* Alias for the #SoupSocket:is-server property, qv.
*/
const SOCKET_IS_SERVER: string;
/**
* Alias for the #SoupSocket:local-address property. (Address
* of local end of socket.)
*/
const SOCKET_LOCAL_ADDRESS: string;
/**
* Alias for the #SoupSocket:remote-address property. (Address
* of remote end of socket.)
*/
const SOCKET_REMOTE_ADDRESS: string;
/**
* Alias for the #SoupSocket:ssl-creds property.
* (SSL credential information.)
*/
const SOCKET_SSL_CREDENTIALS: string;
/**
* Alias for the #SoupSocket:ssl-fallback property.
*/
const SOCKET_SSL_FALLBACK: string;
/**
* Alias for the #SoupSocket:ssl-strict property.
*/
const SOCKET_SSL_STRICT: string;
/**
* Alias for the #SoupSocket:timeout property. (The timeout
* in seconds for blocking socket I/O operations.)
*/
const SOCKET_TIMEOUT: string;
/**
* Alias for the #SoupSocket:tls-certificate
* property. Note that this property's value is only useful
* if the socket is for a TLS connection, and only reliable
* after some data has been transferred to or from it.
*/
const SOCKET_TLS_CERTIFICATE: string;
/**
* Alias for the #SoupSocket:tls-errors
* property. Note that this property's value is only useful
* if the socket is for a TLS connection, and only reliable
* after some data has been transferred to or from it.
*/
const SOCKET_TLS_ERRORS: string;
/**
* Alias for the #SoupSocket:trusted-certificate
* property.
*/
const SOCKET_TRUSTED_CERTIFICATE: string;
/**
* Alias for the #SoupSocket:use-thread-context property. (Use
* g_main_context_get_thread_default())
*/
const SOCKET_USE_THREAD_CONTEXT: string;
/**
* A macro that should be defined by the user prior to including
* libsoup.h. The definition should be one of the predefined libsoup
* version macros: %SOUP_VERSION_2_24, %SOUP_VERSION_2_26, ...
*
* This macro defines the earliest version of libsoup that the package
* is required to be able to compile against.
*
* If the compiler is configured to warn about the use of deprecated
* functions, then using functions that were deprecated in version
* %SOUP_VERSION_MIN_REQUIRED or earlier will cause warnings (but
* using functions deprecated in later releases will not).
*/
const VERSION_MIN_REQUIRED: number;
/**
* Like SOUP_CHECK_VERSION, but the check for soup_check_version is
* at runtime instead of compile time. This is useful for compiling
* against older versions of libsoup, but using features from newer
* versions.
* @param major the major version to check
* @param minor the minor version to check
* @param micro the micro version to check
* @returns %TRUE if the version of the libsoup currently loaded is the same as or newer than the passed-in version.
*/
function check_version(major: number, minor: number, micro: number): boolean;
/**
* Parses `header` and returns a #SoupCookie. (If `header` contains
* multiple cookies, only the first one will be parsed.)
*
* If `header` does not have "path" or "domain" attributes, they will
* be defaulted from `origin`. If `origin` is %NULL, path will default
* to "/", but domain will be left as %NULL. Note that this is not a
* valid state for a #SoupCookie, and you will need to fill in some
* appropriate string for the domain if you want to actually make use
* of the cookie.
* @param header a cookie string (eg, the value of a Set-Cookie header)
* @param origin origin of the cookie, or %NULL
* @returns a new #SoupCookie, or %NULL if it could not be parsed, or contained an illegal "domain" attribute for a cookie originating from @origin.
*/
function cookie_parse(header: string, origin: URI): Cookie | null;
/**
* Parses `msg'`s Cookie request header and returns a #GSList of
* #SoupCookies. As the "Cookie" header, unlike "Set-Cookie",
* only contains cookie names and values, none of the other
* #SoupCookie fields will be filled in. (Thus, you can't generally
* pass a cookie returned from this method directly to
* soup_cookies_to_response().)
* @param msg a #SoupMessage containing a "Cookie" request header
* @returns a #GSList of #SoupCookies, which can be freed with soup_cookies_free().
*/
function cookies_from_request(msg: Message): Cookie[];
/**
* Parses `msg'`s Set-Cookie response headers and returns a #GSList of
* #SoupCookies. Cookies that do not specify "path" or
* "domain" attributes will have their values defaulted from `msg`.
* @param msg a #SoupMessage containing a "Set-Cookie" response header
* @returns a #GSList of #SoupCookies, which can be freed with soup_cookies_free().
*/
function cookies_from_response(msg: Message): Cookie[];
/**
* Serializes a #GSList of #SoupCookie into a string suitable for
* setting as the value of the "Cookie" header.
* @param cookies a #GSList of #SoupCookie
* @returns the serialization of @cookies
*/
function cookies_to_cookie_header(cookies: Cookie[]): string;
/**
* Adds the name and value of each cookie in `cookies` to `msg'`s
* "Cookie" request. (If `msg` already has a "Cookie" request header,
* these cookies will be appended to the cookies already present. Be
* careful that you do not append the same cookies twice, eg, when
* requeuing a message.)
* @param cookies a #GSList of #SoupCookie
* @param msg a #SoupMessage
*/
function cookies_to_request(cookies: Cookie[], msg: Message): void;
/**
* Appends a "Set-Cookie" response header to `msg` for each cookie in
* `cookies`. (This is in addition to any other "Set-Cookie" headers
* `msg` may already have.)
* @param cookies a #GSList of #SoupCookie
* @param msg a #SoupMessage
*/
function cookies_to_response(cookies: Cookie[], msg: Message): void;
/**
* Decodes `form,` which is an urlencoded dataset as defined in the
* HTML 4.01 spec.
* @param encoded_form data of type "application/x-www-form-urlencoded"
* @returns a hash table containing the name/value pairs from @encoded_form, which you can free with g_hash_table_destroy().
*/
function form_decode(encoded_form: string): GLib.HashTable;
/**
* Decodes the "multipart/form-data" request in `msg;` this is a
* convenience method for the case when you have a single file upload
* control in a form. (Or when you don't have any file upload
* controls, but are still using "multipart/form-data" anyway.) Pass
* the name of the file upload control in `file_control_name,` and
* soup_form_decode_multipart() will extract the uploaded file data
* into `filename,` `content_type,` and `file`. All of the other form
* control data will be returned (as strings, as with
* soup_form_decode()) in the returned #GHashTable.
*
* You may pass %NULL for `filename,` `content_type` and/or `file` if you do not
* care about those fields. soup_form_decode_multipart() may also
* return %NULL in those fields if the client did not provide that
* information. You must free the returned filename and content-type
* with g_free(), and the returned file data with soup_buffer_free().
*
* If you have a form with more than one file upload control, you will
* need to decode it manually, using soup_multipart_new_from_message()
* and soup_multipart_get_part().
* @param msg a #SoupMessage containing a "multipart/form-data" request body
* @param file_control_name the name of the HTML file upload control, or %NULL
* @returns a hash table containing the name/value pairs (other than @file_control_name) from @msg, which you can free with g_hash_table_destroy(). On error, it will return %NULL.
*/
function form_decode_multipart(
msg: Message,
file_control_name: string | null,
): [GLib.HashTable | null, string, string, Buffer | null];
/**
* Encodes `form_data_set` into a value of type
* "application/x-www-form-urlencoded", as defined in the HTML 4.01
* spec. Unlike soup_form_encode_hash(), this preserves the ordering
* of the form elements, which may be required in some situations.
* @param form_data_set a datalist containing name/value pairs
* @returns the encoded form
*/
function form_encode_datalist(form_data_set: GLib.Data): string;
/**
* Encodes `form_data_set` into a value of type
* "application/x-www-form-urlencoded", as defined in the HTML 4.01
* spec.
*
* Note that the HTML spec states that "The control names/values are
* listed in the order they appear in the document." Since this method
* takes a hash table, it cannot enforce that; if you care about the
* ordering of the form fields, use soup_form_encode_datalist().
* @param form_data_set a hash table containing name/value pairs (as strings)
* @returns the encoded form
*/
function form_encode_hash(form_data_set: { [key: string]: any } | GLib.HashTable): string;
/**
* Creates a new %SoupMessage and sets it up to send `form_data_set` to
* `uri` via `method,` as with soup_form_request_new().
* @param method the HTTP method, either "GET" or "POST"
* @param uri the URI to send the form data to
* @param form_data_set the data to send to @uri
* @returns the new %SoupMessage
*/
function form_request_new_from_datalist(method: string, uri: string, form_data_set: GLib.Data): Message;
/**
* Creates a new %SoupMessage and sets it up to send `form_data_set` to
* `uri` via `method,` as with soup_form_request_new().
* @param method the HTTP method, either "GET" or "POST"
* @param uri the URI to send the form data to
* @param form_data_set the data to send to @uri
* @returns the new %SoupMessage
*/
function form_request_new_from_hash(
method: string,
uri: string,
form_data_set: { [key: string]: any } | GLib.HashTable,
): Message;
/**
* Creates a new %SoupMessage and sets it up to send `multipart` to
* `uri` via POST.
*
* To send a "multipart/form-data" POST, first
* create a #SoupMultipart, using %SOUP_FORM_MIME_TYPE_MULTIPART as
* the MIME type. Then use soup_multipart_append_form_string() and
* soup_multipart_append_form_file() to add the value of each form
* control to the multipart. (These are just convenience methods, and
* you can use soup_multipart_append_part() if you need greater
* control over the part headers.) Finally, call
* soup_form_request_new_from_multipart() to serialize the multipart
* structure and create a #SoupMessage.
* @param uri the URI to send the form data to
* @param multipart a "multipart/form-data" #SoupMultipart
* @returns the new %SoupMessage
*/
function form_request_new_from_multipart(uri: string, multipart: Multipart): Message;
/**
* Returns the major version number of the libsoup library.
* (e.g. in libsoup version 2.42.0 this is 2.)
*
* This function is in the library, so it represents the libsoup library
* your code is running against. Contrast with the #SOUP_MAJOR_VERSION
* macro, which represents the major version of the libsoup headers you
* have included when compiling your code.
* @returns the major version number of the libsoup library
*/
function get_major_version(): number;
/**
* Returns the micro version number of the libsoup library.
* (e.g. in libsoup version 2.42.0 this is 0.)
*
* This function is in the library, so it represents the libsoup library
* your code is running against. Contrast with the #SOUP_MICRO_VERSION
* macro, which represents the micro version of the libsoup headers you
* have included when compiling your code.
* @returns the micro version number of the libsoup library
*/
function get_micro_version(): number;
/**
* Returns the minor version number of the libsoup library.
* (e.g. in libsoup version 2.42.0 this is 42.)
*
* This function is in the library, so it represents the libsoup library
* your code is running against. Contrast with the #SOUP_MINOR_VERSION
* macro, which represents the minor version of the libsoup headers you
* have included when compiling your code.
* @returns the minor version number of the libsoup library
*/
function get_minor_version(): number;
function get_resource(): Gio.Resource;
/**
* Parses `header` to see if it contains the token `token` (matched
* case-insensitively). Note that this can't be used with lists
* that have qvalues.
* @param header An HTTP header suitable for parsing with soup_header_parse_list()
* @param token a token
* @returns whether or not @header contains @token
*/
function header_contains(header: string, token: string): boolean;
/**
* Frees `param_list`.
* @param param_list a #GHashTable returned from soup_header_parse_param_list() or soup_header_parse_semi_param_list()
*/
function header_free_param_list(param_list: { [key: string]: any } | GLib.HashTable): void;
/**
* Appends something like `name=``value<`/literal> to `string,`
* taking care to quote `value` if needed, and if so, to escape any
* quotes or backslashes in `value`.
*
* Alternatively, if `value` is a non-ASCII UTF-8 string, it will be
* appended using RFC5987 syntax. Although in theory this is supposed
* to work anywhere in HTTP that uses this style of parameter, in
* reality, it can only be used portably with the Content-Disposition
* "filename" parameter.
*
* If `value` is %NULL, this will just append `name` to `string`.
* @param string a #GString being used to construct an HTTP header value
* @param name a parameter name
* @param value a parameter value, or %NULL
*/
function header_g_string_append_param(string: GLib.String, name: string, value: string): void;
/**
* Appends something like `name=`"`value"` to
* `string,` taking care to escape any quotes or backslashes in `value`.
*
* If `value` is (non-ASCII) UTF-8, this will instead use RFC 5987
* encoding, just like soup_header_g_string_append_param().
* @param string a #GString being used to construct an HTTP header value
* @param name a parameter name
* @param value a parameter value
*/
function header_g_string_append_param_quoted(string: GLib.String, name: string, value: string): void;
/**
* Parses a header whose content is described by RFC2616 as
* "#something", where "something" does not itself contain commas,
* except as part of quoted-strings.
* @param header a header value
* @returns a #GSList of list elements, as allocated strings
*/
function header_parse_list(header: string): string[];
/**
* Parses a header which is a comma-delimited list of something like:
* token [ "=" ( token | quoted-string ) ].
*
* Tokens that don't have an associated value will still be added to
* the resulting hash table, but with a %NULL value.
*
* This also handles RFC5987 encoding (which in HTTP is mostly used
* for giving UTF8-encoded filenames in the Content-Disposition
* header).
* @param header a header value
* @returns a #GHashTable of list elements, which can be freed with soup_header_free_param_list().
*/
function header_parse_param_list(header: string): GLib.HashTable;
/**
* A strict version of soup_header_parse_param_list()
* that bails out if there are duplicate parameters.
* Note that this function will treat RFC5987-encoded
* parameters as duplicated if an ASCII version is also
* present. For header fields that might contain
* RFC5987-encoded parameters, use
* soup_header_parse_param_list() instead.
* @param header a header value
* @returns a #GHashTable of list elements, which can be freed with soup_header_free_param_list() or %NULL if there are duplicate elements.
*/
function header_parse_param_list_strict(header: string): GLib.HashTable | null;
/**
* Parses a header whose content is a list of items with optional
* "qvalue"s (eg, Accept, Accept-Charset, Accept-Encoding,
* Accept-Language, TE).
*
* If `unacceptable` is not %NULL, then on return, it will contain the
* items with qvalue 0. Either way, those items will be removed from
* the main list.
* @param header a header value
* @returns a #GSList of acceptable values (as allocated strings), highest-qvalue first.
*/
function header_parse_quality_list(header: string): [string[], string[] | null];
/**
* Parses a header which is a semicolon-delimited list of something
* like: token [ "=" ( token | quoted-string ) ].
*
* Tokens that don't have an associated value will still be added to
* the resulting hash table, but with a %NULL value.
*
* This also handles RFC5987 encoding (which in HTTP is mostly used
* for giving UTF8-encoded filenames in the Content-Disposition
* header).
* @param header a header value
* @returns a #GHashTable of list elements, which can be freed with soup_header_free_param_list().
*/
function header_parse_semi_param_list(header: string): GLib.HashTable;
/**
* A strict version of soup_header_parse_semi_param_list()
* that bails out if there are duplicate parameters.
* Note that this function will treat RFC5987-encoded
* parameters as duplicated if an ASCII version is also
* present. For header fields that might contain
* RFC5987-encoded parameters, use
* soup_header_parse_semi_param_list() instead.
* @param header a header value
* @returns a #GHashTable of list elements, which can be freed with soup_header_free_param_list() or %NULL if there are duplicate elements.
*/
function header_parse_semi_param_list_strict(header: string): GLib.HashTable | null;
/**
* Parses the headers of an HTTP request or response in `str` and
* stores the results in `dest`. Beware that `dest` may be modified even
* on failure.
*
* This is a low-level method; normally you would use
* soup_headers_parse_request() or soup_headers_parse_response().
* @param str the header string (including the Request-Line or Status-Line, but not the trailing blank line)
* @param len length of @str
* @param dest #SoupMessageHeaders to store the header values in
* @returns success or failure
*/
function headers_parse(str: string, len: number, dest: MessageHeaders): boolean;
/**
* Parses the headers of an HTTP request in `str` and stores the
* results in `req_method,` `req_path,` `ver,` and `req_headers`.
*
* Beware that `req_headers` may be modified even on failure.
* @param str the headers (up to, but not including, the trailing blank line)
* @param len length of @str
* @param req_headers #SoupMessageHeaders to store the header values in
* @returns %SOUP_STATUS_OK if the headers could be parsed, or an HTTP error to be returned to the client if they could not be.
*/
function headers_parse_request(
str: string,
len: number,
req_headers: MessageHeaders,
): [number, string, string, HTTPVersion | null];
/**
* Parses the headers of an HTTP response in `str` and stores the
* results in `ver,` `status_code,` `reason_phrase,` and `headers`.
*
* Beware that `headers` may be modified even on failure.
* @param str the headers (up to, but not including, the trailing blank line)
* @param len length of @str
* @param headers #SoupMessageHeaders to store the header values in
* @returns success or failure.
*/
function headers_parse_response(
str: string,
len: number,
headers: MessageHeaders,
): [boolean, HTTPVersion | null, number, string];
/**
* Parses the HTTP Status-Line string in `status_line` into `ver,`
* `status_code,` and `reason_phrase`. `status_line` must be terminated by
* either "\0" or "\r\n".
* @param status_line an HTTP Status-Line
* @returns %TRUE if @status_line was parsed successfully.
*/
function headers_parse_status_line(status_line: string): [boolean, HTTPVersion | null, number, string];
function http_error_quark(): GLib.Quark;
/**
* Initializes `iter` for iterating `hdrs`.
* @param hdrs a %SoupMessageHeaders
*/
function message_headers_iter_init(hdrs: MessageHeaders): MessageHeadersIter;
/**
* Yields the next name/value pair in the %SoupMessageHeaders being
* iterated by `iter`. If `iter` has already yielded the last header,
* then soup_message_headers_iter_next() will return %FALSE and `name`
* and `value` will be unchanged.
* @param iter a %SoupMessageHeadersIter
* @returns %TRUE if another name and value were returned, %FALSE if the end of the headers has been reached.
*/
function message_headers_iter_next(iter: MessageHeadersIter): [boolean, MessageHeadersIter, string, string];
function request_error_quark(): GLib.Quark;
function requester_error_quark(): GLib.Quark;
/**
* Looks up the stock HTTP description of `status_code`. This is used
* by soup_message_set_status() to get the correct text to go with a
* given status code.
*
* There is no reason for you to ever use this
* function. If you wanted the textual description for the
* #SoupMessage:status_code of a given #SoupMessage, you should just
* look at the message's #SoupMessage:reason_phrase. However, you
* should only do that for use in debugging messages; HTTP reason
* phrases are not localized, and are not generally very descriptive
* anyway, and so they should never be presented to the user directly.
* Instead, you should create you own error messages based on the
* status code, and on what you were trying to do.
* @param status_code an HTTP status code
* @returns the (terse, English) description of @status_code
*/
function status_get_phrase(status_code: number): string;
/**
* Turns %SOUP_STATUS_CANT_RESOLVE into
* %SOUP_STATUS_CANT_RESOLVE_PROXY and %SOUP_STATUS_CANT_CONNECT into
* %SOUP_STATUS_CANT_CONNECT_PROXY. Other status codes are passed
* through unchanged.
* @param status_code a status code
* @returns the "proxified" equivalent of @status_code.
*/
function status_proxify(status_code: number): number;
/**
* Compares `v1` and `v2` in a case-insensitive manner
* @param v1 an ASCII string
* @param v2 another ASCII string
* @returns %TRUE if they are equal (modulo case)
*/
function str_case_equal(v1?: any | null, v2?: any | null): boolean;
/**
* Hashes `key` in a case-insensitive manner.
* @param key ASCII string to hash
* @returns the hash code.
*/
function str_case_hash(key?: any | null): number;
/**
* Looks whether the `domain` passed as argument is a public domain
* suffix (.org, .com, .co.uk, etc) or not.
*
* Prior to libsoup 2.46, this function required that `domain` be in
* UTF-8 if it was an IDN. From 2.46 on, the name can be in either
* UTF-8 or ASCII format.
* @param domain a domain name
* @returns %TRUE if it is a public domain, %FALSE otherwise.
*/
function tld_domain_is_public_suffix(domain: string): boolean;
function tld_error_quark(): GLib.Quark;
/**
* Finds the base domain for a given `hostname`. The base domain is
* composed by the top level domain (such as .org, .com, .co.uk, etc)
* plus the second level domain, for example for myhost.mydomain.com
* it will return mydomain.com.
*
* Note that %NULL will be returned for private URLs (those not ending
* with any well known TLD) because choosing a base domain for them
* would be totally arbitrary.
*
* Prior to libsoup 2.46, this function required that `hostname` be in
* UTF-8 if it was an IDN. From 2.46 on, the name can be in either
* UTF-8 or ASCII format (and the return value will be in the same
* format).
* @param hostname a hostname
* @returns a pointer to the start of the base domain in @hostname. If an error occurs, %NULL will be returned and @error set.
*/
function tld_get_base_domain(hostname: string): string;
/**
* Fully %-decodes `part`.
*
* In the past, this would return %NULL if `part` contained invalid
* percent-encoding, but now it just ignores the problem (as
* soup_uri_new() already did).
* @param part a URI part
* @returns the decoded URI part.
*/
function uri_decode(part: string): string;
/**
* This %-encodes the given URI part and returns the escaped
* version in allocated memory, which the caller must free when it is
* done.
* @param part a URI part
* @param escape_extra additional reserved characters to escape (or %NULL)
* @returns the encoded URI part
*/
function uri_encode(part: string, escape_extra?: string | null): string;
/**
* %-decodes any "unreserved" characters (or characters in
* `unescape_extra)` in `part,` and %-encodes any non-ASCII
* characters, spaces, and non-printing characters in `part`.
*
* "Unreserved" characters are those that are not allowed to be used
* for punctuation according to the URI spec. For example, letters are
* unreserved, so soup_uri_normalize() will turn
* http://example.com/foo/b%61r into
* http://example.com/foo/bar, which is guaranteed
* to mean the same thing. However, "/" is "reserved", so
* http://example.com/foo%2Fbar would not
* be changed, because it might mean something different to the
* server.
*
* In the past, this would return %NULL if `part` contained invalid
* percent-encoding, but now it just ignores the problem (as
* soup_uri_new() already did).
* @param part a URI part
* @param unescape_extra reserved characters to unescape (or %NULL)
* @returns the normalized URI part
*/
function uri_normalize(part: string, unescape_extra?: string | null): string;
/**
* Creates a new %GValueArray. (This is just a wrapper around
* g_value_array_new(), for naming consistency purposes.)
* @returns a new %GValueArray
*/
function value_array_new(): GObject.ValueArray;
/**
* Inserts `value` into `hash`. (Unlike with g_hash_table_insert(), both
* the key and the value are copied).
* @param hash a value hash
* @param key the key
* @param value a value
*/
function value_hash_insert_value(
hash: { [key: string]: any } | GLib.HashTable,
key: string,
value: GObject.Value | any,
): void;
/**
* Creates a #GHashTable whose keys are strings and whose values
* are #GValue.
* @returns a new empty #GHashTable
*/
function value_hash_new(): GLib.HashTable;
/**
* Adds the necessary headers to `msg` to request a WebSocket
* handshake. The message body and non-WebSocket-related headers are
* not modified.
*
* Use soup_websocket_client_prepare_handshake_with_extensions() if you
* want to include "Sec-WebSocket-Extensions" header in the request.
*
* This is a low-level function; if you use
* soup_session_websocket_connect_async() to create a WebSocket
* connection, it will call this for you.
* @param msg a #SoupMessage
* @param origin the "Origin" header to set
* @param protocols list of protocols to offer
*/
function websocket_client_prepare_handshake(
msg: Message,
origin?: string | null,
protocols?: string[] | null,
): void;
/**
* Adds the necessary headers to `msg` to request a WebSocket
* handshake including supported WebSocket extensions.
* The message body and non-WebSocket-related headers are
* not modified.
*
* This is a low-level function; if you use
* soup_session_websocket_connect_async() to create a WebSocket
* connection, it will call this for you.
* @param msg a #SoupMessage
* @param origin the "Origin" header to set
* @param protocols list of protocols to offer
* @param supported_extensions list of supported extension types
*/
function websocket_client_prepare_handshake_with_extensions(
msg: Message,
origin?: string | null,
protocols?: string[] | null,
supported_extensions?: GObject.TypeClass[] | null,
): void;
/**
* Looks at the response status code and headers in `msg` and
* determines if they contain a valid WebSocket handshake response
* (given the handshake request in `msg'`s request headers).
*
* If the response contains the "Sec-WebSocket-Extensions" header,
* the handshake will be considered invalid. You need to use
* soup_websocket_client_verify_handshake_with_extensions() to handle
* responses with extensions.
*
* This is a low-level function; if you use
* soup_session_websocket_connect_async() to create a WebSocket
* connection, it will call this for you.
* @param msg #SoupMessage containing both client and server sides of a WebSocket handshake
* @returns %TRUE if @msg contains a completed valid WebSocket handshake, %FALSE and an error if not.
*/
function websocket_client_verify_handshake(msg: Message): boolean;
/**
* Looks at the response status code and headers in `msg` and
* determines if they contain a valid WebSocket handshake response
* (given the handshake request in `msg'`s request headers).
*
* If `supported_extensions` is non-%NULL, extensions included in the
* response "Sec-WebSocket-Extensions" are verified too. Accepted
* extensions are returned in `accepted_extensions` parameter if non-%NULL.
*
* This is a low-level function; if you use
* soup_session_websocket_connect_async() to create a WebSocket
* connection, it will call this for you.
* @param msg #SoupMessage containing both client and server sides of a WebSocket handshake
* @param supported_extensions list of supported extension types
* @returns %TRUE if @msg contains a completed valid WebSocket handshake, %FALSE and an error if not.
*/
function websocket_client_verify_handshake_with_extensions(
msg: Message,
supported_extensions?: GObject.TypeClass[] | null,
): [boolean, WebsocketExtension[] | null];
function websocket_error_get_quark(): GLib.Quark;
/**
* Examines the method and request headers in `msg` and determines
* whether `msg` contains a valid handshake request.
*
* If `origin` is non-%NULL, then only requests containing a matching
* "Origin" header will be accepted. If `protocols` is non-%NULL, then
* only requests containing a compatible "Sec-WebSocket-Protocols"
* header will be accepted.
*
* Requests containing "Sec-WebSocket-Extensions" header will be
* accepted even if the header is not valid. To check a request
* with extensions you need to use
* soup_websocket_server_check_handshake_with_extensions() and provide
* the list of supported extension types.
*
* Normally soup_websocket_server_process_handshake() will take care
* of this for you, and if you use soup_server_add_websocket_handler()
* to handle accepting WebSocket connections, it will call that for
* you. However, this function may be useful if you need to perform
* more complicated validation; eg, accepting multiple different Origins,
* or handling different protocols depending on the path.
* @param msg #SoupMessage containing the client side of a WebSocket handshake
* @param origin expected Origin header
* @param protocols allowed WebSocket protocols.
* @returns %TRUE if @msg contained a valid WebSocket handshake, %FALSE and an error if not.
*/
function websocket_server_check_handshake(
msg: Message,
origin?: string | null,
protocols?: string[] | null,
): boolean;
/**
* Examines the method and request headers in `msg` and determines
* whether `msg` contains a valid handshake request.
*
* If `origin` is non-%NULL, then only requests containing a matching
* "Origin" header will be accepted. If `protocols` is non-%NULL, then
* only requests containing a compatible "Sec-WebSocket-Protocols"
* header will be accepted. If `supported_extensions` is non-%NULL, then
* only requests containing valid supported extensions in
* "Sec-WebSocket-Extensions" header will be accepted.
*
* Normally soup_websocket_server_process_handshake_with_extensioins()
* will take care of this for you, and if you use
* soup_server_add_websocket_handler() to handle accepting WebSocket
* connections, it will call that for you. However, this function may
* be useful if you need to perform more complicated validation; eg,
* accepting multiple different Origins, or handling different protocols
* depending on the path.
* @param msg #SoupMessage containing the client side of a WebSocket handshake
* @param origin expected Origin header
* @param protocols allowed WebSocket protocols.
* @param supported_extensions list of supported extension types
* @returns %TRUE if @msg contained a valid WebSocket handshake, %FALSE and an error if not.
*/
function websocket_server_check_handshake_with_extensions(
msg: Message,
origin?: string | null,
protocols?: string[] | null,
supported_extensions?: GObject.TypeClass[] | null,
): boolean;
/**
* Examines the method and request headers in `msg` and (assuming `msg`
* contains a valid handshake request), fills in the handshake
* response.
*
* If `expected_origin` is non-%NULL, then only requests containing a matching
* "Origin" header will be accepted. If `protocols` is non-%NULL, then
* only requests containing a compatible "Sec-WebSocket-Protocols"
* header will be accepted.
*
* Requests containing "Sec-WebSocket-Extensions" header will be
* accepted even if the header is not valid. To process a request
* with extensions you need to use
* soup_websocket_server_process_handshake_with_extensions() and provide
* the list of supported extension types.
*
* This is a low-level function; if you use
* soup_server_add_websocket_handler() to handle accepting WebSocket
* connections, it will call this for you.
* @param msg #SoupMessage containing the client side of a WebSocket handshake
* @param expected_origin expected Origin header
* @param protocols allowed WebSocket protocols.
* @returns %TRUE if @msg contained a valid WebSocket handshake request and was updated to contain a handshake response. %FALSE if not.
*/
function websocket_server_process_handshake(
msg: Message,
expected_origin?: string | null,
protocols?: string[] | null,
): boolean;
/**
* Examines the method and request headers in `msg` and (assuming `msg`
* contains a valid handshake request), fills in the handshake
* response.
*
* If `expected_origin` is non-%NULL, then only requests containing a matching
* "Origin" header will be accepted. If `protocols` is non-%NULL, then
* only requests containing a compatible "Sec-WebSocket-Protocols"
* header will be accepted. If `supported_extensions` is non-%NULL, then
* only requests containing valid supported extensions in
* "Sec-WebSocket-Extensions" header will be accepted. The accepted extensions
* will be returned in `accepted_extensions` parameter if non-%NULL.
*
* This is a low-level function; if you use
* soup_server_add_websocket_handler() to handle accepting WebSocket
* connections, it will call this for you.
* @param msg #SoupMessage containing the client side of a WebSocket handshake
* @param expected_origin expected Origin header
* @param protocols allowed WebSocket protocols.
* @param supported_extensions list of supported extension types
* @returns %TRUE if @msg contained a valid WebSocket handshake request and was updated to contain a handshake response. %FALSE if not.
*/
function websocket_server_process_handshake_with_extensions(
msg: Message,
expected_origin?: string | null,
protocols?: string[] | null,
supported_extensions?: GObject.TypeClass[] | null,
): [boolean, WebsocketExtension[] | null];
/**
* This creates an XML-RPC methodCall and returns it as a string.
* This is the low-level method that soup_xmlrpc_request_new() is
* built on.
*
* `params` is an array of #GValue representing the parameters to
* `method`. (It is *not* a #GValueArray, although if you have a
* #GValueArray, you can just pass its valuesf and
* n_values fields.)
*
* The correspondence between glib types and XML-RPC types is:
*
* int: #int (%G_TYPE_INT)
* boolean: #gboolean (%G_TYPE_BOOLEAN)
* string: #char* (%G_TYPE_STRING)
* double: #double (%G_TYPE_DOUBLE)
* datetime.iso8601: #SoupDate (%SOUP_TYPE_DATE)
* base64: #GByteArray (%SOUP_TYPE_BYTE_ARRAY)
* struct: #GHashTable (%G_TYPE_HASH_TABLE)
* array: #GValueArray (%G_TYPE_VALUE_ARRAY)
*
* For structs, use a #GHashTable that maps strings to #GValue;
* soup_value_hash_new() and related methods can help with this.
* @param method_name the name of the XML-RPC method
* @param params arguments to @method
* @returns the text of the methodCall, or %NULL on error
*/
function xmlrpc_build_method_call(method_name: string, params: (GObject.Value | any)[]): string | null;
/**
* This creates a (successful) XML-RPC methodResponse and returns it
* as a string. To create a fault response, use
* soup_xmlrpc_build_fault().
*
* The glib type to XML-RPC type mapping is as with
* soup_xmlrpc_build_method_call(), qv.
* @param value the return value
* @returns the text of the methodResponse, or %NULL on error
*/
function xmlrpc_build_method_response(value: GObject.Value | any): string | null;
/**
* This creates an XML-RPC methodCall and returns it as a string.
* This is the low-level method that soup_xmlrpc_message_new() is
* built on.
*
* `params` is a #GVariant tuple representing the method parameters.
*
* Serialization details:
* - "a{s*}" and "{s*}" are serialized as <struct>
* - "ay" is serialized as <base64>
* - Other arrays and tuples are serialized as <array>
* - booleans are serialized as <boolean>
* - byte, int16, uint16 and int32 are serialized as <int>
* - uint32 and int64 are serialized as the nonstandard <i8> type
* - doubles are serialized as <double>
* - Strings are serialized as <string>
* - Variants (i.e. "v" type) are unwrapped and their child is serialized.
* - #GVariants created by soup_xmlrpc_variant_new_datetime() are serialized as
* <dateTime.iso8601>
* - Other types are not supported and will return %NULL and set `error`.
* This notably includes: object-paths, signatures, uint64, handles, maybes
* and dictionaries with non-string keys.
*
* If `params` is floating, it is consumed.
* @param method_name the name of the XML-RPC method
* @param params a #GVariant tuple
* @returns the text of the methodCall, or %NULL on error.
*/
function xmlrpc_build_request(method_name: string, params: GLib.Variant): string;
/**
* This creates a (successful) XML-RPC methodResponse and returns it
* as a string. To create a fault response, use soup_xmlrpc_build_fault(). This
* is the low-level method that soup_xmlrpc_message_set_response() is built on.
*
* See soup_xmlrpc_build_request() for serialization details, but note
* that since a method can only have a single return value, `value`
* should not be a tuple here (unless the return value is an array).
*
* If `value` is floating, it is consumed.
* @param value the return value
* @returns the text of the methodResponse, or %NULL on error.
*/
function xmlrpc_build_response(value: GLib.Variant): string;
function xmlrpc_error_quark(): GLib.Quark;
function xmlrpc_fault_quark(): GLib.Quark;
/**
* Creates an XML-RPC methodCall and returns a #SoupMessage, ready
* to send, for that method call.
*
* See soup_xmlrpc_build_request() for serialization details.
*
* If `params` is floating, it is consumed.
* @param uri URI of the XML-RPC service
* @param method_name the name of the XML-RPC method to invoke at @uri
* @param params a #GVariant tuple
* @returns a #SoupMessage encoding the indicated XML-RPC request, or %NULL on error.
*/
function xmlrpc_message_new(uri: string, method_name: string, params: GLib.Variant): Message;
/**
* Sets the status code and response body of `msg` to indicate a
* successful XML-RPC call, with a return value given by `value`. To set a
* fault response, use soup_xmlrpc_message_set_fault().
*
* See soup_xmlrpc_build_request() for serialization details.
*
* If `value` is floating, it is consumed.
* @param msg an XML-RPC request
* @param value a #GVariant
* @returns %TRUE on success, %FALSE otherwise.
*/
function xmlrpc_message_set_response(msg: Message, value: GLib.Variant): boolean;
/**
* Parses `method_call` to get the name and parameters, and returns the
* parameter values in a #GValueArray; see also
* soup_xmlrpc_extract_method_call(), which is more convenient if you
* know in advance what the types of the parameters will be.
* @param method_call the XML-RPC methodCall string
* @param length the length of @method_call, or -1 if it is NUL-terminated
* @returns success or failure.
*/
function xmlrpc_parse_method_call(method_call: string, length: number): [boolean, string, GObject.ValueArray];
/**
* Parses `method_response` and returns the return value in `value`. If
* `method_response` is a fault, `value` will be unchanged, and `error`
* will be set to an error of type %SOUP_XMLRPC_FAULT, with the error
* #code containing the fault code, and the error #message containing
* the fault string. (If `method_response` cannot be parsed at all,
* soup_xmlrpc_parse_method_response() will return %FALSE, but `error`
* will be unset.)
* @param method_response the XML-RPC methodResponse string
* @param length the length of @method_response, or -1 if it is NUL-terminated
* @returns %TRUE if a return value was parsed, %FALSE if the response could not be parsed, or contained a fault.
*/
function xmlrpc_parse_method_response(method_response: string, length: number): [boolean, unknown];
/**
* Parses `method_call` and return the method name. Method parameters can be
* parsed later using soup_xmlrpc_params_parse().
* @param method_call the XML-RPC methodCall string
* @param length the length of @method_call, or -1 if it is NUL-terminated
* @returns method's name, or %NULL on error.
*/
function xmlrpc_parse_request(method_call: string, length: number): [string, XMLRPCParams];
/**
* Parses `method_response` and returns the return value. If
* `method_response` is a fault, %NULL is returned, and `error`
* will be set to an error in the %SOUP_XMLRPC_FAULT domain, with the error
* code containing the fault code, and the error message containing
* the fault string. If `method_response` cannot be parsed, %NULL is returned,
* and `error` will be set to an error in the %SOUP_XMLRPC_ERROR domain.
*
* See soup_xmlrpc_params_parse() for deserialization details.
* @param method_response the XML-RPC methodResponse string
* @param length the length of @method_response, or -1 if it is NUL-terminated
* @param signature A valid #GVariant type string, or %NULL
* @returns a new (non-floating) #GVariant, or %NULL
*/
function xmlrpc_parse_response(
method_response: string,
length: number,
signature?: string | null,
): GLib.Variant;
/**
* Get the #SoupDate from special #GVariant created by
* soup_xmlrpc_variant_new_datetime() or by parsing a <dateTime.iso8601>
* node. See soup_xmlrpc_params_parse().
*
* If `variant` does not contain a datetime it will return an error but it is not
* considered a programmer error because it generally means parameters received
* are not in the expected type.
* @param variant a #GVariant
* @returns a new #SoupDate, or %NULL on error.
*/
function xmlrpc_variant_get_datetime(variant: GLib.Variant): Date;
/**
* Construct a special #GVariant used to serialize a <dateTime.iso8601>
* node. See soup_xmlrpc_build_request().
*
* The actual type of the returned #GVariant is unspecified and "v" or "*"
* should be used in variant format strings. For example:
*
* args = g_variant_new ("(v)", soup_xmlrpc_variant_new_datetime (date));
*
* @param date a #SoupDate
* @returns a floating #GVariant.
*/
function xmlrpc_variant_new_datetime(date: Date): GLib.Variant;
interface AddressCallback {
(addr: Address, status: number): void;
}
interface AuthDomainBasicAuthCallback {
(domain: AuthDomainBasic, msg: Message, username: string, password: string): boolean;
}
interface AuthDomainDigestAuthCallback {
(domain: AuthDomainDigest, msg: Message, username: string): string | null;
}
interface AuthDomainFilter {
(domain: AuthDomain, msg: Message): boolean;
}
interface AuthDomainGenericAuthCallback {
(domain: AuthDomain, msg: Message, username: string): boolean;
}
interface ChunkAllocator {
(msg: Message, max_len: number): Buffer | null;
}
interface LoggerFilter {
(logger: Logger, msg: Message): LoggerLogLevel;
}
interface LoggerPrinter {
(logger: Logger, level: LoggerLogLevel, direction: number, data: string): void;
}
interface MessageHeadersForeachFunc {
(name: string, value: string): void;
}
interface PasswordManagerCallback {
(password_manager: PasswordManager, msg: Message, auth: Auth, retrying: boolean): void;
}
interface ProxyResolverCallback {
(proxy_resolver: ProxyResolver, msg: Message, arg: number, addr: Address): void;
}
interface ProxyURIResolverCallback {
(resolver: ProxyURIResolver, status: number, proxy_uri: URI): void;
}
interface ServerCallback {
(
server: Server,
msg: Message,
path: string,
query: GLib.HashTable | null,
client: ClientContext,
): void;
}
interface ServerWebsocketCallback {
(server: Server, connection: WebsocketConnection, path: string, client: ClientContext): void;
}
interface SessionCallback {
(session: Session, msg: Message): void;
}
interface SessionConnectProgressCallback {
(session: Session, event: Gio.SocketClientEvent, connection: Gio.IOStream): void;
}
interface SocketCallback {
(sock: Socket, status: number): void;
}
type ByteArray = object | null;
export namespace Cacheability {
export const $gtype: GObject.GType;
}
enum Cacheability {
CACHEABLE,
UNCACHEABLE,
INVALIDATES,
VALIDATES,
}
/**
* Represents the parsed value of the "Expect" header.
*/
/**
* Represents the parsed value of the "Expect" header.
*/
export namespace Expectation {
export const $gtype: GObject.GType;
}
enum Expectation {
/**
* any unrecognized expectation
*/
UNRECOGNIZED,
/**
* "100-continue"
*/
CONTINUE,
}
/**
* Various flags that can be set on a #SoupMessage to alter its
* behavior.
*/
/**
* Various flags that can be set on a #SoupMessage to alter its
* behavior.
*/
export namespace MessageFlags {
export const $gtype: GObject.GType;
}
enum MessageFlags {
/**
* The session should not follow redirect
* (3xx) responses received by this message.
*/
NO_REDIRECT,
/**
* The caller will rebuild the request
* body if the message is restarted; see
* soup_message_body_set_accumulate() for more details.
*/
CAN_REBUILD,
/**
* Deprecated: equivalent to calling
* soup_message_body_set_accumulate() on the incoming message body
* (ie, #SoupMessage:response_body for a client-side request),
* passing %FALSE.
*/
OVERWRITE_CHUNKS,
/**
* Set by #SoupContentDecoder to
* indicate that it has removed the Content-Encoding on a message (and
* so headers such as Content-Length may no longer accurately describe
* the body).
*/
CONTENT_DECODED,
/**
* if set after an https response
* has been received, indicates that the server's SSL certificate is
* trusted according to the session's CA.
*/
CERTIFICATE_TRUSTED,
/**
* Requests that the message should be
* sent on a newly-created connection, not reusing an existing
* persistent connection. Note that messages with non-idempotent
* #SoupMessage:methods behave this way by default, unless
* #SOUP_MESSAGE_IDEMPOTENT is set.
*/
NEW_CONNECTION,
/**
* The message is considered idempotent,
* regardless its #SoupMessage:method, and allows reuse of existing
* idle connections, instead of always requiring a new one, unless
* #SOUP_MESSAGE_NEW_CONNECTION is set.
*/
IDEMPOTENT,
/**
* Request that a new connection is
* created for the message if there aren't idle connections available
* and it's not possible to create new connections due to any of the
* connection limits has been reached. If a dedicated connection is
* eventually created for this message, it will be dropped when the
* message finishes. Since 2.50
*/
IGNORE_CONNECTION_LIMITS,
/**
* The #SoupAuthManager should not use
* the credentials cache for this message, neither to use cached credentials
* to automatically authenticate this message nor to cache the credentials
* after the message is successfully authenticated. This applies to both server
* and proxy authentication. Note that #SoupSession::authenticate signal will
* be emitted, if you want to disable authentication for a message use
* soup_message_disable_feature() passing #SOUP_TYPE_AUTH_MANAGER instead. Since 2.58
*/
DO_NOT_USE_AUTH_CACHE,
}
/**
* Options to pass to soup_server_listen(), etc.
*
* %SOUP_SERVER_LISTEN_IPV4_ONLY and %SOUP_SERVER_LISTEN_IPV6_ONLY
* only make sense with soup_server_listen_all() and
* soup_server_listen_local(), not plain soup_server_listen() (which
* simply listens on whatever kind of socket you give it). And you
* cannot specify both of them in a single call.
*/
/**
* Options to pass to soup_server_listen(), etc.
*
* %SOUP_SERVER_LISTEN_IPV4_ONLY and %SOUP_SERVER_LISTEN_IPV6_ONLY
* only make sense with soup_server_listen_all() and
* soup_server_listen_local(), not plain soup_server_listen() (which
* simply listens on whatever kind of socket you give it). And you
* cannot specify both of them in a single call.
*/
export namespace ServerListenOptions {
export const $gtype: GObject.GType;
}
enum ServerListenOptions {
/**
* Listen for https connections rather
* than plain http.
*/
HTTPS,
/**
* Only listen on IPv4 interfaces.
*/
IPV4_ONLY,
/**
* Only listen on IPv6 interfaces.
*/
IPV6_ONLY,
}
namespace Address {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'notify::family': (pspec: GObject.ParamSpec) => void;
'notify::name': (pspec: GObject.ParamSpec) => void;
'notify::physical': (pspec: GObject.ParamSpec) => void;
'notify::port': (pspec: GObject.ParamSpec) => void;
'notify::protocol': (pspec: GObject.ParamSpec) => void;
'notify::sockaddr': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, Gio.SocketConnectable.ConstructorProps {
family: AddressFamily;
name: string;
physical: string;
port: number;
protocol: string;
sockaddr: any;
}
}
class Address extends GObject.Object implements Gio.SocketConnectable {
static $gtype: GObject.GType;
// Properties
get family(): AddressFamily;
get name(): string;
get physical(): string;
get port(): number;
get protocol(): string;
get sockaddr(): any;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Address.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](name: string, port: number): Address;
static new_any(family: AddressFamily, port: number): Address;
static new_from_sockaddr(sa: any | null, len: number): Address;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Tests if `addr1` and `addr2` have the same IP address. This method
* can be used with soup_address_hash_by_ip() to create a
* #GHashTable that hashes on IP address.
*
* This would be used to distinguish hosts in situations where
* different virtual hosts on the same IP address should be considered
* the same. Eg, if "www.example.com" and "www.example.net" have the
* same IP address, then a single connection can be used to talk
* to either of them.
*
* See also soup_address_equal_by_name(), which compares by name
* rather than by IP address.
* @param addr2 another #SoupAddress with a resolved IP address
* @returns whether or not @addr1 and @addr2 have the same IP address.
*/
equal_by_ip(addr2: Address): boolean;
/**
* Tests if `addr1` and `addr2` have the same "name". This method can be
* used with soup_address_hash_by_name() to create a #GHashTable that
* hashes on address "names".
*
* Comparing by name normally means comparing the addresses by their
* hostnames. But if the address was originally created using an IP
* address literal, then it will be compared by that instead.
*
* In particular, if "www.example.com" has the IP address 10.0.0.1,
* and `addr1` was created with the name "www.example.com" and `addr2`
* was created with the name "10.0.0.1", then they will compare as
* unequal for purposes of soup_address_equal_by_name().
*
* This would be used to distinguish hosts in situations where
* different virtual hosts on the same IP address should be considered
* different. Eg, for purposes of HTTP authentication or cookies, two
* hosts with the same IP address but different names are considered
* to be different hosts.
*
* See also soup_address_equal_by_ip(), which compares by IP address
* rather than by name.
* @param addr2 another #SoupAddress with a resolved name
* @returns whether or not @addr1 and @addr2 have the same name
*/
equal_by_name(addr2: Address): boolean;
/**
* Creates a new #GSocketAddress corresponding to `addr` (which is assumed
* to only have one socket address associated with it).
* @returns a new #GSocketAddress
*/
get_gsockaddr(): Gio.SocketAddress;
/**
* Returns the hostname associated with `addr`.
*
* This method is not thread-safe; if you call it while `addr` is being
* resolved in another thread, it may return garbage. You can use
* soup_address_is_resolved() to safely test whether or not an address
* is resolved before fetching its name or address.
* @returns the hostname, or %NULL if it is not known.
*/
get_name(): string | null;
/**
* Returns the physical address associated with `addr` as a string.
* (Eg, "127.0.0.1"). If the address is not yet known, returns %NULL.
*
* This method is not thread-safe; if you call it while `addr` is being
* resolved in another thread, it may return garbage. You can use
* soup_address_is_resolved() to safely test whether or not an address
* is resolved before fetching its name or address.
* @returns the physical address, or %NULL
*/
get_physical(): string | null;
/**
* Returns the port associated with `addr`.
* @returns the port
*/
get_port(): number;
/**
* Returns the sockaddr associated with `addr,` with its length in
* *`len`. If the sockaddr is not yet known, returns %NULL.
*
* This method is not thread-safe; if you call it while `addr` is being
* resolved in another thread, it may return garbage. You can use
* soup_address_is_resolved() to safely test whether or not an address
* is resolved before fetching its name or address.
* @returns the sockaddr, or %NULL
*/
get_sockaddr(): [any | null, number];
/**
* A hash function (for #GHashTable) that corresponds to
* soup_address_equal_by_ip(), qv
* @returns the IP-based hash value for @addr.
*/
hash_by_ip(): number;
/**
* A hash function (for #GHashTable) that corresponds to
* soup_address_equal_by_name(), qv
* @returns the named-based hash value for @addr.
*/
hash_by_name(): number;
/**
* Tests if `addr` has already been resolved. Unlike the other
* #SoupAddress "get" methods, this is safe to call when `addr` might
* be being resolved in another thread.
* @returns %TRUE if @addr has been resolved.
*/
is_resolved(): boolean;
/**
* Asynchronously resolves the missing half of `addr` (its IP address
* if it was created with soup_address_new(), or its hostname if it
* was created with soup_address_new_from_sockaddr() or
* soup_address_new_any().)
*
* If `cancellable` is non-%NULL, it can be used to cancel the
* resolution. `callback` will still be invoked in this case, with a
* status of %SOUP_STATUS_CANCELLED.
*
* It is safe to call this more than once on a given address, from the
* same thread, with the same `async_context` (and doing so will not
* result in redundant DNS queries being made). But it is not safe to
* call from multiple threads, or with different `async_contexts,` or
* mixed with calls to soup_address_resolve_sync().
* @param async_context the #GMainContext to call @callback from
* @param cancellable a #GCancellable object, or %NULL
* @param callback callback to call with the result
*/
resolve_async(
async_context: GLib.MainContext | null,
cancellable: Gio.Cancellable | null,
callback: AddressCallback,
): void;
/**
* Synchronously resolves the missing half of `addr,` as with
* soup_address_resolve_async().
*
* If `cancellable` is non-%NULL, it can be used to cancel the
* resolution. soup_address_resolve_sync() will then return a status
* of %SOUP_STATUS_CANCELLED.
*
* It is safe to call this more than once, even from different
* threads, but it is not safe to mix calls to
* soup_address_resolve_sync() with calls to
* soup_address_resolve_async() on the same address.
* @param cancellable a #GCancellable object, or %NULL
* @returns %SOUP_STATUS_OK, %SOUP_STATUS_CANT_RESOLVE, or %SOUP_STATUS_CANCELLED.
*/
resolve_sync(cancellable?: Gio.Cancellable | null): number;
// Inherited methods
/**
* Creates a #GSocketAddressEnumerator for `connectable`.
* @returns a new #GSocketAddressEnumerator.
*/
enumerate(): Gio.SocketAddressEnumerator;
/**
* Creates a #GSocketAddressEnumerator for `connectable` that will
* return a #GProxyAddress for each of its addresses that you must connect
* to via a proxy.
*
* If `connectable` does not implement
* g_socket_connectable_proxy_enumerate(), this will fall back to
* calling g_socket_connectable_enumerate().
* @returns a new #GSocketAddressEnumerator.
*/
proxy_enumerate(): Gio.SocketAddressEnumerator;
/**
* Format a #GSocketConnectable as a string. This is a human-readable format for
* use in debugging output, and is not a stable serialization format. It is not
* suitable for use in user interfaces as it exposes too much information for a
* user.
*
* If the #GSocketConnectable implementation does not support string formatting,
* the implementation’s type name will be returned as a fallback.
* @returns the formatted string
*/
to_string(): string;
/**
* Creates a #GSocketAddressEnumerator for `connectable`.
*/
vfunc_enumerate(): Gio.SocketAddressEnumerator;
/**
* Creates a #GSocketAddressEnumerator for `connectable` that will
* return a #GProxyAddress for each of its addresses that you must connect
* to via a proxy.
*
* If `connectable` does not implement
* g_socket_connectable_proxy_enumerate(), this will fall back to
* calling g_socket_connectable_enumerate().
*/
vfunc_proxy_enumerate(): Gio.SocketAddressEnumerator;
/**
* Format a #GSocketConnectable as a string. This is a human-readable format for
* use in debugging output, and is not a stable serialization format. It is not
* suitable for use in user interfaces as it exposes too much information for a
* user.
*
* If the #GSocketConnectable implementation does not support string formatting,
* the implementation’s type name will be returned as a fallback.
*/
vfunc_to_string(): string;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace Auth {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'notify::host': (pspec: GObject.ParamSpec) => void;
'notify::is-authenticated': (pspec: GObject.ParamSpec) => void;
'notify::is-for-proxy': (pspec: GObject.ParamSpec) => void;
'notify::realm': (pspec: GObject.ParamSpec) => void;
'notify::scheme-name': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
host: string;
is_authenticated: boolean;
isAuthenticated: boolean;
is_for_proxy: boolean;
isForProxy: boolean;
realm: string;
scheme_name: string;
schemeName: string;
}
}
/**
* The abstract base class for handling authentication. Specific HTTP
* Authentication mechanisms are implemented by its subclasses, but
* applications never need to be aware of the specific subclasses
* being used.
*/
abstract class Auth extends GObject.Object {
static $gtype: GObject.GType;
// Properties
get host(): string;
set host(val: string);
get is_authenticated(): boolean;
get isAuthenticated(): boolean;
get is_for_proxy(): boolean;
set is_for_proxy(val: boolean);
get isForProxy(): boolean;
set isForProxy(val: boolean);
get realm(): string;
set realm(val: string);
get scheme_name(): string;
get schemeName(): string;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Auth.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](type: GObject.GType, msg: Message, auth_header: string): Auth;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
/**
* Call this on an auth to authenticate it; normally this will cause
* the auth's message to be requeued with the new authentication info.
* @param username the username provided by the user or client
* @param password the password provided by the user or client
*/
vfunc_authenticate(username: string, password: string): void;
/**
* Tests if `auth` is able to authenticate by providing credentials to the
* soup_auth_authenticate().
*/
vfunc_can_authenticate(): boolean;
/**
* Generates an appropriate "Authorization" header for `msg`. (The
* session will only call this if soup_auth_is_authenticated()
* returned %TRUE.)
* @param msg the #SoupMessage to be authorized
*/
vfunc_get_authorization(msg: Message): string;
/**
* Returns a list of paths on the server which `auth` extends over.
* (All subdirectories of these paths are also assumed to be part
* of `auth'`s protection space, unless otherwise discovered not to
* be.)
* @param source_uri the URI of the request that @auth was generated in response to.
*/
vfunc_get_protection_space(source_uri: URI): string[];
/**
* Tests if `auth` has been given a username and password
*/
vfunc_is_authenticated(): boolean;
/**
* Tests if `auth` is ready to make a request for `msg` with. For most
* auths, this is equivalent to soup_auth_is_authenticated(), but for
* some auth types (eg, NTLM), the auth may be sendable (eg, as an
* authentication request) even before it is authenticated.
* @param msg a #SoupMessage
*/
vfunc_is_ready(msg: Message): boolean;
/**
* Updates `auth` with the information from `msg` and `auth_header,`
* possibly un-authenticating it. As with soup_auth_new(), this is
* normally only used by #SoupSession.
* @param msg the #SoupMessage @auth is being updated for
* @param auth_header the WWW-Authenticate/Proxy-Authenticate header
*/
vfunc_update(msg: Message, auth_header: { [key: string]: any } | GLib.HashTable): boolean;
// Methods
/**
* Call this on an auth to authenticate it; normally this will cause
* the auth's message to be requeued with the new authentication info.
* @param username the username provided by the user or client
* @param password the password provided by the user or client
*/
authenticate(username: string, password: string): void;
/**
* Tests if `auth` is able to authenticate by providing credentials to the
* soup_auth_authenticate().
* @returns %TRUE if @auth is able to accept credentials.
*/
can_authenticate(): boolean;
/**
* Generates an appropriate "Authorization" header for `msg`. (The
* session will only call this if soup_auth_is_authenticated()
* returned %TRUE.)
* @param msg the #SoupMessage to be authorized
* @returns the "Authorization" header, which must be freed.
*/
get_authorization(msg: Message): string;
/**
* Returns the host that `auth` is associated with.
* @returns the hostname
*/
get_host(): string;
/**
* Gets an opaque identifier for `auth,` for use as a hash key or the
* like. #SoupAuth objects from the same server with the same
* identifier refer to the same authentication domain (eg, the URLs
* associated with them take the same usernames and passwords).
* @returns the identifier
*/
get_info(): string;
/**
* Returns a list of paths on the server which `auth` extends over.
* (All subdirectories of these paths are also assumed to be part
* of `auth'`s protection space, unless otherwise discovered not to
* be.)
* @param source_uri the URI of the request that @auth was generated in response to.
* @returns the list of paths, which can be freed with soup_auth_free_protection_space().
*/
get_protection_space(source_uri: URI): string[];
/**
* Returns `auth'`s realm. This is an identifier that distinguishes
* separate authentication spaces on a given server, and may be some
* string that is meaningful to the user. (Although it is probably not
* localized.)
* @returns the realm name
*/
get_realm(): string;
get_saved_password(user: string): string;
get_saved_users(): string[];
/**
* Returns `auth'`s scheme name. (Eg, "Basic", "Digest", or "NTLM")
* @returns the scheme name
*/
get_scheme_name(): string;
has_saved_password(username: string, password: string): void;
/**
* Tests if `auth` is ready to make a request for `msg` with. For most
* auths, this is equivalent to soup_auth_is_authenticated(), but for
* some auth types (eg, NTLM), the auth may be sendable (eg, as an
* authentication request) even before it is authenticated.
* @param msg a #SoupMessage
* @returns %TRUE if @auth is ready to make a request with.
*/
is_ready(msg: Message): boolean;
save_password(username: string, password: string): void;
/**
* Updates `auth` with the information from `msg` and `auth_header,`
* possibly un-authenticating it. As with soup_auth_new(), this is
* normally only used by #SoupSession.
* @param msg the #SoupMessage @auth is being updated for
* @param auth_header the WWW-Authenticate/Proxy-Authenticate header
* @returns %TRUE if @auth is still a valid (but potentially unauthenticated) #SoupAuth. %FALSE if something about @auth_params could not be parsed or incorporated into @auth at all.
*/
update(msg: Message, auth_header: string): boolean;
}
namespace AuthBasic {
// Signal signatures
interface SignalSignatures extends Auth.SignalSignatures {
'notify::host': (pspec: GObject.ParamSpec) => void;
'notify::is-authenticated': (pspec: GObject.ParamSpec) => void;
'notify::is-for-proxy': (pspec: GObject.ParamSpec) => void;
'notify::realm': (pspec: GObject.ParamSpec) => void;
'notify::scheme-name': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends Auth.ConstructorProps {}
}
class AuthBasic extends Auth {
static $gtype: GObject.GType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: AuthBasic.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
}
namespace AuthDigest {
// Signal signatures
interface SignalSignatures extends Auth.SignalSignatures {
'notify::host': (pspec: GObject.ParamSpec) => void;
'notify::is-authenticated': (pspec: GObject.ParamSpec) => void;
'notify::is-for-proxy': (pspec: GObject.ParamSpec) => void;
'notify::realm': (pspec: GObject.ParamSpec) => void;
'notify::scheme-name': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends Auth.ConstructorProps {}
}
class AuthDigest extends Auth {
static $gtype: GObject.GType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: AuthDigest.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
}
namespace AuthDomain {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'notify::add-path': (pspec: GObject.ParamSpec) => void;
'notify::filter': (pspec: GObject.ParamSpec) => void;
'notify::filter-data': (pspec: GObject.ParamSpec) => void;
'notify::generic-auth-callback': (pspec: GObject.ParamSpec) => void;
'notify::generic-auth-data': (pspec: GObject.ParamSpec) => void;
'notify::proxy': (pspec: GObject.ParamSpec) => void;
'notify::realm': (pspec: GObject.ParamSpec) => void;
'notify::remove-path': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
add_path: string;
addPath: string;
filter: AuthDomainFilter;
filter_data: any;
filterData: any;
generic_auth_callback: AuthDomainGenericAuthCallback;
genericAuthCallback: AuthDomainGenericAuthCallback;
generic_auth_data: any;
genericAuthData: any;
proxy: boolean;
realm: string;
remove_path: string;
removePath: string;
}
}
abstract class AuthDomain extends GObject.Object {
static $gtype: GObject.GType;
// Properties
set add_path(val: string);
set addPath(val: string);
/**
* The #SoupAuthDomainFilter for the domain
*/
get filter(): AuthDomainFilter;
set filter(val: AuthDomainFilter);
get filter_data(): any;
set filter_data(val: any);
get filterData(): any;
set filterData(val: any);
/**
* The #SoupAuthDomainGenericAuthCallback for the domain
*/
get generic_auth_callback(): AuthDomainGenericAuthCallback;
set generic_auth_callback(val: AuthDomainGenericAuthCallback);
/**
* The #SoupAuthDomainGenericAuthCallback for the domain
*/
get genericAuthCallback(): AuthDomainGenericAuthCallback;
set genericAuthCallback(val: AuthDomainGenericAuthCallback);
get generic_auth_data(): any;
set generic_auth_data(val: any);
get genericAuthData(): any;
set genericAuthData(val: any);
get proxy(): boolean;
get realm(): string;
set remove_path(val: string);
set removePath(val: string);
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: AuthDomain.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
vfunc_accepts(msg: Message, header: string): string;
/**
* Adds a "WWW-Authenticate" or "Proxy-Authenticate" header to `msg,`
* requesting that the client authenticate, and sets `msg'`s status
* accordingly.
*
* This is used by #SoupServer internally and is probably of no use to
* anyone else.
* @param msg a #SoupMessage
*/
vfunc_challenge(msg: Message): string;
/**
* Checks if `msg` authenticates to `domain` via `username` and
* `password`. This would normally be called from a
* #SoupAuthDomainGenericAuthCallback.
* @param msg a #SoupMessage
* @param username a username
* @param password a password
*/
vfunc_check_password(msg: Message, username: string, password: string): boolean;
// Methods
/**
* Checks if `msg` contains appropriate authorization for `domain` to
* accept it. Mirroring soup_auth_domain_covers(), this does not check
* whether or not `domain` cares if `msg` is
* authorized.
*
* This is used by #SoupServer internally and is probably of no use to
* anyone else.
* @param msg a #SoupMessage
* @returns the username that @msg has authenticated as, if in fact it has authenticated. %NULL otherwise.
*/
accepts(msg: Message): string | null;
/**
* Adds a "WWW-Authenticate" or "Proxy-Authenticate" header to `msg,`
* requesting that the client authenticate, and sets `msg'`s status
* accordingly.
*
* This is used by #SoupServer internally and is probably of no use to
* anyone else.
* @param msg a #SoupMessage
*/
challenge(msg: Message): void;
/**
* Checks if `msg` authenticates to `domain` via `username` and
* `password`. This would normally be called from a
* #SoupAuthDomainGenericAuthCallback.
* @param msg a #SoupMessage
* @param username a username
* @param password a password
* @returns whether or not the message is authenticated
*/
check_password(msg: Message, username: string, password: string): boolean;
/**
* Checks if `domain` requires `msg` to be authenticated (according to
* its paths and filter function). This does not actually look at
* whether `msg` is authenticated, merely whether
* or not it needs to be.
*
* This is used by #SoupServer internally and is probably of no use to
* anyone else.
* @param msg a #SoupMessage
* @returns %TRUE if @domain requires @msg to be authenticated
*/
covers(msg: Message): boolean;
/**
* Gets the realm name associated with `domain`
* @returns @domain's realm
*/
get_realm(): string;
/**
* Adds `filter` as an authentication filter to `domain`. The filter
* gets a chance to bypass authentication for certain requests that
* would otherwise require it. Eg, it might check the message's path
* in some way that is too complicated to do via the other methods, or
* it might check the message's method, and allow GETs but not PUTs.
*
* The filter function returns %TRUE if the request should still
* require authentication, or %FALSE if authentication is unnecessary
* for this request.
*
* To help prevent security holes, your filter should return %TRUE by
* default, and only return %FALSE under specifically-tested
* circumstances, rather than the other way around. Eg, in the example
* above, where you want to authenticate PUTs but not GETs, you should
* check if the method is GET and return %FALSE in that case, and then
* return %TRUE for all other methods (rather than returning %TRUE for
* PUT and %FALSE for all other methods). This way if it turned out
* (now or later) that some paths supported additional methods besides
* GET and PUT, those methods would default to being NOT allowed for
* unauthenticated users.
*
* You can also set the filter by setting the %SOUP_AUTH_DOMAIN_FILTER
* and %SOUP_AUTH_DOMAIN_FILTER_DATA properties, which can also be
* used to set the filter at construct time.
* @param filter the auth filter for @domain
*/
set_filter(filter: AuthDomainFilter): void;
/**
* Sets `auth_callback` as an authentication-handling callback for
* `domain`. Whenever a request comes in to `domain` which cannot be
* authenticated via a domain-specific auth callback (eg,
* #SoupAuthDomainDigestAuthCallback), the generic auth callback
* will be invoked. See #SoupAuthDomainGenericAuthCallback for information
* on what the callback should do.
* @param auth_callback the auth callback
*/
set_generic_auth_callback(auth_callback: AuthDomainGenericAuthCallback): void;
try_generic_auth_callback(msg: Message, username: string): boolean;
}
namespace AuthDomainBasic {
// Signal signatures
interface SignalSignatures extends AuthDomain.SignalSignatures {
'notify::auth-callback': (pspec: GObject.ParamSpec) => void;
'notify::auth-data': (pspec: GObject.ParamSpec) => void;
'notify::add-path': (pspec: GObject.ParamSpec) => void;
'notify::filter': (pspec: GObject.ParamSpec) => void;
'notify::filter-data': (pspec: GObject.ParamSpec) => void;
'notify::generic-auth-callback': (pspec: GObject.ParamSpec) => void;
'notify::generic-auth-data': (pspec: GObject.ParamSpec) => void;
'notify::proxy': (pspec: GObject.ParamSpec) => void;
'notify::realm': (pspec: GObject.ParamSpec) => void;
'notify::remove-path': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends AuthDomain.ConstructorProps {
auth_callback: AuthDomainBasicAuthCallback;
authCallback: AuthDomainBasicAuthCallback;
auth_data: any;
authData: any;
}
}
class AuthDomainBasic extends AuthDomain {
static $gtype: GObject.GType;
// Properties
/**
* The #SoupAuthDomainBasicAuthCallback
*/
get auth_callback(): AuthDomainBasicAuthCallback;
set auth_callback(val: AuthDomainBasicAuthCallback);
/**
* The #SoupAuthDomainBasicAuthCallback
*/
get authCallback(): AuthDomainBasicAuthCallback;
set authCallback(val: AuthDomainBasicAuthCallback);
/**
* The data to pass to the #SoupAuthDomainBasicAuthCallback
*/
get auth_data(): any;
set auth_data(val: any);
/**
* The data to pass to the #SoupAuthDomainBasicAuthCallback
*/
get authData(): any;
set authData(val: any);
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: AuthDomainBasic.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q]
? Q
: never
): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Sets the callback that `domain` will use to authenticate incoming
* requests. For each request containing authorization, `domain` will
* invoke the callback, and then either accept or reject the request
* based on `callback'`s return value.
*
* You can also set the auth callback by setting the
* %SOUP_AUTH_DOMAIN_BASIC_AUTH_CALLBACK and
* %SOUP_AUTH_DOMAIN_BASIC_AUTH_DATA properties, which can also be
* used to set the callback at construct time.
* @param callback the callback
*/
set_auth_callback(callback: AuthDomainBasicAuthCallback): void;
}
namespace AuthDomainDigest {
// Signal signatures
interface SignalSignatures extends AuthDomain.SignalSignatures {
'notify::auth-callback': (pspec: GObject.ParamSpec) => void;
'notify::auth-data': (pspec: GObject.ParamSpec) => void;
'notify::add-path': (pspec: GObject.ParamSpec) => void;
'notify::filter': (pspec: GObject.ParamSpec) => void;
'notify::filter-data': (pspec: GObject.ParamSpec) => void;
'notify::generic-auth-callback': (pspec: GObject.ParamSpec) => void;
'notify::generic-auth-data': (pspec: GObject.ParamSpec) => void;
'notify::proxy': (pspec: GObject.ParamSpec) => void;
'notify::realm': (pspec: GObject.ParamSpec) => void;
'notify::remove-path': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends AuthDomain.ConstructorProps {
auth_callback: AuthDomainDigestAuthCallback;
authCallback: AuthDomainDigestAuthCallback;
auth_data: any;
authData: any;
}
}
class AuthDomainDigest extends AuthDomain {
static $gtype: GObject.GType;
// Properties
/**
* The #SoupAuthDomainDigestAuthCallback
*/
get auth_callback(): AuthDomainDigestAuthCallback;
set auth_callback(val: AuthDomainDigestAuthCallback);
/**
* The #SoupAuthDomainDigestAuthCallback
*/
get authCallback(): AuthDomainDigestAuthCallback;
set authCallback(val: AuthDomainDigestAuthCallback);
/**
* The data to pass to the #SoupAuthDomainDigestAuthCallback
*/
get auth_data(): any;
set auth_data(val: any);
/**
* The data to pass to the #SoupAuthDomainDigestAuthCallback
*/
get authData(): any;
set authData(val: any);
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: AuthDomainDigest.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q]
? Q
: never
): void;
emit(signal: string, ...args: any[]): void;
// Static methods
/**
* Encodes the username/realm/password triplet for Digest
* authentication. (That is, it returns a stringified MD5 hash of
* `username,` `realm,` and `password` concatenated together). This is
* the form that is needed as the return value of
* #SoupAuthDomainDigest's auth handler.
*
* For security reasons, you should store the encoded hash, rather
* than storing the cleartext password itself and calling this method
* only when you need to verify it. This way, if your server is
* compromised, the attackers will not gain access to cleartext
* passwords which might also be usable at other sites. (Note also
* that the encoded password returned by this method is identical to
* the encoded password stored in an Apache .htdigest file.)
* @param username a username
* @param realm an auth realm name
* @param password the password for @username in @realm
*/
static encode_password(username: string, realm: string, password: string): string;
// Methods
/**
* Sets the callback that `domain` will use to authenticate incoming
* requests. For each request containing authorization, `domain` will
* invoke the callback, and then either accept or reject the request
* based on `callback'`s return value.
*
* You can also set the auth callback by setting the
* %SOUP_AUTH_DOMAIN_DIGEST_AUTH_CALLBACK and
* %SOUP_AUTH_DOMAIN_DIGEST_AUTH_DATA properties, which can also be
* used to set the callback at construct time.
* @param callback the callback
*/
set_auth_callback(callback: AuthDomainDigestAuthCallback): void;
}
namespace AuthManager {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
authenticate: (arg0: Message, arg1: Auth, arg2: boolean) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, SessionFeature.ConstructorProps {}
}
class AuthManager extends GObject.Object implements SessionFeature {
static $gtype: GObject.GType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: AuthManager.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
vfunc_authenticate(msg: Message, auth: Auth, retrying: boolean): void;
// Methods
/**
* Clear all credentials cached by `manager`
*/
clear_cached_credentials(): void;
/**
* Records that `auth` is to be used under `uri,` as though a
* WWW-Authenticate header had been received at that URI. This can be
* used to "preload" `manager'`s auth cache, to avoid an extra HTTP
* round trip in the case where you know ahead of time that a 401
* response will be returned.
*
* This is only useful for authentication types where the initial
* Authorization header does not depend on any additional information
* from the server. (Eg, Basic or NTLM, but not Digest.)
* @param uri the #SoupURI under which @auth is to be used
* @param auth the #SoupAuth to use
*/
use_auth(uri: URI, auth: Auth): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace AuthNTLM {
// Signal signatures
interface SignalSignatures extends Auth.SignalSignatures {
'notify::host': (pspec: GObject.ParamSpec) => void;
'notify::is-authenticated': (pspec: GObject.ParamSpec) => void;
'notify::is-for-proxy': (pspec: GObject.ParamSpec) => void;
'notify::realm': (pspec: GObject.ParamSpec) => void;
'notify::scheme-name': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends Auth.ConstructorProps {}
}
class AuthNTLM extends Auth {
static $gtype: GObject.GType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: AuthNTLM.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
}
namespace AuthNegotiate {
// Signal signatures
interface SignalSignatures extends Auth.SignalSignatures {
'notify::host': (pspec: GObject.ParamSpec) => void;
'notify::is-authenticated': (pspec: GObject.ParamSpec) => void;
'notify::is-for-proxy': (pspec: GObject.ParamSpec) => void;
'notify::realm': (pspec: GObject.ParamSpec) => void;
'notify::scheme-name': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends Auth.ConstructorProps {}
}
class AuthNegotiate extends Auth {
static $gtype: GObject.GType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: AuthNegotiate.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Static methods
/**
* Indicates whether libsoup was built with GSSAPI support. If this is
* %FALSE, %SOUP_TYPE_AUTH_NEGOTIATE will still be defined and can
* still be added to a #SoupSession, but libsoup will never attempt to
* actually use this auth type.
*/
static supported(): boolean;
}
namespace Cache {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'notify::cache-dir': (pspec: GObject.ParamSpec) => void;
'notify::cache-type': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, SessionFeature.ConstructorProps {
cache_dir: string;
cacheDir: string;
cache_type: CacheType;
cacheType: CacheType;
}
}
class Cache extends GObject.Object implements SessionFeature {
static $gtype: GObject.GType;
// Properties
get cache_dir(): string;
get cacheDir(): string;
get cache_type(): CacheType;
get cacheType(): CacheType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Cache.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](cache_dir: string | null, cache_type: CacheType): Cache;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
vfunc_get_cacheability(msg: Message): Cacheability;
// Methods
/**
* Will remove all entries in the `cache` plus all the cache files.
*/
clear(): void;
/**
* Synchronously writes the cache index out to disk. Contrast with
* soup_cache_flush(), which writes pending cache
* entries to disk.
*
* You must call this before exiting if you want your cache data to
* persist between sessions.
*/
dump(): void;
/**
* This function will force all pending writes in the `cache` to be
* committed to disk. For doing so it will iterate the #GMainContext
* associated with `cache'`s session as long as needed.
*
* Contrast with soup_cache_dump(), which writes out the cache index
* file.
*/
flush(): void;
/**
* Gets the maximum size of the cache.
* @returns the maximum size of the cache, in bytes.
*/
get_max_size(): number;
/**
* Loads the contents of `cache'`s index into memory.
*/
load(): void;
/**
* Sets the maximum size of the cache.
* @param max_size the maximum size of the cache, in bytes
*/
set_max_size(max_size: number): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace ContentDecoder {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, SessionFeature.ConstructorProps {}
}
class ContentDecoder extends GObject.Object implements SessionFeature {
static $gtype: GObject.GType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: ContentDecoder.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace ContentSniffer {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, SessionFeature.ConstructorProps {}
}
class ContentSniffer extends GObject.Object implements SessionFeature {
static $gtype: GObject.GType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: ContentSniffer.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): ContentSniffer;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
/**
* Gets the number of bytes `sniffer` needs in order to properly sniff
* a buffer.
*/
vfunc_get_buffer_size(): number;
/**
* Sniffs `buffer` to determine its Content-Type. The result may also
* be influenced by the Content-Type declared in `msg'`s response
* headers.
* @param msg the message to sniff
* @param buffer a buffer containing the start of @msg's response body
*/
vfunc_sniff(msg: Message, buffer: Buffer): [string, GLib.HashTable | null];
// Methods
/**
* Gets the number of bytes `sniffer` needs in order to properly sniff
* a buffer.
* @returns the number of bytes to sniff
*/
get_buffer_size(): number;
/**
* Sniffs `buffer` to determine its Content-Type. The result may also
* be influenced by the Content-Type declared in `msg'`s response
* headers.
* @param msg the message to sniff
* @param buffer a buffer containing the start of @msg's response body
* @returns the sniffed Content-Type of @buffer; this will never be %NULL, but may be "application/octet-stream".
*/
sniff(msg: Message, buffer: Buffer): [string, GLib.HashTable | null];
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace CookieJar {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
changed: (arg0: Cookie, arg1: Cookie) => void;
'notify::accept-policy': (pspec: GObject.ParamSpec) => void;
'notify::read-only': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, SessionFeature.ConstructorProps {
accept_policy: CookieJarAcceptPolicy;
acceptPolicy: CookieJarAcceptPolicy;
read_only: boolean;
readOnly: boolean;
}
}
class CookieJar extends GObject.Object implements SessionFeature {
static $gtype: GObject.GType;
// Properties
/**
* The policy the jar should follow to accept or reject cookies
*/
get accept_policy(): CookieJarAcceptPolicy;
set accept_policy(val: CookieJarAcceptPolicy);
/**
* The policy the jar should follow to accept or reject cookies
*/
get acceptPolicy(): CookieJarAcceptPolicy;
set acceptPolicy(val: CookieJarAcceptPolicy);
get read_only(): boolean;
get readOnly(): boolean;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: CookieJar.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): CookieJar;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
vfunc_changed(old_cookie: Cookie, new_cookie: Cookie): void;
/**
* Gets whether `jar` stores cookies persistenly.
*/
vfunc_is_persistent(): boolean;
/**
* This function exists for backward compatibility, but does not do
* anything any more; cookie jars are saved automatically when they
* are changed.
*/
vfunc_save(): void;
// Methods
/**
* Adds `cookie` to `jar,` emitting the 'changed' signal if we are modifying
* an existing cookie or adding a valid new cookie ('valid' means
* that the cookie's expire date is not in the past).
*
* `cookie` will be 'stolen' by the jar, so don't free it afterwards.
* @param cookie a #SoupCookie
*/
add_cookie(cookie: Cookie): void;
/**
* Adds `cookie` to `jar,` emitting the 'changed' signal if we are modifying
* an existing cookie or adding a valid new cookie ('valid' means
* that the cookie's expire date is not in the past).
*
* `first_party` will be used to reject cookies coming from third party
* resources in case such a security policy is set in the `jar`.
*
* `uri` will be used to reject setting or overwriting secure cookies
* from insecure origins. %NULL is treated as secure.
*
* `cookie` will be 'stolen' by the jar, so don't free it afterwards.
* @param cookie a #SoupCookie
* @param uri the URI setting the cookie
* @param first_party the URI for the main document
*/
add_cookie_full(cookie: Cookie, uri?: URI | null, first_party?: URI | null): void;
/**
* Adds `cookie` to `jar,` emitting the 'changed' signal if we are modifying
* an existing cookie or adding a valid new cookie ('valid' means
* that the cookie's expire date is not in the past).
*
* `first_party` will be used to reject cookies coming from third party
* resources in case such a security policy is set in the `jar`.
*
* `cookie` will be 'stolen' by the jar, so don't free it afterwards.
*
* For secure cookies to work properly you may want to use
* soup_cookie_jar_add_cookie_full().
* @param first_party the URI for the main document
* @param cookie a #SoupCookie
*/
add_cookie_with_first_party(first_party: URI, cookie: Cookie): void;
/**
* Constructs a #GSList with every cookie inside the `jar`.
* The cookies in the list are a copy of the original, so
* you have to free them when you are done with them.
* @returns a #GSList with all the cookies in the @jar.
*/
all_cookies(): Cookie[];
/**
* Deletes `cookie` from `jar,` emitting the 'changed' signal.
* @param cookie a #SoupCookie
*/
delete_cookie(cookie: Cookie): void;
/**
* Gets `jar'`s #SoupCookieJarAcceptPolicy
* @returns the #SoupCookieJarAcceptPolicy set in the @jar
*/
get_accept_policy(): CookieJarAcceptPolicy;
/**
* Retrieves the list of cookies that would be sent with a request to `uri`
* as a #GSList of #SoupCookie objects.
*
* If `for_http` is %TRUE, the return value will include cookies marked
* "HttpOnly" (that is, cookies that the server wishes to keep hidden
* from client-side scripting operations such as the JavaScript
* document.cookies property). Since #SoupCookieJar sets the Cookie
* header itself when making the actual HTTP request, you should
* almost certainly be setting `for_http` to %FALSE if you are calling
* this.
* @param uri a #SoupURI
* @param for_http whether or not the return value is being passed directly to an HTTP operation
* @returns a #GSList with the cookies in the @jar that would be sent with a request to @uri.
*/
get_cookie_list(uri: URI, for_http: boolean): Cookie[];
/**
* This is an extended version of soup_cookie_jar_get_cookie_list() that
* provides more information required to use SameSite cookies. See the
* [SameSite cookies spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00)
* for more detailed information.
* @param uri a #SoupURI
* @param top_level a #SoupURI for the top level document
* @param site_for_cookies a #SoupURI indicating the origin to get cookies for
* @param for_http whether or not the return value is being passed directly to an HTTP operation
* @param is_safe_method if the HTTP method is safe, as defined by RFC 7231, ignored when @for_http is %FALSE
* @param is_top_level_navigation whether or not the HTTP request is part of top level navigation
* @returns a #GSList with the cookies in the @jar that would be sent with a request to @uri.
*/
get_cookie_list_with_same_site_info(
uri: URI,
top_level: URI | null,
site_for_cookies: URI | null,
for_http: boolean,
is_safe_method: boolean,
is_top_level_navigation: boolean,
): Cookie[];
/**
* Retrieves (in Cookie-header form) the list of cookies that would
* be sent with a request to `uri`.
*
* If `for_http` is %TRUE, the return value will include cookies marked
* "HttpOnly" (that is, cookies that the server wishes to keep hidden
* from client-side scripting operations such as the JavaScript
* document.cookies property). Since #SoupCookieJar sets the Cookie
* header itself when making the actual HTTP request, you should
* almost certainly be setting `for_http` to %FALSE if you are calling
* this.
* @param uri a #SoupURI
* @param for_http whether or not the return value is being passed directly to an HTTP operation
* @returns the cookies, in string form, or %NULL if there are no cookies for @uri.
*/
get_cookies(uri: URI, for_http: boolean): string | null;
/**
* Gets whether `jar` stores cookies persistenly.
* @returns %TRUE if @jar storage is persistent or %FALSE otherwise.
*/
is_persistent(): boolean;
/**
* This function exists for backward compatibility, but does not do
* anything any more; cookie jars are saved automatically when they
* are changed.
*/
save(): void;
/**
* Sets `policy` as the cookie acceptance policy for `jar`.
* @param policy a #SoupCookieJarAcceptPolicy
*/
set_accept_policy(policy: CookieJarAcceptPolicy | null): void;
/**
* Adds `cookie` to `jar,` exactly as though it had appeared in a
* Set-Cookie header returned from a request to `uri`.
*
* Keep in mind that if the #SoupCookieJarAcceptPolicy set is either
* %SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY or
* %SOUP_COOKIE_JAR_ACCEPT_GRANDFATHERED_THIRD_PARTY you'll need to use
* soup_cookie_jar_set_cookie_with_first_party(), otherwise the jar
* will have no way of knowing if the cookie is being set by a third
* party or not.
* @param uri the URI setting the cookie
* @param cookie the stringified cookie to set
*/
set_cookie(uri: URI, cookie: string): void;
/**
* Adds `cookie` to `jar,` exactly as though it had appeared in a
* Set-Cookie header returned from a request to `uri`. `first_party`
* will be used to reject cookies coming from third party resources in
* case such a security policy is set in the `jar`.
* @param uri the URI setting the cookie
* @param first_party the URI for the main document
* @param cookie the stringified cookie to set
*/
set_cookie_with_first_party(uri: URI, first_party: URI, cookie: string): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace CookieJarDB {
// Signal signatures
interface SignalSignatures extends CookieJar.SignalSignatures {
'notify::filename': (pspec: GObject.ParamSpec) => void;
'notify::accept-policy': (pspec: GObject.ParamSpec) => void;
'notify::read-only': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends CookieJar.ConstructorProps, SessionFeature.ConstructorProps {
filename: string;
}
}
class CookieJarDB extends CookieJar implements SessionFeature {
static $gtype: GObject.GType;
// Properties
get filename(): string;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: CookieJarDB.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](filename: string, read_only: boolean): CookieJarDB;
// Conflicted with Soup.CookieJar.new
static ['new'](...args: never[]): any;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace CookieJarText {
// Signal signatures
interface SignalSignatures extends CookieJar.SignalSignatures {
'notify::filename': (pspec: GObject.ParamSpec) => void;
'notify::accept-policy': (pspec: GObject.ParamSpec) => void;
'notify::read-only': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends CookieJar.ConstructorProps, SessionFeature.ConstructorProps {
filename: string;
}
}
class CookieJarText extends CookieJar implements SessionFeature {
static $gtype: GObject.GType;
// Properties
get filename(): string;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: CookieJarText.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](filename: string, read_only: boolean): CookieJarText;
// Conflicted with Soup.CookieJar.new
static ['new'](...args: never[]): any;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace HSTSEnforcer {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
changed: (arg0: HSTSPolicy, arg1: HSTSPolicy) => void;
'hsts-enforced': (arg0: Message) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, SessionFeature.ConstructorProps {}
}
class HSTSEnforcer extends GObject.Object implements SessionFeature {
static $gtype: GObject.GType;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: HSTSEnforcer.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](): HSTSEnforcer;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
/**
* the class closure for the #SoupHSTSEnforcer::changed signal.
* @param old_policy
* @param new_policy
*/
vfunc_changed(old_policy: HSTSPolicy, new_policy: HSTSPolicy): void;
/**
* Gets whether `hsts_enforcer` has a currently valid policy for `domain`.
* @param domain a domain.
*/
vfunc_has_valid_policy(domain: string): boolean;
vfunc_hsts_enforced(message: Message): void;
/**
* Gets whether `hsts_enforcer` stores policies persistenly.
*/
vfunc_is_persistent(): boolean;
// Methods
/**
* Gets a list of domains for which there are policies in `enforcer`.
* @param session_policies whether to include session policies
* @returns a newly allocated list of domains. Use g_list_free_full() and g_free() to free the list.
*/
get_domains(session_policies: boolean): string[];
/**
* Gets a list with the policies in `enforcer`.
* @param session_policies whether to include session policies
* @returns a newly allocated list of policies. Use g_list_free_full() and soup_hsts_policy_free() to free the list.
*/
get_policies(session_policies: boolean): HSTSPolicy[];
/**
* Gets whether `hsts_enforcer` has a currently valid policy for `domain`.
* @param domain a domain.
* @returns %TRUE if access to @domain should happen over HTTPS, false otherwise.
*/
has_valid_policy(domain: string): boolean;
/**
* Gets whether `hsts_enforcer` stores policies persistenly.
* @returns %TRUE if @hsts_enforcer storage is persistent or %FALSE otherwise.
*/
is_persistent(): boolean;
/**
* Sets `policy` to `hsts_enforcer`. If `policy` is expired, any
* existing HSTS policy for its host will be removed instead. If a
* policy existed for this host, it will be replaced. Otherwise, the
* new policy will be inserted. If the policy is a session policy, that
* is, one created with soup_hsts_policy_new_session_policy(), the policy
* will not expire and will be enforced during the lifetime of
* `hsts_enforcer'`s #SoupSession.
* @param policy the policy of the HSTS host
*/
set_policy(policy: HSTSPolicy): void;
/**
* Sets a session policy for `domain`. A session policy is a policy
* that is permanent to the lifetime of `hsts_enforcer'`s #SoupSession
* and doesn't expire.
* @param domain policy domain or hostname
* @param include_subdomains %TRUE if the policy applies on sub domains
*/
set_session_policy(domain: string, include_subdomains: boolean): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace HSTSEnforcerDB {
// Signal signatures
interface SignalSignatures extends HSTSEnforcer.SignalSignatures {
'notify::filename': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends HSTSEnforcer.ConstructorProps, SessionFeature.ConstructorProps {
filename: string;
}
}
class HSTSEnforcerDB extends HSTSEnforcer implements SessionFeature {
static $gtype: GObject.GType;
// Properties
/**
* The filename of the SQLite database where HSTS policies are stored.
*/
get filename(): string;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: HSTSEnforcerDB.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](filename: string): HSTSEnforcerDB;
// Conflicted with Soup.HSTSEnforcer.new
static ['new'](...args: never[]): any;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace Logger {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'notify::level': (pspec: GObject.ParamSpec) => void;
'notify::max-body-size': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, SessionFeature.ConstructorProps {
level: LoggerLogLevel;
max_body_size: number;
maxBodySize: number;
}
}
class Logger extends GObject.Object implements SessionFeature {
static $gtype: GObject.GType;
// Properties
/**
* The level of logging output
*/
get level(): LoggerLogLevel;
set level(val: LoggerLogLevel);
/**
* If #SoupLogger:level is %SOUP_LOGGER_LOG_BODY, this gives
* the maximum number of bytes of the body that will be logged.
* (-1 means "no limit".)
*/
get max_body_size(): number;
set max_body_size(val: number);
/**
* If #SoupLogger:level is %SOUP_LOGGER_LOG_BODY, this gives
* the maximum number of bytes of the body that will be logged.
* (-1 means "no limit".)
*/
get maxBodySize(): number;
set maxBodySize(val: number);
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Logger.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](level: LoggerLogLevel, max_body_size: number): Logger;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Sets `logger` to watch `session` and print debug information for
* its messages.
*
* (The session will take a reference on `logger,` which will be
* removed when you call soup_logger_detach(), or when the session is
* destroyed.)
* @param session a #SoupSession
*/
attach(session: Session): void;
/**
* Stops `logger` from watching `session`.
* @param session a #SoupSession
*/
detach(session: Session): void;
/**
* Sets up an alternate log printing routine, if you don't want
* the log to go to stdout.
* @param printer the callback for printing logging output
*/
set_printer(printer: LoggerPrinter): void;
/**
* Sets up a filter to determine the log level for a given request.
* For each HTTP request `logger` will invoke `request_filter` to
* determine how much (if any) of that request to log. (If you do not
* set a request filter, `logger` will just always log requests at the
* level passed to soup_logger_new().)
* @param request_filter the callback for request debugging
*/
set_request_filter(request_filter: LoggerFilter): void;
/**
* Sets up a filter to determine the log level for a given response.
* For each HTTP response `logger` will invoke `response_filter` to
* determine how much (if any) of that response to log. (If you do not
* set a response filter, `logger` will just always log responses at
* the level passed to soup_logger_new().)
* @param response_filter the callback for response debugging
*/
set_response_filter(response_filter: LoggerFilter): void;
// Inherited methods
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace Message {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'content-sniffed': (arg0: string, arg1: GLib.HashTable) => void;
finished: () => void;
'got-body': () => void;
'got-chunk': (arg0: Buffer) => void;
'got-headers': () => void;
'got-informational': () => void;
'network-event': (arg0: Gio.SocketClientEvent, arg1: Gio.IOStream) => void;
restarted: () => void;
starting: () => void;
'wrote-body': () => void;
'wrote-body-data': (arg0: Buffer) => void;
'wrote-chunk': () => void;
'wrote-headers': () => void;
'wrote-informational': () => void;
'notify::first-party': (pspec: GObject.ParamSpec) => void;
'notify::flags': (pspec: GObject.ParamSpec) => void;
'notify::http-version': (pspec: GObject.ParamSpec) => void;
'notify::is-top-level-navigation': (pspec: GObject.ParamSpec) => void;
'notify::method': (pspec: GObject.ParamSpec) => void;
'notify::priority': (pspec: GObject.ParamSpec) => void;
'notify::reason-phrase': (pspec: GObject.ParamSpec) => void;
'notify::request-body': (pspec: GObject.ParamSpec) => void;
'notify::request-body-data': (pspec: GObject.ParamSpec) => void;
'notify::request-headers': (pspec: GObject.ParamSpec) => void;
'notify::response-body': (pspec: GObject.ParamSpec) => void;
'notify::response-body-data': (pspec: GObject.ParamSpec) => void;
'notify::response-headers': (pspec: GObject.ParamSpec) => void;
'notify::server-side': (pspec: GObject.ParamSpec) => void;
'notify::site-for-cookies': (pspec: GObject.ParamSpec) => void;
'notify::status-code': (pspec: GObject.ParamSpec) => void;
'notify::tls-certificate': (pspec: GObject.ParamSpec) => void;
'notify::tls-errors': (pspec: GObject.ParamSpec) => void;
'notify::uri': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps {
first_party: URI;
firstParty: URI;
flags: MessageFlags;
http_version: HTTPVersion;
httpVersion: HTTPVersion;
is_top_level_navigation: boolean;
isTopLevelNavigation: boolean;
method: string;
priority: MessagePriority;
reason_phrase: string;
reasonPhrase: string;
request_body: MessageBody;
requestBody: MessageBody;
request_body_data: GLib.Bytes;
requestBodyData: GLib.Bytes;
request_headers: MessageHeaders;
requestHeaders: MessageHeaders;
response_body: MessageBody;
responseBody: MessageBody;
response_body_data: GLib.Bytes;
responseBodyData: GLib.Bytes;
response_headers: MessageHeaders;
responseHeaders: MessageHeaders;
server_side: boolean;
serverSide: boolean;
site_for_cookies: URI;
siteForCookies: URI;
status_code: number;
statusCode: number;
tls_certificate: Gio.TlsCertificate;
tlsCertificate: Gio.TlsCertificate;
tls_errors: Gio.TlsCertificateFlags;
tlsErrors: Gio.TlsCertificateFlags;
uri: URI;
}
}
/**
* Represents an HTTP message being sent or received.
*
* `status_code` will normally be a #SoupStatus value, eg,
* %SOUP_STATUS_OK, though of course it might actually be an unknown
* status code. `reason_phrase` is the actual text returned from the
* server, which may or may not correspond to the "standard"
* description of `status_code`. At any rate, it is almost certainly
* not localized, and not very descriptive even if it is in the user's
* language; you should not use `reason_phrase` in user-visible
* messages. Rather, you should look at `status_code,` and determine an
* end-user-appropriate message based on that and on what you were
* trying to do.
*
* As described in the #SoupMessageBody documentation, the
* `request_body` and `response_body` data fields
* will not necessarily be filled in at all times. When the body
* fields are filled in, they will be terminated with a '\0' byte
* (which is not included in the length), so you
* can use them as ordinary C strings (assuming that you know that the
* body doesn't have any other '\0' bytes).
*
* For a client-side #SoupMessage, `request_body'`s
* data is usually filled in right before libsoup
* writes the request to the network, but you should not count on
* this; use soup_message_body_flatten() if you want to ensure that
* data is filled in. If you are not using
* #SoupRequest to read the response, then `response_body'`s
* data will be filled in before
* #SoupMessage::finished is emitted. (If you are using #SoupRequest,
* then the message body is not accumulated by default, so
* `response_body'`s data will always be %NULL.)
*
* For a server-side #SoupMessage, `request_body'`s %data will be
* filled in before #SoupMessage::got_body is emitted.
*
* To prevent the %data field from being filled in at all (eg, if you
* are handling the data from a #SoupMessage::got_chunk, and so don't
* need to see it all at the end), call
* soup_message_body_set_accumulate() on `response_body` or
* `request_body` as appropriate, passing %FALSE.
*/
class Message extends GObject.Object {
static $gtype: GObject.GType;
// Properties
/**
* The #SoupURI loaded in the application when the message was
* queued.
*/
get first_party(): URI;
set first_party(val: URI);
/**
* The #SoupURI loaded in the application when the message was
* queued.
*/
get firstParty(): URI;
set firstParty(val: URI);
get flags(): MessageFlags;
set flags(val: MessageFlags);
get http_version(): HTTPVersion;
set http_version(val: HTTPVersion);
get httpVersion(): HTTPVersion;
set httpVersion(val: HTTPVersion);
/**
* Set when the message is navigating between top level domains.
*/
get is_top_level_navigation(): boolean;
set is_top_level_navigation(val: boolean);
/**
* Set when the message is navigating between top level domains.
*/
get isTopLevelNavigation(): boolean;
set isTopLevelNavigation(val: boolean);
get method(): string;
set method(val: string);
get priority(): MessagePriority;
set priority(val: MessagePriority);
get reason_phrase(): string;
set reason_phrase(val: string);
get reasonPhrase(): string;
set reasonPhrase(val: string);
get request_body(): MessageBody;
get requestBody(): MessageBody;
/**
* The message's HTTP request body, as a #GBytes.
*/
get request_body_data(): GLib.Bytes;
/**
* The message's HTTP request body, as a #GBytes.
*/
get requestBodyData(): GLib.Bytes;
get request_headers(): MessageHeaders;
get requestHeaders(): MessageHeaders;
get response_body(): MessageBody;
get responseBody(): MessageBody;
/**
* The message's HTTP response body, as a #GBytes.
*/
get response_body_data(): GLib.Bytes;
/**
* The message's HTTP response body, as a #GBytes.
*/
get responseBodyData(): GLib.Bytes;
get response_headers(): MessageHeaders;
get responseHeaders(): MessageHeaders;
get server_side(): boolean;
get serverSide(): boolean;
get site_for_cookies(): URI;
set site_for_cookies(val: URI);
get siteForCookies(): URI;
set siteForCookies(val: URI);
get status_code(): number;
set status_code(val: number);
get statusCode(): number;
set statusCode(val: number);
/**
* The #GTlsCertificate associated with the message
*/
get tls_certificate(): Gio.TlsCertificate;
set tls_certificate(val: Gio.TlsCertificate);
/**
* The #GTlsCertificate associated with the message
*/
get tlsCertificate(): Gio.TlsCertificate;
set tlsCertificate(val: Gio.TlsCertificate);
/**
* The verification errors on #SoupMessage:tls-certificate
*/
get tls_errors(): Gio.TlsCertificateFlags;
set tls_errors(val: Gio.TlsCertificateFlags);
/**
* The verification errors on #SoupMessage:tls-certificate
*/
get tlsErrors(): Gio.TlsCertificateFlags;
set tlsErrors(val: Gio.TlsCertificateFlags);
get uri(): URI;
set uri(val: URI);
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Message.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](method: string, uri_string: string): Message;
static new_from_uri(method: string, uri: URI): Message;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q] ? Q : never
): void;
emit(signal: string, ...args: any[]): void;
// Virtual methods
vfunc_finished(): void;
vfunc_got_body(): void;
vfunc_got_chunk(chunk: Buffer): void;
vfunc_got_headers(): void;
vfunc_got_informational(): void;
vfunc_restarted(): void;
vfunc_starting(): void;
vfunc_wrote_body(): void;
vfunc_wrote_chunk(): void;
vfunc_wrote_headers(): void;
vfunc_wrote_informational(): void;
// Methods
content_sniffed(content_type: string, params: { [key: string]: any } | GLib.HashTable): void;
/**
* This disables the actions of #SoupSessionFeatures with the
* given `feature_type` (or a subclass of that type) on `msg,` so that
* `msg` is processed as though the feature(s) hadn't been added to the
* session. Eg, passing #SOUP_TYPE_CONTENT_SNIFFER for `feature_type`
* will disable Content-Type sniffing on the message.
*
* You must call this before queueing `msg` on a session; calling it on
* a message that has already been queued is undefined. In particular,
* you cannot call this on a message that is being requeued after a
* redirect or authentication.
* @param feature_type the #GType of a #SoupSessionFeature
*/
disable_feature(feature_type: GObject.GType): void;
finished(): void;
/**
* Gets the address `msg'`s URI points to. After first setting the
* URI on a message, this will be unresolved, although the message's
* session will resolve it before sending the message.
* @returns the address @msg's URI points to
*/
get_address(): Address;
/**
* Gets `msg'`s first-party #SoupURI
* @returns the @msg's first party #SoupURI
*/
get_first_party(): URI;
/**
* Gets the flags on `msg`
* @returns the flags
*/
get_flags(): MessageFlags;
/**
* Gets the HTTP version of `msg`. This is the minimum of the
* version from the request and the version from the response.
* @returns the HTTP version
*/
get_http_version(): HTTPVersion;
/**
* If `msg` is using https (or attempted to use https but got
* %SOUP_STATUS_SSL_FAILED), this retrieves the #GTlsCertificate
* associated with its connection, and the #GTlsCertificateFlags
* showing what problems, if any, have been found with that
* certificate.
*
* This is only meaningful with messages processed by a #SoupSession and is
* not useful for messages received by a #SoupServer
* @returns %TRUE if @msg used/attempted https, %FALSE if not
*/
get_https_status(): [boolean, Gio.TlsCertificate, Gio.TlsCertificateFlags];
get_is_top_level_navigation(): boolean;
/**
* Retrieves the #SoupMessagePriority. If not set this value defaults
* to #SOUP_MESSAGE_PRIORITY_NORMAL.
* @returns the priority of the message.
*/
get_priority(): MessagePriority;
/**
* Gets `msg'`s site for cookies #SoupURI
* @returns the @msg's site for cookies #SoupURI
*/
get_site_for_cookies(): URI;
/**
* If `msg` is associated with a #SoupRequest, this returns that
* request. Otherwise it returns %NULL.
* @returns @msg's associated #SoupRequest
*/
get_soup_request(): Request;
/**
* Gets `msg'`s URI
* @returns the URI @msg is targeted for.
*/
get_uri(): URI;
got_body(): void;
got_chunk(chunk: Buffer): void;
got_headers(): void;
got_informational(): void;
/**
* Get whether #SoupSessionFeatures of the given `feature_type`
* (or a subclass of that type) are disabled on `msg`.
* See soup_message_disable_feature().
* @param feature_type the #GType of a #SoupSessionFeature
* @returns %TRUE if feature is disabled, or %FALSE otherwise.
*/
is_feature_disabled(feature_type: GObject.GType): boolean;
/**
* Determines whether or not `msg'`s connection can be kept alive for
* further requests after processing `msg,` based on the HTTP version,
* Connection header, etc.
* @returns %TRUE or %FALSE.
*/
is_keepalive(): boolean;
restarted(): void;
/**
* Sets an alternate chunk-allocation function to use when reading
* `msg'`s body when using the traditional (ie,
* non-#SoupRequest-based) API. Every time data is available
* to read, libsoup will call `allocator,` which should return a
* #SoupBuffer. (See #SoupChunkAllocator for additional details.)
* Libsoup will then read data from the network into that buffer, and
* update the buffer's length to indicate how much
* data it read.
*
* Generally, a custom chunk allocator would be used in conjunction
* with soup_message_body_set_accumulate() %FALSE and
* #SoupMessage::got_chunk, as part of a strategy to avoid unnecessary
* copying of data. However, you cannot assume that every call to the
* allocator will be followed by a call to your
* #SoupMessage::got_chunk handler; if an I/O error occurs, then the
* buffer will be unreffed without ever having been used. If your
* buffer-allocation strategy requires special cleanup, use
* soup_buffer_new_with_owner() rather than doing the cleanup from the
* #SoupMessage::got_chunk handler.
*
* The other thing to remember when using non-accumulating message
* bodies is that the buffer passed to the #SoupMessage::got_chunk
* handler will be unreffed after the handler returns, just as it
* would be in the non-custom-allocated case. If you want to hand the
* chunk data off to some other part of your program to use later,
* you'll need to ref the #SoupBuffer (or its owner, in the
* soup_buffer_new_with_owner() case) to ensure that the data remains
* valid.
* @param allocator the chunk allocator callback
*/
set_chunk_allocator(allocator: ChunkAllocator): void;
/**
* Sets `first_party` as the main document #SoupURI for `msg`. For
* details of when and how this is used refer to the documentation for
* #SoupCookieJarAcceptPolicy.
* @param first_party the #SoupURI for the @msg's first party
*/
set_first_party(first_party: URI): void;
/**
* Sets the specified flags on `msg`.
* @param flags a set of #SoupMessageFlags values
*/
set_flags(flags: MessageFlags | null): void;
/**
* Sets the HTTP version on `msg`. The default version is
* %SOUP_HTTP_1_1. Setting it to %SOUP_HTTP_1_0 will prevent certain
* functionality from being used.
* @param version the HTTP version
*/
set_http_version(version: HTTPVersion | null): void;
/**
* See the [same-site spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00)
* for more information.
* @param is_top_level_navigation if %TRUE indicate the current request is a top-level navigation
*/
set_is_top_level_navigation(is_top_level_navigation: boolean): void;
/**
* Sets the priority of a message. Note that this won't have any
* effect unless used before the message is added to the session's
* message processing queue.
*
* The message will be placed just before any other previously added
* message with lower priority (messages with the same priority are
* processed on a FIFO basis).
*
* Setting priorities does not currently work with #SoupSessionSync
* (or with synchronous messages on a plain #SoupSession) because in
* the synchronous/blocking case, priority ends up being determined
* semi-randomly by thread scheduling.
* @param priority the #SoupMessagePriority
*/
set_priority(priority: MessagePriority | null): void;
/**
* Sets `msg'`s status_code to `status_code` and adds a Location header
* pointing to `redirect_uri`. Use this from a #SoupServer when you
* want to redirect the client to another URI.
*
* `redirect_uri` can be a relative URI, in which case it is
* interpreted relative to `msg'`s current URI. In particular, if
* `redirect_uri` is just a path, it will replace the path
* and query of `msg'`s URI.
* @param status_code a 3xx status code
* @param redirect_uri the URI to redirect @msg to
*/
set_redirect(status_code: number, redirect_uri: string): void;
/**
* Convenience function to set the request body of a #SoupMessage. If
* `content_type` is %NULL, the request body must be empty as well.
* @param content_type MIME Content-Type of the body
* @param req_use a #SoupMemoryUse describing how to handle @req_body
* @param req_body a data buffer containing the body of the message request.
*/
set_request(content_type: string | null, req_use: MemoryUse | null, req_body?: Uint8Array | null): void;
/**
* Convenience function to set the response body of a #SoupMessage. If
* `content_type` is %NULL, the response body must be empty as well.
* @param content_type MIME Content-Type of the body
* @param resp_use a #SoupMemoryUse describing how to handle @resp_body
* @param resp_body a data buffer containing the body of the message response.
*/
set_response(content_type: string | null, resp_use: MemoryUse | null, resp_body?: Uint8Array | null): void;
/**
* Sets `site_for_cookies` as the policy URL for same-site cookies for `msg`.
*
* It is either the URL of the top-level document or %NULL depending on whether the registrable
* domain of this document's URL matches the registrable domain of its parent's/opener's
* URL. For the top-level document it is set to the document's URL.
*
* See the [same-site spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00)
* for more information.
* @param site_for_cookies the #SoupURI for the @msg's site for cookies
*/
set_site_for_cookies(site_for_cookies?: URI | null): void;
/**
* Sets `msg'`s status code to `status_code`. If `status_code` is a
* known value, it will also set `msg'`s reason_phrase.
* @param status_code an HTTP status code
*/
set_status(status_code: number): void;
/**
* Sets `msg'`s status code and reason phrase.
* @param status_code an HTTP status code
* @param reason_phrase a description of the status
*/
set_status_full(status_code: number, reason_phrase: string): void;
/**
* Sets `msg'`s URI to `uri`. If `msg` has already been sent and you want
* to re-send it with the new URI, you need to call
* soup_session_requeue_message().
* @param uri the new #SoupURI
*/
set_uri(uri: URI): void;
starting(): void;
wrote_body(): void;
wrote_body_data(chunk: Buffer): void;
wrote_chunk(): void;
wrote_headers(): void;
wrote_informational(): void;
}
namespace MultipartInputStream {
// Signal signatures
interface SignalSignatures extends Gio.FilterInputStream.SignalSignatures {
'notify::message': (pspec: GObject.ParamSpec) => void;
'notify::base-stream': (pspec: GObject.ParamSpec) => void;
'notify::close-base-stream': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps
extends Gio.FilterInputStream.ConstructorProps,
Gio.PollableInputStream.ConstructorProps {
message: Message;
}
}
class MultipartInputStream extends Gio.FilterInputStream implements Gio.PollableInputStream {
static $gtype: GObject.GType;
// Properties
get message(): Message;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: MultipartInputStream.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
static ['new'](msg: Message, base_stream: Gio.InputStream): MultipartInputStream;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q]
? Q
: never
): void;
emit(signal: string, ...args: any[]): void;
// Methods
/**
* Obtains the headers for the part currently being processed. Note
* that the #SoupMessageHeaders that are returned are owned by the
* #SoupMultipartInputStream and will be replaced when a call is made
* to soup_multipart_input_stream_next_part() or its async
* counterpart, so if keeping the headers is required, a copy must be
* made.
*
* Note that if a part had no headers at all an empty #SoupMessageHeaders
* will be returned.
* @returns a #SoupMessageHeaders containing the headers for the part currently being processed or %NULL if the headers failed to parse.
*/
get_headers(): MessageHeaders | null;
/**
* Obtains an input stream for the next part. When dealing with a
* multipart response the input stream needs to be wrapped in a
* #SoupMultipartInputStream and this function or its async
* counterpart need to be called to obtain the first part for
* reading.
*
* After calling this function,
* soup_multipart_input_stream_get_headers() can be used to obtain the
* headers for the first part. A read of 0 bytes indicates the end of
* the part; a new call to this function should be done at that point,
* to obtain the next part.
* @param cancellable a #GCancellable
* @returns a new #GInputStream, or %NULL if there are no more parts
*/
next_part(cancellable?: Gio.Cancellable | null): Gio.InputStream | null;
/**
* Obtains a #GInputStream for the next request. See
* soup_multipart_input_stream_next_part() for details on the
* workflow.
* @param io_priority the I/O priority for the request.
* @param cancellable a #GCancellable.
*/
next_part_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
): globalThis.Promise;
/**
* Obtains a #GInputStream for the next request. See
* soup_multipart_input_stream_next_part() for details on the
* workflow.
* @param io_priority the I/O priority for the request.
* @param cancellable a #GCancellable.
* @param callback callback to call when request is satisfied.
*/
next_part_async(
io_priority: number,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback | null,
): void;
/**
* Obtains a #GInputStream for the next request. See
* soup_multipart_input_stream_next_part() for details on the
* workflow.
* @param io_priority the I/O priority for the request.
* @param cancellable a #GCancellable.
* @param callback callback to call when request is satisfied.
*/
next_part_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): globalThis.Promise | void;
/**
* Finishes an asynchronous request for the next part.
* @param result a #GAsyncResult.
* @returns a newly created #GInputStream for reading the next part or %NULL if there are no more parts.
*/
next_part_finish(result: Gio.AsyncResult): Gio.InputStream | null;
// Inherited methods
/**
* Checks if `stream` is actually pollable. Some classes may implement
* #GPollableInputStream but have only certain instances of that class
* be pollable. If this method returns %FALSE, then the behavior of
* other #GPollableInputStream methods is undefined.
*
* For any given stream, the value returned by this method is constant;
* a stream cannot switch from pollable to non-pollable or vice versa.
* @returns %TRUE if @stream is pollable, %FALSE if not.
*/
can_poll(): boolean;
/**
* Creates a #GSource that triggers when `stream` can be read, or
* `cancellable` is triggered or an error occurs. The callback on the
* source is of the #GPollableSourceFunc type.
*
* As with g_pollable_input_stream_is_readable(), it is possible that
* the stream may not actually be readable even after the source
* triggers, so you should use g_pollable_input_stream_read_nonblocking()
* rather than g_input_stream_read() from the callback.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @param cancellable a #GCancellable, or %NULL
* @returns a new #GSource
*/
create_source(cancellable?: Gio.Cancellable | null): GLib.Source;
/**
* Checks if `stream` can be read.
*
* Note that some stream types may not be able to implement this 100%
* reliably, and it is possible that a call to g_input_stream_read()
* after this returns %TRUE would still block. To guarantee
* non-blocking behavior, you should always use
* g_pollable_input_stream_read_nonblocking(), which will return a
* %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @returns %TRUE if @stream is readable, %FALSE if not. If an error has occurred on @stream, this will result in g_pollable_input_stream_is_readable() returning %TRUE, and the next attempt to read will return the error.
*/
is_readable(): boolean;
/**
* Attempts to read up to `count` bytes from `stream` into `buffer,` as
* with g_input_stream_read(). If `stream` is not currently readable,
* this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
* use g_pollable_input_stream_create_source() to create a #GSource
* that will be triggered when `stream` is readable.
*
* Note that since this method never blocks, you cannot actually
* use `cancellable` to cancel it. However, it will return an error
* if `cancellable` has already been cancelled when you call, which
* may happen if you call this method after a source triggers due
* to having been cancelled.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @param cancellable a #GCancellable, or %NULL
* @returns the number of bytes read, or -1 on error (including %G_IO_ERROR_WOULD_BLOCK).
*/
read_nonblocking(cancellable?: Gio.Cancellable | null): [number, Uint8Array];
/**
* Checks if `stream` is actually pollable. Some classes may implement
* #GPollableInputStream but have only certain instances of that class
* be pollable. If this method returns %FALSE, then the behavior of
* other #GPollableInputStream methods is undefined.
*
* For any given stream, the value returned by this method is constant;
* a stream cannot switch from pollable to non-pollable or vice versa.
*/
vfunc_can_poll(): boolean;
/**
* Creates a #GSource that triggers when `stream` can be read, or
* `cancellable` is triggered or an error occurs. The callback on the
* source is of the #GPollableSourceFunc type.
*
* As with g_pollable_input_stream_is_readable(), it is possible that
* the stream may not actually be readable even after the source
* triggers, so you should use g_pollable_input_stream_read_nonblocking()
* rather than g_input_stream_read() from the callback.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
* @param cancellable a #GCancellable, or %NULL
*/
vfunc_create_source(cancellable?: Gio.Cancellable | null): GLib.Source;
/**
* Checks if `stream` can be read.
*
* Note that some stream types may not be able to implement this 100%
* reliably, and it is possible that a call to g_input_stream_read()
* after this returns %TRUE would still block. To guarantee
* non-blocking behavior, you should always use
* g_pollable_input_stream_read_nonblocking(), which will return a
* %G_IO_ERROR_WOULD_BLOCK error rather than blocking.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
*/
vfunc_is_readable(): boolean;
/**
* Attempts to read up to `count` bytes from `stream` into `buffer,` as
* with g_input_stream_read(). If `stream` is not currently readable,
* this will immediately return %G_IO_ERROR_WOULD_BLOCK, and you can
* use g_pollable_input_stream_create_source() to create a #GSource
* that will be triggered when `stream` is readable.
*
* Note that since this method never blocks, you cannot actually
* use `cancellable` to cancel it. However, it will return an error
* if `cancellable` has already been cancelled when you call, which
* may happen if you call this method after a source triggers due
* to having been cancelled.
*
* The behaviour of this method is undefined if
* g_pollable_input_stream_can_poll() returns %FALSE for `stream`.
*/
vfunc_read_nonblocking(): [number, Uint8Array | null];
/**
* Clears the pending flag on `stream`.
*/
clear_pending(): void;
/**
* Closes the stream, releasing resources related to it.
*
* Once the stream is closed, all other operations will return %G_IO_ERROR_CLOSED.
* Closing a stream multiple times will not return an error.
*
* Streams will be automatically closed when the last reference
* is dropped, but you might want to call this function to make sure
* resources are released as early as possible.
*
* Some streams might keep the backing store of the stream (e.g. a file descriptor)
* open after the stream is closed. See the documentation for the individual
* stream for details.
*
* On failure the first error that happened will be reported, but the close
* operation will finish as much as possible. A stream that failed to
* close will still return %G_IO_ERROR_CLOSED for all operations. Still, it
* is important to check and report the error to the user.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
* Cancelling a close will still leave the stream closed, but some streams
* can use a faster close that doesn't block to e.g. check errors.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE on success, %FALSE on failure
*/
close(cancellable?: Gio.Cancellable | null): boolean;
/**
* Requests an asynchronous closes of the stream, releasing resources related to it.
* When the operation is finished `callback` will be called.
* You can then call g_input_stream_close_finish() to get the result of the
* operation.
*
* For behaviour details see g_input_stream_close().
*
* The asynchronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional cancellable object
*/
close_async(io_priority: number, cancellable?: Gio.Cancellable | null): globalThis.Promise;
/**
* Requests an asynchronous closes of the stream, releasing resources related to it.
* When the operation is finished `callback` will be called.
* You can then call g_input_stream_close_finish() to get the result of the
* operation.
*
* For behaviour details see g_input_stream_close().
*
* The asynchronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional cancellable object
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
close_async(
io_priority: number,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback | null,
): void;
/**
* Requests an asynchronous closes of the stream, releasing resources related to it.
* When the operation is finished `callback` will be called.
* You can then call g_input_stream_close_finish() to get the result of the
* operation.
*
* For behaviour details see g_input_stream_close().
*
* The asynchronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional cancellable object
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
close_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): globalThis.Promise | void;
/**
* Finishes closing a stream asynchronously, started from g_input_stream_close_async().
* @param result a #GAsyncResult.
* @returns %TRUE if the stream was closed successfully.
*/
close_finish(result: Gio.AsyncResult): boolean;
/**
* Checks if an input stream has pending actions.
* @returns %TRUE if @stream has pending actions.
*/
has_pending(): boolean;
/**
* Checks if an input stream is closed.
* @returns %TRUE if the stream is closed.
*/
is_closed(): boolean;
/**
* Tries to read `count` bytes from the stream into the buffer starting at
* `buffer`. Will block during this read.
*
* If count is zero returns zero and does nothing. A value of `count`
* larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes read into the buffer is returned.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* The returned `buffer` is not a nul-terminated string, it can contain nul bytes
* at any position, and this function doesn't nul-terminate the `buffer`.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
*
* On error -1 is returned and `error` is set accordingly.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns Number of bytes read, or -1 on error, or 0 on end of file.
*/
read(cancellable?: Gio.Cancellable | null): [number, Uint8Array];
/**
* Tries to read `count` bytes from the stream into the buffer starting at
* `buffer`. Will block during this read.
*
* This function is similar to g_input_stream_read(), except it tries to
* read as many bytes as requested, only stopping on an error or end of stream.
*
* On a successful read of `count` bytes, or if we reached the end of the
* stream, %TRUE is returned, and `bytes_read` is set to the number of bytes
* read into `buffer`.
*
* If there is an error during the operation %FALSE is returned and `error`
* is set to indicate the error status.
*
* As a special exception to the normal conventions for functions that
* use #GError, if this function returns %FALSE (and sets `error)` then
* `bytes_read` will be set to the number of bytes that were successfully
* read before the error was encountered. This functionality is only
* available from C. If you need it from another language then you must
* write your own loop around g_input_stream_read().
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns %TRUE on success, %FALSE if there was an error
*/
read_all(cancellable?: Gio.Cancellable | null): [boolean, Uint8Array, number];
/**
* Request an asynchronous read of `count` bytes from the stream into the
* buffer starting at `buffer`.
*
* This is the asynchronous equivalent of [method`InputStream`.read_all].
*
* Call [method`InputStream`.read_all_finish] to collect the result.
*
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is %G_PRIORITY_DEFAULT.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
*/
read_all_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
): [globalThis.Promise, Uint8Array];
/**
* Request an asynchronous read of `count` bytes from the stream into the
* buffer starting at `buffer`.
*
* This is the asynchronous equivalent of [method`InputStream`.read_all].
*
* Call [method`InputStream`.read_all_finish] to collect the result.
*
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is %G_PRIORITY_DEFAULT.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
read_all_async(
io_priority: number,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback | null,
): Uint8Array;
/**
* Request an asynchronous read of `count` bytes from the stream into the
* buffer starting at `buffer`.
*
* This is the asynchronous equivalent of [method`InputStream`.read_all].
*
* Call [method`InputStream`.read_all_finish] to collect the result.
*
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is %G_PRIORITY_DEFAULT.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
read_all_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): [globalThis.Promise | void, Uint8Array];
/**
* Finishes an asynchronous stream read operation started with
* [method`InputStream`.read_all_async].
*
* As a special exception to the normal conventions for functions that
* use #GError, if this function returns %FALSE (and sets `error)` then
* `bytes_read` will be set to the number of bytes that were successfully
* read before the error was encountered. This functionality is only
* available from C. If you need it from another language then you must
* write your own loop around g_input_stream_read_async().
* @param result a #GAsyncResult
* @returns %TRUE on success, %FALSE if there was an error
*/
read_all_finish(result: Gio.AsyncResult): [boolean, number];
/**
* Request an asynchronous read of `count` bytes from the stream into the buffer
* starting at `buffer`. When the operation is finished `callback` will be called.
* You can then call g_input_stream_read_finish() to get the result of the
* operation.
*
* During an async request no other sync and async calls are allowed on `stream,` and will
* result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes read into the buffer will be passed to the
* callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to read
* as many bytes as requested. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is %G_PRIORITY_DEFAULT.
*
* The asynchronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
): [globalThis.Promise, Uint8Array];
/**
* Request an asynchronous read of `count` bytes from the stream into the buffer
* starting at `buffer`. When the operation is finished `callback` will be called.
* You can then call g_input_stream_read_finish() to get the result of the
* operation.
*
* During an async request no other sync and async calls are allowed on `stream,` and will
* result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes read into the buffer will be passed to the
* callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to read
* as many bytes as requested. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is %G_PRIORITY_DEFAULT.
*
* The asynchronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
read_async(
io_priority: number,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback | null,
): Uint8Array;
/**
* Request an asynchronous read of `count` bytes from the stream into the buffer
* starting at `buffer`. When the operation is finished `callback` will be called.
* You can then call g_input_stream_read_finish() to get the result of the
* operation.
*
* During an async request no other sync and async calls are allowed on `stream,` and will
* result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes read into the buffer will be passed to the
* callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to read
* as many bytes as requested. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is %G_PRIORITY_DEFAULT.
*
* The asynchronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
read_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): [globalThis.Promise | void, Uint8Array];
/**
* Like g_input_stream_read(), this tries to read `count` bytes from
* the stream in a blocking fashion. However, rather than reading into
* a user-supplied buffer, this will create a new #GBytes containing
* the data that was read. This may be easier to use from language
* bindings.
*
* If count is zero, returns a zero-length #GBytes and does nothing. A
* value of `count` larger than %G_MAXSSIZE will cause a
* %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, a new #GBytes is returned. It is not an error if the
* size of this object is not the same as the requested size, as it
* can happen e.g. near the end of a file. A zero-length #GBytes is
* returned on end of file (or if `count` is zero), but never
* otherwise.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
*
* On error %NULL is returned and `error` is set accordingly.
* @param count maximum number of bytes that will be read from the stream. Common values include 4096 and 8192.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns a new #GBytes, or %NULL on error
*/
read_bytes(count: number, cancellable?: Gio.Cancellable | null): GLib.Bytes;
/**
* Request an asynchronous read of `count` bytes from the stream into a
* new #GBytes. When the operation is finished `callback` will be
* called. You can then call g_input_stream_read_bytes_finish() to get the
* result of the operation.
*
* During an async request no other sync and async calls are allowed
* on `stream,` and will result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a
* %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the new #GBytes will be passed to the callback. It is
* not an error if this is smaller than the requested size, as it can
* happen e.g. near the end of a file, but generally we try to read as
* many bytes as requested. Zero is returned on end of file (or if
* `count` is zero), but never otherwise.
*
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is %G_PRIORITY_DEFAULT.
* @param count the number of bytes that will be read from the stream
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_bytes_async(
count: number,
io_priority: number,
cancellable?: Gio.Cancellable | null,
): globalThis.Promise;
/**
* Request an asynchronous read of `count` bytes from the stream into a
* new #GBytes. When the operation is finished `callback` will be
* called. You can then call g_input_stream_read_bytes_finish() to get the
* result of the operation.
*
* During an async request no other sync and async calls are allowed
* on `stream,` and will result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a
* %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the new #GBytes will be passed to the callback. It is
* not an error if this is smaller than the requested size, as it can
* happen e.g. near the end of a file, but generally we try to read as
* many bytes as requested. Zero is returned on end of file (or if
* `count` is zero), but never otherwise.
*
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is %G_PRIORITY_DEFAULT.
* @param count the number of bytes that will be read from the stream
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
read_bytes_async(
count: number,
io_priority: number,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback | null,
): void;
/**
* Request an asynchronous read of `count` bytes from the stream into a
* new #GBytes. When the operation is finished `callback` will be
* called. You can then call g_input_stream_read_bytes_finish() to get the
* result of the operation.
*
* During an async request no other sync and async calls are allowed
* on `stream,` and will result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a
* %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the new #GBytes will be passed to the callback. It is
* not an error if this is smaller than the requested size, as it can
* happen e.g. near the end of a file, but generally we try to read as
* many bytes as requested. Zero is returned on end of file (or if
* `count` is zero), but never otherwise.
*
* Any outstanding I/O request with higher priority (lower numerical
* value) will be executed before an outstanding request with lower
* priority. Default priority is %G_PRIORITY_DEFAULT.
* @param count the number of bytes that will be read from the stream
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
read_bytes_async(
count: number,
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): globalThis.Promise | void;
/**
* Finishes an asynchronous stream read-into-#GBytes operation.
* @param result a #GAsyncResult.
* @returns the newly-allocated #GBytes, or %NULL on error
*/
read_bytes_finish(result: Gio.AsyncResult): GLib.Bytes;
/**
* Finishes an asynchronous stream read operation.
* @param result a #GAsyncResult.
* @returns number of bytes read in, or -1 on error, or 0 on end of file.
*/
read_finish(result: Gio.AsyncResult): number;
/**
* Sets `stream` to have actions pending. If the pending flag is
* already set or `stream` is closed, it will return %FALSE and set
* `error`.
* @returns %TRUE if pending was previously unset and is now set.
*/
set_pending(): boolean;
/**
* Tries to skip `count` bytes from the stream. Will block during the operation.
*
* This is identical to g_input_stream_read(), from a behaviour standpoint,
* but the bytes that are skipped are not returned to the user. Some
* streams have an implementation that is more efficient than reading the data.
*
* This function is optional for inherited classes, as the default implementation
* emulates it using read.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
* @param count the number of bytes that will be skipped from the stream
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @returns Number of bytes skipped, or -1 on error
*/
skip(count: number, cancellable?: Gio.Cancellable | null): number;
/**
* Request an asynchronous skip of `count` bytes from the stream.
* When the operation is finished `callback` will be called.
* You can then call g_input_stream_skip_finish() to get the result
* of the operation.
*
* During an async request no other sync and async calls are allowed,
* and will result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes skipped will be passed to the callback.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to skip
* as many bytes as requested. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value)
* will be executed before an outstanding request with lower priority.
* Default priority is %G_PRIORITY_DEFAULT.
*
* The asynchronous methods have a default fallback that uses threads to
* implement asynchronicity, so they are optional for inheriting classes.
* However, if you override one, you must override all.
* @param count the number of bytes that will be skipped from the stream
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
skip_async(
count: number,
io_priority: number,
cancellable?: Gio.Cancellable | null,
): globalThis.Promise;
/**
* Request an asynchronous skip of `count` bytes from the stream.
* When the operation is finished `callback` will be called.
* You can then call g_input_stream_skip_finish() to get the result
* of the operation.
*
* During an async request no other sync and async calls are allowed,
* and will result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes skipped will be passed to the callback.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to skip
* as many bytes as requested. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value)
* will be executed before an outstanding request with lower priority.
* Default priority is %G_PRIORITY_DEFAULT.
*
* The asynchronous methods have a default fallback that uses threads to
* implement asynchronicity, so they are optional for inheriting classes.
* However, if you override one, you must override all.
* @param count the number of bytes that will be skipped from the stream
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
skip_async(
count: number,
io_priority: number,
cancellable: Gio.Cancellable | null,
callback: Gio.AsyncReadyCallback | null,
): void;
/**
* Request an asynchronous skip of `count` bytes from the stream.
* When the operation is finished `callback` will be called.
* You can then call g_input_stream_skip_finish() to get the result
* of the operation.
*
* During an async request no other sync and async calls are allowed,
* and will result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes skipped will be passed to the callback.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to skip
* as many bytes as requested. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value)
* will be executed before an outstanding request with lower priority.
* Default priority is %G_PRIORITY_DEFAULT.
*
* The asynchronous methods have a default fallback that uses threads to
* implement asynchronicity, so they are optional for inheriting classes.
* However, if you override one, you must override all.
* @param count the number of bytes that will be skipped from the stream
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
skip_async(
count: number,
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): globalThis.Promise | void;
/**
* Finishes a stream skip operation.
* @param result a #GAsyncResult.
* @returns the size of the bytes skipped, or `-1` on error.
*/
skip_finish(result: Gio.AsyncResult): number;
/**
* Requests an asynchronous closes of the stream, releasing resources related to it.
* When the operation is finished `callback` will be called.
* You can then call g_input_stream_close_finish() to get the result of the
* operation.
*
* For behaviour details see g_input_stream_close().
*
* The asynchronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional cancellable object
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_close_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): void;
/**
* Finishes closing a stream asynchronously, started from g_input_stream_close_async().
* @param result a #GAsyncResult.
*/
vfunc_close_finish(result: Gio.AsyncResult): boolean;
vfunc_close_fn(cancellable?: Gio.Cancellable | null): boolean;
/**
* Request an asynchronous read of `count` bytes from the stream into the buffer
* starting at `buffer`. When the operation is finished `callback` will be called.
* You can then call g_input_stream_read_finish() to get the result of the
* operation.
*
* During an async request no other sync and async calls are allowed on `stream,` and will
* result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes read into the buffer will be passed to the
* callback. It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to read
* as many bytes as requested. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value) will
* be executed before an outstanding request with lower priority. Default
* priority is %G_PRIORITY_DEFAULT.
*
* The asynchronous methods have a default fallback that uses threads to implement
* asynchronicity, so they are optional for inheriting classes. However, if you
* override one you must override all.
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request.
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_read_async(
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): Uint8Array | null;
/**
* Finishes an asynchronous stream read operation.
* @param result a #GAsyncResult.
*/
vfunc_read_finish(result: Gio.AsyncResult): number;
vfunc_read_fn(buffer: any | null, count: number, cancellable?: Gio.Cancellable | null): number;
/**
* Tries to skip `count` bytes from the stream. Will block during the operation.
*
* This is identical to g_input_stream_read(), from a behaviour standpoint,
* but the bytes that are skipped are not returned to the user. Some
* streams have an implementation that is more efficient than reading the data.
*
* This function is optional for inherited classes, as the default implementation
* emulates it using read.
*
* If `cancellable` is not %NULL, then the operation can be cancelled by
* triggering the cancellable object from another thread. If the operation
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
* operation was partially finished when the operation was cancelled the
* partial result will be returned, without an error.
* @param count the number of bytes that will be skipped from the stream
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
vfunc_skip(count: number, cancellable?: Gio.Cancellable | null): number;
/**
* Request an asynchronous skip of `count` bytes from the stream.
* When the operation is finished `callback` will be called.
* You can then call g_input_stream_skip_finish() to get the result
* of the operation.
*
* During an async request no other sync and async calls are allowed,
* and will result in %G_IO_ERROR_PENDING errors.
*
* A value of `count` larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes skipped will be passed to the callback.
* It is not an error if this is not the same as the requested size, as it
* can happen e.g. near the end of a file, but generally we try to skip
* as many bytes as requested. Zero is returned on end of file
* (or if `count` is zero), but never otherwise.
*
* Any outstanding i/o request with higher priority (lower numerical value)
* will be executed before an outstanding request with lower priority.
* Default priority is %G_PRIORITY_DEFAULT.
*
* The asynchronous methods have a default fallback that uses threads to
* implement asynchronicity, so they are optional for inheriting classes.
* However, if you override one, you must override all.
* @param count the number of bytes that will be skipped from the stream
* @param io_priority the [I/O priority](iface.AsyncResult.html#io-priority) of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback a #GAsyncReadyCallback to call when the request is satisfied
*/
vfunc_skip_async(
count: number,
io_priority: number,
cancellable?: Gio.Cancellable | null,
callback?: Gio.AsyncReadyCallback | null,
): void;
/**
* Finishes a stream skip operation.
* @param result a #GAsyncResult.
*/
vfunc_skip_finish(result: Gio.AsyncResult): number;
/**
* Creates an asynchronous iterator for a Gio.InputStream that reads the stream in chunks.
*
* Each iteration will return a GLib.Bytes object containing at most `count` bytes (default 4096). The iterator will end when the stream is exhausted.
*
* Example:
* ```js
* import Gio from "gi://Gio";
*
* const textDecoder = new TextDecoder("utf-8");
*
* const file = Gio.File.new_for_path("/etc/os-release");
* const inputStream = file.read(null);
*
* for await (const bytes of inputStream.createAsyncIterator(4)) {
* log(textDecoder.decode(bytes.toArray()));
* }
* ```
*
* `returns` An async iterator yielding GLib.Bytes objects
* @param count Maximum number of bytes to read per chunk (default: 4096)
* @param priority I/O priority of the request (default: GLib.PRIORITY_DEFAULT)
*/
createAsyncIterator(count?: number, priority?: number): AsyncIterableIterator;
/**
* Creates a synchronous iterator for a Gio.InputStream that reads the stream in chunks.
*
* Each iteration will return a GLib.Bytes object containing at most `count` bytes (default 4096). The iterator will end when the stream is exhausted.
*
* Example:
* ```js
* import Gio from "gi://Gio";
*
* const textDecoder = new TextDecoder("utf-8");
*
* const file = Gio.File.new_for_path("/etc/os-release");
* const inputStream = file.read(null);
*
* for (const bytes of inputStream.createSyncIterator(4)) {
* log(textDecoder.decode(bytes.toArray()));
* }
* ```
*
* `returns` An iterable yielding GLib.Bytes objects
* @param count Maximum number of bytes to read per chunk (default: 4096)
* @param priority I/O priority of the request (default: GLib.PRIORITY_DEFAULT)
*/
createSyncIterator(count?: number, priority?: number): IterableIterator;
}
namespace ProxyResolverDefault {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'notify::gproxy-resolver': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps
extends GObject.Object.ConstructorProps,
ProxyURIResolver.ConstructorProps,
SessionFeature.ConstructorProps {
gproxy_resolver: Gio.ProxyResolver;
gproxyResolver: Gio.ProxyResolver;
}
}
class ProxyResolverDefault extends GObject.Object implements ProxyURIResolver, SessionFeature {
static $gtype: GObject.GType;
// Properties
set gproxy_resolver(val: Gio.ProxyResolver);
set gproxyResolver(val: Gio.ProxyResolver);
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: ProxyResolverDefault.SignalSignatures;
// Constructors
constructor(properties?: Partial, ...args: any[]);
_init(...args: any[]): void;
// Signals
connect(
signal: K,
callback: GObject.SignalCallback,
): number;
connect(signal: string, callback: (...args: any[]) => any): number;
connect_after(
signal: K,
callback: GObject.SignalCallback,
): number;
connect_after(signal: string, callback: (...args: any[]) => any): number;
emit(
signal: K,
...args: GObject.GjsParameters extends [any, ...infer Q]
? Q
: never
): void;
emit(signal: string, ...args: any[]): void;
// Inherited methods
/**
* Asynchronously determines a proxy URI to use for `msg` and calls
* `callback`.
* @param uri the #SoupURI you want a proxy for
* @param async_context the #GMainContext to invoke @callback in
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to invoke with the proxy address
*/
get_proxy_uri_async(
uri: URI,
async_context: GLib.MainContext | null,
cancellable: Gio.Cancellable | null,
callback: ProxyURIResolverCallback,
): void;
/**
* Synchronously determines a proxy URI to use for `uri`. If `uri`
* should be sent via proxy, *`proxy_uri` will be set to the URI of the
* proxy, else it will be set to %NULL.
* @param uri the #SoupURI you want a proxy for
* @param cancellable a #GCancellable, or %NULL
* @returns %SOUP_STATUS_OK if successful, or a transport-level error.
*/
get_proxy_uri_sync(uri: URI, cancellable: Gio.Cancellable | null): [number, URI];
/**
* Asynchronously determines a proxy URI to use for `msg` and calls
* `callback`.
* @param uri the #SoupURI you want a proxy for
* @param async_context the #GMainContext to invoke @callback in
* @param cancellable a #GCancellable, or %NULL
* @param callback callback to invoke with the proxy address
*/
vfunc_get_proxy_uri_async(
uri: URI,
async_context: GLib.MainContext | null,
cancellable: Gio.Cancellable | null,
callback: ProxyURIResolverCallback,
): void;
/**
* Synchronously determines a proxy URI to use for `uri`. If `uri`
* should be sent via proxy, *`proxy_uri` will be set to the URI of the
* proxy, else it will be set to %NULL.
* @param uri the #SoupURI you want a proxy for
* @param cancellable a #GCancellable, or %NULL
*/
vfunc_get_proxy_uri_sync(uri: URI, cancellable: Gio.Cancellable | null): [number, URI];
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature accepted @type as a subfeature.
*/
add_feature(type: GObject.GType): boolean;
attach(session: Session): void;
detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @feature has a subfeature of type @type
*/
has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
* @returns %TRUE if @type was removed from @feature
*/
remove_feature(type: GObject.GType): boolean;
/**
* Adds a "sub-feature" of type `type` to the base feature `feature`.
* This is used for features that can be extended with multiple
* different types. Eg, the authentication manager can be extended
* with subtypes of #SoupAuth.
* @param type the #GType of a "sub-feature"
*/
vfunc_add_feature(type: GObject.GType): boolean;
/**
* Perform setup when a feature is added to a session
* @param session
*/
vfunc_attach(session: Session): void;
/**
* Perform cleanup when a feature is removed from a session
* @param session
*/
vfunc_detach(session: Session): void;
/**
* Tests if `feature` has a "sub-feature" of type `type`. See
* soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_has_feature(type: GObject.GType): boolean;
/**
* Removes the "sub-feature" of type `type` from the base feature
* `feature`. See soup_session_feature_add_feature().
* @param type the #GType of a "sub-feature"
*/
vfunc_remove_feature(type: GObject.GType): boolean;
/**
* Proxies the session's #SoupSession::request_queued signal
* @param session
* @param msg
*/
vfunc_request_queued(session: Session, msg: Message): void;
/**
* Proxies the session's #SoupSession::request_started signal. Deprecated 2.50. Use #SoupMessage::starting instead.
* @param session
* @param msg
* @param socket
*/
vfunc_request_started(session: Session, msg: Message, socket: Socket): void;
/**
* Proxies the session's #SoupSession::request_unqueued signal
* @param session
* @param msg
*/
vfunc_request_unqueued(session: Session, msg: Message): void;
/**
* Creates a binding between `source_property` on `source` and `target_property`
* on `target`.
*
* Whenever the `source_property` is changed the `target_property` is
* updated using the same value. For instance:
*
*
* ```c
* g_object_bind_property (action, "active", widget, "sensitive", 0);
* ```
*
*
* Will result in the "sensitive" property of the widget #GObject instance to be
* updated with the same value of the "active" property of the action #GObject
* instance.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well.
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. To remove the binding without affecting the
* `source` and the `target` you can just call g_object_unref() on the returned
* #GBinding instance.
*
* Removing the binding by calling g_object_unref() on it must only be done if
* the binding, `source` and `target` are only used from a single thread and it
* is clear that both `source` and `target` outlive the binding. Especially it
* is not safe to rely on this if the binding, `source` or `target` can be
* finalized from different threads. Keep another reference to the binding and
* use g_binding_unbind() instead to be on the safe side.
*
* A #GObject can have multiple bindings.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
): GObject.Binding;
/**
* Complete version of g_object_bind_property().
*
* Creates a binding between `source_property` on `source` and `target_property`
* on `target,` allowing you to set the transformation functions to be used by
* the binding.
*
* If `flags` contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
* if `target_property` on `target` changes then the `source_property` on `source`
* will be updated as well. The `transform_from` function is only used in case
* of bidirectional bindings, otherwise it will be ignored
*
* The binding will automatically be removed when either the `source` or the
* `target` instances are finalized. This will release the reference that is
* being held on the #GBinding instance; if you want to hold on to the
* #GBinding instance, you will need to hold a reference to it.
*
* To remove the binding, call g_binding_unbind().
*
* A #GObject can have multiple bindings.
*
* The same `user_data` parameter will be used for both `transform_to`
* and `transform_from` transformation functions; the `notify` function will
* be called once, when the binding is removed. If you need different data
* for each transformation function, please use
* g_object_bind_property_with_closures() instead.
* @param source_property the property on @source to bind
* @param target the target #GObject
* @param target_property the property on @target to bind
* @param flags flags to pass to #GBinding
* @param transform_to the transformation function from the @source to the @target, or %NULL to use the default
* @param transform_from the transformation function from the @target to the @source, or %NULL to use the default
* @param notify a function to call when disposing the binding, to free resources used by the transformation functions, or %NULL if not required
* @returns the #GBinding instance representing the binding between the two #GObject instances. The binding is released whenever the #GBinding reference count reaches zero.
*/
bind_property_full(
source_property: string,
target: GObject.Object,
target_property: string,
flags: GObject.BindingFlags | null,
transform_to?: GObject.BindingTransformFunc | null,
transform_from?: GObject.BindingTransformFunc | null,
notify?: GLib.DestroyNotify | null,
): GObject.Binding;
// Conflicted with GObject.Object.bind_property_full
bind_property_full(...args: never[]): any;
/**
* This function is intended for #GObject implementations to re-enforce
* a [floating][floating-ref] object reference. Doing this is seldom
* required: all #GInitiallyUnowneds are created with a floating reference
* which usually just needs to be sunken by calling g_object_ref_sink().
*/
force_floating(): void;
/**
* Increases the freeze count on `object`. If the freeze count is
* non-zero, the emission of "notify" signals on `object` is
* stopped. The signals are queued until the freeze count is decreased
* to zero. Duplicate notifications are squashed so that at most one
* #GObject::notify signal is emitted for each property modified while the
* object is frozen.
*
* This is necessary for accessors that modify multiple properties to prevent
* premature notification while the object is still being modified.
*/
freeze_notify(): void;
/**
* Gets a named field from the objects table of associations (see g_object_set_data()).
* @param key name of the key for that association
* @returns the data if found, or %NULL if no such data exists.
*/
get_data(key: string): any | null;
/**
* Gets a property of an object.
*
* The value can be:
* - an empty GObject.Value initialized by G_VALUE_INIT, which will be automatically initialized with the expected type of the property (since GLib 2.60)
* - a GObject.Value initialized with the expected type of the property
* - a GObject.Value initialized with a type to which the expected type of the property can be transformed
*
* In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling GObject.Value.unset.
*
* Note that GObject.Object.get_property is really intended for language bindings, GObject.Object.get is much more convenient for C programming.
* @param property_name The name of the property to get
* @param value Return location for the property value. Can be an empty GObject.Value initialized by G_VALUE_INIT (auto-initialized with expected type since GLib 2.60), a GObject.Value initialized with the expected property type, or a GObject.Value initialized with a transformable type
*/
get_property(property_name: string, value: GObject.Value | any): any;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
get_qdata(quark: GLib.Quark): any | null;
/**
* Gets `n_properties` properties for an `object`.
* Obtained properties will be set to `values`. All properties must be valid.
* Warnings will be emitted and undefined behaviour may result if invalid
* properties are passed in.
* @param names the names of each property to get
* @param values the values of each property to get
*/
getv(names: string[], values: (GObject.Value | any)[]): void;
/**
* Checks whether `object` has a [floating][floating-ref] reference.
* @returns %TRUE if @object has a floating reference
*/
is_floating(): boolean;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param property_name the name of a property installed on the class of @object.
*/
notify(property_name: string): void;
/**
* Emits a "notify" signal for the property specified by `pspec` on `object`.
*
* This function omits the property name lookup, hence it is faster than
* g_object_notify().
*
* One way to avoid using g_object_notify() from within the
* class that registered the properties, and using g_object_notify_by_pspec()
* instead, is to store the GParamSpec used with
* g_object_class_install_property() inside a static array, e.g.:
*
*
* ```c
* typedef enum
* {
* PROP_FOO = 1,
* PROP_LAST
* } MyObjectProperty;
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL,
* 0, 100,
* 50,
* G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
* g_object_class_install_property (gobject_class,
* PROP_FOO,
* properties[PROP_FOO]);
* }
* ```
*
*
* and then notify a change on the "foo" property with:
*
*
* ```c
* g_object_notify_by_pspec (self, properties[PROP_FOO]);
* ```
*
* @param pspec the #GParamSpec of a property installed on the class of @object.
*/
notify_by_pspec(pspec: GObject.ParamSpec): void;
/**
* Increases the reference count of `object`.
*
* Since GLib 2.56, if `GLIB_VERSION_MAX_ALLOWED` is 2.56 or greater, the type
* of `object` will be propagated to the return type (using the GCC typeof()
* extension), so any casting the caller needs to do on the return type must be
* explicit.
* @returns the same @object
*/
ref(): GObject.Object;
/**
* Increase the reference count of `object,` and possibly remove the
* [floating][floating-ref] reference, if `object` has a floating reference.
*
* In other words, if the object is floating, then this call "assumes
* ownership" of the floating reference, converting it to a normal
* reference by clearing the floating flag while leaving the reference
* count unchanged. If the object is not floating, then this call
* adds a new normal reference increasing the reference count by one.
*
* Since GLib 2.56, the type of `object` will be propagated to the return type
* under the same conditions as for g_object_ref().
* @returns @object
*/
ref_sink(): GObject.Object;
/**
* Releases all references to other objects. This can be used to break
* reference cycles.
*
* This function should only be called from object system implementations.
*/
run_dispose(): void;
/**
* Each object carries around a table of associations from
* strings to pointers. This function lets you set an association.
*
* If the object already had an association with that name,
* the old association will be destroyed.
*
* Internally, the `key` is converted to a #GQuark using g_quark_from_string().
* This means a copy of `key` is kept permanently (even after `object` has been
* finalized) — so it is recommended to only use a small, bounded set of values
* for `key` in your program, to avoid the #GQuark storage growing unbounded.
* @param key name of the key
* @param data data to associate with that key
*/
set_data(key: string, data?: any | null): void;
/**
* Sets a property on an object.
* @param property_name The name of the property to set
* @param value The value to set the property to
*/
set_property(property_name: string, value: GObject.Value | any): void;
/**
* Remove a specified datum from the object's data associations,
* without invoking the association's destroy handler.
* @param key name of the key
* @returns the data if found, or %NULL if no such data exists.
*/
steal_data(key: string): any | null;
/**
* This function gets back user data pointers stored via
* g_object_set_qdata() and removes the `data` from object
* without invoking its destroy() function (if any was
* set).
* Usually, calling this function is only required to update
* user data pointers with a destroy notifier, for example:
*
* ```c
* void
* object_add_to_user_list (GObject *object,
* const gchar *new_string)
* {
* // the quark, naming the object data
* GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
* // retrieve the old string list
* GList *list = g_object_steal_qdata (object, quark_string_list);
*
* // prepend new string
* list = g_list_prepend (list, g_strdup (new_string));
* // this changed 'list', so we need to set it again
* g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
* }
* static void
* free_string_list (gpointer data)
* {
* GList *node, *list = data;
*
* for (node = list; node; node = node->next)
* g_free (node->data);
* g_list_free (list);
* }
* ```
*
* Using g_object_get_qdata() in the above example, instead of
* g_object_steal_qdata() would have left the destroy function set,
* and thus the partial string list would have been freed upon
* g_object_set_qdata_full().
* @param quark A #GQuark, naming the user data pointer
* @returns The user data pointer set, or %NULL
*/
steal_qdata(quark: GLib.Quark): any | null;
/**
* Reverts the effect of a previous call to
* g_object_freeze_notify(). The freeze count is decreased on `object`
* and when it reaches zero, queued "notify" signals are emitted.
*
* Duplicate notifications for each property are squashed so that at most one
* #GObject::notify signal is emitted for each property, in the reverse order
* in which they have been queued.
*
* It is an error to call this function when the freeze count is zero.
*/
thaw_notify(): void;
/**
* Decreases the reference count of `object`. When its reference count
* drops to 0, the object is finalized (i.e. its memory is freed).
*
* If the pointer to the #GObject may be reused in future (for example, if it is
* an instance variable of another object), it is recommended to clear the
* pointer to %NULL rather than retain a dangling pointer to a potentially
* invalid #GObject instance. Use g_clear_object() for this.
*/
unref(): void;
/**
* This function essentially limits the life time of the `closure` to
* the life time of the object. That is, when the object is finalized,
* the `closure` is invalidated by calling g_closure_invalidate() on
* it, in order to prevent invocations of the closure with a finalized
* (nonexisting) object. Also, g_object_ref() and g_object_unref() are
* added as marshal guards to the `closure,` to ensure that an extra
* reference count is held on `object` during invocation of the
* `closure`. Usually, this function will be called on closures that
* use this `object` as closure data.
* @param closure #GClosure to watch
*/
watch_closure(closure: GObject.Closure): void;
/**
* the `constructed` function is called by g_object_new() as the
* final step of the object creation process. At the point of the call, all
* construction properties have been set on the object. The purpose of this
* call is to allow for object initialisation steps that can only be performed
* after construction properties have been set. `constructed` implementors
* should chain up to the `constructed` call of their parent class to allow it
* to complete its initialisation.
*/
vfunc_constructed(): void;
/**
* emits property change notification for a bunch
* of properties. Overriding `dispatch_properties_changed` should be rarely
* needed.
* @param n_pspecs
* @param pspecs
*/
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void;
/**
* the `dispose` function is supposed to drop all references to other
* objects, but keep the instance otherwise intact, so that client method
* invocations still work. It may be run multiple times (due to reference
* loops). Before returning, `dispose` should chain up to the `dispose` method
* of the parent class.
*/
vfunc_dispose(): void;
/**
* instance finalization function, should finish the finalization of
* the instance begun in `dispose` and chain up to the `finalize` method of the
* parent class.
*/
vfunc_finalize(): void;
/**
* the generic getter for all properties of this type. Should be
* overridden for every type with properties.
* @param property_id
* @param value
* @param pspec
*/
vfunc_get_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Emits a "notify" signal for the property `property_name` on `object`.
*
* When possible, eg. when signaling a property change from within the class
* that registered the property, you should use g_object_notify_by_pspec()
* instead.
*
* Note that emission of the notify signal may be blocked with
* g_object_freeze_notify(). In this case, the signal emissions are queued
* and will be emitted (in reverse order) when g_object_thaw_notify() is
* called.
* @param pspec
*/
vfunc_notify(pspec: GObject.ParamSpec): void;
/**
* the generic setter for all properties of this type. Should be
* overridden for every type with properties. If implementations of
* `set_property` don't emit property change notification explicitly, this will
* be done implicitly by the type system. However, if the notify signal is
* emitted explicitly, the type system will not emit it a second time.
* @param property_id
* @param value
* @param pspec
*/
vfunc_set_property(property_id: number, value: GObject.Value | any, pspec: GObject.ParamSpec): void;
/**
* Disconnects a handler from an instance so it will not be called during any future or currently ongoing emissions of the signal it has been connected to.
* @param id Handler ID of the handler to be disconnected
*/
disconnect(id: number): void;
/**
* Sets multiple properties of an object at once. The properties argument should be a dictionary mapping property names to values.
* @param properties Object containing the properties to set
*/
set(properties: { [key: string]: any }): void;
/**
* Blocks a handler of an instance so it will not be called during any signal emissions
* @param id Handler ID of the handler to be blocked
*/
block_signal_handler(id: number): void;
/**
* Unblocks a handler so it will be called again during any signal emissions
* @param id Handler ID of the handler to be unblocked
*/
unblock_signal_handler(id: number): void;
/**
* Stops a signal's emission by the given signal name. This will prevent the default handler and any subsequent signal handlers from being invoked.
* @param detailedName Name of the signal to stop emission of
*/
stop_emission_by_name(detailedName: string): void;
}
namespace Request {
// Signal signatures
interface SignalSignatures extends GObject.Object.SignalSignatures {
'notify::session': (pspec: GObject.ParamSpec) => void;
'notify::uri': (pspec: GObject.ParamSpec) => void;
}
// Constructor properties interface
interface ConstructorProps extends GObject.Object.ConstructorProps, Gio.Initable.ConstructorProps {
session: Session;
uri: URI;
}
}
/**
* A request to retrieve a particular URI.
*/
class Request extends GObject.Object implements Gio.Initable {
static $gtype: GObject.GType;
// Properties
/**
* The request's #SoupSession.
*/
get session(): Session;
/**
* The request URI.
*/
get uri(): URI;
/**
* Compile-time signal type information.
*
* This instance property is generated only for TypeScript type checking.
* It is not defined at runtime and should not be accessed in JS code.
* @internal
*/
$signals: Request.SignalSignatures;
// Constructors
constructor(properties?: Partial