@@ -69,7 +69,7 @@ type CredentialProposal struct {
69
69
SchemaIssuerDID string `json:"schema_issuer_did"`
70
70
SchemaVersion string `json:"schema_version"`
71
71
Comment string `json:"comment"`
72
- Credential CredentialPreview `json:"credential_proposal"`
72
+ CredentialPreview CredentialPreview `json:"credential_proposal"`
73
73
}
74
74
75
75
type CredentialRequest struct {
@@ -123,21 +123,12 @@ type Attribute struct {
123
123
Value string `json:"value"`
124
124
}
125
125
126
- func (c * Client ) SendCredentialExchangeOffer (offer CredentialOfferRequest ) (CredentialExchange , error ) {
127
- var credentialExchangeRecord CredentialExchange
128
- err := c .post (fmt .Sprintf ("%s/issue-credential/send-offer" , c .ACApyURL ), nil , offer , & credentialExchangeRecord )
129
- if err != nil {
130
- return CredentialExchange {}, err
131
- }
132
- return credentialExchangeRecord , nil
133
- }
134
-
135
126
type CredentialProposalRequest struct {
136
127
CredentialDefinitionID string `json:"cred_def_id"`
137
128
ConnectionID string `json:"connection_id"`
138
129
IssuerDID string `json:"issuer_did"`
139
130
Comment string `json:"comment"`
140
- CredentialProposal CredentialPreview `json:"credential_proposal"`
131
+ CredentialPreview CredentialPreview `json:"credential_proposal"`
141
132
SchemaName string `json:"schema_name"`
142
133
SchemaVersion string `json:"schema_version"`
143
134
SchemaID string `json:"schema_id"`
@@ -146,28 +137,22 @@ type CredentialProposalRequest struct {
146
137
AutoRemove bool `json:"auto_remove"`
147
138
}
148
139
149
- type CredentialProposalResponse struct {
150
- CredentialExchangeID string `json:"credential_exchange_id"`
151
- ConnectionID string `json:"connection_id"`
152
- ThreadID string `json:"thread_id"`
153
- State string `json:"state"`
154
- Initiator string `json:"initiator"`
155
- Role string `json:"role"`
156
- CredentialProposalMap CredentialProposal `json:"credential_proposal_dict"`
157
- CreatedAt string `json:"created_at"`
158
- UpdatedAt string `json:"updated_at"`
159
- Trace bool `json:"trace"`
160
- AutoIssue bool `json:"auto_issue"`
161
- AutoRemove bool `json:"auto_remove"`
140
+ func (c * Client ) SendCredentialProposal (proposal CredentialProposalRequest ) (CredentialExchange , error ) {
141
+ var credentialExchange CredentialExchange
142
+ err := c .post (fmt .Sprintf ("%s/issue-credential/send-proposal" , c .ACApyURL ), nil , proposal , & credentialExchange )
143
+ if err != nil {
144
+ return CredentialExchange {}, err
145
+ }
146
+ return credentialExchange , nil
162
147
}
163
148
164
- func (c * Client ) SendCredentialExchangeProposal ( proposal CredentialProposalRequest ) (CredentialProposalResponse , error ) {
165
- var credentialProposalResponse CredentialProposalResponse
166
- err := c .post (fmt .Sprintf ("%s/issue-credential/send-proposal " , c .ACApyURL ), nil , proposal , & credentialProposalResponse )
149
+ func (c * Client ) SendCredentialOffer ( offer CredentialOfferRequest ) (CredentialExchange , error ) {
150
+ var credentialExchangeRecord CredentialExchange
151
+ err := c .post (fmt .Sprintf ("%s/issue-credential/send-offer " , c .ACApyURL ), nil , offer , & credentialExchangeRecord )
167
152
if err != nil {
168
- return CredentialProposalResponse {}, err
153
+ return CredentialExchange {}, err
169
154
}
170
- return credentialProposalResponse , nil
155
+ return credentialExchangeRecord , nil
171
156
}
172
157
173
158
type QueryCredentialExchangeParams struct {
@@ -204,17 +189,16 @@ func (c *Client) GetCredentialExchange(credentialExchangeID string) (CredentialE
204
189
}
205
190
206
191
type CredentialCreateRequest struct {
207
- CredentialDefinitionID string `json:"cred_def_id"`
208
- // ConnectionID string `json:"connection_id"`
209
- IssuerDID string `json:"issuer_did"`
210
- Comment string `json:"comment"`
211
- CredentialProposal CredentialPreview `json:"credential_proposal"`
212
- SchemaName string `json:"schema_name"`
213
- SchemaVersion string `json:"schema_version"`
214
- SchemaID string `json:"schema_id"`
215
- SchemaIssuerDID string `json:"schema_issuer_did"`
216
- Trace bool `json:"trace"`
217
- AutoRemove bool `json:"auto_remove"`
192
+ CredentialDefinitionID string `json:"cred_def_id"`
193
+ IssuerDID string `json:"issuer_did"`
194
+ Comment string `json:"comment"`
195
+ CredentialPreview CredentialPreview `json:"credential_proposal"`
196
+ SchemaName string `json:"schema_name"`
197
+ SchemaVersion string `json:"schema_version"`
198
+ SchemaID string `json:"schema_id"`
199
+ SchemaIssuerDID string `json:"schema_issuer_did"`
200
+ Trace bool `json:"trace"`
201
+ AutoRemove bool `json:"auto_remove"`
218
202
}
219
203
220
204
func (c * Client ) CreateCredentialExchange (request CredentialCreateRequest ) (CredentialExchange , error ) {
@@ -228,7 +212,7 @@ func (c *Client) CreateCredentialExchange(request CredentialCreateRequest) (Cred
228
212
229
213
type CredentialSendRequest CredentialProposalRequest
230
214
231
- func (c * Client ) SendCredentialExchange (request CredentialSendRequest ) (CredentialExchange , error ) {
215
+ func (c * Client ) SendCredential (request CredentialSendRequest ) (CredentialExchange , error ) {
232
216
var credentialExchange CredentialExchange
233
217
err := c .post (fmt .Sprintf ("%s/issue-credential/send" , c .ACApyURL ), nil , request , & credentialExchange )
234
218
if err != nil {
@@ -237,7 +221,7 @@ func (c *Client) SendCredentialExchange(request CredentialSendRequest) (Credenti
237
221
return credentialExchange , nil
238
222
}
239
223
240
- func (c * Client ) SendCredentialExchangeOfferByID (credentialExchangeID string ) (CredentialExchange , error ) {
224
+ func (c * Client ) SendCredentialOfferByID (credentialExchangeID string ) (CredentialExchange , error ) {
241
225
var credentialExchange CredentialExchange
242
226
err := c .post (fmt .Sprintf ("%s/issue-credential/records/%s/send-offer" , c .ACApyURL , credentialExchangeID ), nil , nil , & credentialExchange )
243
227
if err != nil {
@@ -246,7 +230,7 @@ func (c *Client) SendCredentialExchangeOfferByID(credentialExchangeID string) (C
246
230
return credentialExchange , nil
247
231
}
248
232
249
- func (c * Client ) SendCredentialExchangeRequestByID (credentialExchangeID string ) (CredentialExchange , error ) {
233
+ func (c * Client ) SendCredentialRequestByID (credentialExchangeID string ) (CredentialExchange , error ) {
250
234
var credentialExchange CredentialExchange
251
235
err := c .post (fmt .Sprintf ("%s/issue-credential/records/%s/send-request" , c .ACApyURL , credentialExchangeID ), nil , nil , & credentialExchange )
252
236
if err != nil {
@@ -255,7 +239,7 @@ func (c *Client) SendCredentialExchangeRequestByID(credentialExchangeID string)
255
239
return credentialExchange , nil
256
240
}
257
241
258
- func (c * Client ) SendCredentialToHolder (credentialExchangeID string , comment string ) (CredentialExchange , error ) {
242
+ func (c * Client ) IssueCredentialByID (credentialExchangeID string , comment string ) (CredentialExchange , error ) {
259
243
var credentialExchange CredentialExchange
260
244
var body = struct {
261
245
Comment string `json:"comment"`
@@ -269,7 +253,8 @@ func (c *Client) SendCredentialToHolder(credentialExchangeID string, comment str
269
253
return credentialExchange , nil
270
254
}
271
255
272
- func (c * Client ) StoreReceivedCredential (credentialExchangeID string , credentialID string ) (CredentialExchange , error ) {
256
+ // credentialID is optional: https://github.com/hyperledger/aries-cloudagent-python/issues/594#issuecomment-656113125
257
+ func (c * Client ) StoreCredentialByID (credentialExchangeID string , credentialID string ) (CredentialExchange , error ) {
273
258
var credentialExchange CredentialExchange
274
259
var body = struct {
275
260
CredentialID string `json:"credential_id"`
0 commit comments