Skip to content

Commit

Permalink
Access modifiers winglang/wing#4133
Browse files Browse the repository at this point in the history
  • Loading branch information
skorfmann committed Sep 19, 2023
1 parent b0ea031 commit 3301d43
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions examples/api-basic-auth-middleware/basic-auth.w
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
bring cloud;

class Utils {
extern "./utils.js" static inflight base64decode(value: str): str;
extern "./utils.js" static inflight base64encode(value: str): str;
extern "./utils.js" pub static inflight base64decode(value: str): str;
extern "./utils.js" pub static inflight base64encode(value: str): str;
init() { }
}

Expand All @@ -20,7 +20,7 @@ class BasicAuth {
this.password = password ?? "admin";
}

inflight call(req: cloud.ApiRequest): bool {
pub inflight call(req: cloud.ApiRequest): bool {
try {
let authHeader = this.authHeader(req.headers);
let credentials = this.authCredentials(authHeader);
Expand All @@ -33,7 +33,7 @@ class BasicAuth {
}
}

private inflight authCredentials(header: str): Credentials {
inflight authCredentials(header: str): Credentials {
let auth = Utils.base64decode(header.split(" ").at(1));
let splittedAuth = auth.split(":");
let username = splittedAuth.at(0);
Expand All @@ -45,7 +45,7 @@ class BasicAuth {
};
}
// workaround for https://github.com/winglang/wing/issues/3205
private inflight authHeader(headers: Map<str>?): str {
inflight authHeader(headers: Map<str>?): str {
if (this.authHeaderPresent(headers)) {
let authHeaderOptional = headers?.get("authorization");
let var authHeader = headers?.get("Authorization");
Expand All @@ -64,7 +64,7 @@ class BasicAuth {
}

// workaround for https://github.com/winglang/wing/issues/3205
private inflight authHeaderPresent(headers: Map<str>?): bool {
inflight authHeaderPresent(headers: Map<str>?): bool {
if (headers?.has("authorization") == false) && (headers?.has("Authorization") == false) {
return false;
}
Expand Down
12 changes: 6 additions & 6 deletions examples/api-basic-auth/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ bring util;
bring http;

class Utils {
extern "./utils.js" static inflight base64decode(value: str): str;
extern "./utils.js" static inflight base64encode(value: str): str;
extern "./utils.js" pub static inflight base64decode(value: str): str;
extern "./utils.js" pub static inflight base64encode(value: str): str;
init() { }
}

Expand All @@ -22,7 +22,7 @@ class BasicAuth {
this.password = password ?? "admin";
}

inflight call(req: cloud.ApiRequest): bool {
pub inflight call(req: cloud.ApiRequest): bool {
try {
let authHeader = this.authHeader(req.headers);
let credentials = this.authCredentials(authHeader);
Expand All @@ -35,7 +35,7 @@ class BasicAuth {
}
}

private inflight authCredentials(header: str): Credentials {
inflight authCredentials(header: str): Credentials {
let auth = Utils.base64decode(header.split(" ").at(1));
let splittedAuth = auth.split(":");
let username = splittedAuth.at(0);
Expand All @@ -47,7 +47,7 @@ class BasicAuth {
};
}
// workaround for https://github.com/winglang/wing/issues/3205
private inflight authHeader(headers: Map<str>?): str {
inflight authHeader(headers: Map<str>?): str {
if (this.authHeaderPresent(headers)) {
let authHeaderOptional = headers?.get("authorization");
let var authHeader = headers?.get("Authorization");
Expand All @@ -66,7 +66,7 @@ class BasicAuth {
}

// workaround for https://github.com/winglang/wing/issues/3205
private inflight authHeaderPresent(headers: Map<str>?): bool {
inflight authHeaderPresent(headers: Map<str>?): bool {
if (headers?.has("authorization") == false) && (headers?.has("Authorization") == false) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/api-counter-ssr/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ bring util;
bring http;

class Utils {
extern "./utils.js" static inflight render(template: str, value: num): str;
extern "./utils.js" pub static inflight render(template: str, value: num): str;
// This is a workaround for the pending fs module
// https://github.com/winglang/wing/issues/3096
extern "./utils.js" static readFile(filePath: str): str;
extern "./utils.js" pub static readFile(filePath: str): str;
init() { }
}

Expand Down
2 changes: 1 addition & 1 deletion examples/api-counter-ssr/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/stock-poller/main.w
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TwelveDataApi {
);
}

inflight stockUpdates(tickerSymbol: str): http.Response {
pub inflight stockUpdates(tickerSymbol: str): http.Response {
return http.get("https://api.twelvedata.com/time_series?symbol=${tickerSymbol}&interval=1min&outputsize=1&apikey=${this.key.value()}");
}
}
Expand Down

0 comments on commit 3301d43

Please sign in to comment.