/
Jsonrpc-1.0.d.ts
3866 lines (3863 loc) · 179 KB
/
Jsonrpc-1.0.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* 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 itself or create a bug report on https://github.com/sammydre/ts-for-gjs
*/
/**
* Jsonrpc-1.0
*/
import type * as Gjs from './Gjs';
import type Gio from './Gio-2.0';
import type GObject from './GObject-2.0';
import type GLib from './GLib-2.0';
export namespace Jsonrpc {
enum ClientError {
PARSE_ERROR,
INVALID_REQUEST,
METHOD_NOT_FOUND,
INVALID_PARAMS,
INTERNAL_ERROR,
}
/**
* jsonrpc-glib major version component (e.g. 1 if %JSONRPC_VERSION is 1.2.3)
*/
const MAJOR_VERSION: number
/**
* jsonrpc-glib micro version component (e.g. 3 if %JSONRPC_VERSION is 1.2.3)
*/
const MICRO_VERSION: number
/**
* jsonrpc-glib minor version component (e.g. 2 if %JSONRPC_VERSION is 1.2.3)
*/
const MINOR_VERSION: number
/**
* jsonrpc-glib version, encoded as a string, useful for printing and
* concatenation.
*/
const VERSION_S: string
interface ServerHandler {
(self: Server, client: Client, method: string, id: GLib.Variant, params: GLib.Variant): void
}
interface Client_ConstructProps extends GObject.Object_ConstructProps {
/* Constructor properties of Jsonrpc-1.0.Jsonrpc.Client */
/**
* The "io-stream" property is the [class`Gio`.IOStream] to use for communicating
* with a JSON-RPC peer.
*/
io_stream?: Gio.IOStream
/**
* The "use-gvariant" property denotes if [struct`GLib`.Variant] should be used to
* communicate with the peer instead of JSON. You should only set this
* if you know the peer is also a Jsonrpc-GLib based client.
*
* Setting this property allows the peers to communicate using GVariant
* instead of JSON. This means that we can access the messages without
* expensive memory allocations and parsing costs associated with JSON.
* [struct`GLib`.Variant] is much more optimal for memory-bassed message passing.
*/
use_gvariant?: boolean
}
class Client {
/* Properties of Jsonrpc-1.0.Jsonrpc.Client */
/**
* The "io-stream" property is the [class`Gio`.IOStream] to use for communicating
* with a JSON-RPC peer.
*/
readonly io_stream: Gio.IOStream
/**
* The "use-gvariant" property denotes if [struct`GLib`.Variant] should be used to
* communicate with the peer instead of JSON. You should only set this
* if you know the peer is also a Jsonrpc-GLib based client.
*
* Setting this property allows the peers to communicate using GVariant
* instead of JSON. This means that we can access the messages without
* expensive memory allocations and parsing costs associated with JSON.
* [struct`GLib`.Variant] is much more optimal for memory-bassed message passing.
*/
use_gvariant: boolean
/* Fields of GObject-2.0.GObject.Object */
g_type_instance: GObject.TypeInstance
/* Methods of Jsonrpc-1.0.Jsonrpc.Client */
/**
* Synchronously calls `method` with `params` on the remote peer.
*
* once a reply has been received, or failure, this function will return.
* If successful, `return_value` will be set with the reslut field of
* the response.
*
* If `params` is floating then this function consumes the reference.
* @param method The name of the method to call
* @param params A [struct`GLib`.Variant] of parameters or %NULL
* @param cancellable A #GCancellable or %NULL
*/
call(method: string, params?: GLib.Variant | null, cancellable?: Gio.Cancellable | null): [ /* returnType */ boolean, /* return_value */ GLib.Variant | null ]
/**
* Asynchronously calls `method` with `params` on the remote peer.
*
* Upon completion or failure, `callback` is executed and it should
* call [method`Client`.call_finish] to complete the request and release
* any memory held.
*
* If `params` is floating, the floating reference is consumed.
* @param method The name of the method to call
* @param params A [struct`GLib`.Variant] of parameters or %NULL
* @param cancellable A #GCancellable or %NULL
* @param callback a callback to executed upon completion
*/
call_async(method: string, params?: GLib.Variant | null, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
/**
* Completes an asynchronous call to [method`Client`.call_async].
* @param result A #GAsyncResult provided to the callback in [method`Client`.call_async]
*/
call_finish(result: Gio.AsyncResult): [ /* returnType */ boolean, /* return_value */ GLib.Variant | null ]
/**
* Asynchronously calls `method` with `params` on the remote peer.
*
* Upon completion or failure, `callback` is executed and it should
* call [method`Client`.call_finish] to complete the request and release
* any memory held.
*
* This function is similar to [method`Client`.call_async] except that
* it allows the caller to get the id of the command which might be useful
* in systems where you can cancel the operation (such as the Language
* Server Protocol).
*
* If `params` is floating, the floating reference is consumed.
* @param method The name of the method to call
* @param params A [struct`GLib`.Variant] of parameters or %NULL
* @param cancellable A #GCancellable or %NULL
* @param callback Callback to executed upon completion
*/
call_with_id_async(method: string, params?: GLib.Variant | null, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): /* id */ GLib.Variant | null
/**
* Closes the underlying streams and cancels any inflight operations of the
* #JsonrpcClient.
*
* This is important to call when you are done with the
* client so that any outstanding operations that have caused `self` to
* hold additional references are cancelled.
*
* Failure to call this method results in a leak of #JsonrpcClient.
* @param cancellable
*/
close(cancellable?: Gio.Cancellable | null): boolean
/**
* Asynchronous version of [method`Client`.close].
*
* Currently this operation is implemented synchronously, but in the future may
* be converted to using asynchronous operations.
* @param cancellable
* @param callback
*/
close_async(cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
/**
* Completes an asynchronous request of [method`Client`.close_async].
* @param result
*/
close_finish(result: Gio.AsyncResult): boolean
/**
* Gets the [property`Client:`use-gvariant] property.
*
* Indicates if [struct`GLib`.Variant] is being used to communicate with the peer.
*/
get_use_gvariant(): boolean
/**
* Synchronous variant of [method`Client`.reply_async].
*
* If `id` or `result` are floating, there floating references are consumed.
* @param id The id of the message to reply
* @param result The return value or %NULL
* @param cancellable A #GCancellable, or %NULL
*/
reply(id: GLib.Variant, result?: GLib.Variant | null, cancellable?: Gio.Cancellable | null): boolean
reply_async(id: GLib.Variant, result: GLib.Variant, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
/**
* Asynchronously replies to the peer, sending a JSON-RPC error message.
*
* Call [method`Client`.reply_error_finish] to get the result of this operation.
*
* If `id` is floating, it's floating reference is consumed.
* @param id A [struct`GLib`.Variant] containing the call id
* @param code The error code
* @param message An optional error message
* @param cancellable A #GCancellable, or %NULL
* @param callback A #GAsyncReadyCallback or %NULL
*/
reply_error_async(id: GLib.Variant, code: number, message?: string | null, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
reply_error_finish(result: Gio.AsyncResult): boolean
/**
* Completes an asynchronous request to [method`Client`.reply_async].
* @param result A #GAsyncResult
*/
reply_finish(result: Gio.AsyncResult): boolean
/**
* Synchronously calls `method` with `params` on the remote peer.
*
* This function will not wait or expect a reply from the peer.
*
* If `params` is floating then the reference is consumed.
* @param method The name of the method to call
* @param params A [struct`GLib`.Variant] of parameters or %NULL
* @param cancellable A #GCancellable or %NULL
*/
send_notification(method: string, params?: GLib.Variant | null, cancellable?: Gio.Cancellable | null): boolean
/**
* Asynchronously calls `method` with `params` on the remote peer.
*
* This function will not wait or expect a reply from the peer.
*
* This function is useful when the caller wants to be notified that
* the bytes have been delivered to the underlying stream. This does
* not indicate that the peer has received them.
*
* If `params` is floating then the reference is consumed.
* @param method The name of the method to call
* @param params A [struct`GLib`.Variant] of parameters or %NULL
* @param cancellable A #GCancellable or %NULL
* @param callback
*/
send_notification_async(method: string, params?: GLib.Variant | null, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
/**
* Completes an asynchronous call to [method`Client`.send_notification_async].
*
* Successful completion of this function only indicates that the request
* has been written to the underlying buffer, not that the peer has received
* the notification.
* @param result
*/
send_notification_finish(result: Gio.AsyncResult): boolean
/**
* Sets the [property`Client:`use-gvariant] property.
*
* This function sets if [struct`GLib`.Variant] should be used to communicate with the
* peer. Doing so can allow for more efficient communication by avoiding
* expensive parsing overhead and memory allocations. However, it requires
* that the peer also supports [struct`GLib`.Variant] encoding.
* @param use_gvariant If [struct`GLib`.Variant] should be used
*/
set_use_gvariant(use_gvariant: boolean): void
/**
* This function requests that client start processing incoming
* messages from the peer.
*/
start_listening(): void
/* Methods of GObject-2.0.GObject.Object */
/**
* 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
*/
bind_property(source_property: string, target: GObject.Object, target_property: string, flags: GObject.BindingFlags): GObject.Binding
/**
* 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.
*
* This function is the language bindings friendly version of
* g_object_bind_property_full(), using #GClosures instead of
* function pointers.
* @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 a #GClosure wrapping the transformation function from the `source` to the `target,` or %NULL to use the default
* @param transform_from a #GClosure wrapping the transformation function from the `target` to the `source,` or %NULL to use the default
*/
bind_property_full(source_property: string, target: GObject.Object, target_property: string, flags: GObject.BindingFlags, transform_to: Function, transform_from: Function): GObject.Binding
/**
* 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
*/
get_data(key: string): object | null
/**
* Gets a property of an object.
*
* The `value` can be:
*
* - an empty #GValue initialized by %G_VALUE_INIT, which will be
* automatically initialized with the expected type of the property
* (since GLib 2.60)
* - a #GValue initialized with the expected type of the property
* - a #GValue 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 g_value_unset().
*
* Note that g_object_get_property() is really intended for language
* bindings, g_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
*/
get_property(property_name: string, value: any): void
/**
* This function gets back user data pointers stored via
* g_object_set_qdata().
* @param quark A #GQuark, naming the user data pointer
*/
get_qdata(quark: GLib.Quark): object | 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: any[]): void
/**
* Checks whether `object` has a [floating][floating-ref] 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
* enum
* {
* PROP_0,
* PROP_FOO,
* PROP_LAST
* };
*
* static GParamSpec *properties[PROP_LAST];
*
* static void
* my_object_class_init (MyObjectClass *klass)
* {
* properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
* 0, 100,
* 50,
* G_PARAM_READWRITE);
* 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.
*/
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().
*/
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?: object | null): void
/**
* Sets a property on an object.
* @param property_name the name of the property to set
* @param value the value
*/
set_property(property_name: string, 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
*/
steal_data(key: string): object | 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
*/
steal_qdata(quark: GLib.Quark): object | 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: Function): void
/* Virtual methods of Jsonrpc-1.0.Jsonrpc.Client */
vfunc_failed(): void
vfunc_handle_call(method: string, id: GLib.Variant, params: GLib.Variant): boolean
vfunc_notification(method_name: string, params: GLib.Variant): void
/* Virtual methods of GObject-2.0.GObject.Object */
vfunc_constructed(): void
vfunc_dispatch_properties_changed(n_pspecs: number, pspecs: GObject.ParamSpec): void
vfunc_dispose(): void
vfunc_finalize(): void
vfunc_get_property(property_id: number, 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
vfunc_set_property(property_id: number, value: any, pspec: GObject.ParamSpec): void
/* Signals of Jsonrpc-1.0.Jsonrpc.Client */
/**
* The "failed" signal is called when the client has failed communication
* or the connection has been knowingly closed.
*/
connect(sigName: "failed", callback: (($obj: Client) => void)): number
connect_after(sigName: "failed", callback: (($obj: Client) => void)): number
emit(sigName: "failed"): void
/**
* This signal is emitted when an RPC has been received from the peer we
* are connected to. Return %TRUE if you have handled this message, even
* asynchronously. If no handler has returned %TRUE an error will be
* synthesized.
*
* If you handle the message, you are responsible for replying to the peer
* in a timely manner using [method`Client`.reply] or [method`Client`.reply_async].
*
* Additionally, since 3.28 you may connect to the "detail" of this signal
* to handle a specific method call. Use the method name as the detail of
* the signal.
* @param method The method name
* @param id The "id" field of the JSONRPC message
* @param params The "params" field of the JSONRPC message
*/
connect(sigName: "handle-call", callback: (($obj: Client, method: string, id: GLib.Variant, params?: GLib.Variant | null) => boolean)): number
connect_after(sigName: "handle-call", callback: (($obj: Client, method: string, id: GLib.Variant, params?: GLib.Variant | null) => boolean)): number
emit(sigName: "handle-call", method: string, id: GLib.Variant, params?: GLib.Variant | null): void
/**
* This signal is emitted when a notification has been received from a
* peer. Unlike [signal`Client:`:handle-call], this does not have an "id"
* parameter because notifications do not have ids. They do not round
* trip.
* @param method The method name of the notification
* @param params Params for the notification
*/
connect(sigName: "notification", callback: (($obj: Client, method: string, params?: GLib.Variant | null) => void)): number
connect_after(sigName: "notification", callback: (($obj: Client, method: string, params?: GLib.Variant | null) => void)): number
emit(sigName: "notification", method: string, params?: GLib.Variant | null): void
/* Signals of GObject-2.0.GObject.Object */
/**
* The notify signal is emitted on an object when one of its properties has
* its value set through g_object_set_property(), g_object_set(), et al.
*
* Note that getting this signal doesn’t itself guarantee that the value of
* the property has actually changed. When it is emitted is determined by the
* derived GObject class. If the implementor did not create the property with
* %G_PARAM_EXPLICIT_NOTIFY, then any call to g_object_set_property() results
* in ::notify being emitted, even if the new value is the same as the old.
* If they did pass %G_PARAM_EXPLICIT_NOTIFY, then this signal is emitted only
* when they explicitly call g_object_notify() or g_object_notify_by_pspec(),
* and common practice is to do that only when the value has actually changed.
*
* This signal is typically used to obtain change notification for a
* single property, by specifying the property name as a detail in the
* g_signal_connect() call, like this:
*
*
* ```c
* g_signal_connect (text_view->buffer, "notify::paste-target-list",
* G_CALLBACK (gtk_text_view_target_list_notify),
* text_view)
* ```
*
*
* It is important to note that you must use
* [canonical parameter names][canonical-parameter-names] as
* detail strings for the notify signal.
* @param pspec the #GParamSpec of the property which changed.
*/
connect(sigName: "notify", callback: (($obj: Client, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify", callback: (($obj: Client, pspec: GObject.ParamSpec) => void)): number
emit(sigName: "notify", pspec: GObject.ParamSpec): void
connect(sigName: "notify::io-stream", callback: (($obj: Client, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::io-stream", callback: (($obj: Client, pspec: GObject.ParamSpec) => void)): number
connect(sigName: "notify::use-gvariant", callback: (($obj: Client, pspec: GObject.ParamSpec) => void)): number
connect_after(sigName: "notify::use-gvariant", callback: (($obj: Client, pspec: GObject.ParamSpec) => void)): number
connect(sigName: string, callback: any): number
connect_after(sigName: string, callback: any): number
emit(sigName: string, ...args: any[]): void
disconnect(id: number): void
static name: string
constructor (config?: Client_ConstructProps)
_init (config?: Client_ConstructProps): void
/* Static methods and pseudo-constructors */
static new(io_stream: Gio.IOStream): Client
static error_quark(): GLib.Quark
static $gtype: GObject.Type
}
interface InputStream_ConstructProps extends Gio.DataInputStream_ConstructProps {
}
class InputStream {
/* Properties of Gio-2.0.Gio.DataInputStream */
/**
* The :byte-order property determines the byte ordering that
* is used when reading multi-byte entities (such as integers)
* from the stream.
*/
byte_order: Gio.DataStreamByteOrder
/**
* The :newline-type property determines what is considered
* as a line ending when reading complete lines from the stream.
*/
newline_type: Gio.DataStreamNewlineType
/* Properties of Gio-2.0.Gio.BufferedInputStream */
buffer_size: number
/* Properties of Gio-2.0.Gio.FilterInputStream */
close_base_stream: boolean
/* Fields of Gio-2.0.Gio.DataInputStream */
parent_instance: Gio.BufferedInputStream
/* Fields of Gio-2.0.Gio.FilterInputStream */
base_stream: Gio.InputStream
/* Fields of GObject-2.0.GObject.Object */
g_type_instance: GObject.TypeInstance
/* Methods of Jsonrpc-1.0.Jsonrpc.InputStream */
read_message(cancellable: Gio.Cancellable | null, message: GLib.Variant): boolean
read_message_async(cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
read_message_finish(result: Gio.AsyncResult, message: GLib.Variant): boolean
/* Methods of Gio-2.0.Gio.DataInputStream */
/**
* Gets the byte order for the data input stream.
*/
get_byte_order(): Gio.DataStreamByteOrder
/**
* Gets the current newline type for the `stream`.
*/
get_newline_type(): Gio.DataStreamNewlineType
/**
* Reads an unsigned 8-bit/1-byte value from `stream`.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_byte(cancellable?: Gio.Cancellable | null): number
/**
* Reads a 16-bit/2-byte value from `stream`.
*
* In order to get the correct byte order for this read operation,
* see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_int16(cancellable?: Gio.Cancellable | null): number
/**
* Reads a signed 32-bit/4-byte value from `stream`.
*
* In order to get the correct byte order for this read operation,
* see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* 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.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_int32(cancellable?: Gio.Cancellable | null): number
/**
* Reads a 64-bit/8-byte value from `stream`.
*
* In order to get the correct byte order for this read operation,
* see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* 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.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_int64(cancellable?: Gio.Cancellable | null): number
/**
* Reads a line from the data input stream. Note that no encoding
* checks or conversion is performed; the input is not guaranteed to
* be UTF-8, and may in fact have embedded NUL characters.
*
* 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.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_line(cancellable?: Gio.Cancellable | null): [ /* returnType */ Uint8Array | null, /* length */ number | null ]
/**
* The asynchronous version of g_data_input_stream_read_line(). It is
* an error to have two outstanding calls to this function.
*
* When the operation is finished, `callback` will be called. You
* can then call g_data_input_stream_read_line_finish() to get
* the result of the operation.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback callback to call when the request is satisfied.
*/
read_line_async(io_priority: number, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
/**
* Finish an asynchronous call started by
* g_data_input_stream_read_line_async(). Note the warning about
* string encoding in g_data_input_stream_read_line() applies here as
* well.
* @param result the #GAsyncResult that was provided to the callback.
*/
read_line_finish(result: Gio.AsyncResult): [ /* returnType */ Uint8Array | null, /* length */ number | null ]
/**
* Finish an asynchronous call started by
* g_data_input_stream_read_line_async().
* @param result the #GAsyncResult that was provided to the callback.
*/
read_line_finish_utf8(result: Gio.AsyncResult): [ /* returnType */ string | null, /* length */ number | null ]
/**
* Reads a UTF-8 encoded line from the data input stream.
*
* 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.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_line_utf8(cancellable?: Gio.Cancellable | null): [ /* returnType */ string | null, /* length */ number | null ]
/**
* Reads an unsigned 16-bit/2-byte value from `stream`.
*
* In order to get the correct byte order for this read operation,
* see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_uint16(cancellable?: Gio.Cancellable | null): number
/**
* Reads an unsigned 32-bit/4-byte value from `stream`.
*
* In order to get the correct byte order for this read operation,
* see g_data_input_stream_get_byte_order() and g_data_input_stream_set_byte_order().
*
* 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.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_uint32(cancellable?: Gio.Cancellable | null): number
/**
* Reads an unsigned 64-bit/8-byte value from `stream`.
*
* In order to get the correct byte order for this read operation,
* see g_data_input_stream_get_byte_order().
*
* 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.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_uint64(cancellable?: Gio.Cancellable | null): number
/**
* Reads a string from the data input stream, up to the first
* occurrence of any of the stop characters.
*
* Note that, in contrast to g_data_input_stream_read_until_async(),
* this function consumes the stop character that it finds.
*
* Don't use this function in new code. Its functionality is
* inconsistent with g_data_input_stream_read_until_async(). Both
* functions will be marked as deprecated in a future release. Use
* g_data_input_stream_read_upto() instead, but note that that function
* does not consume the stop character.
* @param stop_chars characters to terminate the read.
* @param cancellable optional #GCancellable object, %NULL to ignore.
*/
read_until(stop_chars: string, cancellable?: Gio.Cancellable | null): [ /* returnType */ string, /* length */ number | null ]
/**
* The asynchronous version of g_data_input_stream_read_until().
* It is an error to have two outstanding calls to this function.
*
* Note that, in contrast to g_data_input_stream_read_until(),
* this function does not consume the stop character that it finds. You
* must read it for yourself.
*
* When the operation is finished, `callback` will be called. You
* can then call g_data_input_stream_read_until_finish() to get
* the result of the operation.
*
* Don't use this function in new code. Its functionality is
* inconsistent with g_data_input_stream_read_until(). Both functions
* will be marked as deprecated in a future release. Use
* g_data_input_stream_read_upto_async() instead.
* @param stop_chars characters to terminate the read.
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore.
* @param callback callback to call when the request is satisfied.
*/
read_until_async(stop_chars: string, io_priority: number, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
/**
* Finish an asynchronous call started by
* g_data_input_stream_read_until_async().
* @param result the #GAsyncResult that was provided to the callback.
*/
read_until_finish(result: Gio.AsyncResult): [ /* returnType */ string, /* length */ number | null ]
/**
* Reads a string from the data input stream, up to the first
* occurrence of any of the stop characters.
*
* In contrast to g_data_input_stream_read_until(), this function
* does not consume the stop character. You have to use
* g_data_input_stream_read_byte() to get it before calling
* g_data_input_stream_read_upto() again.
*
* Note that `stop_chars` may contain '\0' if `stop_chars_len` is
* specified.
*
* The returned string will always be nul-terminated on success.
* @param stop_chars characters to terminate the read
* @param stop_chars_len length of `stop_chars`. May be -1 if `stop_chars` is nul-terminated
* @param cancellable optional #GCancellable object, %NULL to ignore
*/
read_upto(stop_chars: string, stop_chars_len: number, cancellable?: Gio.Cancellable | null): [ /* returnType */ string, /* length */ number | null ]
/**
* The asynchronous version of g_data_input_stream_read_upto().
* It is an error to have two outstanding calls to this function.
*
* In contrast to g_data_input_stream_read_until(), this function
* does not consume the stop character. You have to use
* g_data_input_stream_read_byte() to get it before calling
* g_data_input_stream_read_upto() again.
*
* Note that `stop_chars` may contain '\0' if `stop_chars_len` is
* specified.
*
* When the operation is finished, `callback` will be called. You
* can then call g_data_input_stream_read_upto_finish() to get
* the result of the operation.
* @param stop_chars characters to terminate the read
* @param stop_chars_len length of `stop_chars`. May be -1 if `stop_chars` is nul-terminated
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object, %NULL to ignore
* @param callback callback to call when the request is satisfied
*/
read_upto_async(stop_chars: string, stop_chars_len: number, io_priority: number, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
/**
* Finish an asynchronous call started by
* g_data_input_stream_read_upto_async().
*
* Note that this function does not consume the stop character. You
* have to use g_data_input_stream_read_byte() to get it before calling
* g_data_input_stream_read_upto_async() again.
*
* The returned string will always be nul-terminated on success.
* @param result the #GAsyncResult that was provided to the callback
*/
read_upto_finish(result: Gio.AsyncResult): [ /* returnType */ string, /* length */ number | null ]
/**
* This function sets the byte order for the given `stream`. All subsequent
* reads from the `stream` will be read in the given `order`.
* @param order a #GDataStreamByteOrder to set.
*/
set_byte_order(order: Gio.DataStreamByteOrder): void
/**
* Sets the newline type for the `stream`.
*
* Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read
* chunk ends in "CR" we must read an additional byte to know if this is "CR" or
* "CR LF", and this might block if there is no more data available.
* @param type the type of new line return as #GDataStreamNewlineType.
*/
set_newline_type(type: Gio.DataStreamNewlineType): void
/* Methods of Gio-2.0.Gio.BufferedInputStream */
/**
* Tries to read `count` bytes from the stream into the 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.
*
* If `count` is -1 then the attempted read size is equal to the number of
* bytes that are required to fill 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.
*
* For the asynchronous, non-blocking, version of this function, see
* g_buffered_input_stream_fill_async().
* @param count the number of bytes that will be read from the stream
* @param cancellable optional #GCancellable object, %NULL to ignore
*/
fill(count: number, cancellable?: Gio.Cancellable | null): number
/**
* Reads data into `stream'`s buffer asynchronously, up to `count` size.
* `io_priority` can be used to prioritize reads. For the synchronous
* version of this function, see g_buffered_input_stream_fill().
*
* If `count` is -1 then the attempted read size is equal to the number
* of bytes that are required to fill the buffer.
* @param count the number of bytes that will be read from the stream
* @param io_priority the [I/O priority][io-priority] of the request
* @param cancellable optional #GCancellable object
* @param callback a #GAsyncReadyCallback
*/
fill_async(count: number, io_priority: number, cancellable?: Gio.Cancellable | null, callback?: Gio.AsyncReadyCallback | null): void
/**
* Finishes an asynchronous read.
* @param result a #GAsyncResult
*/
fill_finish(result: Gio.AsyncResult): number
/**
* Gets the size of the available data within the stream.
*/
get_available(): number
/**
* Gets the size of the input buffer.
*/
get_buffer_size(): number
/**
* Peeks in the buffer, copying data of size `count` into `buffer,`
* offset `offset` bytes.
* @param buffer a pointer to an allocated chunk of memory
* @param offset a #gsize
*/