Skip to content
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

Update wit #2

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
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
21 changes: 11 additions & 10 deletions dc_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,46 @@ class DataCollection(exports.DataCollection):
'''
The page method should return an EdgeeRequest object that contains the
information needed to make an HTTP request to the provider's API to
send page data, passing the event information formatted for the provider's API as well as the credentials
send page data, passing the event information formatted for the provider's API as well as the settings
needed to authenticate with the provider's API.
'''
def page(self, e: data_collection.Event, cred: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
def page(self, e: data_collection.Event, settings: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
'''
cred is a list of tuple, which contains each key and secret for the provider
settings is a list of tuple, which contains each key and secret for the provider
for example, if your component is set to use
[[components.data_collection]]
name = "my_component"
component = "outpout.wasm"
credentials.test_project_id = "123456789"
credentials.test_write_key = "abcdefg"
settings.test_project_id = "123456789"
settings.test_write_key = "abcdefg"

cred will be [("test_project_id", "123456789"), ("test_write_key", "abcdefg")]
settings will be [("test_project_id", "123456789"), ("test_write_key", "abcdefg")]
'''
'''
the function should return the following:
return provider.EdgeeRequest(
method=provider.HttpMethod.GET,
url="https://yourwebsite.com",
headers={},
forward_client_headers=true,
body="")
'''
raise NotImplementedError("page is not implemented")

'''
The track method should return an EdgeeRequest object that contains the
information needed to make an HTTP request to the provider's API to
send track data, passing the event information formatted for the provider's API as well as the credentials
send track data, passing the event information formatted for the provider's API as well as the settings
needed to authenticate with the provider's API.
'''
def track(self, e: data_collection.Event, cred: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
def track(self, e: data_collection.Event, settings: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
raise NotImplementedError("track is not implemented")

'''
The user method should return an EdgeeRequest object that contains the
information needed to make an HTTP request to the provider's API to
send user data, passing the event information formatted for the provider's API as well as the credentials
send user data, passing the event information formatted for the provider's API as well as the settings
needed to authenticate with the provider's API.
'''
def user(self, e: data_collection.Event, cred: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
def user(self, e: data_collection.Event, settings: List[Tuple[str, str]]) -> data_collection.EdgeeRequest:
raise NotImplementedError("user is not implemented")
6 changes: 3 additions & 3 deletions wit/deps.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[protocols]
url = "https://github.com/edgee-cloud/edgee-wit/archive/refs/tags/v0.3.0.tar.gz"
sha256 = "4d412367fff6f826280acbe95f7067e362d9299d76e60994981e7e27c74d1576"
sha512 = "65021cace5ed07990fdfb563699accb975a31cb22311739ff6189849b969b06b564a0f8f72de154fd086ba474757d3cffaef0175778e4989c467280cf1c86284"
url = "https://github.com/edgee-cloud/edgee-wit/archive/refs/tags/v0.4.0.tar.gz"
sha256 = "8b5c8ea97c81d1d6cf4f227e75afb8c4dc5c0a411c3a0401fb7e4f7b745e21ba"
sha512 = "16771cd12095409e7c4857a8f5c0b4ad680959e3c35dcd7999e11131bcce05d3b1a1b829daefceabbd853ae5b7f6453e3e359ddfbdebd6e2a94db6c55780368f"
2 changes: 1 addition & 1 deletion wit/deps.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
protocols="https://github.com/edgee-cloud/edgee-wit/archive/refs/tags/v0.3.0.tar.gz"
protocols="https://github.com/edgee-cloud/edgee-wit/archive/refs/tags/v0.4.0.tar.gz"
4 changes: 2 additions & 2 deletions wit/deps/protocols/consent-mapping.wit
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package edgee:protocols;

interface consent-mapping {
type config = list<tuple<string,string>>;
type dict = list<tuple<string,string>>;

enum consent {
pending,
granted,
denied,
}

map: func(cookie: string, config: config) -> option<consent>;
map: func(cookie: string, settings: dict) -> option<consent>;
}
7 changes: 4 additions & 3 deletions wit/deps/protocols/data-collection.wit
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,13 @@ interface data-collection {
method: http-method,
url: string,
headers: dict,
forward-client-headers: bool,
body: string,
}

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

page: func(e: event, cred: dict) -> result<edgee-request, string>;
track: func(e: event, cred: dict) -> result<edgee-request, string>;
user: func(e: event, cred:dict) -> result<edgee-request, 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>;
}