Class: Appwrite::Apps

Inherits:
Service show all
Defined in:
lib/appwrite/services/apps.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Apps

Returns a new instance of Apps.



5
6
7
# File 'lib/appwrite/services/apps.rb', line 5

def initialize(client)
    @client = client
end

Instance Method Details

#create(app_id:, name:, redirect_uris:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, post_logout_redirect_uris: nil, enabled: nil, type: nil, device_flow: nil, team_id: nil) ⇒ App

Create a new application.

Parameters:

  • app_id (String) —

    Application ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.

  • name (String) —

    Application name.

  • redirect_uris (Array) —

    Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment.

  • description (String) (defaults to: nil) —

    Application description shown to users during OAuth2 consent.

  • client_uri (String) (defaults to: nil) —

    Application homepage URL shown to users during OAuth2 consent.

  • logo_uri (String) (defaults to: nil) —

    Application logo URL shown to users during OAuth2 consent.

  • privacy_policy_url (String) (defaults to: nil) —

    Application privacy policy URL shown to users during OAuth2 consent.

  • terms_url (String) (defaults to: nil) —

    Application terms of service URL shown to users during OAuth2 consent.

  • contacts (Array) (defaults to: nil) —

    Application support or security contact emails. Maximum of 100 contacts are allowed.

  • tagline (String) (defaults to: nil) —

    Application tagline shown to users during OAuth2 consent.

  • tags (Array) (defaults to: nil) —

    Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long.

  • images (Array) (defaults to: nil) —

    Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed.

  • support_url (String) (defaults to: nil) —

    Application support URL shown to users during OAuth2 consent.

  • data_deletion_url (String) (defaults to: nil) —

    Application data deletion URL shown to users during OAuth2 consent.

  • post_logout_redirect_uris (Array) (defaults to: nil) —

    Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list.

  • [] —

    enabled Is application enabled?

  • type (String) (defaults to: nil) —

    OAuth2 client type. Use public for SPAs, mobile, and native apps that cannot keep a client_secret — PKCE is then required at the token endpoint. Use confidential for server-side clients that present a client_secret. Defaults to confidential.

  • [] —

    device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false.

  • team_id (String) (defaults to: nil) —

    Team unique ID.

Returns:

  • (App)


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
# File 'lib/appwrite/services/apps.rb', line 63

def create(
    app_id:,
    name:,
    redirect_uris:,
    description: nil,
    client_uri: nil,
    logo_uri: nil,
    privacy_policy_url: nil,
    terms_url: nil,
    contacts: nil,
    tagline: nil,
    tags: nil,
    images: nil,
    support_url: nil,
    data_deletion_url: nil,
    post_logout_redirect_uris: nil,
    enabled: nil,
    type: nil,
    device_flow: nil,
    team_id: nil
)
    if app_id.nil?
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if name.nil?
        raise Appwrite::Exception.new('Missing required parameter: "name"')
    end

    if redirect_uris.nil?
        raise Appwrite::Exception.new('Missing required parameter: "redirectUris"')
    end

    api_path = '/apps'

    api_params = {
        appId: app_id,
        name: name,
        description: description,
        clientUri: client_uri,
        logoUri: logo_uri,
        privacyPolicyUrl: privacy_policy_url,
        termsUrl: terms_url,
        contacts: contacts,
        tagline: tagline,
        tags: tags,
        images: images,
        supportUrl: support_url,
        dataDeletionUrl: data_deletion_url,
        redirectUris: redirect_uris,
        postLogoutRedirectUris: post_logout_redirect_uris,
        enabled: enabled,
        type: type,
        deviceFlow: device_flow,
        teamId: team_id,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'POST',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::App
    )
end

#create_installation_token(app_id:, installation_id:) ⇒ Oauth2Token

