Skip to content

Commit

Permalink
Merge pull request #34 from smswithoutborders/feature/grpc-api
Browse files Browse the repository at this point in the history
feat: modify platform.json > change `protocol` to `protocol_type`.
  • Loading branch information
PromiseFru authored Jul 8, 2024
2 parents 536daed + 7a755cb commit cc338c7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
9 changes: 9 additions & 0 deletions grpc_publisher_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,15 @@ def handle_oauth2_text(device_id, platform_name, service_type, payload, token):
success=True,
)

except OAuthError as e:
return error_response(
context,
response,
str(e),
grpc.StatusCode.INVALID_ARGUMENT,
_type="UNKNOWN",
)

except Exception as exc:
return error_response(
context,
Expand Down
30 changes: 15 additions & 15 deletions platforms.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[
{
"name": "gmail",
"shortcode": "g",
"service_type": "email",
"protocol": "oauth2",
"icon": "https://raw.githubusercontent.com/smswithoutborders/SMSWithoutBorders-Publisher/staging/icons/gmail.svg"
},
{
"name": "twitter",
"shortcode": "t",
"service_type": "text",
"protocol": "oauth2",
"icon": "https://raw.githubusercontent.com/smswithoutborders/SMSWithoutBorders-Publisher/staging/icons/twitter.svg"
}
]
{
"name": "gmail",
"shortcode": "g",
"service_type": "email",
"protocol_type": "oauth2",
"icon": "https://raw.githubusercontent.com/smswithoutborders/SMSWithoutBorders-Publisher/staging/icons/gmail.svg"
},
{
"name": "twitter",
"shortcode": "t",
"service_type": "text",
"protocol_type": "oauth2",
"icon": "https://raw.githubusercontent.com/smswithoutborders/SMSWithoutBorders-Publisher/staging/icons/twitter.svg"
}
]
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def check_platform_supported(platform_name, protocol):
"this platform will be implemented."
)

expected_protocol = supported_platform.get("protocol")
expected_protocol = supported_platform.get("protocol_type")

if protocol != expected_protocol:
raise NotImplementedError(
Expand Down

0 comments on commit cc338c7

Please sign in to comment.