Skip to content

Commit b7c59bc

Browse files
diego-signalwirehey-augustDevon-White
authored
Rename LAML bin to CXML Script (#162)
* Rename LAML bin to CXML Script * rename external_laml_handler to cxml_webhook * rename routes * updated _spec.yml --------- Co-authored-by: August <[email protected]> Co-authored-by: Devon <[email protected]> Co-authored-by: Devon-White <[email protected]>
1 parent 8180e88 commit b7c59bc

File tree

19 files changed

+1520
-1096
lines changed

19 files changed

+1520
-1096
lines changed

api/signalwire-rest/fabric-api/_spec_.yaml

+443-95
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import "@typespec/http";
2+
import "@typespec/openapi";
3+
import "./models/core.tsp";
4+
import "./models/responses.tsp";
5+
import "../../types";
6+
7+
using TypeSpec.Http;
8+
using Types.StatusCodes;
9+
10+
@route("/resources/cxml_webhooks/{cxml_webhook_id}/addresses")
11+
namespace FabricAPI.CXMLWebhookAddresses {
12+
@tag("cXML Webhook")
13+
@friendlyName("cXML Webhooks")
14+
interface CXMLWebhookAddresses {
15+
@summary("List cXML Webhook Addresses")
16+
@doc("A list of cXML Webhook Addresses")
17+
list(...CXMLWebhookIDPath):
18+
CXMLWebhookAddressListResponse |
19+
StatusCode401 |
20+
StatusCode404;
21+
}
22+
}
23+

api/signalwire-rest/fabric-api/external-laml-handler-addresses/models/core.tsp renamed to api/signalwire-rest/fabric-api/cxml-webhook-addresses/models/core.tsp

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import "../../../types";
55
using TypeSpec.Http;
66
using TypeSpec.OpenAPI;
77

8-
model ExternalLAMLHandlerIDPath {
9-
@doc("Unique ID of a External LAML Handler.")
8+
model CXMLWebhookIDPath {
9+
@doc("Unique ID of a CXML Webhook.")
1010
@path
11-
external_laml_handler_id: uuid
11+
cxml_webhook_id: uuid
1212
}
1313

14-
model ExternalLAMLHandlerAddress {
14+
model CXMLWebhookAddress {
1515
@doc("Unique ID of the Fabric Address.")
1616
@example("691af061-cd86-4893-a605-173f47afc4c2")
1717
id: uuid;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
model CXMLWebhookAddressListResponse {
2+
data: CXMLWebhookAddress[];
3+
links: CXMLWebhookAddressPaginationResponse;
4+
}
5+
6+
model CXMLWebhookAddressPaginationResponse {
7+
@doc("Link of the current page")
8+
@example("https://{space_name}.signalwire.com/api/fabric/resources/cxml_webhooks/a87db7ed-8ebe-42e4-829f-8ba5a4152f54/addresses?page_number=0&page_size=50")
9+
self: url;
10+
11+
@doc("Link to the first page")
12+
@example("https://{space_name}.signalwire.com/api/fabric/resources/cxml_webhooks/a87db7ed-8ebe-42e4-829f-8ba5a4152f54/addresses?page_number=0&page_size=50")
13+
first: url;
14+
15+
@doc("Link to the next page")
16+
@example("https://{space_name}.signalwire.com/api/fabric/resources/cxml_webhooks/a87db7ed-8ebe-42e4-829f-8ba5a4152f54/addresses?page_number=1&page_size=50&page_token=PAbff61159-faab-48b3-959a-3021a8f5beca")
17+
next: url;
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import "@typespec/http";
2+
import "@typespec/openapi";
3+
import "./models/core.tsp";
4+
import "./models/requests.tsp";
5+
import "./models/responses.tsp";
6+
import "./models/errors.tsp";
7+
import "../../types";
8+
9+
using TypeSpec.Http;
10+
using Types.StatusCodes;
11+
12+
@route("/resources/cxml_webhooks")
13+
namespace FabricAPI.CXMLWebhooks {
14+
@tag("cXML Webhook")
15+
@friendlyName("cXML Webhooks")
16+
interface CXMLWebhooks {
17+
@summary("List cXML Webhooks")
18+
@doc("A list of cXML Webhooks")
19+
list():
20+
CXMLWebhookListResponse |
21+
StatusCode401 |
22+
StatusCode404;
23+
24+
@summary("Get cXML Webhook")
25+
@doc("Returns an cXML Webhook by ID")
26+
read(...CXMLWebhookID): {
27+
@statusCode statusCode: 200;
28+
@body cxml_webhook: CXMLWebhookResponse;
29+
} |
30+
StatusCode401 |
31+
StatusCode404;
32+
33+
@summary("Create cXML Webhook")
34+
@doc("Creates an cXML Webhook")
35+
@post create(...CXMLWebhookCreateRequest):
36+
{ @statusCode statusCode: 201; @body cxml_webhook: CXMLWebhookResponse; } |
37+
StatusCode401 |
38+
StatusCode404 |
39+
CXMLWebhookCreateStatusCode422;
40+
41+
@summary("Update cXML Webhook")
42+
@doc("Updates an cXML Webhook by ID")
43+
@patch update(...CXMLWebhookID, ...CXMLWebhookUpdateRequest): {
44+
@statusCode statusCode: 200; @body cxml_webhook: CXMLWebhookResponse;
45+
} |
46+
StatusCode401 |
47+
StatusCode404 |
48+
CXMLWebhookUpdateStatusCode422;
49+
50+
@summary("Delete cXML Webhook")
51+
@doc("Deletes an cXML Webhook by ID")
52+
@delete delete(...CXMLWebhookID):
53+
{ @statusCode statusCode: 204; } |
54+
StatusCode401 |
55+
StatusCode404;
56+
}
57+
}
58+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import "./enums.tsp";
2+
import "../../../types";
3+
4+
using TypeSpec.Http;
5+
6+
model CXMLWebhookID {
7+
@doc("Unique ID of a CXML Webhook.")
8+
@path
9+
id: uuid
10+
}
11+
12+
model CXMLWebhook {
13+
@doc("Unique ID of the CXML Webhook.")
14+
@example("a87db7ed-8ebe-42e4-829f-8ba5a4152f54")
15+
id: uuid;
16+
17+
@doc("Name of the CXML Webhook.")
18+
@example("My CXML Webhook")
19+
name: string;
20+
21+
@doc("Used for of the CXML Webhook.")
22+
@example(UsedForType.Calling)
23+
used_for: UsedForType;
24+
25+
@doc("Primary request url of the CXML Webhook.")
26+
@example("https://primary.com")
27+
primary_request_url: string;
28+
29+
@doc("Primary request method of the CXML Webhook.")
30+
@example(UrlMethodType.Get)
31+
primary_request_method: UrlMethodType;
32+
33+
@doc("Fallback request url of the CXML Webhook.")
34+
@example("https://fallback.com")
35+
fallback_request_url: string;
36+
37+
@doc("Fallback request method of the CXML Webhook.")
38+
@example(UrlMethodType.Get)
39+
fallback_request_method: UrlMethodType;
40+
41+
@doc("Status callback url of the CXML Webhook.")
42+
@example("https://callback.com")
43+
status_callback_url: string;
44+
45+
@doc("Status callback method of the CXML Webhook.")
46+
@example(UrlMethodType.Post)
47+
status_callback_method: UrlMethodType;
48+
}

api/signalwire-rest/fabric-api/external-laml-handler/models/errors.tsp renamed to api/signalwire-rest/fabric-api/cxml-webhooks/models/errors.tsp

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ using Types.StatusCodes;
1111
url: "https://developer.signalwire.com/rest/signalwire-rest/overview/error-codes/#http_url_required"
1212
}],
1313
})
14-
model ExternalLamlHandlerCreateStatusCode422 is StatusCode422;
14+
model CXMLWebhookCreateStatusCode422 is StatusCode422;
1515

16-
model ExternalLamlHandlerUpdateStatusCode422 is ExternalLamlHandlerCreateStatusCode422;
16+
model CXMLWebhookUpdateStatusCode422 is CXMLWebhookCreateStatusCode422;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
model CXMLWebhookCreateRequest {
2+
@doc("Name of the CXML Webhook.")
3+
@example("My CXML Webhook")
4+
name?: string;
5+
6+
@doc("Used for of the CXML Webhook.")
7+
@example("calling")
8+
used_for?: "calling" | "messaging" = "calling";
9+
10+
@doc("Primary request url of the CXML Webhook.")
11+
@example("https://primary.com")
12+
primary_request_url: string;
13+
14+
@doc("Primary request method of the CXML Webhook.")
15+
@example("GET")
16+
primary_request_method?: "GET" | "POST" = "POST";
17+
18+
@doc("Fallback request url of the CXML Webhook.")
19+
@example("https://fallback.com")
20+
fallback_request_url?: string;
21+
22+
@doc("Fallback request method of the CXML Webhook.")
23+
@example("GET")
24+
fallback_request_method?: "GET" | "POST" = "POST";
25+
26+
@doc("Status callback url of the CXML Webhook.")
27+
@example("https://callback.com")
28+
status_callback_url?: string;
29+
30+
@doc("Status callback method of the CXML Webhook.")
31+
@example("POST")
32+
status_callback_method?: "GET" | "POST" = "POST";
33+
}
34+
35+
model CXMLWebhookUpdateRequest {
36+
@doc("Name of the CXML Webhook.")
37+
@example("My CXML Webhook")
38+
name?: string;
39+
40+
@doc("Used for of the CXML Webhook.")
41+
@example("calling")
42+
used_for?: "calling" | "messaging" = "calling";
43+
44+
@doc("Primary request url of the CXML Webhook.")
45+
@example("https://primary.com")
46+
primary_request_url?: string;
47+
48+
@doc("Primary request method of the CXML Webhook.")
49+
@example("GET")
50+
primary_request_method?: "GET" | "POST" = "POST";
51+
52+
@doc("Fallback request url of the CXML Webhook.")
53+
@example("https://fallback.com")
54+
fallback_request_url?: string;
55+
56+
@doc("Fallback request method of the CXML Webhook.")
57+
@example("GET")
58+
fallback_request_method?: "GET" | "POST" = "POST";
59+
60+
@doc("Status callback url of the CXML Webhook.")
61+
@example("https://callback.com")
62+
status_callback_url?: string;
63+
64+
@doc("Status callback method of the CXML Webhook.")
65+
@example("POST")
66+
status_callback_method?: "GET" | "POST" = "POST";
67+
}
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11

2-
model ExternalLAMLHandlerResponse {
3-
@doc("Unique ID of the ExternalLAMLHandler.")
2+
model CXMLWebhookResponse {
3+
@doc("Unique ID of the CXMLWebhook.")
44
@example("a87db7ed-8ebe-42e4-829f-8ba5a4152f54")
55
id: uuid;
66

77
@doc("Unique ID of the Project.")
88
@example("99151cf8-9548-4860-ba70-a8de824f3312")
99
project_id: uuid;
1010

11-
@doc("Display name of the ExternalLAMLHandler Fabric Resource")
11+
@doc("Display name of the CXMLWebhook Fabric Resource")
1212
@example("Booking Assistant")
1313
display_name: string;
1414

1515
@doc("Type of the Fabric Resource")
16-
@example("external_laml_handler")
16+
@example("cxml_webhook")
1717
type: string;
1818

1919
@doc("Date and time when the resource was created.")
@@ -24,25 +24,25 @@ model ExternalLAMLHandlerResponse {
2424
@example(utcDateTime.fromISO("2024-10-17T14:14:53Z"))
2525
updated_at: utcDateTime;
2626

27-
@doc("ExternalLAMLHandler data.")
28-
external_laml_handler: ExternalLAMLHandler;
27+
@doc("CXMLWebhook data.")
28+
cxml_webhook: CXMLWebhook;
2929
}
3030

31-
model ExternalLAMLHandlerListResponse {
32-
data: ExternalLAMLHandlerResponse[];
33-
links: ExternalLAMLHandlerPaginationResponse;
31+
model CXMLWebhookListResponse {
32+
data: CXMLWebhookResponse[];
33+
links: CXMLWebhookPaginationResponse;
3434
}
3535

36-
model ExternalLAMLHandlerPaginationResponse {
36+
model CXMLWebhookPaginationResponse {
3737
@doc("Link of the current page")
38-
@example("https://{space_name}.signalwire.com/api/fabric/resources/external_laml_handlers?page_number=0&page_size=50")
38+
@example("https://{space_name}.signalwire.com/api/fabric/resources/cxml_webhooks?page_number=0&page_size=50")
3939
self: url;
4040

4141
@doc("Link to the first page")
42-
@example("https://{space_name}.signalwire.com/api/fabric/resources/external_laml_handlers?page_number=0&page_size=50")
42+
@example("https://{space_name}.signalwire.com/api/fabric/resources/cxml_webhooks?page_number=0&page_size=50")
4343
first: url;
4444

4545
@doc("Link to the next page")
46-
@example("https://{space_name}.signalwire.com/api/fabric/resources/external_laml_handlers?page_number=1&page_size=50&page_token=PAbff61159-faab-48b3-959a-3021a8f5beca")
46+
@example("https://{space_name}.signalwire.com/api/fabric/resources/cxml_webhooks?page_number=1&page_size=50&page_token=PAbff61159-faab-48b3-959a-3021a8f5beca")
4747
next: url;
4848
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
openapi: 3.0.0
2+
info:
3+
title: (title)
4+
version: 0.0.0
5+
tags: []
6+
paths: {}
7+
components:
8+
schemas:
9+
AddressChannel:
10+
anyOf:
11+
- $ref: '#/components/schemas/AudioChannel'
12+
- $ref: '#/components/schemas/MessagingChannel'
13+
- $ref: '#/components/schemas/VideoChannel'
14+
AudioChannel:
15+
type: object
16+
required:
17+
- audio
18+
properties:
19+
audio:
20+
type: string
21+
example: /external/resource_name?channel=audio
22+
description: Audio Channel of Fabric Address
23+
CXMLWebhookID:
24+
type: object
25+
required:
26+
- id
27+
properties:
28+
id:
29+
allOf:
30+
- $ref: '#/components/schemas/uuid'
31+
description: Unique ID of a CXML Webhook.
32+
DisplayTypes:
33+
type: string
34+
enum:
35+
- app
36+
- room
37+
- call
38+
- subscriber
39+
description: DisplayTypes
40+
HandleCallsUsing:
41+
type: string
42+
enum:
43+
- script
44+
- external_url
45+
description: Indicates whether the call will be handled by a script or an external url.
46+
MessagingChannel:
47+
type: object
48+
required:
49+
- messaging
50+
properties:
51+
messaging:
52+
type: string
53+
example: /external/resource_name?channel=messaging
54+
description: Messaging Channel of Fabric Address
55+
StatusCode403:
56+
type: object
57+
required:
58+
- error
59+
properties:
60+
error:
61+
type: string
62+
enum:
63+
- Forbidden
64+
VideoChannel:
65+
type: object
66+
required:
67+
- video
68+
properties:
69+
video:
70+
type: string
71+
example: /external/resource_name?channel=video
72+
description: Video Channel of Fabric Address
73+
uuid:
74+
type: string
75+
format: uuid
76+
description: Universal Unique Identifier.

0 commit comments

Comments
 (0)