@@ -264,7 +264,7 @@ To retrieve the file associated with a record, first query the record, then use
264
264
<InlineFilter filters = { [" swift" ]} >
265
265
``` swift title="ContentView"
266
266
// Get the song record
267
- let song = try await Amplify.API .query (request : .get (Song.self , byIdentifier : currentSong.id )).get ()
267
+ let song = try await Amplify.API .query (request : .get (Song.self , byId : currentSong.id )).get ()
268
268
269
269
// Download the art cover
270
270
let imageData = try await Amplify.Storage .downloadData (path : .fromString ((song? .coverArtPath )! )).value
@@ -316,7 +316,7 @@ The following example removes the file association from the record, but does not
316
316
<InlineFilter filters = { [" swift" ]} >
317
317
``` swift title="ContentView"
318
318
// Get the song record
319
- var song = try await Amplify.API .query (request : .get (Song.self , byIdentifier : currentSong.id )).get ()
319
+ var song = try await Amplify.API .query (request : .get (Song.self , byId : currentSong.id )).get ()
320
320
321
321
// If the record has no associated file, we can return early.
322
322
guard song? .coverArtPath != nil else {
@@ -368,7 +368,7 @@ The following example removes the file from the record, then deletes the file fr
368
368
<InlineFilter filters = { [" swift" ]} >
369
369
``` swift title="ContentView"
370
370
// Get the song record
371
- var song = try await Amplify.API .query (request : .get (Song.self , byIdentifier : currentSong.id )).get ()
371
+ var song = try await Amplify.API .query (request : .get (Song.self , byId : currentSong.id )).get ()
372
372
373
373
// If the record has no associated file, we can return early.
374
374
guard let coverArtPath = song? .coverArtPath else {
@@ -424,7 +424,7 @@ await remove({ path: song.coverArtPath });
424
424
<InlineFilter filters = { [" swift" ]} >
425
425
``` swift title="ContentView"
426
426
// Get the song record
427
- let song = try await Amplify.API .mutate (request : .get (Song.self , byIdentifier : currentSong.id )).get ()
427
+ let song = try await Amplify.API .mutate (request : .get (Song.self , byId : currentSong.id )).get ()
428
428
429
429
// Delete the record from the API
430
430
let deleteResult = try await Amplify.API .mutate (request : .delete (song! ))
@@ -603,7 +603,7 @@ _ = try await Amplify.Storage.uploadData(path: .fromString(path),
603
603
data : imageData).value
604
604
605
605
// Query existing record to retrieve currently associated files:
606
- var album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id )).get ()
606
+ var album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id )).get ()
607
607
608
608
guard var imagePaths = album? .imagePaths else {
609
609
print (" Album does not contain images" )
@@ -777,7 +777,7 @@ To retrieve the files associated with a record, first query the record, then use
777
777
<InlineFilter filters = { [" swift" ]} >
778
778
``` swift title="ContentView"
779
779
// Query the record to get the file paths:
780
- let album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id )).get ()
780
+ let album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id )).get ()
781
781
782
782
// If the record has no associated files, we can return early.
783
783
guard let imagePathsOptional = album? .imagePaths else {
@@ -855,7 +855,7 @@ The workflow for deleting and removing files associated with API records is the
855
855
]} >
856
856
``` swift title="ContentView"
857
857
// Get the API record:
858
- var album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id )).get ()
858
+ var album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id )).get ()
859
859
860
860
// If the record has no associated file, we can return early.
861
861
guard let imagePaths = album? .imagePaths, ! imagePaths.isEmpty else {
@@ -906,7 +906,7 @@ const updatedPhotoAlbum = await client.models.PhotoAlbum.update({
906
906
]} >
907
907
``` swift title="ContentView"
908
908
// Get the API record:
909
- var album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id )).get ()
909
+ var album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id )).get ()
910
910
911
911
// If the record has no associated files, we can return early.
912
912
guard let imagePathsOptional = album? .imagePaths else {
@@ -980,7 +980,7 @@ await Promise.all(
980
980
<InlineFilter >
981
981
``` swift title="ContentView"
982
982
// Get the album record
983
- var album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id )).get ()
983
+ var album = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id )).get ()
984
984
985
985
// If the record has no associated file, we can return early.
986
986
guard let imagePathsOptional = album? .imagePaths else {
@@ -1325,7 +1325,7 @@ class SongViewModel: ObservableObject {
1325
1325
await setCurrentImage (nil )
1326
1326
1327
1327
// Get the song record
1328
- let result = try await Amplify.API .query (request : .get (Song.self , byIdentifier : currentSong.id ))
1328
+ let result = try await Amplify.API .query (request : .get (Song.self , byId : currentSong.id ))
1329
1329
guard case .success (let queriedSong) = result else {
1330
1330
print (" Failed with error: " , result)
1331
1331
return
@@ -1364,7 +1364,7 @@ class SongViewModel: ObservableObject {
1364
1364
}
1365
1365
1366
1366
// Get the song record
1367
- let result = try await Amplify.API .mutate (request : .get (Song.self , byIdentifier : currentSong.id ))
1367
+ let result = try await Amplify.API .mutate (request : .get (Song.self , byId : currentSong.id ))
1368
1368
guard case .success (let queriedSong) = result else {
1369
1369
print (" Failed with error: " , result)
1370
1370
return
@@ -1403,7 +1403,7 @@ class SongViewModel: ObservableObject {
1403
1403
}
1404
1404
1405
1405
// Get the song record
1406
- let result = try await Amplify.API .query (request : .get (Song.self , byIdentifier : currentSong.id ))
1406
+ let result = try await Amplify.API .query (request : .get (Song.self , byId : currentSong.id ))
1407
1407
guard case .success (let queriedSong) = result else {
1408
1408
print (" Failed with error: " , result)
1409
1409
return
@@ -1447,7 +1447,7 @@ class SongViewModel: ObservableObject {
1447
1447
}
1448
1448
1449
1449
// Get the song record
1450
- let result = try await Amplify.API .mutate (request : .get (Song.self , byIdentifier : currentSong.id ))
1450
+ let result = try await Amplify.API .mutate (request : .get (Song.self , byId : currentSong.id ))
1451
1451
guard case .success (let queriedSong) = result else {
1452
1452
print (" Failed with error: " , result)
1453
1453
return
@@ -1760,7 +1760,7 @@ class PhotoAlbumViewModel: ObservableObject {
1760
1760
options : .init (accessLevel : .private )).value
1761
1761
1762
1762
// Get the latest album
1763
- let result = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id ))
1763
+ let result = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id ))
1764
1764
guard case .success (let queriedAlbum) = result else {
1765
1765
print (" Failed with error: " , result)
1766
1766
return
@@ -1851,7 +1851,7 @@ class PhotoAlbumViewModel: ObservableObject {
1851
1851
await setCurrentImages ([])
1852
1852
1853
1853
// Get the song record
1854
- let result = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id ))
1854
+ let result = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id ))
1855
1855
guard case .success (let queriedAlbum) = result else {
1856
1856
print (" Failed with error: " , result)
1857
1857
return
@@ -1910,7 +1910,7 @@ class PhotoAlbumViewModel: ObservableObject {
1910
1910
}
1911
1911
1912
1912
// Get the album record
1913
- let result = try await Amplify.API .mutate (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id ))
1913
+ let result = try await Amplify.API .mutate (request : .get (PhotoAlbum.self , byId : currentAlbum.id ))
1914
1914
guard case .success (let queriedAlbum) = result else {
1915
1915
print (" Failed with error: " , result)
1916
1916
return
@@ -1951,7 +1951,7 @@ class PhotoAlbumViewModel: ObservableObject {
1951
1951
}
1952
1952
1953
1953
// Get the album record
1954
- let result = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id ))
1954
+ let result = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id ))
1955
1955
guard case .success (let queriedAlbum) = result else {
1956
1956
print (" Failed with error: " , result)
1957
1957
return
@@ -2014,7 +2014,7 @@ class PhotoAlbumViewModel: ObservableObject {
2014
2014
}
2015
2015
2016
2016
// Get the album record
2017
- let result = try await Amplify.API .query (request : .get (PhotoAlbum.self , byIdentifier : currentAlbum.id ))
2017
+ let result = try await Amplify.API .query (request : .get (PhotoAlbum.self , byId : currentAlbum.id ))
2018
2018
guard case .success (let queriedAlbum) = result else {
2019
2019
print (" Failed with error: " , result)
2020
2020
return
0 commit comments