Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Macro openapi
sourceTypeMacroBody
attachmentPageId
syntaxSwagger / OpenAPI
attachmentId
url
openapi: 3.0.3
info:
  title: Patron creation
  description: Edge API for creation of patron account through web-form
  version: 1.0.0
servers:
  - url: 'https://github.com/folio-org/mod-patron'
paths:
  /patron/account/{email}:
    get:
      description: Get patron account by email
      tags:
        - patron
      parameters:
        - in: path
          name: email
          schema:
            type: string
          required: true
      responses:
        201:
          $ref: "#/components/requestBodies/PatronAccountRequest"
        404:
          $ref: '#/components/responses/NotFound'
    put:
      description: Update Patron Account by email
      operationId: updatePatronByEmail
      tags:
        - patron
      parameters:
        - in: path
          name: email
          schema:
            type: string
          required: true
      requestBody:
        $ref: "#/components/requestBodies/PatronAccountRequest"
      responses:
        201:
          $ref: "#/components/requestBodies/PatronAccountRequest"
        404:
          $ref: '#/components/responses/NotFound'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/InternalServerError'
  /patron/account:
    get:
      description: Get Expired records
      operationId: getExpiredRecords
      tags:
        - patron
      parameters:
        - in: query
          name: expired
          description: flag to fetch expired records
          required: true
      responses:
        201:
          description: A JSON array of user names
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ExpiredPatronAccount"
        404:
          $ref: '#/components/responses/NotFound'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/InternalServerError'
    post:
      description: Create Patron Account
      operationId: createPatron
      tags:
        - patron
      requestBody:
        $ref: "#/components/requestBodies/PatronAccountRequest"
      responses:
        201:
          $ref: "#/components/requestBodies/PatronAccountRequest"
        404:
          $ref: '#/components/responses/NotFound'
        400:
          $ref: '#/components/responses/BadRequest'
        500:
          $ref: '#/components/responses/InternalServerError'


components:
  schemas:
    ExpiredPatronAccount:
      type: object
      description: Information on expired patron accoun
      properties:
        externalSystemId:
          description: External System ID
          type: string
        firstName:
          description: First Name
          type: string
        preferredFirstName:
          description: Preferred First Name
          type: string
        middleName:
          description: Middle Name
          type: string
        lastName:
          description: Last Name
          type: string
        email:
          description: Email Address
          type: string
        expirationDate:
          description: Expiration Date
          type: string
          format: date
    PatronAccount:
      type: object
      description: Information for patron registration for web-form
      required:
        - generalInfo
        - address0address
        - contactInfo
        - userType
      properties:
        generalInfo:
          description: General info
          type: object
          required:
            - firstName
            - lastName
          properties:
            externalSystemId:
              description: External System ID
              type: string
            firstName:
              description: First Name
              type: string
            preferredFirstName:
              description: Preferred First Name
              type: string
            middleName:
              description: Middle Name
              type: string
            lastName:
              description: Last Name
              type: string

        address0address:
          description: Current address/Address 0
          type: object
          properties:
            addressLine0:
              description: Current Address/Address line 0
              type: string
            addressLine1:
              description: Current Address/Address line 1
              type: string
            city:
              description: City
              type: string
            province:
              description: State/Province
              type: string
            zip:
              description: Zip/Postal Code
              type: string
            country:
              description: Country
              type: string

        contactInfo:
          description: Contact info
          type: object
          required:
            - phone
            - email
          properties:
            phone:
              description: Phone Number
              type: string
            mobilePhone:
              description: Mobile Phone
              type: string
            email:
              description: Email Address
              type: string

        preferences:
          type: object
          description: Preferences
          properties:
            serviceEmailAlertsEnabled:
              description: I would like to receive email communications from the Library of Congress about service requests and alerts, research information, and surveys related to doing research at the Library.
              type: boolean
              default: false
            programEmailAlertsEnabled:
              description: I would like to receive email communications from the Library of Congress about other Library programs (concerts, exhibits, lectures, etc.), customer surveys, and other services available to the general public.
              type: boolean
              default: false
            supportEmailAlertsEnabled:
              description: I would like to receive email communications from the Library of Congress about how I might support the Library.
              type: boolean
              default: false

    Error:
      description: "An error"
      type: object
      properties:
        message:
          type: string
          minLength: 1
          description: "Error message text"
        type:
          type: string
          description: "Error message type"
        code:
          type: string
          description: "Error message code"
      additionalProperties: false
      required:
        - message

  requestBodies:
    PatronAccountRequest:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/PatronAccount"

  responses:
    PatronAccountResponse:
      description: SuccessfulResult
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/PatronAccount"

    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"

...