ServiceHooksRestClient class

Base class that should be used (derived from) to make requests to VSS REST apis

Extends

Constructors

ServiceHooksRestClient(IVssRestClientOptions)

Methods

createSubscription(Subscription)

Create a subscription.

createSubscriptionsQuery(SubscriptionsQuery)

Query for service hook subscriptions.

createTestNotification(Notification, boolean)

Sends a test notification. This is useful for verifying the configuration of an updated or new service hooks subscription.

deleteSubscription(string)

Delete a specific service hooks subscription.

getConsumer(string, string)

Get a specific consumer service. Optionally filter out consumer actions that do not support any event types for the specified publisher.

getConsumerAction(string, string, string)

Get details about a specific consumer action.

getEventType(string, string)

Get a specific event type.

getNotification(string, number)

Get a specific notification for a subscription.

getNotifications(string, number, NotificationStatus, NotificationResult)

Get a list of notifications for a specific subscription. A notification includes details about the event, the request to and the response from the consumer service.

getPublisher(string)

Get a specific service hooks publisher.

getSubscription(string)

Get a specific service hooks subscription.

getSubscriptionDiagnostics(string)
listConsumerActions(string, string)

Get a list of consumer actions for a specific consumer.

listConsumers(string)

Get a list of available service hook consumer services. Optionally filter by consumers that support at least one event type from the specific publisher.

listEventTypes(string)

Get the event types for a specific publisher.

listPublishers()

Get a list of publishers.

listSubscriptions(string, string, string, string)

Get a list of subscriptions.

publishExternalEvent(string, string)

Publish an external event.

queryInputValues(InputValuesQuery, string)
queryNotifications(NotificationsQuery)

Query for notifications. A notification includes details about the event, the request to and the response from the consumer service.

queryPublishers(PublishersQuery)

Query for service hook publishers.

replaceSubscription(Subscription, string)

Update a subscription. <param name="subscriptionId">ID for a subscription that you wish to update.</param>

updateSubscriptionDiagnostics(UpdateSubscripitonDiagnosticsParameters, string)

Constructor Details

ServiceHooksRestClient(IVssRestClientOptions)

new ServiceHooksRestClient(options: IVssRestClientOptions)

Parameters

Method Details

createSubscription(Subscription)

Create a subscription.

function createSubscription(subscription: Subscription): Promise<Subscription>

Parameters

subscription
Subscription

Subscription to be created.

Returns

Promise<Subscription>

createSubscriptionsQuery(SubscriptionsQuery)

Query for service hook subscriptions.

function createSubscriptionsQuery(query: SubscriptionsQuery): Promise<SubscriptionsQuery>

Parameters

Returns

createTestNotification(Notification, boolean)

Sends a test notification. This is useful for verifying the configuration of an updated or new service hooks subscription.

function createTestNotification(testNotification: Notification, useRealData?: boolean): Promise<Notification>

Parameters

testNotification
Notification
useRealData

boolean

Only allow testing with real data in existing subscriptions.

Returns

Promise<Notification>

deleteSubscription(string)

Delete a specific service hooks subscription.

function deleteSubscription(subscriptionId: string): Promise<void>

Parameters

subscriptionId

string

ID for a subscription.

Returns

Promise<void>

getConsumer(string, string)

Get a specific consumer service. Optionally filter out consumer actions that do not support any event types for the specified publisher.

function getConsumer(consumerId: string, publisherId?: string): Promise<Consumer>

Parameters

consumerId

string

ID for a consumer.

publisherId

string

Returns

Promise<Consumer>

getConsumerAction(string, string, string)

Get details about a specific consumer action.

function getConsumerAction(consumerId: string, consumerActionId: string, publisherId?: string): Promise<ConsumerAction>

Parameters

consumerId

string

ID for a consumer.

consumerActionId

string

ID for a consumerActionId.

publisherId

string

Returns

Promise<ConsumerAction>

getEventType(string, string)

Get a specific event type.

function getEventType(publisherId: string, eventTypeId: string): Promise<EventTypeDescriptor>

Parameters

publisherId

string

ID for a publisher.

eventTypeId

string

Returns

getNotification(string, number)

Get a specific notification for a subscription.

function getNotification(subscriptionId: string, notificationId: number): Promise<Notification>

Parameters

