mirror of
https://github.com/supabase/supabase.git
synced 2026-07-03 02:34:22 +08:00
docs(swift): add documentation for new Swift SDK features
Added documentation for two new methods from supabase-swift v2.33.1+: 1. `maxAffected()` method (from PR #795): - Allows setting maximum number of rows affected by a query - Works with UPDATE, DELETE, and RPC operations - Requires PostgREST v13+ - Added examples for update, delete, and RPC usage 2. `linkIdentityWithIdToken()` method (from PR #776): - Enables linking OIDC identities using ID tokens - Useful for Sign in with Apple and other OIDC providers - Added examples with and without nonce parameter These additions document features that were merged in supabase/supabase-swift PRs #795 and #776. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -931,6 +931,42 @@ functions:
|
||||
// custom URL opening logic
|
||||
}
|
||||
```
|
||||
- id: link-identity-with-id-token
|
||||
title: 'linkIdentityWithIdToken()'
|
||||
notes: |
|
||||
- The **Enable Manual Linking** option must be enabled from your [project's authentication settings](/dashboard/project/_/settings/auth).
|
||||
- The user needs to be signed in to call `linkIdentityWithIdToken()`.
|
||||
- If the candidate identity is already linked to the existing user or another user, `linkIdentityWithIdToken()` will fail.
|
||||
- This method allows you to link an OIDC identity using an ID token obtained from a provider like Apple, Google, etc.
|
||||
examples:
|
||||
- id: link-identity-with-id-token
|
||||
name: Link an OIDC identity using an ID token
|
||||
isSpotlight: true
|
||||
code: |
|
||||
```swift
|
||||
try await supabase.auth.linkIdentityWithIdToken(
|
||||
credentials: OpenIDConnectCredentials(
|
||||
provider: .apple,
|
||||
idToken: idToken
|
||||
)
|
||||
)
|
||||
```
|
||||
description: |
|
||||
Link an OpenID Connect identity to the current user using an ID token. This is useful when you've obtained an ID token from a provider's SDK (like Sign in with Apple) and want to link it to the current user's account.
|
||||
- id: link-identity-with-id-token-and-nonce
|
||||
name: Link an OIDC identity with nonce
|
||||
code: |
|
||||
```swift
|
||||
try await supabase.auth.linkIdentityWithIdToken(
|
||||
credentials: OpenIDConnectCredentials(
|
||||
provider: .apple,
|
||||
idToken: idToken,
|
||||
nonce: nonce
|
||||
)
|
||||
)
|
||||
```
|
||||
description: |
|
||||
For providers that support nonce verification (like Apple), you can include the nonce used during authentication.
|
||||
- id: unlink-identity
|
||||
title: 'unlinkIdentity()'
|
||||
notes: |
|
||||
@@ -3750,6 +3786,57 @@ functions:
|
||||
hideCodeBlock: true
|
||||
isSpotlight: true
|
||||
|
||||
- id: max-affected
|
||||
title: maxAffected()
|
||||
description: |
|
||||
Set the maximum number of rows that can be affected by the query.
|
||||
|
||||
Only available in PostgREST v13+ and only works with PATCH, DELETE methods and RPC calls.
|
||||
notes: |
|
||||
- This method sets `handling=strict` and `max-affected=<value>` headers for row limit enforcement.
|
||||
- Only use with UPDATE (PATCH), DELETE operations, or RPC calls that modify data.
|
||||
- If the query would affect more rows than specified, PostgREST will return an error.
|
||||
- This is useful for preventing accidental bulk updates or deletes.
|
||||
examples:
|
||||
- id: with-update
|
||||
name: With `update()`
|
||||
code: |
|
||||
```swift
|
||||
try await supabase
|
||||
.from("users")
|
||||
.update(["status": "active"])
|
||||
.eq("id", value: 1)
|
||||
.maxAffected(1)
|
||||
.execute()
|
||||
```
|
||||
description: |
|
||||
Ensure that only one row is updated. If the query would update more than one row, an error is returned.
|
||||
isSpotlight: true
|
||||
- id: with-delete
|
||||
name: With `delete()`
|
||||
code: |
|
||||
```swift
|
||||
try await supabase
|
||||
.from("users")
|
||||
.delete()
|
||||
.in("id", values: [1, 2, 3])
|
||||
.maxAffected(3)
|
||||
.execute()
|
||||
```
|
||||
description: |
|
||||
Ensure that only three rows are deleted. If the query would delete more than three rows, an error is returned.
|
||||
- id: with-rpc
|
||||
name: With `rpc()`
|
||||
code: |
|
||||
```swift
|
||||
try await supabase
|
||||
.rpc("delete_inactive_users")
|
||||
.maxAffected(10)
|
||||
.execute()
|
||||
```
|
||||
description: |
|
||||
Ensure that the RPC call affects at most 10 rows. Useful for limiting the impact of stored procedures.
|
||||
|
||||
- id: single
|
||||
title: single()
|
||||
description: |
|
||||
|
||||
Reference in New Issue
Block a user