-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc88867
commit 76bbaea
Showing
5 changed files
with
1,297 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# GraphQL schema for querying offers | ||
schema { | ||
query: PromotionQueryType | ||
} | ||
|
||
# Offer query operation | ||
type PromotionQueryType { | ||
passenger(id: Int!): CurrentPassenger | ||
offer(passengerId: Int!): CurrentOffer | ||
} | ||
|
||
# Passenger data type | ||
type CurrentPassenger { | ||
id: Int | ||
pnr: String | ||
firstName: String | ||
lastName: String | ||
milesBalance: Int | ||
loyaltyStatus: FFlevel | ||
ffNumber: String | ||
hasStopover: Boolean | ||
} | ||
|
||
enum FFlevel { | ||
SILVER | ||
GOLD | ||
PLATINUM | ||
} | ||
|
||
# Offer data type | ||
type CurrentOffer { | ||
title: String | ||
isValid: Boolean | ||
Message: String | ||
} |
209 changes: 209 additions & 0 deletions
209
samples/tn19-connect-demo/loyalty_api/CICX_Loyalty_API.json
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,209 @@ | ||
{ | ||
"imports": [ | ||
"github.com/project-flogo/flow", | ||
"git.tibco.com/git/product/ipaas/wi-contrib.git/contributions/General/activity/rest", | ||
"github.com/project-flogo/contrib/activity/actreturn", | ||
"rest_1 git.tibco.com/git/product/ipaas/wi-contrib.git/contributions/General/trigger/rest" | ||
], | ||
"name": "CICX_Loyalty_API", | ||
"description": " ", | ||
"version": "1.1.0", | ||
"type": "flogo:app", | ||
"appModel": "1.1.0", | ||
"feVersion": "2.6.0", | ||
"triggers": [ | ||
{ | ||
"ref": "#rest_1", | ||
"name": "ReceiveHTTPMessage", | ||
"description": "", | ||
"settings": { | ||
"port": 8080, | ||
"secureConnection": false, | ||
"serverKey": "", | ||
"caCertificate": "", | ||
"swagger": "" | ||
}, | ||
"id": "ReceiveHTTPMessage", | ||
"handlers": [ | ||
{ | ||
"description": "", | ||
"settings": { | ||
"Method": "GET", | ||
"Path": "/loyalty/{airline}/{ffNumber}", | ||
"OutputValidation": false | ||
}, | ||
"action": { | ||
"ref": "github.com/project-flogo/flow", | ||
"settings": { | ||
"flowURI": "res://flow:getLoyaltyStatus" | ||
}, | ||
"input": { | ||
"airline_code": "=$.pathParams.airline", | ||
"ffNumber": "=$.pathParams.ffNumber" | ||
}, | ||
"output": { | ||
"data": { | ||
"mapping": { | ||
"loyaltyStatus": "=$.loyaltyStatus", | ||
"milesBalance": "=$.milesBalance" | ||
} | ||
} | ||
} | ||
}, | ||
"reply": { | ||
"code": 200, | ||
"message": "" | ||
}, | ||
"schemas": { | ||
"reply": { | ||
"data": { | ||
"type": "json", | ||
"value": "{\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"type\":\"object\",\"properties\":{\"loyaltyStatus\":{\"type\":\"string\"},\"milesBalance\":{\"type\":\"number\"}}}", | ||
"fe_metadata": "{\n \"loyaltyStatus\": \"PLATINUM\",\n \"milesBalance\": 222673\n}" | ||
} | ||
}, | ||
"output": { | ||
"pathParams": { | ||
"type": "json", | ||
"value": "{\"type\":\"object\",\"properties\":{\"airline\":{\"type\":\"string\"},\"ffNumber\":{\"type\":\"string\"}},\"required\":[]}", | ||
"fe_metadata": "[{\"parameterName\":\"airline\",\"type\":\"string\"},{\"parameterName\":\"ffNumber\",\"type\":\"string\"}]" | ||
}, | ||
"headers": { | ||
"type": "json", | ||
"value": "{\"type\":\"object\",\"properties\":{\"Accept\":{\"type\":\"string\",\"visible\":false},\"Accept-Charset\":{\"type\":\"string\",\"visible\":false},\"Accept-Encoding\":{\"type\":\"string\",\"visible\":false},\"Content-Type\":{\"type\":\"string\",\"visible\":false},\"Content-Length\":{\"type\":\"string\",\"visible\":false},\"Connection\":{\"type\":\"string\",\"visible\":false},\"Cookie\":{\"type\":\"string\",\"visible\":false},\"Pragma\":{\"type\":\"string\",\"visible\":false}},\"required\":[]}", | ||
"fe_metadata": "[{\"parameterName\":\"Accept\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Accept-Charset\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Accept-Encoding\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Content-Type\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Content-Length\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Connection\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Cookie\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Pragma\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false}]" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"resources": [ | ||
{ | ||
"id": "flow:getLoyaltyStatus", | ||
"data": { | ||
"name": "getLoyaltyStatus", | ||
"description": "", | ||
"links": [ | ||
{ | ||
"id": 1, | ||
"from": "InvokeRESTService", | ||
"to": "Return", | ||
"type": "default" | ||
}, | ||
{ | ||
"id": 2, | ||
"from": "InvokeRESTService", | ||
"to": "Return1", | ||
"type": "error" | ||
} | ||
], | ||
"tasks": [ | ||
{ | ||
"id": "InvokeRESTService", | ||
"name": "InvokeRESTService", | ||
"activity": { | ||
"ref": "#rest", | ||
"input": { | ||
"Method": "GET", | ||
"Uri": "https://rishikeshpalve.github.io/mock-data/loyalty/{ffNumber}/ffData.json", | ||
"requestType": "application/json", | ||
"responseType": "application/json", | ||
"Use certificate for verification": false, | ||
"Server Certificate": "", | ||
"pathParams": { | ||
"mapping": { | ||
"ffNumber": "=$flow.ffNumber" | ||
} | ||
} | ||
}, | ||
"schemas": { | ||
"input": { | ||
"pathParams": { | ||
"type": "json", | ||
"value": "{\"type\":\"object\",\"properties\":{\"ffNumber\":{\"type\":\"string\"}},\"required\":[]}", | ||
"fe_metadata": "[{\"parameterName\":\"ffNumber\",\"type\":\"string\"}]" | ||
}, | ||
"headers": { | ||
"type": "json", | ||
"value": "{\"type\":\"object\",\"properties\":{\"Accept\":{\"type\":\"string\",\"visible\":false},\"Accept-Charset\":{\"type\":\"string\",\"visible\":false},\"Accept-Encoding\":{\"type\":\"string\",\"visible\":false},\"Content-Type\":{\"type\":\"string\",\"visible\":false},\"Content-Length\":{\"type\":\"string\",\"visible\":false},\"Connection\":{\"type\":\"string\",\"visible\":false},\"Cookie\":{\"type\":\"string\",\"visible\":false},\"Pragma\":{\"type\":\"string\",\"visible\":false}},\"required\":[]}", | ||
"fe_metadata": "[{\"parameterName\":\"Accept\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Accept-Charset\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Accept-Encoding\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Content-Type\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Content-Length\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Connection\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Cookie\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Pragma\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false}]" | ||
} | ||
}, | ||
"output": { | ||
"responseBody": { | ||
"type": "json", | ||
"value": "{\"$schema\":\"http://json-schema.org/draft-04/schema#\",\"type\":\"object\",\"properties\":{\"ffNumber\":{\"type\":\"string\"},\"loyaltyStatus\":{\"type\":\"string\"},\"milesBalance\":{\"type\":\"number\"}}}", | ||
"fe_metadata": "{\n \"ffNumber\": \"2835160728\",\n \"loyaltyStatus\": \"PLATINUM\",\n \"milesBalance\": 222673\n}" | ||
}, | ||
"headers": { | ||
"type": "json", | ||
"value": "{\"type\":\"object\",\"properties\":{\"Accept\":{\"type\":\"string\",\"visible\":false},\"Accept-Charset\":{\"type\":\"string\",\"visible\":false},\"Accept-Encoding\":{\"type\":\"string\",\"visible\":false},\"Content-Type\":{\"type\":\"string\",\"visible\":false},\"Content-Length\":{\"type\":\"string\",\"visible\":false},\"Connection\":{\"type\":\"string\",\"visible\":false},\"Cookie\":{\"type\":\"string\",\"visible\":false},\"Pragma\":{\"type\":\"string\",\"visible\":false}},\"required\":[]}", | ||
"fe_metadata": "[{\"parameterName\":\"Accept\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Accept-Charset\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Accept-Encoding\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Content-Type\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Content-Length\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Connection\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Cookie\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false},{\"parameterName\":\"Pragma\",\"type\":\"string\",\"repeating\":\"false\",\"required\":\"false\",\"visible\":false}]" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "Return", | ||
"name": "Return", | ||
"activity": { | ||
"ref": "#actreturn", | ||
"settings": { | ||
"mappings": { | ||
"loyaltyStatus": "=$activity[InvokeRESTService].responseBody.loyaltyStatus", | ||
"milesBalance": "=$activity[InvokeRESTService].responseBody.milesBalance" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "Return1", | ||
"name": "Return1", | ||
"activity": { | ||
"ref": "#actreturn", | ||
"settings": { | ||
"mappings": { | ||
"loyaltyStatus": "PLATINUM", | ||
"milesBalance": "=number.int64(227600)" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"metadata": { | ||
"input": [ | ||
{ | ||
"name": "airline_code", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "ffNumber", | ||
"type": "string" | ||
} | ||
], | ||
"output": [ | ||
{ | ||
"name": "loyaltyStatus", | ||
"type": "string" | ||
}, | ||
{ | ||
"name": "milesBalance", | ||
"type": "float64" | ||
} | ||
], | ||
"fe_metadata": { | ||
"input": "{\n \"airline_code\": \"UA\",\n \"ffNumber\": \"2835160728\"\n}", | ||
"output": "{\n \"loyaltyStatus\": \"PLATINUM\",\n \"milesBalance\": 222673\n}" | ||
} | ||
}, | ||
"explicitReply": true | ||
} | ||
} | ||
], | ||
"properties": [], | ||
"contrib": "W3sicmVmIjoiZ2l0LnRpYmNvLmNvbS9naXQvcHJvZHVjdC9pcGFhcy93aS1jb250cmliLmdpdC9jb250cmlidXRpb25zL0dlbmVyYWwiLCJzM2xvY2F0aW9uIjoiVGliY28vR2VuZXJhbCJ9XQ==", | ||
"fe_metadata": "UEsDBAoAAAAIAEQZyk6rqSRGFQAAABMAAAAIAAAAYXBwLmpzb26rViopykxPTy1yy8kvL1ayio6tBQBQSwECFAAKAAAACABEGcpOq6kkRhUAAAATAAAACAAAAAAAAAAAAAAAAAAAAAAAYXBwLmpzb25QSwUGAAAAAAEAAQA2AAAAOwAAAAAA" | ||
} |
Oops, something went wrong.