Skip to content

Commit 8790efc

Browse files
committed
update source to handle 0.4.0
1 parent e0fa8a5 commit 8790efc

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

DataCollectionComponent.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ This is the main class that you will need to implement. It should inherit from
77
These functions are called by the Edgee runtime to get the HTTP request to make to the provider's API for each event type.
88
*/
99
public class DataCollectionImpl: IDataCollection {
10-
public static IDataCollection.EdgeeRequest Page(IDataCollection.Event e, List<(string, string)> creds) {
10+
public static IDataCollection.EdgeeRequest Page(IDataCollection.Event e, List<(string, string)> settings) {
1111
/*
12-
cred is a list of tuple, which contains each key and secret for the provider
12+
settings is a list of tuple, which contains each key and secret for the provider
1313
for example, if your component is set to use
1414
[[components.data_collection]]
1515
name = "my_component"
1616
component = "outpout.wasm"
17-
credentials.test_project_id = "123456789"
18-
credentials.test_write_key = "abcdefg"
17+
settings.test_project_id = "123456789"
18+
settings.test_write_key = "abcdefg"
1919
then
20-
foreach (var cred in creds)
20+
foreach (var settings in settings)
2121
{
22-
Console.WriteLine($"{cred.Item1}: {cred.Item2}");
22+
Console.WriteLine($"{settings.Item1}: {cred.Item2}");
2323
}
2424
will print:
2525
test_project_id: 123456789
@@ -32,27 +32,30 @@ public static IDataCollection.EdgeeRequest Page(IDataCollection.Event e, List<(s
3232
("Content-Type", "application/json")
3333
};
3434
string body = "{\"event\": \"page\"}";
35-
return new IDataCollection.EdgeeRequest(IDataCollection.HttpMethod.POST, url, headers, body);
35+
bool forward_client_headers = true;
36+
return new IDataCollection.EdgeeRequest(IDataCollection.HttpMethod.POST, url, headers, forward_client_headers, body);
3637
}
37-
public static IDataCollection.EdgeeRequest Track(IDataCollection.Event e, List<(string, string)> creds) {
38+
public static IDataCollection.EdgeeRequest Track(IDataCollection.Event e, List<(string, string)> settings) {
3839
string url = "https://example.com/";
3940
var headers = new List<(string, string)>
4041
{
4142
("Authorization", "Bearer exampleToken123"),
4243
("Content-Type", "application/json")
4344
};
4445
string body = "{\"event\": \"track\"}";
45-
return new IDataCollection.EdgeeRequest(IDataCollection.HttpMethod.POST, url, headers, body);
46+
bool forward_client_headers = true;
47+
return new IDataCollection.EdgeeRequest(IDataCollection.HttpMethod.POST, url, headers, forward_client_headers, body);
4648
}
47-
public static IDataCollection.EdgeeRequest User(IDataCollection.Event e, List<(string, string)> creds) {
49+
public static IDataCollection.EdgeeRequest User(IDataCollection.Event e, List<(string, string)> settings) {
4850
string url = "https://example.com/";
4951
var headers = new List<(string, string)>
5052
{
5153
("Authorization", "Bearer exampleToken123"),
5254
("Content-Type", "application/json")
5355
};
5456
string body = "{\"event\": \"user\"}";
55-
return new IDataCollection.EdgeeRequest(IDataCollection.HttpMethod.POST, url, headers, body);
57+
bool forward_client_headers = true;
58+
return new IDataCollection.EdgeeRequest(IDataCollection.HttpMethod.POST, url, headers, forward_client_headers, body);
5659
}
5760
}
5861

0 commit comments

Comments
 (0)