Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
eladcon committed May 30, 2024
1 parent c937acb commit aea24c7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion sns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ npm i @winglibs/sns
```js
bring sns;

let client = new sns.MobileClient();
let client = new sns.MobileNotifications();

test "sending an SMS" {
client.publish(PhoneNumber: "+14155552671", Message: "Hello");
Expand Down
4 changes: 2 additions & 2 deletions sns/aws.w
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ bring cloud;
bring "./types.w" as types;
bring aws;

pub class MobileClient_aws impl types.IMobileClient {
pub class MobileNotifications_aws impl types.IMobileNotifications {
pub inflight publish(options: types.PublishOptions): types.PublishResult {
return MobileClient_aws._publish(options);
return MobileNotifications_aws._publish(options);
}

pub onLift(host: std.IInflightHost, ops: Array<str>) {
Expand Down
2 changes: 1 addition & 1 deletion sns/lib.test.w
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
bring "./lib.w" as sns;

let client = new sns.MobileClient();
let client = new sns.MobileNotifications();

test "will send an SMS" {
client.publish(PhoneNumber: "+14155552671", Message: "Hello");
Expand Down
14 changes: 7 additions & 7 deletions sns/lib.w
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ bring "./types.w" as types;
bring "./sim.w" as sim;
bring "./aws.w" as aws;

/// MobileClient is a client for interacting with SNS mobile service.
/// MobileNotifications is a client for interacting with SNS mobile service.
/// No cloud resources are created when using this class.
/// When running the simulator in a non test environment, it will use the
/// actual cloud implementation.
pub class MobileClient impl types.IMobileClient {
inner: types.IMobileClient;
pub class MobileNotifications impl types.IMobileNotifications {
inner: types.IMobileNotifications;
new() {
let target = util.env("WING_TARGET");
if target == "sim" {
if std.Node.of(this).app.isTestEnvironment {
this.inner = new sim.MobileClient_sim();
this.inner = new sim.MobileNotifications_sim();
} else {
this.inner = new aws.MobileClient_aws();
this.inner = new aws.MobileNotifications_aws();
}
} elif target == "tf-aws" {
this.inner = new aws.MobileClient_aws();
this.inner = new aws.MobileNotifications_aws();
} elif target == "awscdk" {
this.inner = new aws.MobileClient_aws();
this.inner = new aws.MobileNotifications_aws();
} else {
throw "Unsupported target {target}";
}
Expand Down
2 changes: 1 addition & 1 deletion sns/sim.w
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ bring cloud;
bring util;
bring "./types.w" as types;

pub class MobileClient_sim impl types.IMobileClient {
pub class MobileNotifications_sim impl types.IMobileNotifications {
store: cloud.Bucket;
new() {
this.store = new cloud.Bucket() as "Inbox";
Expand Down
2 changes: 1 addition & 1 deletion sns/types.w
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ pub struct PublishResult {
SequenceNumber: str?;
}

pub interface IMobileClient {
pub interface IMobileNotifications {
inflight publish(options: PublishOptions): PublishResult;
}

0 comments on commit aea24c7

Please sign in to comment.