Skip to content

Commit c61eb65

Browse files
smoghe-bwclaude
andcommitted
Fix Connect and Endpoint BXML verbs to match API docs
Connect: replace incorrect attributes (copied from Transfer) with the single documented attribute: eventCallbackUrl. Endpoint: remove EndpointAttributes interface — per the docs, Endpoint has no attributes, only text content (the endpoint ID). Generated from Claude9 with Claude Code Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5f545de commit c61eb65

4 files changed

Lines changed: 11 additions & 49 deletions

File tree

models/bxml/verbs/Connect.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@ import { NestableVerb } from '../NestableVerb';
22
import { Endpoint } from './Endpoint';
33

44
export interface ConnectAttributes {
5-
connectCompleteUrl?: string;
6-
connectCompleteMethod?: string;
7-
connectCompleteFallbackUrl?: string;
8-
connectCompleteFallbackMethod?: string;
9-
username?: string;
10-
password?: string;
11-
fallbackUsername?: string;
12-
fallbackPassword?: string;
13-
tag?: string;
5+
eventCallbackUrl?: string;
146
}
157

168
/**

models/bxml/verbs/Endpoint.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
import { Verb } from '../Verb';
22

3-
export interface EndpointAttributes {
4-
endpointId?: string;
5-
}
6-
73
/**
84
* @export
95
* @class Endpoint
106
* @extends {Verb}
117
* Represents an Endpoint verb
128
*/
139
export class Endpoint extends Verb {
14-
attributes: EndpointAttributes;
15-
1610
/**
1711
* Creates an instance of Endpoint
1812
* @param {string} endpointId The endpoint ID to connect to
19-
* @param {EndpointAttributes} attributes The attributes to add to the element
2013
*/
21-
constructor(endpointId: string, attributes?: EndpointAttributes) {
22-
super('Endpoint', endpointId, attributes);
14+
constructor(endpointId: string) {
15+
super('Endpoint', endpointId);
2316
}
2417
}

tests/unit/models/bxml/verbs/Connect.test.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,14 @@ import { Endpoint } from '../../../../../models/bxml/verbs/Endpoint';
44

55
describe('Connect', () => {
66
const attributes: ConnectAttributes = {
7-
connectCompleteUrl: 'https://initial.com',
8-
connectCompleteMethod: 'POST',
9-
connectCompleteFallbackUrl: 'https://initial.com',
10-
connectCompleteFallbackMethod: 'POST',
11-
username: 'initialUsername',
12-
password: 'initialPassword',
13-
fallbackUsername: 'initialFallbackUsername',
14-
fallbackPassword: 'initialFallbackPassword',
15-
tag: 'initialTag'
7+
eventCallbackUrl: 'https://example.com/events'
168
};
179

1810
const endpoint = new Endpoint('ep-123456');
1911

2012
test('should create a Connect Verb', () => {
2113
const connect = new Connect(attributes);
22-
const expected = '<Connect connectCompleteUrl="https://initial.com" connectCompleteMethod="POST" connectCompleteFallbackUrl="https://initial.com" connectCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag"/>';
14+
const expected = '<Connect eventCallbackUrl="https://example.com/events"/>';
2315

2416
expect(connect).toBeInstanceOf(Connect);
2517
expect(connect).toBeInstanceOf(Verb);
@@ -28,7 +20,7 @@ describe('Connect', () => {
2820

2921
test('should create a Connect Verb with nested Endpoint', () => {
3022
const connect = new Connect(attributes, endpoint);
31-
const expected = '<Connect connectCompleteUrl="https://initial.com" connectCompleteMethod="POST" connectCompleteFallbackUrl="https://initial.com" connectCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag"><Endpoint>ep-123456</Endpoint></Connect>';
23+
const expected = '<Connect eventCallbackUrl="https://example.com/events"><Endpoint>ep-123456</Endpoint></Connect>';
3224

3325
expect(connect).toBeInstanceOf(Connect);
3426
expect(connect).toBeInstanceOf(Verb);
@@ -38,7 +30,7 @@ describe('Connect', () => {
3830
test('should create a Connect Verb with multiple nested Endpoints', () => {
3931
const endpoint2 = new Endpoint('ep-789012');
4032
const connect = new Connect(attributes, [endpoint, endpoint2]);
41-
const expected = '<Connect connectCompleteUrl="https://initial.com" connectCompleteMethod="POST" connectCompleteFallbackUrl="https://initial.com" connectCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag"><Endpoint>ep-123456</Endpoint><Endpoint>ep-789012</Endpoint></Connect>';
33+
const expected = '<Connect eventCallbackUrl="https://example.com/events"><Endpoint>ep-123456</Endpoint><Endpoint>ep-789012</Endpoint></Connect>';
4234

4335
expect(connect).toBeInstanceOf(Connect);
4436
expect(connect).toBeInstanceOf(Verb);
@@ -47,7 +39,7 @@ describe('Connect', () => {
4739

4840
test('should test the addEndpoints method when no verbs are initially nested', () => {
4941
const connect = new Connect(attributes);
50-
const expected = '<Connect connectCompleteUrl="https://initial.com" connectCompleteMethod="POST" connectCompleteFallbackUrl="https://initial.com" connectCompleteFallbackMethod="POST" username="initialUsername" password="initialPassword" fallbackUsername="initialFallbackUsername" fallbackPassword="initialFallbackPassword" tag="initialTag"><Endpoint>ep-123456</Endpoint></Connect>';
42+
const expected = '<Connect eventCallbackUrl="https://example.com/events"><Endpoint>ep-123456</Endpoint></Connect>';
5143

5244
connect.addEndpoints(endpoint);
5345
expect(connect.toBxml()).toBe(expected);
Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
import { Verb } from '../../../../../models/bxml/Verb';
2-
import { Endpoint, EndpointAttributes } from '../../../../../models/bxml/verbs/Endpoint';
2+
import { Endpoint } from '../../../../../models/bxml/verbs/Endpoint';
33

44
describe('Endpoint', () => {
5-
const attributes: EndpointAttributes = {
6-
endpointId: 'ep-123456'
7-
};
8-
9-
const expected = '<Endpoint endpointId="ep-123456">ep-123456</Endpoint>';
10-
const expectedNoAttributes = '<Endpoint>ep-123456</Endpoint>';
11-
12-
test('should create an Endpoint Verb with attributes', () => {
13-
const endpoint = new Endpoint('ep-123456', attributes);
14-
15-
expect(endpoint).toBeInstanceOf(Endpoint);
16-
expect(endpoint).toBeInstanceOf(Verb);
17-
expect(endpoint.toBxml()).toBe(expected);
18-
});
19-
20-
test('should create an Endpoint Verb without attributes', () => {
5+
test('should create an Endpoint Verb', () => {
216
const endpoint = new Endpoint('ep-123456');
227

238
expect(endpoint).toBeInstanceOf(Endpoint);
249
expect(endpoint).toBeInstanceOf(Verb);
25-
expect(endpoint.toBxml()).toBe(expectedNoAttributes);
10+
expect(endpoint.toBxml()).toBe('<Endpoint>ep-123456</Endpoint>');
2611
});
2712
});

0 commit comments

Comments
 (0)