Skip to content

Commit 9fa0199

Browse files
committed
fix: return types
1 parent f642ef1 commit 9fa0199

File tree

2 files changed

+30
-40
lines changed

2 files changed

+30
-40
lines changed

src/services/avatars.ts

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,10 @@ export class Avatars extends Service {
369369
* @param {number} height
370370
* @param {number} quality
371371
* @throws {AppwriteException}
372-
* @returns ArrayBuffer
372+
* @returns {URL}
373373
374374
*/
375-
getBrowserURL(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {
375+
getBrowserURL(code: Browser, width?: number, height?: number, quality?: number): URL {
376376
const apiPath = '/avatars/browsers/{code}'.replace('{code}', code);
377377
const payload: Payload = {};
378378

@@ -390,8 +390,7 @@ export class Avatars extends Service {
390390

391391
const uri = new URL(this.client.config.endpoint + apiPath);
392392

393-
return this.client.call('get', uri, {
394-
}, payload);
393+
return uri;
395394
}
396395

397396
/**
@@ -410,10 +409,10 @@ export class Avatars extends Service {
410409
* @param {number} height
411410
* @param {number} quality
412411
* @throws {AppwriteException}
413-
* @returns ArrayBuffer
412+
* @returns {URL}
414413
415414
*/
416-
getCreditCardURL(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {
415+
getCreditCardURL(code: CreditCard, width?: number, height?: number, quality?: number): URL {
417416
const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code);
418417
const payload: Payload = {};
419418

@@ -431,8 +430,7 @@ export class Avatars extends Service {
431430

432431
const uri = new URL(this.client.config.endpoint + apiPath);
433432

434-
return this.client.call('get', uri, {
435-
}, payload);
433+
return uri;
436434
}
437435

438436
/**
@@ -443,10 +441,10 @@ export class Avatars extends Service {
443441
*
444442
* @param {string} url
445443
* @throws {AppwriteException}
446-
* @returns ArrayBuffer
444+
* @returns {URL}
447445
448446
*/
449-
getFaviconURL(url: string): Promise<ArrayBuffer> {
447+
getFaviconURL(url: string): URL {
450448
const apiPath = '/avatars/favicon';
451449
const payload: Payload = {};
452450

@@ -456,8 +454,7 @@ export class Avatars extends Service {
456454

457455
const uri = new URL(this.client.config.endpoint + apiPath);
458456

459-
return this.client.call('get', uri, {
460-
}, payload);
457+
return uri;
461458
}
462459

463460
/**
@@ -477,10 +474,10 @@ export class Avatars extends Service {
477474
* @param {number} height
478475
* @param {number} quality
479476
* @throws {AppwriteException}
480-
* @returns ArrayBuffer
477+
* @returns {URL}
481478
482479
*/
483-
getFlagURL(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer> {
480+
getFlagURL(code: Flag, width?: number, height?: number, quality?: number): URL {
484481
const apiPath = '/avatars/flags/{code}'.replace('{code}', code);
485482
const payload: Payload = {};
486483

@@ -498,8 +495,7 @@ export class Avatars extends Service {
498495

499496
const uri = new URL(this.client.config.endpoint + apiPath);
500497

501-
return this.client.call('get', uri, {
502-
}, payload);
498+
return uri;
503499
}
504500

505501
/**
@@ -519,10 +515,10 @@ export class Avatars extends Service {
519515
* @param {number} width
520516
* @param {number} height
521517
* @throws {AppwriteException}
522-
* @returns ArrayBuffer
518+
* @returns {URL}
523519
524520
*/
525-
getImageURL(url: string, width?: number, height?: number): Promise<ArrayBuffer> {
521+
getImageURL(url: string, width?: number, height?: number): URL {
526522
const apiPath = '/avatars/image';
527523
const payload: Payload = {};
528524

@@ -540,8 +536,7 @@ export class Avatars extends Service {
540536

541537
const uri = new URL(this.client.config.endpoint + apiPath);
542538

543-
return this.client.call('get', uri, {
544-
}, payload);
539+
return uri;
545540
}
546541

547542
/**
@@ -567,10 +562,10 @@ export class Avatars extends Service {
567562
* @param {number} height
568563
* @param {string} background
569564
* @throws {AppwriteException}
570-
* @returns ArrayBuffer
565+
* @returns {URL}
571566
572567
*/
573-
getInitialsURL(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer> {
568+
getInitialsURL(name?: string, width?: number, height?: number, background?: string): URL {
574569
const apiPath = '/avatars/initials';
575570
const payload: Payload = {};
576571

@@ -592,8 +587,7 @@ export class Avatars extends Service {
592587

593588
const uri = new URL(this.client.config.endpoint + apiPath);
594589

595-
return this.client.call('get', uri, {
596-
}, payload);
590+
return uri;
597591
}
598592

599593
/**
@@ -606,10 +600,10 @@ export class Avatars extends Service {
606600
* @param {number} margin
607601
* @param {boolean} download
608602
* @throws {AppwriteException}
609-
* @returns ArrayBuffer
603+
* @returns {URL}
610604
611605
*/
612-
getQRURL(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer> {
606+
getQRURL(text: string, size?: number, margin?: number, download?: boolean): URL {
613607
const apiPath = '/avatars/qr';
614608
const payload: Payload = {};
615609

@@ -631,7 +625,6 @@ export class Avatars extends Service {
631625

632626
const uri = new URL(this.client.config.endpoint + apiPath);
633627

634-
return this.client.call('get', uri, {
635-
}, payload);
628+
return uri;
636629
}
637630
};

src/services/storage.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,10 @@ export class Storage extends Service {
432432
* @param {string} fileId
433433
* @param {string} token
434434
* @throws {AppwriteException}
435-
* @returns ArrayBuffer
435+
* @returns {URL}
436436
437437
*/
438-
getFileDownloadURL(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer> {
438+
getFileDownloadURL(bucketId: string, fileId: string, token?: string): URL {
439439
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
440440
const payload: Payload = {};
441441

@@ -445,8 +445,7 @@ export class Storage extends Service {
445445

446446
const uri = new URL(this.client.config.endpoint + apiPath);
447447

448-
return this.client.call('get', uri, {
449-
}, payload);
448+
return uri;
450449
}
451450

452451
/**
@@ -471,10 +470,10 @@ export class Storage extends Service {
471470
* @param {ImageFormat} output
472471
* @param {string} token
473472
* @throws {AppwriteException}
474-
* @returns ArrayBuffer
473+
* @returns {URL}
475474
476475
*/
477-
getFilePreviewURL(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): Promise<ArrayBuffer> {
476+
getFilePreviewURL(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): URL {
478477
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
479478
const payload: Payload = {};
480479

@@ -528,8 +527,7 @@ export class Storage extends Service {
528527

529528
const uri = new URL(this.client.config.endpoint + apiPath);
530529

531-
return this.client.call('get', uri, {
532-
}, payload);
530+
return uri;
533531
}
534532

535533
/**
@@ -541,10 +539,10 @@ export class Storage extends Service {
541539
* @param {string} fileId
542540
* @param {string} token
543541
* @throws {AppwriteException}
544-
* @returns ArrayBuffer
542+
* @returns {URL}
545543
546544
*/
547-
getFileViewURL(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer> {
545+
getFileViewURL(bucketId: string, fileId: string, token?: string): URL {
548546
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
549547
const payload: Payload = {};
550548

@@ -554,7 +552,6 @@ export class Storage extends Service {
554552

555553
const uri = new URL(this.client.config.endpoint + apiPath);
556554

557-
return this.client.call('get', uri, {
558-
}, payload);
555+
return uri;
559556
}
560557
};

0 commit comments

Comments
 (0)