openapi: 3.0.0
info:
  title: Prospect API
  x-cdq-internal-api: true
  contact:
    name: Krystian Sola
    url: https://www.cdq.com/about-cdq#cdq-team
    email: krystian.sola@cdq.com
  version: '1'
  description: |
    Automates process of creating organizations for new business prospects.
servers:
  - url: >-
      https://prospect-api.reverse-proxy.prod.k8s.production.cdq-cloud-engine.com/soap/v1
    description: Production SOAP
  - url: >-
      https://prospect-api.reverse-proxy.prod.k8s.production.cdq-cloud-engine.com
    description: Production
security:
  - oAuth2: []
tags:
  - name: workflows
    description: Workflows.
paths:
  /trialorganizationworkflows:
    post:
      tags:
        - Trial Organization Workflow
      x-cdq-private: true
      summary: Create Trial Organization Workflow
      description: >
        Creates a trial organization workflow for a new business prospect.

        This endpoint is used to initiate the process of creating an
        organization, workspace, and other related resources.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TrialOrganizationWorkflowCreate'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrialOrganizationWorkflow'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
  /trialorganizationworkflows/{organizationId}:
    get:
      tags:
        - Trial Organization Workflow
      x-cdq-private: true
      summary: Get Trial Organization Workflow
      description: >
        Retrieves the trial organization workflow for a specific organization.

        This endpoint is used to check the status and details of the workflow
        for a given organization.
      parameters:
        - name: organizationId
          in: path
          required: true
          description: ID of the organization for which the workflow is being retrieved.
          schema:
            $ref: '#/components/schemas/OrganizationId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrialOrganizationWorkflow'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
  /trialorganizationworkflows/info:
    get:
      tags:
        - Trial Organization Workflow
      x-cdq-priavte: true
      summary: Get information about available steps in the workflow and their types.
      description: >
        Calling this endpoint will return information about available steps in
        the workflow and their types.
      responses:
        '200':
          description: ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrialWorkflowInformation'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
  /prospects/linkedin/callback:
    post:
      tags:
        - LinkedIn
      x-wsdl: false
      x-cdq-private: true
      summary: Register LinkedIn-originating Organization
      description: >-
        Create organization, workspace without data mirror, lookup configuration
        and api key with that lookup configuration assigned.
      responses:
        '200':
          description: OK
  /prospects/linkedin/registrations:
    get:
      parameters:
        - name: organizationId
          description: ID of the organization.
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/OrganizationId'
      tags:
        - LinkedIn
      x-wsdl: false
      x-cdq-private: true
      summary: Read Registered Organizations
      description: Retrieve list of already registered users via LinkedIn.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LinkedInRegistrationsPage'
  /maintenance/cleanup:
    post:
      tags:
        - Maintenance
      summary: Cleanup LinkedIn Test Users
      description: >-
        This endpoint cleans up test users, which were logged in via LinkedIn to
        allow testing the LinkedIn integration. Only the following users can be
        cleanup:
          * `pwrynio@gmail.com`
          * `pawel.kowalczyk993@gmail.com`
          * `piotr@sobczak.dev`
          * `krystian.sola@gmail.com`
          * `mmmalinkaaa1praca@gmail.com`
          * `cloud-apps-e2e@cdq.com`
        This endpoint can be called only by cdq users or by the preceding users.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CleanupRequest'
      responses:
        '204':
          description: The resource was deleted successfully.
