-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(datastore): add subscribe() impl (#4846)
- Loading branch information
Showing
66 changed files
with
2,194 additions
and
508 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/amplify_datastore/ios/Classes/api/GraphQLRequest+Extension.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// Copyright Amazon.com Inc. or its affiliates. | ||
// All Rights Reserved. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
|
||
import Foundation | ||
import Amplify | ||
|
||
extension GraphQLRequest { | ||
func toNativeGraphQLRequest() -> NativeGraphQLRequest { | ||
let variablesJson = self.variables | ||
.flatMap { try? JSONSerialization.data(withJSONObject: $0, options: []) } | ||
.flatMap { String(data: $0, encoding: .utf8) } | ||
|
||
return NativeGraphQLRequest( | ||
document: self.document, | ||
apiName: self.apiName, | ||
variablesJson: variablesJson ?? "{}", | ||
responseType: String(describing: self.responseType), | ||
decodePath: self.decodePath | ||
) | ||
} | ||
} |
Oops, something went wrong.