Skip to content

Commit

Permalink
EDGPATRON-151 Adding new api contract for Post and get api of LC User…
Browse files Browse the repository at this point in the history
… registration
  • Loading branch information
Vignesh-kalyanasundaram committed Oct 11, 2024
1 parent 7365c9e commit 960ac8d
Show file tree
Hide file tree
Showing 8 changed files with 513 additions and 0 deletions.
102 changes: 102 additions & 0 deletions ramls/edge-patron.raml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ types:
money: !include money.json
item: !include item.json
external_patron: !include external_patron.json
staging_user: !!include staging_user.json
user: !!include userdata.json
external_patron_collection: !include external_patron_collection.json
allowedServicePoints: !include allowed-service-points-response.json
hold-cancellation: !include hold-cancellation.json
Expand All @@ -26,11 +28,65 @@ types:
external_patron_error_get_422: !include schemas/external_patron_error_get_422.schema
external_patron_error_post_422: !include schemas/external_patron_error_post_422.schema
external_patron_error_put_422: !include schemas/external_patron_error_put_422.schema
user_error_400: !include schemas/user_error_400.schema
user_error_404: !include schemas/user_error_404.schema

/patron:
displayName: Patron Services
description: |
Services that allow patron empowerment from 3rd party discovery services
post:
description: |
Create a staging user or update a staging user if it exists
queryParameters:
apikey:
description: "API Key"
type: string
body:
application/json:
type: staging-user
example: !include examples/staging_user.json
responses:
200:
description: |
staging user updated successfully
body:
application/json:
type: staging-user
example: !include examples/staging_user.json
201:
description: |
staging user created successfully
body:
application/json:
type: staging-user
example: !include examples/staging_user.json
400:
description: Bad request
body:
text/plain:
example: unable to process request
401:
description: Not authorized to perform requested action
body:
text/plain:
example: unable to create request
403:
description: Access Denied
body:
text/plain:
example: Access Denied
422:
description: Validation error
body:
text/plain:
example: Validation error
500:
description: |
Internal server error, e.g. due to misconfiguration
body:
text/plain:
example: internal server error, contact administrator
/account:
post:
description: |
Expand Down Expand Up @@ -566,4 +622,50 @@ types:
body:
text/plain:
example: internal server error, contact administrator
/patron-registration-status/{emailId}:
uriParameters:
emailId:
description: The email ID of the patron.
type: string
required: true
get:
description: Get the patron details by email ID
queryParameters:
apikey:
description: "API Key"
type: string
responses:
200:
description: patron information retrieved successfully
body:
application/json:
type: user
example: !include examples/user.json
400:
description: Validation error
body:
application/json:
type: user_error_400
example: !include examples/user_error.json
401:
description: Not authorized to perform requested action
body:
text/plain:
example: unable to get account -- unauthorized
403:
description: Access Denied
body:
text/plain:
example: Access Denied
404:
description: Validation error
body:
application/json:
type: user_error_404
example: !include examples/user_error.json
500:
description: Internal server error, e.g. due to misconfiguration
body:
text/plain:
example: internal server error, contact administrator

28 changes: 28 additions & 0 deletions ramls/examples/staging_user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"isEmailVerified": true,
"status": "TIER-1",
"generalInfo": {
"firstName": "John",
"preferredFirstName": "John",
"middleName": "Felix",
"lastName": "Cena"
},
"addressInfo": {
"addressLine0": "William Morris Endeavor",
"addressLine1": "9601 Wilshire Blvd 3rd Floor",
"city": "Beverly Hills",
"province": "CA",
"zip": "12345",
"country": "USA"
},
"contactInfo": {
"phone": "555-123456",
"mobilePhone": "55555-66666",
"email": "john_cena@test_folio.com"
},
"preferredEmailCommunication": [
"Support",
"Programs",
"Services"
]
}
18 changes: 18 additions & 0 deletions ramls/examples/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"username": "jhandey",
"id": "7261ecaae3a74dc68b468e12a70b1aec",
"active": true,
"type": "patron",
"patronGroup": "4bb563d9-3f9d-4e1e-8d1d-04e75666d68f",
"meta": {
"creation_date": "2016-11-05T0723",
"last_login_date": ""
},
"personal": {
"lastName": "Handey",
"firstName": "Jack",
"preferredFirstName": "Jackie",
"email": "jhandey@biglibrary.org",
"phone": "2125551212"
}
}
4 changes: 4 additions & 0 deletions ramls/examples/user_error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"code": 404,
"errorMessage": "USER_ACCOUNT_INACTIVE"
}
26 changes: 26 additions & 0 deletions ramls/schemas/user_error_400.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "external_patron_error.schema",
"description": "An external_patron user error",
"type": "object",
"properties": {
"code": {
"type": "integer",
"description": "Error code"
},
"errorMessage": {
"type": "string",
"description": "Error message text",
"examples": [
{
"value": "MULTIPLE_USER_EXISTS",
"description": "Multiple users found with the same email"
}
]
}
},
"required": [
"code",
"errorMessage"
]
}
30 changes: 30 additions & 0 deletions ramls/schemas/user_error_404.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "external_patron_error.schema",
"description": "An external_patron user error",
"type": "object",
"properties": {
"code": {
"type": "integer",
"description": "Error code"
},
"errorMessage": {
"type": "string",
"description": "Error message text",
"examples": [
{
"value": "USER_ACCOUNT_INACTIVE",
"description": "User is not active"
},
{
"value": "USER_NOT_FOUND",
"description": "User does not exist"
}
]
}
},
"required": [
"code",
"errorMessage"
]
}
100 changes: 100 additions & 0 deletions ramls/staging_user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "User Information Schema",
"description": "Schema for staging users",
"type": "object",
"properties": {
"isEmailVerified": {
"description": "A flag to determine if a patron is activated/email verification completed.",
"type": "boolean",
"example": true
},
"status": {
"description": "Status of the patron, whether TIER-1 or TIER-2.",
"type": "string",
"enum": ["TIER-1", "TIER-2"],
"example": "TIER-1"
},
"generalInfo": {
"type": "object",
"description": "General info of external patron",
"properties": {
"firstName": {
"description": "First name of the patron",
"type": "string"
},
"preferredFirstName": {
"description": "Preferred first name of the patron",
"type": "string"
},
"middleName": {
"description": "Middle name of the patron",
"type": "string"
},
"lastName": {
"description": "Last name of the patron",
"type": "string"
}
}
},
"addressInfo": {
"type": "object",
"description": "Primary address info of external patron",
"properties": {
"addressLine0": {
"description": "First line of the address",
"type": "string"
},
"addressLine1": {
"description": "Second line of the address",
"type": "string"
},
"city": {
"description": "City",
"type": "string"
},
"province": {
"description": "Province/State",
"type": "string"
},
"zip": {
"description": "Postal/Zip code",
"type": "string"
},
"country": {
"description": "Country",
"type": "string"
}
}
},
"contactInfo": {
"type": "object",
"description": "Contact info of external patron",
"properties": {
"phone": {
"description": "Phone number of the patron",
"type": "string"
},
"mobilePhone": {
"description": "Mobile phone number of the patron",
"type": "string"
},
"email": {
"description": "Email of the patron",
"type": "string"
}
}
},
"preferredEmailCommunication": {
"type": "array",
"description": "Email communication info of external patron",
"items": {
"type": "string",
"enum": ["Support", "Programs", "Service"]
},
"maxItems": 3,
"uniqueItems": true
}
},
"required": ["generalInfo.firstName", "generalInfo.lastName", "contactInfo.email"]
}
Loading

0 comments on commit 960ac8d

Please sign in to comment.