Create a token for an installation of an application. Requires an app key sent in the X-Appwrite-Key header alongside the X-Appwrite-App header, or a caller with update access to the app. The returned token carries the scopes and authorization details granted to the installation, and can be used as an Authorization: Bearer header everywhere OAuth2 access tokens are accepted. Multiple tokens can be active for the same installation at once; each token stays valid until it expires or the installation is updated or deleted.

Parameters:

  • app_id (String) —

    Application unique ID.

  • installation_id (String) —

    Installation unique ID.

Returns:

  • (Oauth2Token)


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
# File 'lib/appwrite/services/apps.rb', line 470

def create_installation_token(
    app_id:,
    installation_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if installation_id.nil? || installation_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "installationId"')
    end

    api_path = '/apps/{appId}/installations/{installationId}/tokens'
        .gsub('{appId}', @client.encode_path(app_id))
        .gsub('{installationId}', @client.encode_path(installation_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'POST',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::Oauth2Token
    )
end

#create_key(app_id:) ⇒ AppKey

Create a new app key for an application. App keys carry no scopes; send one in the X-Appwrite-Key header alongside the X-Appwrite-App header to list the application's installations and create installation access tokens.

Parameters:

  • app_id (String) —

    Application unique ID.

Returns:

  • (AppKey)


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
# File 'lib/appwrite/services/apps.rb', line 548

def create_key(
    app_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    api_path = '/apps/{appId}/keys'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'POST',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppKey
    )
end

#create_secret(app_id:) ⇒ AppSecretPlaintext

Create a new client secret for an application.

Parameters:

  • app_id (String) —

    Application unique ID.

Returns:

  • (AppSecretPlaintext)


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
# File 'lib/appwrite/services/apps.rb', line 736

def create_secret(
    app_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    api_path = '/apps/{appId}/secrets'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'POST',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppSecretPlaintext
    )
end

#delete(app_id:) ⇒ Object

Delete an application by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

Returns:

  • []



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
# File 'lib/appwrite/services/apps.rb', line 311

def delete(
    app_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    api_path = '/apps/{appId}'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'DELETE',
        path: api_path,
        headers: api_headers,
        params: api_params,
    )
end

#delete_installation(app_id:, installation_id:) ⇒ Object

Delete an installation of an application by its unique ID. Requires a caller with update access to the app. Previously issued installation access tokens are revoked.

Parameters:

  • app_id (String) —

    Application unique ID.

  • installation_id (String) —

    Installation unique ID.

Returns:

  • []



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
# File 'lib/appwrite/services/apps.rb', line 425

def delete_installation(
    app_id:,
    installation_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if installation_id.nil? || installation_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "installationId"')
    end

    api_path = '/apps/{appId}/installations/{installationId}'
        .gsub('{appId}', @client.encode_path(app_id))
        .gsub('{installationId}', @client.encode_path(installation_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'DELETE',
        path: api_path,
        headers: api_headers,
        params: api_params,
    )
end

#delete_key(app_id:, key_id:) ⇒ Object

Delete an app key by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

  • key_id (String) —

    App key unique ID.

Returns:

  • []



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
# File 'lib/appwrite/services/apps.rb', line 619

def delete_key(
    app_id:,
    key_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if key_id.nil? || key_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "keyId"')
    end

    api_path = '/apps/{appId}/keys/{keyId}'
        .gsub('{appId}', @client.encode_path(app_id))
        .gsub('{keyId}', @client.encode_path(key_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'DELETE',
        path: api_path,
        headers: api_headers,
        params: api_params,
    )
end

#delete_secret(app_id:, secret_id:) ⇒ Object

Delete an application client secret by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

  • secret_id (String) —

    Secret unique ID.

Returns:

  • []



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
# File 'lib/appwrite/services/apps.rb', line 807

def delete_secret(
    app_id:,
    secret_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if secret_id.nil? || secret_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "secretId"')
    end

    api_path = '/apps/{appId}/secrets/{secretId}'
        .gsub('{appId}', @client.encode_path(app_id))
        .gsub('{secretId}', @client.encode_path(secret_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'DELETE',
        path: api_path,
        headers: api_headers,
        params: api_params,
    )
end

#delete_tokens(app_id:) ⇒ Object

Revoke all tokens for an application by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

Returns:

  • []



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
# File 'lib/appwrite/services/apps.rb', line 884

def delete_tokens(
    app_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    api_path = '/apps/{appId}/tokens'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'DELETE',
        path: api_path,
        headers: api_headers,
        params: api_params,
    )
end

#get(app_id:) ⇒ App

Get an application by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

Returns:

  • (App)


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
# File 'lib/appwrite/services/apps.rb', line 186

def get(
    app_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    api_path = '/apps/{appId}'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::App
    )
end

#get_installation(app_id:, installation_id:) ⇒ AppInstallation

Get an installation of an application by its unique ID. Requires an app key sent in the X-Appwrite-Key header alongside the X-Appwrite-App header, or a caller with update access to the app.

Parameters:

  • app_id (String) —

    Application unique ID.

  • installation_id (String) —

    Installation unique ID.

Returns:

  • (AppInstallation)


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
# File 'lib/appwrite/services/apps.rb', line 385

def get_installation(
    app_id:,
    installation_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if installation_id.nil? || installation_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "installationId"')
    end

    api_path = '/apps/{appId}/installations/{installationId}'
        .gsub('{appId}', @client.encode_path(app_id))
        .gsub('{installationId}', @client.encode_path(installation_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppInstallation
    )
end

#get_key(app_id:, key_id:) ⇒ AppKey

Get an app key by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

  • key_id (String) —

    App key unique ID.

Returns:

  • (AppKey)


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
# File 'lib/appwrite/services/apps.rb', line 581

def get_key(
    app_id:,
    key_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if key_id.nil? || key_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "keyId"')
    end

    api_path = '/apps/{appId}/keys/{keyId}'
        .gsub('{appId}', @client.encode_path(app_id))
        .gsub('{keyId}', @client.encode_path(key_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppKey
    )
end

#get_secret(app_id:, secret_id:) ⇒ AppSecret

Get an application client secret by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

  • secret_id (String) —

    Secret unique ID.

Returns:

  • (AppSecret)


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
# File 'lib/appwrite/services/apps.rb', line 769

def get_secret(
    app_id:,
    secret_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if secret_id.nil? || secret_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "secretId"')
    end

    api_path = '/apps/{appId}/secrets/{secretId}'
        .gsub('{appId}', @client.encode_path(app_id))
        .gsub('{secretId}', @client.encode_path(secret_id))

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppSecret
    )
end

#list(queries: nil, total: nil) ⇒ AppsList

List applications.

Parameters:

  • queries (Array) (defaults to: nil) —

    Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.

  • [] —

    total When set to false, the total count returned will be 0 and will not be calculated.

Returns:

  • (AppsList)


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/appwrite/services/apps.rb', line 15

def list(
    queries: nil,
    total: nil
)
    api_path = '/apps'

    api_params = {
        queries: queries,
        total: total,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppsList
    )
end

#list_installation_scopes ⇒ AppScopeList

List scopes an application can request when installed on a team.

Returns:

  • (AppScopeList)


139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/appwrite/services/apps.rb', line 139

def list_installation_scopes()
    api_path = '/apps/scopes/installations'

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppScopeList
    )
end

#list_installations(app_id:, queries: nil, total: nil) ⇒ AppInstallationList

List installations of an application. Requires an app key sent in the X-Appwrite-Key header alongside the X-Appwrite-App header, or a caller with update access to the app.

Parameters:

  • app_id (String) —

    Application unique ID.

  • queries (Array) (defaults to: nil) —

    Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.

  • [] —

    total When set to false, the total count returned will be 0 and will not be calculated.

Returns:

  • (AppInstallationList)


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
# File 'lib/appwrite/services/apps.rb', line 346

def list_installations(
    app_id:,
    queries: nil,
    total: nil
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    api_path = '/apps/{appId}/installations'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {
        queries: queries,
        total: total,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppInstallationList
    )
end

#list_keys(app_id:, queries: nil, total: nil) ⇒ AppKeyList

List app keys for an application.

Parameters:

  • app_id (String) —

    Application unique ID.

  • queries (Array) (defaults to: nil) —

    Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.

  • [] —

    total When set to false, the total count returned will be 0 and will not be calculated.

Returns:

  • (AppKeyList)


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
# File 'lib/appwrite/services/apps.rb', line 510

def list_keys(
    app_id:,
    queries: nil,
    total: nil
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    api_path = '/apps/{appId}/keys'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {
        queries: queries,
        total: total,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppKeyList
    )
end

#list_o_auth2_scopes ⇒ AppScopeList

List scopes an application can request during the OAuth2 flow.

Returns:

  • (AppScopeList)


162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/appwrite/services/apps.rb', line 162

def list_o_auth2_scopes()
    api_path = '/apps/scopes/oauth2'

    api_params = {}

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppScopeList
    )
end

#list_secrets(app_id:, queries: nil, total: nil) ⇒ AppSecretList

List client secrets for an application.

Parameters:

  • app_id (String) —

    Application unique ID.

  • queries (Array) (defaults to: nil) —

    Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long.

  • [] —

    total When set to false, the total count returned will be 0 and will not be calculated.

Returns:

  • (AppSecretList)


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
# File 'lib/appwrite/services/apps.rb', line 700

def list_secrets(
    app_id:,
    queries: nil,
    total: nil
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    api_path = '/apps/{appId}/secrets'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {
        queries: queries,
        total: total,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "accept": 'application/json',
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::AppSecretList
    )
end

#update(app_id:, name:, description: nil, client_uri: nil, logo_uri: nil, privacy_policy_url: nil, terms_url: nil, contacts: nil, tagline: nil, tags: nil, images: nil, support_url: nil, data_deletion_url: nil, enabled: nil, redirect_uris: nil, post_logout_redirect_uris: nil, type: nil, device_flow: nil, installation_scopes: nil, installation_redirect_url: nil) ⇒ App

Update an application by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

  • name (String) —

    Application name.

  • description (String) (defaults to: nil) —

    Application description shown to users during OAuth2 consent.

  • client_uri (String) (defaults to: nil) —

    Application homepage URL shown to users during OAuth2 consent.

  • logo_uri (String) (defaults to: nil) —

    Application logo URL shown to users during OAuth2 consent.

  • privacy_policy_url (String) (defaults to: nil) —

    Application privacy policy URL shown to users during OAuth2 consent.

  • terms_url (String) (defaults to: nil) —

    Application terms of service URL shown to users during OAuth2 consent.

  • contacts (Array) (defaults to: nil) —

    Application support or security contact emails. Maximum of 100 contacts are allowed.

  • tagline (String) (defaults to: nil) —

    Application tagline shown to users during OAuth2 consent.

  • tags (Array) (defaults to: nil) —

    Application tags shown to users during OAuth2 consent. Maximum of 100 tags are allowed, each up to 64 characters long.

  • images (Array) (defaults to: nil) —

    Application image URLs shown to users during OAuth2 consent. Maximum of 100 images are allowed.

  • support_url (String) (defaults to: nil) —

    Application support URL shown to users during OAuth2 consent.

  • data_deletion_url (String) (defaults to: nil) —

    Application data deletion URL shown to users during OAuth2 consent.

  • [] —

    enabled Is application enabled?

  • redirect_uris (Array) (defaults to: nil) —

    Redirect URIs. Each must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI (e.g. com.example.app:/oauth), and must not contain a fragment.

  • post_logout_redirect_uris (Array) (defaults to: nil) —

    Post-logout redirect URIs for OpenID Connect RP-Initiated Logout. Each must be an https URL, an http loopback URL, or a private-use scheme URI, and must not contain a fragment. After ending the user session, the logout endpoint only redirects to URIs in this list.

  • type (String) (defaults to: nil) —

    OAuth2 client type. Use public for SPAs, mobile, and native apps that cannot keep a client_secret — PKCE is then required at the token endpoint. Use confidential for server-side clients that present a client_secret. Defaults to confidential.

  • [] —

    device_flow Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false.

  • installation_scopes (Array) (defaults to: nil) —

    Scopes the application requests when installed on a team. Only scopes allowed by the project's OAuth2 server installation scopes configuration are accepted; use the list installation scopes endpoint to discover available values. Maximum of 100 scopes are allowed.

  • installation_redirect_url (String) (defaults to: nil) —

    URL users are redirected to after creating or updating an installation of this application. Must be an https URL, an http loopback URL (localhost, 127.0.0.1, [::1]), or a private-use scheme URI, and must not contain a fragment. Leave empty for no redirect.

Returns:

  • (App)


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
# File 'lib/appwrite/services/apps.rb', line 236

def update(
    app_id:,
    name:,
    description: nil,
    client_uri: nil,
    logo_uri: nil,
    privacy_policy_url: nil,
    terms_url: nil,
    contacts: nil,
    tagline: nil,
    tags: nil,
    images: nil,
    support_url: nil,
    data_deletion_url: nil,
    enabled: nil,
    redirect_uris: nil,
    post_logout_redirect_uris: nil,
    type: nil,
    device_flow: nil,
    installation_scopes: nil,
    installation_redirect_url: nil
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if name.nil?
        raise Appwrite::Exception.new('Missing required parameter: "name"')
    end

    api_path = '/apps/{appId}'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {
        name: name,
        description: description,
        clientUri: client_uri,
        logoUri: logo_uri,
        privacyPolicyUrl: privacy_policy_url,
        termsUrl: terms_url,
        contacts: contacts,
        tagline: tagline,
        tags: tags,
        images: images,
        supportUrl: support_url,
        dataDeletionUrl: data_deletion_url,
        enabled: enabled,
        redirectUris: redirect_uris,
        postLogoutRedirectUris: post_logout_redirect_uris,
        type: type,
        deviceFlow: device_flow,
        installationScopes: installation_scopes,
        installationRedirectUrl: installation_redirect_url,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'PUT',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::App
    )
end

#update_labels(app_id:, labels:) ⇒ App

Update the labels of an application. Labels are read-only for clients; only a server SDK using a project API key can set them. Replaces the previous labels.

Parameters:

  • app_id (String) —

    Application unique ID.

  • labels (Array) —

    Array of application labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. Reserved labels are rejected.

Returns:

  • (App)


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
# File 'lib/appwrite/services/apps.rb', line 659

def update_labels(
    app_id:,
    labels:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if labels.nil?
        raise Appwrite::Exception.new('Missing required parameter: "labels"')
    end

    api_path = '/apps/{appId}/labels'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {
        labels: labels,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'PUT',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::App
    )
end

#update_team(app_id:, team_id:) ⇒ App

Transfer an application to another team by its unique ID.

Parameters:

  • app_id (String) —

    Application unique ID.

  • team_id (String) —

    Team ID of the team to transfer application to.

Returns:

  • (App)


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
# File 'lib/appwrite/services/apps.rb', line 845

def update_team(
    app_id:,
    team_id:
)
    if app_id.nil? || app_id == ''
        raise Appwrite::Exception.new('Missing required parameter: "appId"')
    end

    if team_id.nil?
        raise Appwrite::Exception.new('Missing required parameter: "teamId"')
    end

    api_path = '/apps/{appId}/team'
        .gsub('{appId}', @client.encode_path(app_id))

    api_params = {
        teamId: team_id,
    }

    api_headers = {
        "X-Appwrite-Project": @client.get_config('project'),
        "content-type": 'application/json',
        "accept": 'application/json',
    }

    @client.call(
        method: 'PATCH',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::App
    )
end