@girs/appstreamcompose-1.0 1.0.0-4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1261 @@
1
+ /*
2
+ * Type Definitions for Gjs (https://gjs.guide/)
3
+ *
4
+ * These type definitions are automatically generated, do not edit them by hand.
5
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gir
6
+ */
7
+
8
+ import './appstreamcompose-1.0-ambient.d.ts';
9
+
10
+ /**
11
+ * AppStreamCompose-1.0
12
+ */
13
+
14
+ import type Gio from '@girs/gio-2.0';
15
+ import type GObject from '@girs/gobject-2.0';
16
+ import type GLib from '@girs/glib-2.0';
17
+ import type GdkPixbuf from '@girs/gdkpixbuf-2.0';
18
+ import type GModule from '@girs/gmodule-2.0';
19
+ import type AppStream from '@girs/appstream-1.0';
20
+
21
+ export namespace AppStreamCompose {
22
+ /**
23
+ * A drawing error.
24
+ */
25
+ class CanvasError extends GLib.Error {
26
+ static $gtype: GObject.GType<CanvasError>;
27
+
28
+ // Static fields of AppStreamCompose.CanvasError
29
+
30
+ /**
31
+ * Generic failure.
32
+ */
33
+ static FAILED: number;
34
+ /**
35
+ * Drawing operation failed.
36
+ */
37
+ static DRAWING: number;
38
+ /**
39
+ * Issue with font or font selection.
40
+ */
41
+ static FONT: number;
42
+ /**
43
+ * The requested action was not supported.
44
+ */
45
+ static UNSUPPORTED: number;
46
+
47
+ // Constructors of AppStreamCompose.CanvasError
48
+
49
+ constructor(options: { message: string; code: number });
50
+ _init(...args: any[]): void;
51
+
52
+ // Own static methods of AppStreamCompose.CanvasError
53
+
54
+ static quark(): GLib.Quark;
55
+ }
56
+
57
+ /**
58
+ * A metadata composition error.
59
+ */
60
+ class ComposeError extends GLib.Error {
61
+ static $gtype: GObject.GType<ComposeError>;
62
+
63
+ // Static fields of AppStreamCompose.ComposeError
64
+
65
+ /**
66
+ * Generic failure.
67
+ */
68
+ static FAILED: number;
69
+
70
+ // Constructors of AppStreamCompose.ComposeError
71
+
72
+ constructor(options: { message: string; code: number });
73
+ _init(...args: any[]): void;
74
+
75
+ // Own static methods of AppStreamCompose.ComposeError
76
+
77
+ static quark(): GLib.Quark;
78
+ }
79
+
80
+ /**
81
+ * Designated state for an icon of a given size.
82
+ */
83
+ enum IconState {
84
+ /**
85
+ * Ignore icons of this size.
86
+ */
87
+ IGNORED,
88
+ /**
89
+ * Create cache for the icon, and provide remote link as well.
90
+ */
91
+ CACHED_REMOTE,
92
+ /**
93
+ * Set if the icon should be stored in an icon tarball and be cached locally.
94
+ */
95
+ CACHED_ONLY,
96
+ /**
97
+ * Set if this icon should be stored remotely and fetched on demand.
98
+ */
99
+ REMOTE_ONLY,
100
+ }
101
+ /**
102
+ * An image processing error.
103
+ */
104
+ class ImageError extends GLib.Error {
105
+ static $gtype: GObject.GType<ImageError>;
106
+
107
+ // Static fields of AppStreamCompose.ImageError
108
+
109
+ /**
110
+ * Generic failure.
111
+ */
112
+ static FAILED: number;
113
+ /**
114
+ * The graphic type is not supported.
115
+ */
116
+ static UNSUPPORTED: number;
117
+
118
+ // Constructors of AppStreamCompose.ImageError
119
+
120
+ constructor(options: { message: string; code: number });
121
+ _init(...args: any[]): void;
122
+
123
+ // Own static methods of AppStreamCompose.ImageError
124
+
125
+ static quark(): GLib.Quark;
126
+ }
127
+
128
+ /**
129
+ * File format of an image.
130
+ */
131
+ enum ImageFormat {
132
+ /**
133
+ * Unknown image format.
134
+ */
135
+ UNKNOWN,
136
+ /**
137
+ * PNG format
138
+ */
139
+ PNG,
140
+ /**
141
+ * JPEG format
142
+ */
143
+ JPEG,
144
+ /**
145
+ * GIF format
146
+ */
147
+ GIF,
148
+ /**
149
+ * SVG format
150
+ */
151
+ SVG,
152
+ /**
153
+ * Compressed SVG format
154
+ */
155
+ SVGZ,
156
+ /**
157
+ * WebP format
158
+ */
159
+ WEBP,
160
+ /**
161
+ * AVIF format
162
+ */
163
+ AVIF,
164
+ /**
165
+ * XPM format
166
+ */
167
+ XPM,
168
+ }
169
+ /**
170
+ * Builds a global component ID from a component-id
171
+ * and a (usually MD5) checksum generated from the component data.
172
+ *
173
+ * The global-id is used as a global, unique identifier for a component.
174
+ * (while the component-ID is local, e.g. for one source).
175
+ * Its primary usecase is to identify a media directory on the filesystem which is
176
+ * associated with this component.
177
+ * @param component_id an AppStream component ID.
178
+ * @param checksum a MD5 hashsum as string generated from the component's combined metadata.
179
+ */
180
+ function build_component_global_id(component_id: string, checksum: string): string;
181
+ function canvas_error_quark(): GLib.Quark;
182
+ function compose_error_quark(): GLib.Quark;
183
+ /**
184
+ * Generate a filename from a web-URL that can be used to store the
185
+ * file on disk after download.
186
+ * @param url The URL to extract a filename from.
187
+ */
188
+ function filename_from_url(url: string): string;
189
+ /**
190
+ * Register a new hint tag. If a previous tag with the given name
191
+ * already existed, the existing tag will not be replaced unless
192
+ * `overrideExisting` is set to %TRUE.
193
+ * Please be careful when overriding tags! Tag severities can not
194
+ * be lowered by overriding a tag.
195
+ * @param tag the tag-ID to add
196
+ * @param severity the tag severity as #AsIssueSeverity
197
+ * @param explanation the tag explanatory message
198
+ * @param overrideExisting whether an existing tag should be replaced
199
+ * @returns %TRUE if the tag was registered and did not exist previously.
200
+ */
201
+ function globals_add_hint_tag(
202
+ tag: string,
203
+ severity: AppStream.IssueSeverity,
204
+ explanation: string,
205
+ overrideExisting: boolean,
206
+ ): boolean;
207
+ /**
208
+ * Clear all global state and restore defaults.
209
+ */
210
+ function globals_clear(): void;
211
+ /**
212
+ * Get path to the "ffprobe" binary we should use.
213
+ */
214
+ function globals_get_ffprobe_binary(): string;
215
+ /**
216
+ * Retrieve all hint tags that we know.
217
+ * @returns A list of valid hint tags. Free with %g_strfreev
218
+ */
219
+ function globals_get_hint_tags(): string[];
220
+ /**
221
+ * Get path to the "optipng" binary we should use.
222
+ */
223
+ function globals_get_optipng_binary(): string;
224
+ /**
225
+ * Get temporary directory used by appstream-compose.
226
+ */
227
+ function globals_get_tmp_dir(): string;
228
+ /**
229
+ * Get temporary directory used by appstream-compose
230
+ * and try to create it if it does not exist.
231
+ */
232
+ function globals_get_tmp_dir_create(): string;
233
+ /**
234
+ * Get whether images should be optimized using optipng.
235
+ */
236
+ function globals_get_use_optipng(): boolean;
237
+ /**
238
+ * Retrieve the explanation template of the given hint tag.
239
+ * @param tag
240
+ * @returns An explanation template, or %NULL if the tag was not found.
241
+ */
242
+ function globals_hint_tag_explanation(tag: string): string;
243
+ /**
244
+ * Retrieve the severity of the given hint tag.
245
+ * @param tag
246
+ * @returns An #AsIssueSeverity or %AS_ISSUE_SEVERITY_UNKNOWN if the tag did not exist or has an unknown severity.
247
+ */
248
+ function globals_hint_tag_severity(tag: string): AppStream.IssueSeverity;
249
+ /**
250
+ * Set path to the "ffprobe" binary we should use.
251
+ * @param path
252
+ */
253
+ function globals_set_ffprobe_binary(path: string): void;
254
+ /**
255
+ * Set path to the "optipng" binary we should use.
256
+ * @param path
257
+ */
258
+ function globals_set_optipng_binary(path: string): void;
259
+ /**
260
+ * Set temporary directory used by appstream-compose.
261
+ * @param path
262
+ */
263
+ function globals_set_tmp_dir(path: string): void;
264
+ /**
265
+ * Set whether images should be optimized using optipng.
266
+ * @param enabled
267
+ */
268
+ function globals_set_use_optipng(enabled: boolean): void;
269
+ /**
270
+ * Converts the text representation to an enumerated value.
271
+ * @param state_str the string.
272
+ * @returns a #AscIconState
273
+ */
274
+ function icon_state_from_string(state_str: string): IconState;
275
+ /**
276
+ * Converts the enumerated value to an text representation.
277
+ * @param istate the #AscIconState.
278
+ * @returns string version of @istate
279
+ */
280
+ function icon_state_to_string(istate: IconState): string;
281
+ function image_error_quark(): GLib.Quark;
282
+ /**
283
+ * Returns the image format type based on the given file's filename.
284
+ * @param fname the filename.
285
+ * @returns a #AscImageFormat or %ASC_IMAGE_FORMAT_UNKNOWN for unknown
286
+ */
287
+ function image_format_from_filename(fname: string): ImageFormat;
288
+ /**
289
+ * Converts the text representation to an enumerated value.
290
+ * @param str the string.
291
+ * @returns a #AscImageFormat or %ASC_IMAGE_FORMAT_UNKNOWN for unknown
292
+ */
293
+ function image_format_from_string(str: string): ImageFormat;
294
+ /**
295
+ * Converts the enumerated value to an text representation.
296
+ * @param format the %AscImageFormat.
297
+ * @returns string version of @format
298
+ */
299
+ function image_format_to_string(format: ImageFormat): string;
300
+ /**
301
+ * Optimizes a PNG graphic for size with optipng, if its binary
302
+ * is available and this feature is enabled.
303
+ * @param fname Filename of the PNG image to optimize.
304
+ */
305
+ function optimize_png(fname: string): boolean;
306
+ function pixbuf_blur(src: GdkPixbuf.Pixbuf, radius: number, iterations: number): void;
307
+ function pixbuf_sharpen(src: GdkPixbuf.Pixbuf, radius: number, amount: number): void;
308
+ interface CheckMetadataEarlyFn {
309
+ (cres: Result, unit: Unit): void;
310
+ }
311
+ enum ComposeFlags {
312
+ NONE,
313
+ USE_THREADS,
314
+ ALLOW_NET,
315
+ VALIDATE,
316
+ STORE_SCREENSHOTS,
317
+ ALLOW_SCREENCASTS,
318
+ PROCESS_FONTS,
319
+ PROCESS_TRANSLATIONS,
320
+ IGNORE_ICONS,
321
+ PROCESS_UNPAIRED_DESKTOP,
322
+ PROPAGATE_CUSTOM,
323
+ PROPAGATE_ARTIFACTS,
324
+ NO_FINAL_CHECK,
325
+ NO_PARTIAL_URLS,
326
+ }
327
+ /**
328
+ * The flags used for loading images.
329
+ */
330
+ enum ImageLoadFlags {
331
+ /**
332
+ * No special flags set
333
+ */
334
+ NONE,
335
+ /**
336
+ * Sharpen the resulting image
337
+ */
338
+ SHARPEN,
339
+ /**
340
+ * Allow loading of unsupported image types.
341
+ */
342
+ ALLOW_UNSUPPORTED,
343
+ /**
344
+ * Always resize the source image to the perfect size
345
+ */
346
+ ALWAYS_RESIZE,
347
+ }
348
+ /**
349
+ * The flags used for saving images.
350
+ */
351
+ enum ImageSaveFlags {
352
+ /**
353
+ * No special flags set
354
+ */
355
+ NONE,
356
+ /**
357
+ * Optimize generated PNG for size
358
+ */
359
+ OPTIMIZE,
360
+ /**
361
+ * Pad with alpha to 16:9 aspect
362
+ */
363
+ PAD_16_9,
364
+ /**
365
+ * Sharpen the image to clarify detail
366
+ */
367
+ SHARPEN,
368
+ /**
369
+ * Blur the image to clear detail
370
+ */
371
+ BLUR,
372
+ }
373
+ module Canvas {
374
+ // Constructor properties interface
375
+
376
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
377
+ }
378
+
379
+ class Canvas extends GObject.Object {
380
+ static $gtype: GObject.GType<Canvas>;
381
+
382
+ // Constructors of AppStreamCompose.Canvas
383
+
384
+ constructor(properties?: Partial<Canvas.ConstructorProps>, ...args: any[]);
385
+
386
+ _init(...args: any[]): void;
387
+
388
+ static ['new'](width: number, height: number): Canvas;
389
+
390
+ // Own methods of AppStreamCompose.Canvas
391
+
392
+ /**
393
+ * Gets the canvas height.
394
+ */
395
+ get_height(): number;
396
+ /**
397
+ * Gets the canvas width.
398
+ */
399
+ get_width(): number;
400
+ /**
401
+ * Render an SVG graphic from the SVG data provided.
402
+ * @param stream SVG data input stream.
403
+ */
404
+ render_svg(stream: Gio.InputStream): boolean;
405
+ /**
406
+ * Save canvas to PNG file.
407
+ * @param fname Filename to save to.
408
+ */
409
+ save_png(fname: string): boolean;
410
+ }
411
+
412
+ module Compose {
413
+ // Constructor properties interface
414
+
415
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
416
+ }
417
+
418
+ class Compose extends GObject.Object {
419
+ static $gtype: GObject.GType<Compose>;
420
+
421
+ // Constructors of AppStreamCompose.Compose
422
+
423
+ constructor(properties?: Partial<Compose.ConstructorProps>, ...args: any[]);
424
+
425
+ _init(...args: any[]): void;
426
+
427
+ static ['new'](): Compose;
428
+
429
+ // Own methods of AppStreamCompose.Compose
430
+
431
+ /**
432
+ * Adds a component ID to the allowlist. If the list is not empty, only
433
+ * components in the list will be added to the metadata output.
434
+ * @param component_id The component-id to whitelist
435
+ */
436
+ add_allowed_cid(component_id: string): void;
437
+ /**
438
+ * Add a key to the allowlist that is used to filter custom tag values.
439
+ * @param key_id the custom key to add to the allowed list.
440
+ */
441
+ add_custom_allowed(key_id: string): void;
442
+ /**
443
+ * Add compose flags.
444
+ * @param flags The compose flags to add.
445
+ */
446
+ add_flags(flags: ComposeFlags): void;
447
+ /**
448
+ * Add an #AscUnit as data source for metadata processing.
449
+ * @param unit The #AscUnit to add
450
+ */
451
+ add_unit(unit: Unit): void;
452
+ /**
453
+ * Get the results components extracted in the last data processing run.
454
+ * @returns The components
455
+ */
456
+ fetch_components(): AppStream.Component[];
457
+ /**
458
+ * Perform final validation of generated data for the specified
459
+ * result container.
460
+ * @param result the #AscResult to finalize
461
+ */
462
+ finalize_result(result: Result): void;
463
+ /**
464
+ * Perform final validation of generated data.
465
+ * Calling this function is not necessary, unless the final check was explicitly
466
+ * disabled using the %ASC_COMPOSE_FLAG_NO_FINAL_CHECK flag.
467
+ */
468
+ finalize_results(): void;
469
+ /**
470
+ * Get the CA file used to verify peers with, or %NULL for default.
471
+ */
472
+ get_cainfo(): string;
473
+ /**
474
+ * Get the data result directory.
475
+ */
476
+ get_data_result_dir(): string;
477
+ /**
478
+ * Get the flags controlling compose behavior.
479
+ */
480
+ get_flags(): ComposeFlags;
481
+ /**
482
+ * get the format type we are generating.
483
+ */
484
+ get_format(): AppStream.FormatKind;
485
+ /**
486
+ * Get hints report output directory.
487
+ */
488
+ get_hints_result_dir(): string;
489
+ /**
490
+ * Get the policy for how icons should be distributed to
491
+ * any AppStream clients.
492
+ * @returns an #AscIconPolicy
493
+ */
494
+ get_icon_policy(): IconPolicy;
495
+ /**
496
+ * Get the icon result directory.
497
+ */
498
+ get_icons_result_dir(): string;
499
+ /**
500
+ * Get the unit we use for locale processing
501
+ * @returns The unit used for locale processing, or %NULL for default.
502
+ */
503
+ get_locale_unit(): Unit | null;
504
+ /**
505
+ * Get the maximum size a screenshot video or image can have.
506
+ * A size < 0 may be returned for no limit, setting a limit of 0
507
+ * will disable screenshots.
508
+ */
509
+ get_max_screenshot_size(): number;
510
+ /**
511
+ * Get the media base URL to be used for the generated data,
512
+ * or %NULL if no media is cached.
513
+ */
514
+ get_media_baseurl(): string;
515
+ /**
516
+ * Get the media result directory, that can be served on a webserver.
517
+ */
518
+ get_media_result_dir(): string;
519
+ /**
520
+ * Get the metadata origin field.
521
+ */
522
+ get_origin(): string;
523
+ /**
524
+ * Get the directory prefix used for processing.
525
+ */
526
+ get_prefix(): string;
527
+ /**
528
+ * Get the results of the last processing run.
529
+ * @returns The results
530
+ */
531
+ get_results(): Result[];
532
+ /**
533
+ * Check if the last run generated any errors (which will cause metadata to be ignored).
534
+ * @returns %TRUE if we had errors.
535
+ */
536
+ has_errors(): boolean;
537
+ /**
538
+ * Remove a key from the allowlist used to filter the `<custom/>` tag entries.
539
+ * @param key_id the custom key to drop from the allowed list.
540
+ */
541
+ remove_custom_allowed(key_id: string): void;
542
+ /**
543
+ * Remove compose flags.
544
+ * @param flags The compose flags to remove.
545
+ */
546
+ remove_flags(flags: ComposeFlags): void;
547
+ /**
548
+ * Reset the results, units and run-specific settings so the
549
+ * instance can be reused for another metadata generation run.
550
+ */
551
+ reset(): void;
552
+ /**
553
+ * Process the registered units and generate catalog metadata from
554
+ * found components.
555
+ * @param cancellable a #GCancellable.
556
+ * @returns The results, or %NULL on error
557
+ */
558
+ run(cancellable?: Gio.Cancellable | null): Result[];
559
+ /**
560
+ * Set a CA file holding one or more certificates to verify peers with
561
+ * for download operations performed by this #AscCompose.
562
+ * @param cainfo a valid file path
563
+ */
564
+ set_cainfo(cainfo: string): void;
565
+ /**
566
+ * Set an custom callback to be run when most of the metadata has been loaded,
567
+ * but no expensive operations (like downloads or icon rendering) have been done yet.
568
+ * This can be used to ignore unwanted components early on.
569
+ *
570
+ * The callback function may be called from any thread, so it needs to ensure thread safety on its own.
571
+ * @param func the #AscCheckMetainfoLoadResultFn function to be called
572
+ */
573
+ set_check_metadata_early_func(func: CheckMetadataEarlyFn): void;
574
+ /**
575
+ * Set an output location where generated metadata should be saved.
576
+ * If this is set to %NULL, no metadata will be saved.
577
+ * @param dir the metadata save location.
578
+ */
579
+ set_data_result_dir(dir: string): void;
580
+ /**
581
+ * Set compose flags bitfield that controls the enabled features
582
+ * for this #AscCompose.
583
+ * @param flags The compose flags bitfield.
584
+ */
585
+ set_flags(flags: ComposeFlags): void;
586
+ /**
587
+ * Set the format kind of the catalog metadata that we should generate.
588
+ * @param kind The format, e.g. %AS_FORMAT_KIND_XML
589
+ */
590
+ set_format(kind: AppStream.FormatKind): void;
591
+ /**
592
+ * Set an output location for HTML reports of issues generated
593
+ * during a compose run.
594
+ * @param dir the hints data directory.
595
+ */
596
+ set_hints_result_dir(dir: string): void;
597
+ /**
598
+ * Set an icon policy object, overriding the existing one.
599
+ * @param policy an #AscIconPolicy instance
600
+ */
601
+ set_icon_policy(policy: IconPolicy): void;
602
+ /**
603
+ * Set an output location where plain icons for the processed metadata
604
+ * are stored.
605
+ * @param dir the icon storage location.
606
+ */
607
+ set_icons_result_dir(dir: string): void;
608
+ /**
609
+ * Set a specific unit that is used for fetching locale information.
610
+ * This may be useful in case a special language pack layout is used,
611
+ * but is generally not necessary to be set explicitly, as locale
612
+ * will be found in the unit where the metadata is by default.
613
+ * @param locale_unit the unit used for locale processing.
614
+ */
615
+ set_locale_unit(locale_unit: Unit): void;
616
+ /**
617
+ * Set the maximum size a screenshot video or image can have.
618
+ * A size < 0 may be set to allow unlimited sizes, setting a limit of 0
619
+ * will disable screenshot caching entirely.
620
+ * @param size_bytes maximum size of a screenshot image or video in bytes
621
+ */
622
+ set_max_screenshot_size(size_bytes: number): void;
623
+ /**
624
+ * Set the media base URL for the generated metadata. Can be %NULL if no media
625
+ * should be cached and the original URLs should be kept.
626
+ * @param url the media base URL.
627
+ */
628
+ set_media_baseurl(url?: string | null): void;
629
+ /**
630
+ * Set an output location to store media (screenshots, icons, ...) that
631
+ * will be served on a webserver via the URL set as media baseurl.
632
+ * @param dir the media storage location.
633
+ */
634
+ set_media_result_dir(dir: string): void;
635
+ /**
636
+ * Set the metadata origin field (e.g. "debian" or "flathub")
637
+ * @param origin the origin.
638
+ */
639
+ set_origin(origin: string): void;
640
+ /**
641
+ * Set the directory prefix the to-be-processed units are using.
642
+ * @param prefix a directory prefix, e.g. "/usr"
643
+ */
644
+ set_prefix(prefix: string): void;
645
+ }
646
+
647
+ module DirectoryUnit {
648
+ // Constructor properties interface
649
+
650
+ interface ConstructorProps extends Unit.ConstructorProps {}
651
+ }
652
+
653
+ class DirectoryUnit extends Unit {
654
+ static $gtype: GObject.GType<DirectoryUnit>;
655
+
656
+ // Constructors of AppStreamCompose.DirectoryUnit
657
+
658
+ constructor(properties?: Partial<DirectoryUnit.ConstructorProps>, ...args: any[]);
659
+
660
+ _init(...args: any[]): void;
661
+
662
+ static ['new'](root_dir: string): DirectoryUnit;
663
+ // Conflicted with AppStreamCompose.Unit.new
664
+
665
+ static ['new'](...args: never[]): any;
666
+
667
+ // Own methods of AppStreamCompose.DirectoryUnit
668
+
669
+ /**
670
+ * Get the root directory path for this unit.
671
+ */
672
+ get_root(): string;
673
+ /**
674
+ * Sets the root directory path for this unit.
675
+ * @param root_dir Absolute directory path
676
+ */
677
+ set_root(root_dir: string): void;
678
+ }
679
+
680
+ module Hint {
681
+ // Constructor properties interface
682
+
683
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
684
+ }
685
+
686
+ class Hint extends GObject.Object {
687
+ static $gtype: GObject.GType<Hint>;
688
+
689
+ // Constructors of AppStreamCompose.Hint
690
+
691
+ constructor(properties?: Partial<Hint.ConstructorProps>, ...args: any[]);
692
+
693
+ _init(...args: any[]): void;
694
+
695
+ static ['new'](): Hint;
696
+
697
+ static new_for_tag(tag: string): Hint;
698
+
699
+ // Own methods of AppStreamCompose.Hint
700
+
701
+ /**
702
+ * Add a replacement variable for the explanation text.
703
+ * @param var_name Name of the variable to be replaced.
704
+ * @param text Replacement for the variable name.
705
+ */
706
+ add_explanation_var(var_name: string, text: string): void;
707
+ /**
708
+ * Formats the explanation template to return a human-redable issue hint
709
+ * explanation, with all placeholder variables replaced.
710
+ * @returns Explanation text for this hint, with variables replaced.
711
+ */
712
+ format_explanation(): string;
713
+ /**
714
+ * Gets the explanation template for this hint.
715
+ */
716
+ get_explanation_template(): string;
717
+ /**
718
+ * Returns a list with the flattened key/value pairs for this hint.
719
+ * Values are located in uneven list entries, following their keys in even list entries.
720
+ * @returns A flattened #GPtrArray with the key/value pairs.
721
+ */
722
+ get_explanation_vars_list(): string[];
723
+ /**
724
+ * Gets the issue severity of this hint.
725
+ */
726
+ get_severity(): AppStream.IssueSeverity;
727
+ /**
728
+ * Gets the unique tag for the type of this hint.
729
+ */
730
+ get_tag(): string;
731
+ is_error(): boolean;
732
+ /**
733
+ * Check if this hint is valid (it requires at least a tag and a severity
734
+ * in order to be considered valid).
735
+ * @returns %TRUE if this hint is valid.
736
+ */
737
+ is_valid(): boolean;
738
+ /**
739
+ * Sets the explanation template for this hint.
740
+ * @param explanation_tmpl
741
+ */
742
+ set_explanation_template(explanation_tmpl: string): void;
743
+ /**
744
+ * Sets the issue severity of this hint.
745
+ * @param severity
746
+ */
747
+ set_severity(severity: AppStream.IssueSeverity): void;
748
+ /**
749
+ * Sets the unique tag for the type of this hint.
750
+ * @param tag
751
+ */
752
+ set_tag(tag: string): void;
753
+ }
754
+
755
+ module IconPolicy {
756
+ // Constructor properties interface
757
+
758
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
759
+ }
760
+
761
+ class IconPolicy extends GObject.Object {
762
+ static $gtype: GObject.GType<IconPolicy>;
763
+
764
+ // Constructors of AppStreamCompose.IconPolicy
765
+
766
+ constructor(properties?: Partial<IconPolicy.ConstructorProps>, ...args: any[]);
767
+
768
+ _init(...args: any[]): void;
769
+
770
+ static ['new'](): IconPolicy;
771
+
772
+ // Own methods of AppStreamCompose.IconPolicy
773
+
774
+ /**
775
+ * Loads the icon policy from a textual representation.
776
+ * @param serialized_policy A policy string as returned by %asc_icon_policy_to_string
777
+ */
778
+ from_string(serialized_policy: string): boolean;
779
+ /**
780
+ * Sets a designated state for an icon of the given size.
781
+ * @param icon_size the size of the icon to set policy for (e.g. 64 for 64x64px icons)
782
+ * @param icon_scale the icon scale factor, e.g. 1
783
+ * @param state the designated #AscIconState
784
+ */
785
+ set_policy(icon_size: number, icon_scale: number, state: IconState): void;
786
+ /**
787
+ * Converts the current icon policy into a textual representation.
788
+ * @returns The icon policy serialized into a string. Free with g_free()
789
+ */
790
+ to_string(): string;
791
+ }
792
+
793
+ module Image {
794
+ // Constructor properties interface
795
+
796
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
797
+ }
798
+
799
+ class Image extends GObject.Object {
800
+ static $gtype: GObject.GType<Image>;
801
+
802
+ // Constructors of AppStreamCompose.Image
803
+
804
+ constructor(properties?: Partial<Image.ConstructorProps>, ...args: any[]);
805
+
806
+ _init(...args: any[]): void;
807
+
808
+ static ['new'](): Image;
809
+
810
+ static new_from_data(
811
+ data: any | null,
812
+ len: number,
813
+ dest_size: number,
814
+ compressed: boolean,
815
+ flags: ImageLoadFlags,
816
+ ): Image;
817
+
818
+ static new_from_file(fname: string, dest_size: number, flags: ImageLoadFlags): Image;
819
+
820
+ // Own static methods of AppStreamCompose.Image
821
+
822
+ /**
823
+ * Get a set of image format names we can currently read
824
+ * (via GdkPixbuf).
825
+ */
826
+ static supported_format_names(): GLib.HashTable<any, any>;
827
+
828
+ // Own methods of AppStreamCompose.Image
829
+
830
+ /**
831
+ * Gets the image height.
832
+ */
833
+ get_height(): number;
834
+ /**
835
+ * Gets the image pixbuf if set.
836
+ * @returns the #GdkPixbuf, or %NULL
837
+ */
838
+ get_pixbuf(): GdkPixbuf.Pixbuf;
839
+ /**
840
+ * Gets the image width.
841
+ */
842
+ get_width(): number;
843
+ /**
844
+ * Reads an image from a file.
845
+ * @param filename filename to read from
846
+ * @param dest_size The size of the constructed pixbuf, or 0 for the native size
847
+ * @param src_size_min The smallest source size allowed, or 0 for none
848
+ * @param flags a #AscImageLoadFlags, e.g. %ASC_IMAGE_LOAD_FLAG_NONE
849
+ * @returns %TRUE for success
850
+ */
851
+ load_filename(filename: string, dest_size: number, src_size_min: number, flags: ImageLoadFlags): boolean;
852
+ /**
853
+ * Saves the image to a file.
854
+ * @param filename filename to write to
855
+ * @param width target width, or 0 for default
856
+ * @param height target height, or 0 for default
857
+ * @param flags some #AscImageSaveFlags values, e.g. %ASC_IMAGE_SAVE_FLAG_PAD_16_9
858
+ * @returns %TRUE for success
859
+ */
860
+ save_filename(filename: string, width: number, height: number, flags: ImageSaveFlags): boolean;
861
+ /**
862
+ * Resamples a pixbuf to a specific size.
863
+ * @param width target width, or 0 for default
864
+ * @param height target height, or 0 for default
865
+ * @param flags some #AscImageSaveFlags values, e.g. %ASC_IMAGE_SAVE_FLAG_PAD_16_9
866
+ * @returns A #GdkPixbuf of the specified size
867
+ */
868
+ save_pixbuf(width: number, height: number, flags: ImageSaveFlags): GdkPixbuf.Pixbuf;
869
+ /**
870
+ * Scale the image to the given size.
871
+ * @param new_width The new width.
872
+ * @param new_height the new height.
873
+ */
874
+ scale(new_width: number, new_height: number): void;
875
+ /**
876
+ * Scale the image to fir in a square with the given edge length,
877
+ * and keep its aspect ratio.
878
+ * @param size the maximum edge length.
879
+ */
880
+ scale_to_fit(size: number): void;
881
+ /**
882
+ * Scale the image to the given height, preserving
883
+ * its aspect ratio.
884
+ * @param new_height the new height.
885
+ */
886
+ scale_to_height(new_height: number): void;
887
+ /**
888
+ * Scale the image to the given width, preserving
889
+ * its aspect ratio.
890
+ * @param new_width The new width.
891
+ */
892
+ scale_to_width(new_width: number): void;
893
+ /**
894
+ * Sets the image pixbuf.
895
+ * @param pixbuf the #GdkPixbuf, or %NULL
896
+ */
897
+ set_pixbuf(pixbuf: GdkPixbuf.Pixbuf): void;
898
+ }
899
+
900
+ module Result {
901
+ // Constructor properties interface
902
+
903
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
904
+ }
905
+
906
+ class Result extends GObject.Object {
907
+ static $gtype: GObject.GType<Result>;
908
+
909
+ // Constructors of AppStreamCompose.Result
910
+
911
+ constructor(properties?: Partial<Result.ConstructorProps>, ...args: any[]);
912
+
913
+ _init(...args: any[]): void;
914
+
915
+ static ['new'](): Result;
916
+
917
+ // Own methods of AppStreamCompose.Result
918
+
919
+ /**
920
+ * Add component to the results set.
921
+ * @param cpt The #AsComponent to add.
922
+ * @param bytes Source data used to generate the GCID hash, or %NULL if nonexistent.
923
+ * @returns %TRUE on success.
924
+ */
925
+ add_component(cpt: AppStream.Component, bytes: GLib.Bytes | Uint8Array): boolean;
926
+ /**
927
+ * Add component to the results set, using string data.
928
+ * @param cpt The #AsComponent to add.
929
+ * @param data Source data used to generate the GCID hash, or %NULL if nonexistent.
930
+ * @returns %TRUE on success.
931
+ */
932
+ add_component_with_string(cpt: AppStream.Component, data: string): boolean;
933
+ /**
934
+ * Add an issue hint for a component.
935
+ * @param component_id The component-ID of the affected #AsComponent
936
+ * @param tag AppStream Compose Issue hint tag
937
+ * @param kv List of key-value pairs for replacement variables.
938
+ * @returns %TRUE if the added hint did not cause the component to be invalidated.
939
+ */
940
+ add_hint_by_cid(component_id: string, tag: string, kv: string): boolean;
941
+ /**
942
+ * Add an issue hint for a component.
943
+ * @param cpt The affected #AsComponent
944
+ * @param tag AppStream Compose Issue hint tag
945
+ * @param kv List of key-value pairs for replacement variables.
946
+ * @returns %TRUE if the added hint did not cause the component to be invalidated.
947
+ */
948
+ add_hint(cpt: AppStream.Component, tag: string, kv: string): boolean;
949
+ components_count(): number;
950
+ /**
951
+ * Gets all components this #AsResult instance contains.
952
+ * @returns An array of #AsComponent
953
+ */
954
+ fetch_components(): AppStream.Component[];
955
+ /**
956
+ * Get a list of all hints for all components that are registered with this result.
957
+ * @returns An array of #AscHint
958
+ */
959
+ fetch_hints_all(): Hint[];
960
+ /**
961
+ * Retrieve the global component-ID string for the given component-ID,
962
+ * as long as component with the given ID is registered with this #AscResult.
963
+ * Otherwise, %NULL is returned.
964
+ * @param cid Component ID to look for.
965
+ */
966
+ gcid_for_cid(cid: string): string;
967
+ gcid_for_component(cpt: AppStream.Component): string;
968
+ /**
969
+ * Gets the ID name of the bundle (a package / Flatpak / any entity containing metadata)
970
+ * that these these results are generated for.
971
+ */
972
+ get_bundle_id(): string;
973
+ /**
974
+ * Gets the bundle kind these results are for.
975
+ */
976
+ get_bundle_kind(): AppStream.BundleKind;
977
+ /**
978
+ * Gets the component by its component-id-
979
+ * @param cid Component ID to look for.
980
+ * @returns An #AsComponent
981
+ */
982
+ get_component(cid: string): AppStream.Component;
983
+ /**
984
+ * Retrieve a list of all global component-IDs that this result knows of.
985
+ * @returns An array of global component IDs. Free with %g_free
986
+ */
987
+ get_component_gcids(): string[];
988
+ /**
989
+ * Gets list of component-IDs which do have issue hints associated with them.
990
+ * @returns An array of component-IDs. Free container with %g_free
991
+ */
992
+ get_component_ids_with_hints(): string[];
993
+ /**
994
+ * Gets hints for a component with the given component-id.
995
+ * @param cid Component ID to look for.
996
+ * @returns An array of #AscHint or %NULL
997
+ */
998
+ get_hints(cid: string): Hint[];
999
+ /**
1000
+ * Test if a hint tag is associated with a given component in this result.
1001
+ * @param cpt the #AsComponent to check
1002
+ * @param tag the hint tag to check for
1003
+ * @returns %TRUE if a hint with this tag exists for the selected component.
1004
+ */
1005
+ has_hint(cpt: AppStream.Component, tag: string): boolean;
1006
+ hints_count(): number;
1007
+ /**
1008
+ * Check if an #AsComponent was set to be ignored in this result
1009
+ * (usually due to errors).
1010
+ * @param cpt the component to check for.
1011
+ * @returns %TRUE if the component is ignored.
1012
+ */
1013
+ is_ignored(cpt: AppStream.Component): boolean;
1014
+ /**
1015
+ * Remove a component from the results set.
1016
+ * @param cpt The #AsComponent to remove.
1017
+ * @returns %TRUE if the component was found and removed.
1018
+ */
1019
+ remove_component(cpt: AppStream.Component): boolean;
1020
+ /**
1021
+ * Remove a component from the results set.
1022
+ * @param cid a component-ID
1023
+ * @returns %TRUE if the component was found and removed.
1024
+ */
1025
+ remove_component_by_id(cid: string): boolean;
1026
+ /**
1027
+ * Remove a component from the results set.
1028
+ * @param cpt The #AsComponent to remove.
1029
+ * @param remove_gcid %TRUE if global component ID should be unregistered as well.
1030
+ * @returns %TRUE if the component was found and removed.
1031
+ */
1032
+ remove_component_full(cpt: AppStream.Component, remove_gcid: boolean): boolean;
1033
+ /**
1034
+ * Remove all hints that we have associated with the selected component-ID.
1035
+ * @param cid The component ID
1036
+ */
1037
+ remove_hints_for_cid(cid: string): void;
1038
+ /**
1039
+ * Sets the name of the bundle these results are for.
1040
+ * @param id The new ID.
1041
+ */
1042
+ set_bundle_id(id: string): void;
1043
+ /**
1044
+ * Sets the kind of the bundle these results are for.
1045
+ * @param kind
1046
+ */
1047
+ set_bundle_kind(kind: AppStream.BundleKind): void;
1048
+ unit_ignored(): boolean;
1049
+ /**
1050
+ * Update the global component ID for the given component.
1051
+ * @param cpt The #AsComponent to edit.
1052
+ * @param bytes The data to include in the global component ID, or %NULL
1053
+ * @returns %TRUE if the component existed and was updated.
1054
+ */
1055
+ update_component_gcid(cpt: AppStream.Component, bytes?: GLib.Bytes | null): boolean;
1056
+ /**
1057
+ * Update the global component ID for the given component.
1058
+ * This is a convenience method for %asc_result_update_component_gcid
1059
+ * @param cpt The #AsComponent to edit.
1060
+ * @param data The data as string to include in the global component ID, or %NULL
1061
+ * @returns %TRUE if the component existed and was updated.
1062
+ */
1063
+ update_component_gcid_with_string(cpt: AppStream.Component, data?: string | null): boolean;
1064
+ }
1065
+
1066
+ module Unit {
1067
+ // Constructor properties interface
1068
+
1069
+ interface ConstructorProps extends GObject.Object.ConstructorProps {}
1070
+ }
1071
+
1072
+ class Unit extends GObject.Object {
1073
+ static $gtype: GObject.GType<Unit>;
1074
+
1075
+ // Constructors of AppStreamCompose.Unit
1076
+
1077
+ constructor(properties?: Partial<Unit.ConstructorProps>, ...args: any[]);
1078
+
1079
+ _init(...args: any[]): void;
1080
+
1081
+ static ['new'](): Unit;
1082
+
1083
+ // Own virtual methods of AppStreamCompose.Unit
1084
+
1085
+ /**
1086
+ * Close this unit, possibly freeing its resources. Calls to read_data() or
1087
+ * get_contents() may not produce results until open() is called again.
1088
+ */
1089
+ vfunc_close(): void;
1090
+ /**
1091
+ * Returns %TRUE if the directory exists and files in it are readable.
1092
+ * @param dirname The directory name to check.
1093
+ */
1094
+ vfunc_dir_exists(dirname: string): boolean;
1095
+ /**
1096
+ * Returns %TRUE if the filename exists and is readable using %asc_unit_read_data.
1097
+ * @param filename The filename to check.
1098
+ */
1099
+ vfunc_file_exists(filename: string): boolean;
1100
+ /**
1101
+ * Open this unit, populating its content listing.
1102
+ */
1103
+ vfunc_open(): boolean;
1104
+ /**
1105
+ * Read the contents of the selected file into memory and return them.
1106
+ * @param filename The file to read data for.
1107
+ */
1108
+ vfunc_read_data(filename: string): GLib.Bytes;
1109
+
1110
+ // Own methods of AppStreamCompose.Unit
1111
+
1112
+ /**
1113
+ * Add a path to the list of relevant directories.
1114
+ * A unit may only read data in paths that were previously
1115
+ * registered as relevant.
1116
+ * @param path path to be considered relevant
1117
+ */
1118
+ add_relevant_path(path: string): void;
1119
+ /**
1120
+ * Close this unit, possibly freeing its resources. Calls to read_data() or
1121
+ * get_contents() may not produce results until open() is called again.
1122
+ */
1123
+ close(): void;
1124
+ /**
1125
+ * Returns %TRUE if the directory exists and files in it are readable.
1126
+ * @param dirname The directory name to check.
1127
+ */
1128
+ dir_exists(dirname: string): boolean;
1129
+ /**
1130
+ * Returns %TRUE if the filename exists and is readable using %asc_unit_read_data.
1131
+ * @param filename The filename to check.
1132
+ */
1133
+ file_exists(filename: string): boolean;
1134
+ /**
1135
+ * Gets the ID name of the bundle (a package / Flatpak / any entity containing metadata)
1136
+ * that this unit represents.
1137
+ */
1138
+ get_bundle_id(): string;
1139
+ /**
1140
+ * Gets the ID name of the bundle, normalized to be safe to use
1141
+ * in filenames. This may *not* be the same name as set via asc_unit_get_bundle_id()
1142
+ */
1143
+ get_bundle_id_safe(): string;
1144
+ /**
1145
+ * Gets the bundle kind of this unit.
1146
+ */
1147
+ get_bundle_kind(): AppStream.BundleKind;
1148
+ /**
1149
+ * Get a list of all files contained by this unit.
1150
+ * @returns A file listing
1151
+ */
1152
+ get_contents(): string[];
1153
+ /**
1154
+ * Get a list of paths that are relevant for data processing.
1155
+ * @returns A list of paths
1156
+ */
1157
+ get_relevant_paths(): string[];
1158
+ /**
1159
+ * Get user-defined data. This is a helper
1160
+ * function for bindings.
1161
+ */
1162
+ get_user_data(): any | null;
1163
+ /**
1164
+ * Open this unit, populating its content listing.
1165
+ */
1166
+ open(): boolean;
1167
+ /**
1168
+ * Read the contents of the selected file into memory and return them.
1169
+ * @param filename The file to read data for.
1170
+ */
1171
+ read_data(filename: string): GLib.Bytes;
1172
+ /**
1173
+ * Sets the ID of the bundle represented by this unit.
1174
+ * @param id The new ID.
1175
+ */
1176
+ set_bundle_id(id: string): void;
1177
+ /**
1178
+ * Sets the kind of the bundle this unit represents.
1179
+ * @param kind
1180
+ */
1181
+ set_bundle_kind(kind: AppStream.BundleKind): void;
1182
+ /**
1183
+ * Set list of files this unit contains.
1184
+ * @param contents A list of files contained by this unit.
1185
+ */
1186
+ set_contents(contents: string[]): void;
1187
+ /**
1188
+ * Assign user-defined data to this object. This is a helper
1189
+ * function for bindings.
1190
+ * @param user_data the user data
1191
+ */
1192
+ set_user_data(user_data?: any | null): void;
1193
+ }
1194
+
1195
+ type CanvasClass = typeof Canvas;
1196
+ type ComposeClass = typeof Compose;
1197
+ type DirectoryUnitClass = typeof DirectoryUnit;
1198
+ type HintClass = typeof Hint;
1199
+ type IconPolicyClass = typeof IconPolicy;
1200
+ /**
1201
+ * A #AscIconPolicyIter structure represents an iterator that can be used
1202
+ * to iterate over the icon sizes / policy entries of an #AscIconPolicy.
1203
+ * #AscIconPolicyIter structures are typically allocated on the stack and
1204
+ * then initialized with asc_icon_policy_iter_init().
1205
+ */
1206
+ class IconPolicyIter {
1207
+ static $gtype: GObject.GType<IconPolicyIter>;
1208
+
1209
+ // Constructors of AppStreamCompose.IconPolicyIter
1210
+
1211
+ constructor(properties?: Partial<{}>);
1212
+ _init(...args: any[]): void;
1213
+
1214
+ // Own methods of AppStreamCompose.IconPolicyIter
1215
+
1216
+ /**
1217
+ * Initializes a policy iterator for the policy entry list and associates it
1218
+ * it with `ipolicy`.
1219
+ * The #AscIconPolicyIter structure is typically allocated on the stack
1220
+ * and does not need to be freed explicitly.
1221
+ * @param ipolicy an #AscIconPolicy
1222
+ */
1223
+ init(ipolicy: IconPolicy): void;
1224
+ /**
1225
+ * Returns the current icon policy entry and advances the iterator.
1226
+ * Example:
1227
+ *
1228
+ * ```c
1229
+ * AscIconPolicyIter iter;
1230
+ * guint icon_size;
1231
+ * guint icon_scale;
1232
+ * AscIconState istate;
1233
+ *
1234
+ * asc_icon_policy_iter_init (&iter, ipolicy);
1235
+ * while (asc_icon_policy_iter_next (&iter, &icon_size, &icon_scale, &istate)) {
1236
+ * // do something with the icon entry data
1237
+ * }
1238
+ * ```
1239
+ *
1240
+ * @returns %FALSE if the last entry has been reached.
1241
+ */
1242
+ next(): [boolean, number, number, IconState | null];
1243
+ }
1244
+
1245
+ type ImageClass = typeof Image;
1246
+ type ResultClass = typeof Result;
1247
+ type UnitClass = typeof Unit;
1248
+ /**
1249
+ * Name of the imported GIR library
1250
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
1251
+ */
1252
+ const __name__: string;
1253
+ /**
1254
+ * Version of the imported GIR library
1255
+ * `see` https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
1256
+ */
1257
+ const __version__: string;
1258
+ }
1259
+
1260
+ export default AppStreamCompose;
1261
+ // END