Skip to content

Commit 2c6e6c4

Browse files
committed
Update package spec
1 parent 4cb3fdb commit 2c6e6c4

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Diff for: docs/spec/spec.md

+31
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The conforming implementation of the specification is released and included in t
3535
* 2.2.2.7. [onUnsubscritpion](#2227-onunsubscritpion)
3636
* 2.2.2.8. [onUnsubscriptionValidation](#2228-onunsubscriptionvalidation)
3737
* 2.2.2.9. [onUnsubscriptionIntenVerified](#2229-onunsubscriptionintenverified)
38+
* 2.2.3. [Controller](#223-controller)
3839
* 2.3. [Hub Client](#23-hub-client)
3940
* 2.3.1. [Initialization](#231-initialization)
4041
* 2.3.2. [Distribute Content](#232-distribute-content)
@@ -223,9 +224,11 @@ Apart from the listener level configurations a `hub` will require few additional
223224
#
224225
# + leaseSeconds - The period for which the subscription is expected to be active in the `hub`
225226
# + webHookConfig - HTTP client configurations for subscription/unsubscription intent verification
227+
# + autoVerifySubscription - Configuration to enable or disable automatic subscription verification
226228
public type ServiceConfiguration record {|
227229
int leaseSeconds?;
228230
ClientConfiguration webHookConfig?;
231+
boolean autoVerifySubscription = false;
229232
|};
230233
```
231234

@@ -375,6 +378,34 @@ This is due to the limited information in the WebSub specification on the relati
375378
In the event of a bad request from the `publisher` or the `subscriber`, the WebSubHub dispatcher will automatically send
376379
back the appropriate response to the client.
377380

381+
#### 2.2.3. Controller
382+
383+
When `autoVerifySubscription` is enabled in the `websubhub:ServiceConfig` annotation, the `websubhub:Controller` can be used to mark a
384+
subscription or unsubscription as verified. This class is initialized exclusively within the WebSubHub framework and provides the
385+
following API.
386+
387+
```ballerina
388+
type Controller object {
389+
390+
# Marks a particular subscription as verified.
391+
#
392+
# + subscription - The `websubhub:Subscription` or `websubhub:Unsubscription` message
393+
# + return - A `websubhub:Error` if the `websubhub:Service` has not enabled subscription auto-verification,
394+
# or else nil
395+
public isolated function markAsVerified(Subscription|Unsubscription subscription) returns Error?;
396+
397+
# Checks whether a particular subscription has been marked as verified. Please note that this
398+
# is an internal API which is used within the WebSubHub dispatcher to identify whether
399+
# to skip the subscrition intent verification for the subscription or unsubscription.
400+
#
401+
# + subscription - The `websubhub:Subscription` or `websubhub:Unsubscription` message
402+
# + return - A `true` if the subscrition/unsubscription has been marked as verified or else `false`
403+
isolated function skipSubscriptionVerification(Subscription|Unsubscription subscription) returns boolean;
404+
};
405+
```
406+
407+
> Note: The `websubhub:Controller` will be available only as an optional parameter in the `onSubscription` and `onUnsubscription` remote methods of the `websubhub:Service`.
408+
378409
### 2.3. Hub Client
379410

380411
In accordance with the [WebSub specification](https://www.w3.org/TR/websub/#content-distribution), `WebSubHub` package

0 commit comments

Comments
 (0)