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.



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

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)


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

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)
    api_path = '/apps'

    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_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)


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

def create_installation_token(app_id:, installation_id:)
    api_path = '/apps/{appId}/installations/{installationId}/tokens'
        .gsub('{appId}', app_id)
        .gsub('{installationId}', installation_id)

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

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

    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)


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

def create_key(app_id:)
    api_path = '/apps/{appId}/keys'
        .gsub('{appId}', app_id)

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

    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)


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

def create_secret(app_id:)
    api_path = '/apps/{appId}/secrets'
        .gsub('{appId}', app_id)

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

    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:

  • []



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

def delete(app_id:)
    api_path = '/apps/{appId}'
        .gsub('{appId}', app_id)

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

    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:

  • []



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

def delete_installation(app_id:, installation_id:)
    api_path = '/apps/{appId}/installations/{installationId}'
        .gsub('{appId}', app_id)
        .gsub('{installationId}', installation_id)

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

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

    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:

  • []



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

def delete_key(app_id:, key_id:)
    api_path = '/apps/{appId}/keys/{keyId}'
        .gsub('{appId}', app_id)
        .gsub('{keyId}', key_id)

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

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

    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:

  • []



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

def delete_secret(app_id:, secret_id:)
    api_path = '/apps/{appId}/secrets/{secretId}'
        .gsub('{appId}', app_id)
        .gsub('{secretId}', secret_id)

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

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

    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:

  • []



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

def delete_tokens(app_id:)
    api_path = '/apps/{appId}/tokens'
        .gsub('{appId}', app_id)

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

    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)


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

def get(app_id:)
    api_path = '/apps/{appId}'
        .gsub('{appId}', app_id)

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

    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)


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 get_installation(app_id:, installation_id:)
    api_path = '/apps/{appId}/installations/{installationId}'
        .gsub('{appId}', app_id)
        .gsub('{installationId}', installation_id)

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

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

    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)


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

def get_key(app_id:, key_id:)
    api_path = '/apps/{appId}/keys/{keyId}'
        .gsub('{appId}', app_id)
        .gsub('{keyId}', key_id)

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

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

    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)


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

def get_secret(app_id:, secret_id:)
    api_path = '/apps/{appId}/secrets/{secretId}'
        .gsub('{appId}', app_id)
        .gsub('{secretId}', secret_id)

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

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

    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)


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

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_scopesAppScopeList

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

Returns:

  • (AppScopeList)


119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/appwrite/services/apps.rb', line 119

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)


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

def list_installations(app_id:, queries: nil, total: nil)
    api_path = '/apps/{appId}/installations'
        .gsub('{appId}', app_id)

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

    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)


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

def list_keys(app_id:, queries: nil, total: nil)
    api_path = '/apps/{appId}/keys'
        .gsub('{appId}', app_id)

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

    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_scopesAppScopeList

List scopes an application can request during the OAuth2 flow.

Returns:

  • (AppScopeList)


144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/appwrite/services/apps.rb', line 144

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)


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

def list_secrets(app_id:, queries: nil, total: nil)
    api_path = '/apps/{appId}/secrets'
        .gsub('{appId}', app_id)

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

    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)


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

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)
    api_path = '/apps/{appId}'
        .gsub('{appId}', app_id)

    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

    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.

Returns:

  • (App)


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

def update_labels(app_id:, labels:)
    api_path = '/apps/{appId}/labels'
        .gsub('{appId}', app_id)

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

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

    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)


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

def update_team(app_id:, team_id:)
    api_path = '/apps/{appId}/team'
        .gsub('{appId}', app_id)

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

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

    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