subscriptionId

string

ID for a subscription.

notificationId

number

Returns

Promise<Notification>

getNotifications(string, number, NotificationStatus, NotificationResult)

Get a list of notifications for a specific subscription. A notification includes details about the event, the request to and the response from the consumer service.

function getNotifications(subscriptionId: string, maxResults?: number, status?: NotificationStatus, result?: NotificationResult): Promise<Notification[]>

Parameters

subscriptionId

string

ID for a subscription.

maxResults

number

Maximum number of notifications to return. Default is 100.

status
NotificationStatus

Get only notifications with this status.

result
NotificationResult

Get only notifications with this result type.

Returns

Promise<Notification[]>

getPublisher(string)

Get a specific service hooks publisher.

function getPublisher(publisherId: string): Promise<Publisher>

Parameters

publisherId

string

ID for a publisher.

Returns

Promise<Publisher>

getSubscription(string)

Get a specific service hooks subscription.

function getSubscription(subscriptionId: string): Promise<Subscription>

Parameters

subscriptionId

string

ID for a subscription.

Returns

Promise<Subscription>

getSubscriptionDiagnostics(string)

function getSubscriptionDiagnostics(subscriptionId: string): Promise<SubscriptionDiagnostics>

Parameters

subscriptionId

string

Returns

listConsumerActions(string, string)

Get a list of consumer actions for a specific consumer.

function listConsumerActions(consumerId: string, publisherId?: string): Promise<ConsumerAction[]>

Parameters

consumerId

string

ID for a consumer.

publisherId

string

Returns

Promise<ConsumerAction[]>

listConsumers(string)

Get a list of available service hook consumer services. Optionally filter by consumers that support at least one event type from the specific publisher.

function listConsumers(publisherId?: string): Promise<Consumer[]>

Parameters

publisherId

string

Returns

Promise<Consumer[]>

listEventTypes(string)

Get the event types for a specific publisher.

function listEventTypes(publisherId: string): Promise<EventTypeDescriptor[]>

Parameters

publisherId

string

ID for a publisher.

Returns

Promise<EventTypeDescriptor[]>

listPublishers()

Get a list of publishers.

function listPublishers(): Promise<Publisher[]>

Returns

Promise<Publisher[]>

listSubscriptions(string, string, string, string)

Get a list of subscriptions.

function listSubscriptions(publisherId?: string, eventType?: string, consumerId?: string, consumerActionId?: string): Promise<Subscription[]>

Parameters

publisherId

string

ID for a subscription.

eventType

string

The event type to filter on (if any).

consumerId

string

ID for a consumer.

consumerActionId

string

ID for a consumerActionId.

Returns

Promise<Subscription[]>

publishExternalEvent(string, string)

Publish an external event.

function publishExternalEvent(publisherId: string, channelId?: string): Promise<PublisherEvent[]>

Parameters

publisherId

string

channelId

string

Returns

Promise<PublisherEvent[]>

queryInputValues(InputValuesQuery, string)

function queryInputValues(inputValuesQuery: InputValuesQuery, publisherId: string): Promise<InputValuesQuery>

Parameters

inputValuesQuery
InputValuesQuery
publisherId

string

Returns

Promise<InputValuesQuery>

queryNotifications(NotificationsQuery)

Query for notifications. A notification includes details about the event, the request to and the response from the consumer service.

function queryNotifications(query: NotificationsQuery): Promise<NotificationsQuery>

Parameters

Returns

queryPublishers(PublishersQuery)

Query for service hook publishers.

function queryPublishers(query: PublishersQuery): Promise<PublishersQuery>

Parameters

Returns

Promise<PublishersQuery>

replaceSubscription(Subscription, string)

Update a subscription. <param name="subscriptionId">ID for a subscription that you wish to update.</param>

function replaceSubscription(subscription: Subscription, subscriptionId?: string): Promise<Subscription>

Parameters

subscription
Subscription
subscriptionId

string

Returns

Promise<Subscription>

updateSubscriptionDiagnostics(UpdateSubscripitonDiagnosticsParameters, string)

function updateSubscriptionDiagnostics(updateParameters: UpdateSubscripitonDiagnosticsParameters, subscriptionId: string): Promise<SubscriptionDiagnostics>

Parameters

subscriptionId

string

Returns