Skip to content

takapi-Jr/AppSyncDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

AppSyncDemo

Xamarin.Forms+AppSync(+Lambda)を実行するサンプル

AppSyncスキーマ

type GetSampleData {
	message: String
	hoge: String
	fuga: String
	piyo: String
	foo: Int
	bar: Int
}

type GetSampleResponse {
	result: LambdaResult
	data: GetSampleData
}

type LambdaResult {
	status_code: Int
}

type Query {
	GetSample(name: String): GetSampleResponse
}

schema {
	query: Query
}

AppSyncリクエストマッピングテンプレート

#**
The value of 'payload' after the template has been evaluated
will be passed as the event to AWS Lambda.
*#
{
  "version" : "2017-02-28",
  "operation": "Invoke",
  "payload": $util.toJson($context.args)
}

AppSyncレスポンスマッピングテンプレート

$util.toJson($context.result)

Lambda関数(GetSample)

import json

def lambda_handler(event, context):
    # TODO implement
    print(event)
    
    result = {
        "status_code": 200
    }
    
    data = {
        "message": 'Hello {0}!!!'.format(event['name']),
        "hoge": "abc",
        "fuga": "あいう",
        "piyo": "xyz",
        "foo": 123,
        "bar": 456
    }

    ret = {
        "result": result,
        "data": data
    }
    
    return ret

About

Xamarin.Forms+AppSync(+Lambda)を実行するサンプル

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages