Skip to content

Commit

Permalink
Merge pull request #167 from andrewwhitehead/36-37-renaming
Browse files Browse the repository at this point in the history
Remove references to aries 36/37; update related admin routes
  • Loading branch information
swcurran authored Sep 3, 2019
2 parents dea5278 + 29bb057 commit 6b987a3
Show file tree
Hide file tree
Showing 14 changed files with 187 additions and 212 deletions.
24 changes: 15 additions & 9 deletions aries_cloudagent/messaging/credentials/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ async def credentials_list(request: web.BaseRequest):
return web.json_response({"results": credentials})


@docs(tags=["credential_exchange"], summary="Fetch all credential exchange records")
@docs(
tags=["credential_exchange *DEPRECATED*"],
summary="Fetch all credential exchange records",
)
@response_schema(CredentialExchangeListSchema(), 200)
async def credential_exchange_list(request: web.BaseRequest):
"""
Expand Down Expand Up @@ -216,7 +219,10 @@ async def credential_exchange_list(request: web.BaseRequest):
return web.json_response({"results": [record.serialize() for record in records]})


@docs(tags=["credential_exchange"], summary="Fetch a single credential exchange record")
@docs(
tags=["credential_exchange *DEPRECATED*"],
summary="Fetch a single credential exchange record",
)
@response_schema(CredentialExchangeSchema(), 200)
async def credential_exchange_retrieve(request: web.BaseRequest):
"""
Expand All @@ -241,7 +247,7 @@ async def credential_exchange_retrieve(request: web.BaseRequest):


@docs(
tags=["credential_exchange"],
tags=["credential_exchange *DEPRECATED*"],
summary="Sends a credential and automates the entire flow",
)
@request_schema(CredentialSendRequestSchema())
Expand Down Expand Up @@ -289,7 +295,7 @@ async def credential_exchange_send(request: web.BaseRequest):
return web.json_response(credential_exchange_record.serialize())


@docs(tags=["credential_exchange"], summary="Sends a credential offer")
@docs(tags=["credential_exchange *DEPRECATED*"], summary="Sends a credential offer")
@request_schema(CredentialOfferRequestSchema())
@response_schema(CredentialOfferResultSchema(), 200)
async def credential_exchange_send_offer(request: web.BaseRequest):
Expand Down Expand Up @@ -337,7 +343,7 @@ async def credential_exchange_send_offer(request: web.BaseRequest):
return web.json_response(credential_exchange_record.serialize())


@docs(tags=["credential_exchange"], summary="Sends a credential request")
@docs(tags=["credential_exchange *DEPRECATED*"], summary="Sends a credential request")
@response_schema(CredentialRequestResultSchema(), 200)
async def credential_exchange_send_request(request: web.BaseRequest):
"""
Expand Down Expand Up @@ -385,7 +391,7 @@ async def credential_exchange_send_request(request: web.BaseRequest):
return web.json_response(credential_exchange_record.serialize())


@docs(tags=["credential_exchange"], summary="Sends a credential")
@docs(tags=["credential_exchange *DEPRECATED*"], summary="Sends a credential")
@request_schema(CredentialIssueRequestSchema())
@response_schema(CredentialIssueResultSchema(), 200)
async def credential_exchange_issue(request: web.BaseRequest):
Expand Down Expand Up @@ -434,7 +440,7 @@ async def credential_exchange_issue(request: web.BaseRequest):
return web.json_response(credential_exchange_record.serialize())


@docs(tags=["credential_exchange"], summary="Stores a received credential")
@docs(tags=["credential_exchange *DEPRECATED*"], summary="Stores a received credential")
@response_schema(CredentialRequestResultSchema(), 200)
async def credential_exchange_store(request: web.BaseRequest):
"""
Expand Down Expand Up @@ -483,7 +489,7 @@ async def credential_exchange_store(request: web.BaseRequest):


@docs(
tags=["credential_exchange"],
tags=["credential_exchange *DEPRECATED*"],
summary="Send a problem report for credential exchange",
)
@request_schema(CredentialProblemReportRequestSchema())
Expand Down Expand Up @@ -518,7 +524,7 @@ async def credential_exchange_problem_report(request: web.BaseRequest):


