Skip to content

Commit 2396936

Browse files
committed
Introduce Controller API to the package
1 parent f0bc571 commit 2396936

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

Diff for: ballerina/annotation.bal

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616

1717
# Configuration for a WebSub Hub service.
1818
#
19-
# + leaseSeconds - The period for which the subscription is expected to be active in the `hub`
20-
# + webHookConfig - HTTP client configurations for subscription/unsubscription intent verification
19+
# + leaseSeconds - The period for which the subscription is expected to be active in the `hub`
20+
# + webHookConfig - HTTP client configurations for subscription/unsubscription intent verification
21+
# + autoVerifySubscription - Configuration to enable or disable automatic subscription verification
2122
public type ServiceConfiguration record {|
2223
int leaseSeconds?;
2324
ClientConfiguration webHookConfig?;
25+
boolean autoVerifySubscription = false;
2426
|};
2527

2628
# WebSub Hub Configuration for the service.

Diff for: ballerina/http_service.bal

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ isolated service class HttpService {
2929
private final boolean isSubscriptionValidationAvailable;
3030
private final boolean isUnsubscriptionAvailable;
3131
private final boolean isUnsubscriptionValidationAvailable;
32+
private final Controller hubController;
3233

3334
isolated function init(HttpToWebsubhubAdaptor adaptor, string hubUrl, int leaseSeconds,
3435
*ClientConfiguration clientConfig) {
@@ -41,6 +42,7 @@ isolated service class HttpService {
4142
self.isSubscriptionValidationAvailable = isMethodAvailable("onSubscriptionValidation", methodNames);
4243
self.isUnsubscriptionAvailable = isMethodAvailable("onUnsubscription", methodNames);
4344
self.isUnsubscriptionValidationAvailable = isMethodAvailable("onUnsubscriptionValidation", methodNames);
45+
self.hubController = new;
4446
}
4547

4648
isolated resource function post .(http:Caller caller, http:Request request, http:Headers headers) returns Error? {

Diff for: ballerina/hub_controller.bal

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) 2025 WSO2 LLC. (http://www.wso2.com).
2+
//
3+
// WSO2 LLC. licenses this file to you under the Apache License,
4+
// Version 2.0 (the "License"); you may not use this file except
5+
// in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing,
11+
// software distributed under the License is distributed on an
12+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
// KIND, either express or implied. See the License for the
14+
// specific language governing permissions and limitations
15+
// under the License.
16+
17+
// todo: implement this properly
18+
19+
public isolated class Controller {
20+
21+
public function markAsVerified(Subscription|Unsubscription subscription) returns error? {
22+
return error("Not implemented yet");
23+
}
24+
25+
function skipSubscriptionVerification(Subscription|Unsubscription subscription) returns boolean {
26+
return false;
27+
}
28+
}

0 commit comments

Comments
 (0)