Skip to content

Commit

Permalink
update source to handle 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CLEMENTINATOR committed Feb 4, 2025
1 parent a05afc1 commit 1cf7357
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions DataCollectionComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ This is the main class that you will need to implement. It should inherit from
These functions are called by the Edgee runtime to get the HTTP request to make to the provider's API for each event type.
*/
public class DataCollectionImpl: IDataCollection {
public static IDataCollection.EdgeeRequest Page(IDataCollection.Event e, List<(string, string)> creds) {
public static IDataCollection.EdgeeRequest Page(IDataCollection.Event e, List<(string, string)> settings) {
/*
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"
then
foreach (var cred in creds)
foreach (var settings in settings)
{
Console.WriteLine($"{cred.Item1}: {cred.Item2}");
Console.WriteLine($"{settings.Item1}: {cred.Item2}");
}
will print:
test_project_id: 123456789
Expand All @@ -34,7 +34,7 @@ public static IDataCollection.EdgeeRequest Page(IDataCollection.Event e, List<(s
string body = "{\"event\": \"page\"}";
return new IDataCollection.EdgeeRequest(IDataCollection.HttpMethod.POST, url, headers, body);
}
public static IDataCollection.EdgeeRequest Track(IDataCollection.Event e, List<(string, string)> creds) {
public static IDataCollection.EdgeeRequest Track(IDataCollection.Event e, List<(string, string)> settings) {
string url = "https://example.com/";
var headers = new List<(string, string)>
{
Expand All @@ -44,7 +44,7 @@ public static IDataCollection.EdgeeRequest Track(IDataCollection.Event e, List<(
string body = "{\"event\": \"track\"}";
return new IDataCollection.EdgeeRequest(IDataCollection.HttpMethod.POST, url, headers, body);
}
public static IDataCollection.EdgeeRequest User(IDataCollection.Event e, List<(string, string)> creds) {
public static IDataCollection.EdgeeRequest User(IDataCollection.Event e, List<(string, string)> settings) {
string url = "https://example.com/";
var headers = new List<(string, string)>
{
Expand Down

0 comments on commit 1cf7357

Please sign in to comment.