@docs(
tags=["credential_exchange"],
tags=["credential_exchange *DEPRECATED*"],
summary="Remove an existing credential exchange record",
)
async def credential_exchange_remove(request: web.BaseRequest):
Expand Down
29 changes: 12 additions & 17 deletions aries_cloudagent/messaging/issue_credential/v1_0/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ async def prepare_send(
)
await credential_exchange.save(
self.context,
reason=(
"Aries#0036v1.0 create automated credential exchange "
"from cached request"
)
reason="create automated credential exchange from cached request"
)

else:
Expand All @@ -160,9 +157,7 @@ async def prepare_send(
)
(credential_exchange, _) = await self.create_offer(
credential_exchange_record=credential_exchange,
comment=(
"Aries#0036v1.0 create automated credential exchange "
)
comment="create automated credential exchange"
)

# Mark this credential exchange as the current cached one for this cred def
Expand Down Expand Up @@ -263,7 +258,7 @@ async def create_proposal(
)
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 create credential proposal")
reason="create credential proposal")
return credential_exchange_record

async def receive_proposal(
Expand Down Expand Up @@ -310,7 +305,7 @@ async def receive_proposal(
)
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 receive credential proposal"
reason="receive credential proposal"
)

return credential_exchange_record
Expand Down Expand Up @@ -361,7 +356,7 @@ async def create_offer(
credential_exchange_record.credential_offer = credential_offer
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 create credential offer"
reason="create credential offer"
)

return (credential_exchange_record, credential_offer_message)
Expand All @@ -383,7 +378,7 @@ async def receive_offer(
credential_exchange_record.state = V10CredentialExchange.STATE_OFFER_RECEIVED
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 receive credential offer"
reason="receive credential offer"
)

return credential_exchange_record
Expand Down Expand Up @@ -445,7 +440,7 @@ async def create_request(
credential_exchange_record.state = V10CredentialExchange.STATE_REQUEST_SENT
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 create credential request"
reason="create credential request"
)

return credential_exchange_record, credential_request_message
Expand Down Expand Up @@ -476,7 +471,7 @@ async def receive_request(
credential_exchange_record.state = V10CredentialExchange.STATE_REQUEST_RECEIVED
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 receive credential request"
reason="receive credential request"
)

return credential_exchange_record
Expand Down Expand Up @@ -531,7 +526,7 @@ async def issue_credential(
credential_exchange_record.state = V10CredentialExchange.STATE_ISSUED
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 receive credential"
reason="receive credential"
)