components:
  schemas:
    TrialOrganizationWorkflowCreate:
      type: object
      description: Request body for creating a trial organization workflow.
      properties:
        organizationId:
          $ref: '#/components/schemas/OrganizationId'
    TrialOrganizationWorkflow:
      type: object
      description: Represents a trial organization workflow.
      properties:
        description:
          type: string
          description: Description of the trial organization workflow.
          example: Prepare Trial Organization
        organizationId:
          $ref: '#/components/schemas/OrganizationId'
        steps:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowStep'
    WorkflowStep:
      type: object
      description: Workflow step in a given workflow.
      properties:
        name:
          $ref: '#/components/schemas/WorkflowStepName'
        status:
          $ref: '#/components/schemas/WorkflowStepStatus'
        errorMessage:
          $ref: '#/components/schemas/WorkflowStepErrorMessage'
        type:
          $ref: '#/components/schemas/WorkflowStepType'
        technicalKey:
          $ref: '#/components/schemas/WorkflowStepTechnicalKey'
    WorkflowStepName:
      type: string
      description: Name of the workflow step.
      example: Activate reference data sources
    WorkflowStepErrorMessage:
      type: string
      description: Error that occurred during the execution of the workflow step.
      example: Failed to activate reference data sources due to timeout.
    WorkflowStepStatus:
      type: object
      description: Status of a workflow step.
      properties:
        technicalKey:
          $ref: '#/components/schemas/WorkflowStepStatusTechnicalKey'
    WorkflowStepType:
      type: object
      description: Type of a workflow step.
      properties:
        technicalKey:
          $ref: '#/components/schemas/WorkflowStepTypeTechnicalKey'
    WorkflowStepTechnicalKey:
      type: string
      description: |
        Technical key of the workflow step.
      example: ACTIVATE_BRIEFING_EMAILS
    WorkflowStepTypeTechnicalKey:
      type: string
      description: >
        Type of the workflow step.


        List of values:

        * AUTOMATED: The step is automatically executed by the system after the
        workflow is started.

        * MANUAL: The step requires user interaction to be completed.
      example: AUTOMATED
    WorkflowStepStatusTechnicalKey:
      type: string
      description: |
        Technical key of the workflow step status.

        List of values:
        * REGISTERED: The step has been registered.
        * IN_PROGRESS: The step is currently in progress.
        * FINISHED: The step has been completed successfully.
        * FAILED: The step has failed.
        * CANCELED: The step has been canceled.
      example: REGISTERED
    TrialWorkflowInformation:
      type: object
      description: Represents a information about trial workflow.
      properties:
        description:
          type: string
          description: Description of the trial organization workflow.
          example: Prepare Trial Organization
        steps:
          type: array
          items:
            $ref: '#/components/schemas/WorkflowInfoStep'
    WorkflowInfoStep:
      type: object
      description: Workflow step in a given workflow.
      properties:
        name:
          $ref: '#/components/schemas/WorkflowStepName'
        technicalKey:
          $ref: '#/components/schemas/WorkflowStepTechnicalKey'
        type:
          $ref: '#/components/schemas/WorkflowInfoStepType'
    WorkflowInfoStepType:
      type: object
      description: Technical key of the workflow activation type.
      properties:
        technicalKey:
          $ref: '#/components/schemas/WorkflowStepTypeTechnicalKey'
    ApiError:
      type: object
      description: Detailed information about API errors.
      properties:
        status:
          $ref: '#/components/schemas/Status'
    Status:
      type: object
      description: Details about status or error of a service
      properties:
        code:
          $ref: '#/components/schemas/HttpStatusCode'
        technicalKey:
          $ref: '#/components/schemas/HttpStatusTechnicalKey'
        details:
          type: array
          items:
            $ref: '#/components/schemas/StatusDetails'
        path:
          $ref: '#/components/schemas/HttpPath'
        timestamp:
          $ref: '#/components/schemas/StatusTimestamp'
    StatusDetails:
      type: object
      description: Details about this status or error
      required:
        - id
        - message
      properties:
        id:
          $ref: '#/components/schemas/StatusDetailsMessageId'
        message:
          $ref: '#/components/schemas/StatusDetailsMessage'
        technicalKey:
          $ref: '#/components/schemas/StatusDetailsTechnicalKey'
        jsonPath:
          $ref: '#/components/schemas/JsonPath'
        jsonRecord:
          $ref: '#/components/schemas/JsonObject'
    LinkedInRegistrationsPage:
      type: object
      description: Page of Organizations for LinkedIn.
      properties:
        organizations:
          type: array
          items:
            $ref: '#/components/schemas/LinkedInOrganization'
        total:
          $ref: '#/components/schemas/PageTotal'
    LinkedInOrganization:
      type: object
      description: Organization for LinkedIn user.
      properties:
        id:
          $ref: '#/components/schemas/OrganizationId'
        createdAt:
          $ref: '#/components/schemas/CreatedAt'
        trialExpiresAt:
          $ref: '#/components/schemas/TrialExpiresAt'
    TrialExpiresAt:
      type: string
      description: >-
        Expiry date of the customer's trial. If blank, the customer has no
        trial.
      example: 2021-04-11T00:00-00:00
    CleanupRequest:
      type: object
      description: The object to clean up users.
      required:
        - email
      properties:
        email:
          $ref: '#/components/schemas/UserEmail'
    OrganizationId:
      type: string
      description: Uniquely identifying ID of the organization.
      example: cdq_monitor
    HttpStatusCode:
      type: integer
      description: RFC 7231 status code for this error.
      example: '200'
    HttpStatusTechnicalKey:
      type: string
      description: Technical key describing the status or error
      example: OK
    StatusDetailsMessageId:
      type: integer
      description: 9-digit code which is uniquely identifying a message
      example: 200000004
    StatusDetailsMessage:
      type: string
      description: Human-readable message which may also be presented in user interface.
      example: The job came to an end and finished successfully.
    StatusDetailsTechnicalKey:
      type: string
      description: Technical key to uniquely identify a message.
      example: JOB_FINISHED
    JsonPath:
      type: string
      description: JSONPath as specified by the IETF standard
      example: $.businessPartner.names[0].value
    JsonObject:
      type: string
      description: Object provided in plain JSON format.
      example: '{ "key" : "value"}'
      additionalProperties: true
    HttpPath:
      type: string
      description: Requested path which caused this error.
      example: /v2/businesspartners/lookup
    StatusTimestamp:
      type: string
      description: ISO 8601 representation of the timestamp.
      example: 2019-08-31T16:47+00:00
    CreatedAt:
      type: string
      description: Date of creation (ISO 8601-compliant).
      example: 2020-08-31T16:47+00:00
    PageTotal:
      description: Total number of items which can be paged.
      example: '67'
      type: integer
    UserEmail:
      type: string
      description: Email address of a user.
      example: info@cdq.ch
  securitySchemes:
    oAuth2:
      type: oauth2
      flows:
        clientCredentials:
          x-tokenEndpointAuthMethod: client_secret_basic
          tokenUrl: https://id.cdq.com/auth/realms/cs/protocol/openid-connect/token
          scopes: {}
x-cdq-security: true
