Skip to content

Commit

Permalink
markups
Browse files Browse the repository at this point in the history
  • Loading branch information
ellabrmicrosoft committed Dec 15, 2023
1 parent 8e8f84a commit 4e09c02
Show file tree
Hide file tree
Showing 19 changed files with 327 additions and 112 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-autorest";
import "@azure-tools/typespec-azure-core";

using TypeSpec.Http;
Expand Down Expand Up @@ -54,7 +53,7 @@ model PhoneNumberModel {
model ApcErrorResponse {
@doc("The numerical error status eg 500, 404")
status: int32;

@doc("The error code")
code: string;

Expand All @@ -64,3 +63,30 @@ model ApcErrorResponse {
@doc("The consent URL in case of a consent failure")
consentUrl?: url;
}

@doc("IPv4 device indicator")
model Ipv4Address {
/** IPv4 address may be specified in form <address/mask> as:
- address - an IPv4 number in dotted-quad form 1.2.3.4. Only this exact IP number will match the flow control rule.
- address/mask - an IP number as above with a mask width of the form 1.2.3.4/24.
In this case, all IP numbers from 1.2.3.0 to 1.2.3.255 will match. The bit width MUST be valid for the IP version. */
ipv4: string;

@doc("User equipment port.")
port: int32;
}

@doc("IPv6 device indicator")
model Ipv6Address {
/** IPv6 address, following IETF 5952 format, may be specified in form <address/mask> as:
- address - The /128 subnet is optional for single addresses:
- 2001:db8:85a3:8d3:1319:8a2e:370:7344
- 2001:db8:85a3:8d3:1319:8a2e:370:7344/128
- address/mask - an IP v6 number with a mask:
- 2001:db8:85a3:8d3::0/64
- 2001:db8:85a3:8d3::/64 */
ipv6: string;

@doc("User equipment port.")
port: int32;
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,21 @@ interface LocationInterface {

/// Endpoints

@resource("Apis")
@doc("Static endpoint to access Location API")
@resource("DeviceLocation")
@doc("Static endpoint to access the Device Location API family.")
model LocationEndpoint {
@key
@doc("Static endpoint")
@visibility("read")
location: "Location";
location: LocationEnum;
}

/* Needed to add this enum because typespec was creating an x-ms-enum without a name
which was causing a failure during linting. */
@doc("Location static endpoint enum")
enum LocationEnum {
@doc("Static endpoint")
location: "Location",
}

/// Request models
Expand Down Expand Up @@ -59,8 +67,8 @@ model LocationVerifyRequest {

@doc("Response verifying location")
model LocationVerifyResponse {
@doc("True if the location is verified, False otherwise")
verified: boolean;
@doc("True if the location is in the specified area, False otherwise")
verificationResult: boolean;
}

/// Common models
Expand All @@ -77,30 +85,3 @@ model LocationDevice {
@doc("IPv6 address and port of the device")
ipv6Address?: Ipv6Address;
}

@doc("IPv4 device indicator")
model Ipv4Address {
/** IPv4 address may be specified in form <address/mask> as:
- address - an IPv4 number in dotted-quad form 1.2.3.4. Only this exact IP number will match the flow control rule.
- address/mask - an IP number as above with a mask width of the form 1.2.3.4/24.
In this case, all IP numbers from 1.2.3.0 to 1.2.3.255 will match. The bit width MUST be valid for the IP version. */
ipv4: string;

@doc("User equipment port.")
port: int32;
}

@doc("IPv6 device indicator")
model Ipv6Address {
/** IPv6 address, following IETF 5952 format, may be specified in form <address/mask> as:
- address - The /128 subnet is optional for single addresses:
- 2001:db8:85a3:8d3:1319:8a2e:370:7344
- 2001:db8:85a3:8d3:1319:8a2e:370:7344/128
- address/mask - an IP v6 number with a mask:
- 2001:db8:85a3:8d3::0/64
- 2001:db8:85a3:8d3::/64 */
ipv6: string;

@doc("User equipment port.")
port: int32;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ interface Networks {

/// Endpoints

@resource("Apis")
@doc("Static endpoint to access Network API")
@resource("DeviceNetwork")
@doc("Static endpoint to access the Device Network API family.")
model NetworkRetrieveEndpoint {
@key
@doc("Static endpoint")
@visibility("read")
network: "Network";
network: NetworkEnum;
}

/* Needed to add this enum because typespec was creating an x-ms-enum without a name
which was causing a failure during linting. */
@doc("Network static endpoint enum")
enum NetworkEnum {
@doc("Static endpoint")
network: "Network",
}

/// Common models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@ interface NumberInterface {

/// Endpoints

@resource("Apis")
@doc("Static endpoint to access Number API")
@resource("NumberVerification")
@doc("Static endpoint to access Number Verification API family")
model NumberEndpoint {
@key
@doc("Static endpoint")
@visibility("read")
number: "Number";
number: NumberEnum;
}

/* Needed to add this enum because typespec was creating an x-ms-enum without a name
which was causing a failure during linting. */
@doc("Number static endpoint enum")
enum NumberEnum {
@doc("Static endpoint")
number: "Number",
}

/// Request models
Expand All @@ -63,8 +71,8 @@ model NumberVerifyRequest {

@doc("Response verifying number of device")
model NumberVerifyResponse {
@doc("True if number is verified, False otherwise")
verified: boolean;
@doc("True if number if the phone number matches the device, False otherwise")
verificationResult: boolean;
}

@doc("Response with number of device")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,21 @@ interface SimSwapInterface {

/// Endpoints

@resource("device")
@doc("Static endpoint to access Location API")
@resource("SimSwap")
@doc("Static endpoint to access the Sim Swap API family")
model SimSwapEndpoint {
@key
@doc("Static endpoint")
@visibility("read")
simSwap: "SimSwap";
simSwap: SimSwapEnum;
}

/* Needed to add this enum because typespec was creating an x-ms-enum without a name
which was causing a failure during linting. */
@doc("Number static endpoint enum")
enum SimSwapEnum {
@doc("Static endpoint")
simSwap: "SimSwap",
}

/// Request models
Expand Down Expand Up @@ -69,7 +77,7 @@ model SimSwapRetrieveResponse {
@doc("Response verifying SimSwap in period")
model SimSwapVerifyResponse {
@doc("True if the SIM has swapped in the specified period, False otherwise")
verified: boolean;
verificationResult: boolean;
}

/// Common models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "LocationInterface_Verify",
"parameters": {
"api-version": "2023-11-14-preview",
"location": "Location",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand Down Expand Up @@ -30,7 +31,7 @@
"responses": {
"200": {
"body": {
"verified": true
"verificationResult": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "Networks_Retrieve",
"parameters": {
"api-version": "2023-11-14-preview",
"network": "Network",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "NumberInterface_Retrieve",
"parameters": {
"api-version": "2023-11-14-preview",
"number": "Number",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "NumberInterface_Verify",
"parameters": {
"api-version": "2023-11-14-preview",
"number": "Number",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand All @@ -17,7 +18,7 @@
"responses": {
"200": {
"body": {
"verified": true
"verificationResult": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "SimSwapInterface_Retrieve",
"parameters": {
"api-version": "2023-11-14-preview",
"simSwap": "SimSwap",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "SimSwapInterface_Verify",
"parameters": {
"api-version": "2023-11-14-preview",
"simSwap": "SimSwap",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand All @@ -16,7 +17,7 @@
"responses": {
"200": {
"body": {
"verified": true
"verificationResult": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ using TypeSpec.Http;
using TypeSpec.Versioning;
using Azure.Core;

// TODO - how do we implement errors properly?
// TODO - understand if this is the right way to set up auth
@useAuth(
[
OAuth2Auth<[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "LocationInterface_Verify",
"parameters": {
"api-version": "2023-11-14-preview",
"location": "Location",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand Down Expand Up @@ -30,7 +31,7 @@
"responses": {
"200": {
"body": {
"verified": true
"verificationResult": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "Networks_Retrieve",
"parameters": {
"api-version": "2023-11-14-preview",
"network": "Network",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "NumberInterface_Retrieve",
"parameters": {
"api-version": "2023-11-14-preview",
"number": "Number",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "NumberInterface_Verify",
"parameters": {
"api-version": "2023-11-14-preview",
"number": "Number",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand All @@ -17,7 +18,7 @@
"responses": {
"200": {
"body": {
"verified": true
"verificationResult": true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "SimSwapInterface_Retrieve",
"parameters": {
"api-version": "2023-11-14-preview",
"simSwap": "SimSwap",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"operationId": "SimSwapInterface_Verify",
"parameters": {
"api-version": "2023-11-14-preview",
"simSwap": "SimSwap",
"x-ms-client-request-id": "123e4567-e89b-12d3-a456-426614174000",
"apc-gateway-id": "zdgrzzaxlodrvewbksn",
"body": {
Expand All @@ -16,7 +17,7 @@
"responses": {
"200": {
"body": {
"verified": true
"verificationResult": true
}
}
}
Expand Down
Loading

0 comments on commit 4e09c02

Please sign in to comment.