credential_message = CredentialIssue(
Expand Down Expand Up @@ -607,7 +602,7 @@ async def receive_credential(

await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 receive credential"
reason="receive credential"
)
return credential_exchange_record

Expand Down Expand Up @@ -649,7 +644,7 @@ async def store_credential(self, credential_exchange_record: V10CredentialExchan
credential_exchange_record.credential = credential
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 store credential"
reason="store credential"
)

credential_stored_message = CredentialStored()
Expand Down Expand Up @@ -682,7 +677,7 @@ async def credential_stored(self, credential_stored_message: CredentialStored):
credential_exchange_record.state = V10CredentialExchange.STATE_STORED
await credential_exchange_record.save(
self.context,
reason="Aries#0036v1.0 credential stored"
reason="credential stored"
)

return credential_exchange_record
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class Meta:

schema_class = "V10CredentialExchangeSchema"

RECORD_TYPE = "v10_credential_exchange"
RECORD_TYPE = "credential_exchange_v10"
RECORD_ID_NAME = "credential_exchange_id"
WEBHOOK_TOPIC = "aries36_v10_credentials"
WEBHOOK_TOPIC = "issue_credential"

INITIATOR_SELF = "self"
INITIATOR_EXTERNAL = "external"
Expand Down Expand Up @@ -93,7 +93,7 @@ def record_value(self) -> dict:
"auto_issue",
"raw_credential",
"credential",
"parent_thread_id"
"parent_thread_id",
):
val = getattr(self, prop)
if val:
Expand Down
50 changes: 25 additions & 25 deletions aries_cloudagent/messaging/issue_credential/v1_0/routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Connection handling admin routes."""
"""Credential exchange admin routes."""

import asyncio

Expand Down Expand Up @@ -96,7 +96,7 @@ class V10CredentialProblemReportRequestSchema(Schema):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 credentials"],
tags=["issue-credential"],
summary="Get attribute MIME types from wallet"
)
@response_schema(V10AttributeMimeTypesResultSchema(), 200)
Expand All @@ -119,7 +119,7 @@ async def attribute_mime_types_get(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Fetch all credential exchange records"
)
@response_schema(V10CredentialExchangeListResultSchema(), 200)
Expand Down Expand Up @@ -150,7 +150,7 @@ async def credential_exchange_list(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential exchange"],
summary="Fetch a single credential exchange record"
)
@response_schema(V10CredentialExchangeSchema(), 200)
Expand Down Expand Up @@ -178,7 +178,7 @@ async def credential_exchange_retrieve(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Send credential, automating entire flow"
)
@request_schema(V10CredentialProposalRequestSchema())
Expand Down Expand Up @@ -251,7 +251,7 @@ async def credential_exchange_send(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Send issuer a credential proposal"
)
@request_schema(V10CredentialProposalRequestSchema())
Expand Down Expand Up @@ -321,7 +321,7 @@ async def credential_exchange_send_proposal(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Send holder a credential offer, free from reference to any proposal"
)
@request_schema(V10CredentialOfferRequestSchema())
Expand Down Expand Up @@ -409,7 +409,7 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Send holder a credential offer in reference to a proposal"
)
@response_schema(V10CredentialExchangeSchema(), 200)
Expand Down Expand Up @@ -468,7 +468,7 @@ async def credential_exchange_send_bound_offer(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Send a credential request"
)
@response_schema(V10CredentialExchangeSchema(), 200)
Expand Down Expand Up @@ -523,7 +523,7 @@ async def credential_exchange_send_request(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Send a credential"
)
@request_schema(V10CredentialIssueRequestSchema())
Expand Down Expand Up @@ -582,7 +582,7 @@ async def credential_exchange_issue(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Stored a received credential"
)
@response_schema(V10CredentialExchangeSchema(), 200)
Expand Down Expand Up @@ -636,7 +636,7 @@ async def credential_exchange_store(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Send a problem report for credential exchange",
)
@request_schema(V10CredentialProblemReportRequestSchema())
Expand Down Expand Up @@ -673,7 +673,7 @@ async def credential_exchange_problem_report(request: web.BaseRequest):


@docs(
tags=["*EXPERIMENTAL* aries#0036 v1.0 issue-credential exchange"],
tags=["issue-credential"],
summary="Remove an existing credential exchange record",
)
async def credential_exchange_remove(request: web.BaseRequest):
Expand Down Expand Up @@ -704,51 +704,51 @@ async def register(app: web.Application):
app.add_routes(
[
web.get(
"/aries0036/v1.0/mime_types/{credential_id}",
"/issue-credential/mime-types/{credential_id}",
attribute_mime_types_get
),
web.get(
"/aries0036/v1.0/credential_exchange",
"/issue-credential/records",
credential_exchange_list
),
web.get(
"/aries0036/v1.0/issue_credential/{cred_ex_id}",
"/issue-credential/records/{cred_ex_id}",
credential_exchange_retrieve
),
web.post(
"/aries0036/v1.0/issue_credential/send",
"/issue-credential/send",
credential_exchange_send
),
web.post(
"/aries0036/v1.0/issue_credential/send_proposal",
"/issue-credential/send-proposal",
credential_exchange_send_proposal
),
web.post(
"/aries0036/v1.0/issue_credential/send_offer",
"/issue-credential/send-offer",
credential_exchange_send_free_offer
),
web.post(
"/aries0036/v1.0/issue_credential/{cred_ex_id}/send_offer",
"/issue-credential/records/{cred_ex_id}/send-offer",
credential_exchange_send_bound_offer
),
web.post(
"/aries0036/v1.0/issue_credential/{cred_ex_id}/send_request",
"/issue-credential/records/{cred_ex_id}/send-request",
credential_exchange_send_request
),
web.post(
"/aries0036/v1.0/issue_credential/{cred_ex_id}/issue",
"/issue-credential/records/{cred_ex_id}/issue",
credential_exchange_issue
),
web.post(
"/aries0036/v1.0/issue_credential/{cred_ex_id}/store",
"/issue-credential/records/{cred_ex_id}/store",
credential_exchange_store
),
web.post(
"/aries0036/v1.0/issue_credential/{cred_ex_id}/problem_report",
"/issue-credential/records/{cred_ex_id}/problem-report",
credential_exchange_problem_report
),
web.post(
"/aries0036/v1.0/issue_credential/{cred_ex_id}/remove",
"/issue-credential/records/{cred_ex_id}/remove",
credential_exchange_remove
)
]
Expand Down
Loading

0 comments on commit 6b987a3

Please sign in to comment.