diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e643ec6..5126f6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: run: sbt ++${{ matrix.scala }} test - name: Compress target directories - run: tar cf targets.tar selfcare-v2-client/target project/target + run: tar cf targets.tar party-process-client/target party-management-client/target user-registry-client/target selfcare-v2-client/target project/target - name: Upload target directories uses: actions/upload-artifact@v2 diff --git a/.gitignore b/.gitignore index 2fc34ee..d699b9e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,13 @@ metals.sbt .metals .bsp .openapi-generator +party-management-client/src/ +party-process-client/src/ +user-registry-client/src/ selfcare-v2-client/src/ .DS_Store +party-process-client/project/build.properties +party-management-client/project/build.properties +user-registry-client/project/build.properties selfcare-v2-client/project/build.properties .env \ No newline at end of file diff --git a/build.sbt b/build.sbt index 3c4bd40..344bf0a 100644 --- a/build.sbt +++ b/build.sbt @@ -15,7 +15,104 @@ val projectName = settingKey[String]("The project name prefix derived from the lazy val root = (project in file(".")) .settings(name := "interop-selfcare-proxy-clients", publish / skip := true) - .aggregate(selfcareV2Client) + .aggregate(partyProcessClient, partyManagementClient, userRegistryClient, selfcareV2Client) + +cleanFiles += baseDirectory.value / "party-process-client" / "src" +cleanFiles += baseDirectory.value / "party-process-client" / "target" + +lazy val partyProcessClient = project + .in(file("party-process-client")) + .settings( + name := "interop-selfcare-party-process-client", + packagePrefix := name.value + .replaceFirst("interop-", "interop.") + .replaceFirst("selfcare-", "selfcare.") + .replaceFirst("party-process-", "partyprocess-.") + .replaceAll("-", ""), + projectName := name.value + .replaceFirst("interop-", "") + .replaceFirst("selfcare-", ""), + generateCode := { + Process(s"""openapi-generator-cli generate -t template/scala-akka-http-client + | -i party-process-client/interface-specification.yml + | -g scala-akka + | -p projectName=${projectName.value} + | -p invokerPackage=it.pagopa.${packagePrefix.value}.invoker + | -p modelPackage=it.pagopa.${packagePrefix.value}.model + | -p apiPackage=it.pagopa.${packagePrefix.value}.api + | -p modelPropertyNaming=original + | -p dateLibrary=java8 + | -p entityStrictnessTimeout=15 + | -o party-process-client""".stripMargin).!! + }, + scalacOptions := Seq(), + libraryDependencies := Dependencies.Jars.client, + updateOptions := updateOptions.value.withGigahorse(false) + ) + +cleanFiles += baseDirectory.value / "party-management-client" / "src" +cleanFiles += baseDirectory.value / "party-management-client" / "target" + +lazy val partyManagementClient = project + .in(file("party-management-client")) + .settings( + name := "interop-selfcare-party-management-client", + packagePrefix := name.value + .replaceFirst("interop-", "interop.") + .replaceFirst("selfcare-", "selfcare.") + .replaceFirst("party-management-", "partymanagement.") + .replaceAll("-", ""), + projectName := name.value + .replaceFirst("interop-", "") + .replaceFirst("selfcare-", ""), + generateCode := { + Process(s"""openapi-generator-cli generate -t template/scala-akka-http-client + | -i party-management-client/interface-specification.yml + | -g scala-akka + | -p projectName=${projectName.value} + | -p invokerPackage=it.pagopa.${packagePrefix.value}.invoker + | -p modelPackage=it.pagopa.${packagePrefix.value}.model + | -p apiPackage=it.pagopa.${packagePrefix.value}.api + | -p modelPropertyNaming=original + | -p dateLibrary=java8 + | -o party-management-client""".stripMargin).!! + }, + scalacOptions := Seq(), + libraryDependencies := Dependencies.Jars.client, + updateOptions := updateOptions.value.withGigahorse(false) + ) + +cleanFiles += baseDirectory.value / "user-registry-client" / "src" +cleanFiles += baseDirectory.value / "user-registry-client" / "target" + +lazy val userRegistryClient = project + .in(file("user-registry-client")) + .settings( + name := "interop-selfcare-user-registry-client", + packagePrefix := name.value + .replaceFirst("interop-", "interop.") + .replaceFirst("selfcare-", "selfcare.") + .replaceFirst("user-registry-", "userregistry.") + .replaceAll("-", ""), + projectName := name.value + .replaceFirst("interop-", "") + .replaceFirst("selfcare-", ""), + generateCode := { + Process(s"""openapi-generator-cli generate -t template/scala-akka-http-client + | -i user-registry-client/interface-specification.yml + | -g scala-akka + | -p projectName=${projectName.value} + | -p invokerPackage=it.pagopa.${packagePrefix.value}.invoker + | -p modelPackage=it.pagopa.${packagePrefix.value}.model + | -p apiPackage=it.pagopa.${packagePrefix.value}.api + | -p modelPropertyNaming=original + | -p dateLibrary=java8 + | -o user-registry-client""".stripMargin).!! + }, + scalacOptions := Seq(), + libraryDependencies := Dependencies.Jars.client, + updateOptions := updateOptions.value.withGigahorse(false) + ) cleanFiles += baseDirectory.value / "selfcare-v2-client" / "src" cleanFiles += baseDirectory.value / "selfcare-v2-client" / "target" @@ -48,5 +145,9 @@ lazy val selfcareV2Client = project libraryDependencies := Dependencies.Jars.client, updateOptions := updateOptions.value.withGigahorse(false) ) + +(Compile / compile) := ((Compile / compile) dependsOn partyProcessClient / generateCode).value +(Compile / compile) := ((Compile / compile) dependsOn partyManagementClient / generateCode).value +(Compile / compile) := ((Compile / compile) dependsOn userRegistryClient / generateCode).value (Compile / compile) := ((Compile / compile) dependsOn selfcareV2Client / generateCode).value diff --git a/party-management-client/.openapi-generator-ignore b/party-management-client/.openapi-generator-ignore new file mode 100644 index 0000000..6219b10 --- /dev/null +++ b/party-management-client/.openapi-generator-ignore @@ -0,0 +1,27 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md +build.sbt +pom.xml +README.md +project/build.properties diff --git a/party-management-client/interface-specification.yml b/party-management-client/interface-specification.yml new file mode 100644 index 0000000..6dba25a --- /dev/null +++ b/party-management-client/interface-specification.yml @@ -0,0 +1,669 @@ +openapi: 3.0.1 +info: + title: Party Management Micro Service V1 + description: This service is the party manager + version: v1 +tags: + - name: public + description: Public endpoints + externalDocs: + description: Find out more + url: http://swagger.io/ + - name: health + description: Verify service status + externalDocs: + description: Find out more + url: http://swagger.io/ + - name: party + description: Manipulate party information + externalDocs: + description: Find out more + url: http://swagger.io/ + - name: external + description: External id endpoints + externalDocs: + description: Find out more + url: http://swagger.io/ +security: + - apiKeySelfcare: [ ] +servers: + - url: "https://party-management" +paths: + '/persons/{id}': + parameters: + - $ref: '#/components/parameters/SelfcareUID' + - name: id + in: path + schema: + type: string + format: uuid + required: true + description: Person ID + get: + summary: Retrieves Person by ID + tags: + - party + responses: + '200': + description: Person + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + '400': + description: Bad Request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Person not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + operationId: getPersonById + description: 'returns the identified person, if any.' + head: + tags: + - party + summary: Verify if a Person exists for a given ID + description: Return ok + operationId: existsPersonById + parameters: + - name: id + in: path + description: The ID of the Person to check + required: true + schema: + description: The Person ID. + type: string + format: uuid + example: e72dd279-5f52-4039-afbe-2b7e432c490e + responses: + '200': + description: Person exists + '404': + description: Person not found + /institutions/{id}: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + - name: id + in: path + description: The ID of the Institution to check + required: true + schema: + description: to be defined + type: string + format: uuid + example: e72dd279-5f52-4039-afbe-2b7e432c490e + get: + summary: Retrieves Institution by ID + tags: + - party + responses: + '200': + description: Institution + content: + application/json: + schema: + $ref: '#/components/schemas/Institution' + '400': + description: Bad Request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Institution not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + operationId: getInstitutionById + description: 'returns the identified institution, if any.' + head: + tags: + - party + summary: Verify if an institution exists for a given institutionId + description: Return ok + operationId: existsInstitutionById + responses: + '200': + description: successful operation + '404': + description: Institution not found + /institutions/{id}/attributes: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + - schema: + type: string + format: uuid + example: e72dd279-5f52-4039-afbe-2b7e432c490e + name: id + in: path + required: true + description: Institution ID + get: + summary: Retrieves attributes + tags: + - party + responses: + '200': + description: Party Attributes + content: + application/json: + schema: + $ref: '#/components/schemas/Attributes' + '400': + description: Bad Request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Party not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + operationId: getPartyAttributes + description: 'returns the attributes of the identified party, if any.' + /external/institutions/{externalId}: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + - schema: + type: string + name: externalId + in: path + required: true + description: External Institution ID + get: + summary: Retrieves Institution by ID + tags: + - external + responses: + '200': + description: Institution + content: + application/json: + schema: + $ref: '#/components/schemas/Institution' + '400': + description: Bad Request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Institution not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + operationId: getInstitutionByExternalId + description: 'returns the identified institution, if any.' + /relationships: + get: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + - in: query + name: from + schema: + type: string + format: uuid + - in: query + name: to + schema: + type: string + format: uuid + - in: query + name: roles + description: comma separated sequence of role to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/PartyRole' + default: [ ] + explode: false + - in: query + name: states + description: comma separated sequence of states to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/RelationshipState' + default: [ ] + explode: false + - in: query + name: products + description: comma separated sequence of products to filter the response with + schema: + type: array + items: + type: string + default: [ ] + explode: false + - in: query + name: productRoles + description: comma separated sequence of product roles to filter the response with + schema: + type: array + items: + type: string + default: [ ] + explode: false + tags: + - party + summary: Return a list of relationships + description: Return ok + operationId: getRelationships + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Relationships' + '400': + description: Invalid ID supplied + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /relationships/{relationshipId}: + get: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + - name: relationshipId + in: path + description: The ID of the Relationship to retrieve + required: true + schema: + type: string + format: uuid + tags: + - party + summary: Retrieve the relationship for the given relationshipId + description: Return relationship + operationId: getRelationshipById + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Relationship' + '400': + description: Bad Request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Relationship not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /bulk/institutions: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + post: + summary: Retrieves a collection of institutions + tags: + - party + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/BulkPartiesSeed' + responses: + '200': + description: collection of institutions + content: + application/json: + schema: + $ref: '#/components/schemas/BulkInstitutions' + '400': + description: Bad Request + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Institutions not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + operationId: bulkInstitutions + description: 'returns a collection of all the parties for the corresponding identifiers.' + /status: + get: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + tags: + - health + summary: Health status endpoint + description: Return ok + operationId: getStatus + responses: + '200': + description: successful operation + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' +components: + parameters: + SelfcareUID: + in: header + name: x-selfcare-uid + required: true + schema: + type: string + schemas: + Person: + required: + - id + type: object + properties: + id: + type: string + format: uuid + example: 97c0f418-bcb3-48d4-825a-fe8b29ae68e5 + additionalProperties: false + Institution: + required: + - id + - externalId + - originId + - description + - digitalAddress + - address + - zipCode + - taxCode + - attributes + - origin + - institutionType + type: object + properties: + id: + type: string + format: uuid + example: 97c0f418-bcb3-48d4-825a-fe8b29ae68e5 + externalId: + type: string + description: external institution id + example: c_f205 + originId: + type: string + description: origin institution id (e.g iPA code) + example: c_f205 + description: + type: string + example: AGENCY X + digitalAddress: + type: string + format: email + example: email@pec.mail.org + address: + type: string + example: via del campo + zipCode: + type: string + example: '20100' + taxCode: + type: string + description: institution tax code + origin: + type: string + description: The origin form which the institution has been retrieved + example: IPA + institutionType: + type: string + description: institution type + example: PA + attributes: + $ref: '#/components/schemas/Attributes' + additionalProperties: false + PartyRole: + enum: + - MANAGER + - DELEGATE + - SUB_DELEGATE + - OPERATOR + type: string + description: Represents the generic available role types for the relationship + RelationshipState: + enum: + - PENDING + - ACTIVE + - SUSPENDED + - DELETED + - REJECTED + type: string + description: Represents the party relationship state + Attributes: + type: array + items: + $ref: '#/components/schemas/Attribute' + Attribute: + required: + - origin + - code + - description + type: object + properties: + origin: + type: string + description: 'origin of the certified attribute, e.g.: IPA' + code: + type: string + description: 'original identifier as defined at origin side, e.g.: IPA attribute code' + description: + type: string + description: human readable description of the attribute + additionalProperties: false + RelationshipProduct: + required: + - id + - role + - createdAt + type: object + properties: + id: + type: string + role: + type: string + createdAt: + type: string + format: date-time + Relationship: + required: + - id + - from + - to + - role + - product + - state + type: object + properties: + id: + type: string + format: uuid + from: + type: string + description: person ID + format: uuid + to: + type: string + description: institution ID + format: uuid + filePath: + type: string + description: path of the file containing the signed onboarding document + fileName: + type: string + description: name of the file containing the signed onboarding document + contentType: + type: string + description: content type of the file containing the signed onboarding document + tokenId: + type: string + description: confirmation token identifier + format: uuid + role: + $ref: '#/components/schemas/PartyRole' + product: + $ref: '#/components/schemas/RelationshipProduct' + state: + $ref: '#/components/schemas/RelationshipState' + pricingPlan: + type: string + description: pricing plan + institutionUpdate: + $ref: '#/components/schemas/InstitutionUpdate' + billing: + $ref: '#/components/schemas/Billing' + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + additionalProperties: false + Relationships: + required: + - items + type: object + properties: + items: + type: array + items: + $ref: '#/components/schemas/Relationship' + additionalProperties: false + Problem: + required: + - type + - status + - title + - errors + properties: + type: + type: string + description: URI reference of type definition + status: + maximum: 600.0 + exclusiveMaximum: true + minimum: 100.0 + type: integer + description: The HTTP status code generated by the origin server for this occurrence of the problem. + format: int32 + example: 503 + title: + maxLength: 64 + pattern: '^[ -~]{0,64}$' + type: string + description: 'A short, summary of the problem type. Written in english and readable' + example: Service Unavailable + detail: + maxLength: 4096 + pattern: '^.{0,1024}$' + type: string + description: A human readable explanation of the problem. + example: Request took too long to complete. + errors: + minItems: 1 + type: array + items: + $ref: '#/components/schemas/ProblemError' + additionalProperties: false + ProblemError: + required: + - code + - detail + properties: + code: + maxLength: 8 + minLength: 8 + pattern: '^[0-9]{3}-[0-9]{4}$' + type: string + description: Internal code of the error + example: 123-4567 + detail: + maxLength: 4096 + pattern: '^.{0,1024}$' + type: string + description: A human readable explanation specific to this occurrence of the problem. + example: Parameter not valid + InstitutionUpdate: + type: object + properties: + institutionType: + type: string + description: The type of the institution + example: PA + description: + type: string + example: AGENCY X + digitalAddress: + type: string + format: email + example: email@pec.mail.org + address: + type: string + example: via del campo + taxCode: + type: string + description: institution tax code + Billing: + required: + - vatNumber + - recipientCode + type: object + properties: + vatNumber: + type: string + description: institution vat number + recipientCode: + type: string + description: institution recipient code + publicServices: + type: boolean + description: institution recipient code + additionalProperties: false + BulkInstitutions: + type: object + required: + - found + - notFound + properties: + found: + type: array + description: the collection of institutions found. + items: + $ref: '#/components/schemas/Institution' + notFound: + type: array + items: + type: string + description: the identifiers of institutions not found. + BulkPartiesSeed: + type: object + required: + - partyIdentifiers + properties: + partyIdentifiers: + type: array + items: + type: string + format: uuid + description: the identifiers of party + securitySchemes: + apiKeySelfcare: + type: apiKey + name: Ocp-Apim-Subscription-Key + in: header diff --git a/party-process-client/.openapi-generator-ignore b/party-process-client/.openapi-generator-ignore new file mode 100644 index 0000000..6219b10 --- /dev/null +++ b/party-process-client/.openapi-generator-ignore @@ -0,0 +1,27 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md +build.sbt +pom.xml +README.md +project/build.properties diff --git a/party-process-client/interface-specification.yml b/party-process-client/interface-specification.yml new file mode 100644 index 0000000..e164a87 --- /dev/null +++ b/party-process-client/interface-specification.yml @@ -0,0 +1,831 @@ +openapi: 3.0.1 +info: + title: Party Process Micro Service + description: This service is the party process + version: v1 +tags: + - name: process + description: Implements party process + externalDocs: + description: Find out more + url: http://swagger.io/ + - name: public + description: Public endpoints + externalDocs: + description: Find out more + url: http://swagger.io/ + - name: health + description: Verify service status + externalDocs: + description: Find out more + url: http://swagger.io/ + - name: external + description: Implements external endpoints + externalDocs: + description: Find out more + url: http://swagger.io/ +servers: + - url: "https://party-process" +security: + - apiKeySelfcare: [ ] +paths: + '/onboarding/info': + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - process + summary: get on boarding info + description: Return ok + operationId: getOnboardingInfo + parameters: + - name: institutionId + description: The internal identifier of the institution + in: query + schema: + type: string + format: uuid + - name: institutionExternalId + description: The external Id of an institution you can filter the retrieval with + in: query + schema: + type: string + - name: states + in: query + description: comma separated sequence of states to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/RelationshipState' + default: [ ] + explode: false + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingInfo' + '404': + description: Not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '400': + description: Invalid ID supplied + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '/onboarding/institution/{externalId}/products/{productId}': + parameters: + - $ref: '#/components/parameters/SelfcareUID' + head: + tags: + - process + summary: verify onboarding info + description: Checks if the specified institution has been onboarded on the specified product. + operationId: verifyOnboarding + parameters: + - name: externalId + in: path + description: The external identifier of the institution + required: true + schema: + type: string + - name: productId + in: path + description: The identifier of the product + required: true + schema: + type: string + responses: + '204': + description: successful operation + '400': + description: Invalid ID supplied + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /institutions/{id}/relationships: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - process + summary: returns the relationships related to the institution + description: Return ok + operationId: getUserInstitutionRelationships + parameters: + - name: id + in: path + description: The internal identifier of the institution + required: true + schema: + type: string + format: uuid + - in: query + name: personId + description: the person identifier + schema: + type: string + format: uuid + - in: query + name: roles + description: comma separated sequence of role to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/PartyRole' + default: [ ] + explode: false + - in: query + name: states + description: comma separated sequence of states to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/RelationshipState' + default: [ ] + explode: false + - in: query + name: products + description: comma separated sequence of products to filter the response with + schema: + type: array + items: + type: string + default: [ ] + explode: false + - in: query + name: productRoles + description: comma separated sequence of product roles to filter the response with + schema: + type: array + items: + type: string + default: [ ] + explode: false + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipsResponse' + '400': + description: Invalid institution id supplied + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /external/institutions/{externalId}/relationships: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - external + summary: returns the relationships related to the institution + description: Return ok + operationId: getUserInstitutionRelationshipsByExternalId + parameters: + - name: externalId + in: path + description: The external identifier of the institution + required: true + schema: + type: string + - in: query + name: personId + description: the person identifier + schema: + type: string + format: uuid + - in: query + name: roles + description: comma separated sequence of role to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/PartyRole' + default: [ ] + explode: false + - in: query + name: states + description: comma separated sequence of states to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/RelationshipState' + default: [ ] + explode: false + - in: query + name: products + description: comma separated sequence of products to filter the response with + schema: + type: array + items: + type: string + default: [ ] + explode: false + - in: query + name: productRoles + description: comma separated sequence of product roles to filter the response with + schema: + type: array + items: + type: string + default: [ ] + explode: false + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipsResponse' + '400': + description: Invalid institution id supplied + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /institutions/{id}/products: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - process + summary: institution products retrieval + description: retrieves the products this institution is related to. + operationId: retrieveInstitutionProducts + parameters: + - name: id + in: path + description: The internal identifier of the institution + required: true + schema: + type: string + format: uuid + - name: states + in: query + description: comma separated sequence of states to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/ProductState' + default: [ ] + explode: false + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Products' + '404': + description: Institution not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /external/institutions/{externalId}/products: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - external + summary: institution products retrieval + description: retrieves the products this institution is related to. + operationId: retrieveInstitutionProductsByExternalId + parameters: + - name: externalId + in: path + description: The external identifier of the institution + required: true + schema: + type: string + - name: states + in: query + description: comma separated sequence of states to filter the response with + schema: + type: array + items: + $ref: '#/components/schemas/ProductState' + default: [ ] + explode: false + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Products' + '404': + description: Institution not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /relationships/{relationshipId}: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - process + summary: Gets the corresponding relationship + description: Gets relationship + operationId: getRelationship + parameters: + - name: relationshipId + in: path + description: The identifier of the relationship + required: true + schema: + type: string + format: uuid + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipInfo' + '400': + description: Invalid id supplied + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '/institutions/{id}': + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - process + summary: Gets the corresponding institution using internal institution id + description: Gets institution using internal institution id + operationId: getInstitution + parameters: + - name: id + in: path + description: The internal identifier of the institution + required: true + schema: + type: string + format: uuid + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Institution' + '400': + description: Invalid id supplied + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '/external/institutions/{externalId}': + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - external + summary: Gets the corresponding institution using external institution id + description: Gets institution using external institution id + operationId: getInstitutionByExternalId + parameters: + - name: externalId + in: path + description: The external identifier of the institution + required: true + schema: + type: string + responses: + '200': + description: successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Institution' + '400': + description: Invalid id supplied + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + '404': + description: Not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /onboarding/relationship/{relationshipId}/document: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - process + summary: Get an onboarding document + operationId: getOnboardingDocument + parameters: + - name: relationshipId + in: path + description: the relationship id + required: true + schema: + type: string + responses: + "200": + description: Signed onboarding document retrieved + content: + application/octet-stream: + schema: + type: string + format: binary + "404": + description: Document not found + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' + /status: + parameters: + - $ref: '#/components/parameters/SelfcareUID' + get: + tags: + - health + summary: Health status endpoint + description: Return ok + operationId: getStatus + responses: + '200': + description: successful operation + content: + application/problem+json: + schema: + $ref: '#/components/schemas/Problem' +components: + parameters: + SelfcareUID: + in: header + name: x-selfcare-uid + required: true + schema: + type: string + schemas: + RelationshipInfo: + required: + - id + - from + - to + - role + - product + - state + type: object + properties: + id: + type: string + format: uuid + from: + type: string + format: uuid + to: + type: string + format: uuid + role: + $ref: '#/components/schemas/PartyRole' + product: + $ref: '#/components/schemas/ProductInfo' + state: + $ref: '#/components/schemas/RelationshipState' + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + additionalProperties: false + RelationshipsResponse: + type: array + items: + $ref: '#/components/schemas/RelationshipInfo' + ProductInfo: + type: object + properties: + id: + type: string + role: + type: string + createdAt: + type: string + format: date-time + required: + - id + - role + - createdAt + Billing: + type: object + properties: + vatNumber: + description: institution vat number + type: string + recipientCode: + description: institution recipient code + type: string + publicServices: + description: institution recipient code + type: boolean + required: + - vatNumber + - recipientCode + additionalProperties: false + OnboardingData: + properties: + id: + type: string + format: uuid + externalId: + type: string + originId: + type: string + description: + type: string + taxCode: + type: string + digitalAddress: + type: string + address: + type: string + zipCode: + type: string + state: + $ref: '#/components/schemas/RelationshipState' + role: + $ref: '#/components/schemas/PartyRole' + productInfo: + $ref: '#/components/schemas/ProductInfo' + institutionType: + type: string + description: institution type + example: PA + pricingPlan: + type: string + description: pricing plan + billing: + $ref: '#/components/schemas/Billing' + origin: + type: string + description: The origin form which the institution has been retrieved + example: IPA + attributes: + type: array + description: certified attributes bound to this institution + items: + $ref: '#/components/schemas/Attribute' + additionalProperties: false + required: + - id + - externalId + - originId + - origin + - taxCode + - description + - digitalAddress + - address + - zipCode + - state + - role + - productInfo + - attributes + Attribute: + type: object + properties: + origin: + type: string + code: + type: string + description: + type: string + required: + - origin + - code + - description + Attributes: + type: array + items: + $ref: '#/components/schemas/Attribute' + OnboardingInfo: + properties: + userId: + type: string + description: User internal id + format: uuid + institutions: + type: array + items: + $ref: '#/components/schemas/OnboardingData' + additionalProperties: false + required: + - person + - institutions + Product: + type: object + properties: + id: + type: string + state: + $ref: '#/components/schemas/ProductState' + required: + - id + - state + Products: + type: object + properties: + products: + type: array + items: + $ref: '#/components/schemas/Product' + required: + - products + ProductRolesResponse: + title: ProductRolesResponse + type: object + description: This payload contains the currently defined bindings between roles and platform roles. + properties: + managerRoles: + type: array + description: binding between manager and its platform roles + items: + type: string + delegateRoles: + type: array + description: binding between delegate and its platform roles + items: + type: string + operatorRoles: + type: array + description: binding between operator and its platform roles + items: + type: string + required: + - managerRoles + - delegateRoles + - operatorRoles + PartyRole: + type: string + description: Represents the generic available role types for the relationship + enum: + - MANAGER + - DELEGATE + - SUB_DELEGATE + - OPERATOR + RelationshipState: + type: string + description: Represents the party relationship state + enum: + - PENDING + - ACTIVE + - SUSPENDED + - DELETED + - REJECTED + ProductState: + type: string + description: Represents the product state + enum: + - PENDING + - ACTIVE + Institution: + type: object + properties: + id: + type: string + format: uuid + example: 97c0f418-bcb3-48d4-825a-fe8b29ae68e5 + externalId: + description: external institution id + example: 'c_f205' + type: string + originId: + description: origin institution id (e.g iPA code) + example: 'c_f205' + type: string + description: + type: string + example: AGENCY X + digitalAddress: + example: email@pec.mail.org + format: email + type: string + address: + example: via del campo + type: string + zipCode: + example: 20100 + type: string + taxCode: + description: institution tax code + type: string + origin: + type: string + description: The origin form which the institution has been retrieved + example: IPA + institutionType: + type: string + description: institution type + example: PA + attributes: + $ref: '#/components/schemas/Attributes' + required: + - id + - externalId + - originId + - description + - digitalAddress + - address + - zipCode + - taxCode + - attributes + - origin + additionalProperties: false + Problem: + properties: + type: + description: URI reference of type definition + type: string + status: + description: The HTTP status code generated by the origin server for this occurrence of the problem. + example: 503 + exclusiveMaximum: true + format: int32 + maximum: 600 + minimum: 100 + type: integer + title: + description: A short, summary of the problem type. Written in english and readable + example: Service Unavailable + maxLength: 64 + pattern: '^[ -~]{0,64}$' + type: string + detail: + description: A human readable explanation of the problem. + example: Request took too long to complete. + maxLength: 4096 + pattern: '^.{0,1024}$' + type: string + errors: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/ProblemError' + additionalProperties: false + required: + - type + - status + - title + - errors + ProblemError: + properties: + code: + description: Internal code of the error + example: 123-4567 + minLength: 8 + maxLength: 8 + pattern: '^[0-9]{3}-[0-9]{4}$' + type: string + detail: + description: A human readable explanation specific to this occurrence of the problem. + example: Parameter not valid + maxLength: 4096 + pattern: '^.{0,1024}$' + type: string + required: + - code + - detail + securitySchemes: + apiKeySelfcare: + type: apiKey + name: Ocp-Apim-Subscription-Key + in: header \ No newline at end of file diff --git a/user-registry-client/.openapi-generator-ignore b/user-registry-client/.openapi-generator-ignore new file mode 100644 index 0000000..6219b10 --- /dev/null +++ b/user-registry-client/.openapi-generator-ignore @@ -0,0 +1,27 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md +build.sbt +pom.xml +README.md +project/build.properties diff --git a/user-registry-client/interface-specification.yml b/user-registry-client/interface-specification.yml new file mode 100644 index 0000000..1febf57 --- /dev/null +++ b/user-registry-client/interface-specification.yml @@ -0,0 +1,137 @@ +openapi: 3.0.1 +info: + title: pdv-ms-user-registry + description: User Registry API documentation + version: "1.0-SNAPSHOT" +tags: + - name: user + description: User operations +servers: + - url: "https://user-registry" +security: + - apiKeyHeader: [ ] +paths: + '/users/{id}': + get: + tags: + - user + summary: Find user + description: Retrieve the user by its internal id + operationId: findByIdUsingGET + parameters: + - name: id + description: User internal id + in: path + schema: + type: string + format: uuid + style: simple + required: true + - name: fl + description: Field list. Subset of fields to be retrieved for the requested resource + in: query + schema: + type: array + items: + $ref: "#/components/schemas/Field" + style: form + required: true + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UserResource' + '401': + description: Unauthorized + '403': + description: Forbidden + '404': + description: Not found +components: + schemas: + CertifiableFieldResourceOfLocalDate: + title: CertifiableFieldResourceOfLocalDate + required: + - certification + - value + type: object + properties: + certification: + type: string + description: Certified source of information + enum: + - NONE + - SPID + value: + type: string + description: Field value + format: date + CertifiableFieldResourceOfstring: + title: CertifiableFieldResourceOfstring + required: + - certification + - value + type: object + properties: + certification: + type: string + description: Certified source of information + enum: + - NONE + - SPID + value: + type: string + description: Field value + WorkContactResource: + title: WorkContactResource + type: object + properties: + email: + description: User work email + $ref: "#/components/schemas/CertifiableFieldResourceOfstring" + UserResource: + title: UserResource + required: + - id + type: object + properties: + birthDate: + description: User date of birth + $ref: "#/components/schemas/CertifiableFieldResourceOfLocalDate" + email: + description: User email + $ref: "#/components/schemas/CertifiableFieldResourceOfstring" + familyName: + description: User family name + $ref: "#/components/schemas/CertifiableFieldResourceOfstring" + fiscalCode: + type: string + description: User fiscal code + id: + type: string + description: User internal id + format: uuid + name: + description: User name + $ref: "#/components/schemas/CertifiableFieldResourceOfstring" + workContacts: + type: object + additionalProperties: + $ref: "#/components/schemas/WorkContactResource" + description: User work contacts + Field: + type: string + enum: + - birthDate + - email + - familyName + - fiscalCode + - name + - workContacts + securitySchemes: + apiKeyHeader: + type: apiKey + name: x-api-key + in: header \ No newline at end of file