Skip to content

feat: add auth-request part #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion wit/data-collection.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package edgee:components;
package edgee:components@1.0.1;

interface data-collection {
type dict = list<tuple<string,string>>;
Expand Down Expand Up @@ -108,7 +108,21 @@ interface data-collection {

enum http-method { GET, PUT, POST, DELETE }

@since(version = 1.0.1)
record auth-request {
method: http-method,
url: string,
headers: dict,
token-duration: s64,
token-response-property: string,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcasalboni we might need more than one token right ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the AWS API (link), the response will include a Credentials property, which is a JSON object (see this structure).

So we could be ok with a single property, but we need to force the component developer to serialize and deserialize into/from string.

Also, I was wondering where that property is going to be injected in the settings - do we assume that we can use the same property? (like settings.Credentials if token-response-property=Credentials)

body: string,
}

page: func(e: event, settings: dict) -> result<edgee-request, string>;
track: func(e: event, settings: dict) -> result<edgee-request, string>;
user: func(e: event, settings:dict) -> result<edgee-request, string>;
@since(version = 1.0.1)
authenticate: func(settings: dict) -> result<option<auth-request>, string>;
@since(version = 1.0.1)
require-auth: func() -> bool;
}