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
import { | |
BedrockRuntimeClient, | |
BedrockRuntimeClientConfig, | |
InvokeModelWithBidirectionalStreamCommand, | |
InvokeModelWithBidirectionalStreamInput, | |
} from "@aws-sdk/client-bedrock-runtime"; | |
import { | |
NodeHttp2Handler, | |
NodeHttp2HandlerOptions, | |
} from "@smithy/node-http-handler"; |
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
version: 1 | |
backend: | |
phases: | |
build: | |
commands: | |
- npm ci --cache .npm --prefer-offline | |
- npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID --outputs-format dart --outputs-out-dir lib | |
frontend: | |
phases: | |
preBuild: |
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
[ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"mobiletargeting:GetCampaigns", | |
"mobiletargeting:CreateCampaign", | |
"mobiletargeting:SendMessages" | |
], | |
"Resource": [ | |
"<Generated-ARN>" |
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
const { PinpointClient, CreateCampaignCommand } = require("@aws-sdk/client-pinpoint"); | |
const pinpointClient = new PinpointClient({ region: "eu-central-1" }); | |
/* | |
* @type { import('@types/aws-lambda').APIGatewayProxyHandler } | |
*/ | |
exports.handler = async (event) => { | |
console.log(`EVENT: ${JSON.stringify(event)}`); |
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
final session = await Amplify.Auth.fetchAuthSession() as CognitoAuthSession; | |
final userTokenResult = session.userPoolTokensResult.type; | |
switch (userTokenResult) { | |
case AuthSuccessResult(value: final tokens): | |
safePrint('Successfully fetched the tokens: $tokens'); | |
case AuthErrorResult(:final exception): | |
safePrint('Failed to fetch the tokens: $exception'); | |
} |
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
@override | |
Widget build(BuildContext context) { | |
return SizedBox.square( | |
dimension: 100, | |
child: | |
BlocBuilder<PreviousGroceryDetailsCubit, PreviousGroceryDetailsState>( | |
bloc: previousGroceryDetailsCubit, | |
builder: (context, state) { | |
if (state is PreviousGroceryDetailsSuccess) { | |
return CachedNetworkImage( |
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
void main() { | |
printUserAttributes(); | |
} | |
Future<void> printUserAttributes() async { | |
try { | |
final attributes = await Amplify.Auth.fetchUserAttributes(); | |
safePrint('User attributes: $attributes'); | |
} on AuthException catch (e) { | |
switch (e) { |
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
Future<void> main() async { | |
final user = await getCurrentUsernameAndEmailWithNamedParameters(); | |
print('Username is ${user.username}'); | |
print('Email is ${user.email}'); | |
final anotherUser = await getCurrentUsernameAndEmailWithNamedParameters(); | |
print('Username is ${anotherUser.$1}'); | |
print('Email is ${anotherUser.$2}'); | |
} |
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
void main() { | |
final names = ['Salih', 'Abdallah', 'Mo']; | |
final [best, alsoBest, anotherBest] = names; | |
print('best $best'); | |
print('alsoBest $alsoBest'); | |
print('anotherBest $anotherBest'); | |
} |
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
void main() { | |
const friends = [ | |
Friend('Salih', 'D\'artagnan', 'Guler'), | |
Friend('Abdallah', 'Solution', 'Shaban'), | |
Friend('Mo', 'Wise', 'Malaka') | |
]; | |
for (final Friend(:name, :nickname, :surname) in friends) { | |
print('$name the $nickname $surname!'); | |
} |
NewerOlder