# Go API client for github.com/mydatamyconsent/sdk
Unleashing the power of data consent by establishing trust. The Platform Core Developer API defines a set of capabilities that can be used to request, issue, manage and update data, documents and credentials by organizations. The API can be used to request, manage and update Decentralised Identifiers, Financial Data, Health Data issue Documents, Credentials directly or using OpenID Connect flows, and verify Messages signed with DIDs and much more.
# Overview
This API client was generated by the OpenAPI Generator (opens new window) project. By using the OpenAPI-spec (opens new window) from a remote server, you can easily generate an API client.
- API version: v1
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://mydatamyconsent.com/en-us/developers (opens new window)
# Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
2
3
Put the package under your project folder and add the following in import:
import github.com/mydatamyconsent/sdk "github.com/mydatamyconsent/go-sdk"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
# Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
# Select Server Configuration
For using other server than the one defined on index 0 set context value sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), github.com/mydatamyconsent/sdk.ContextServerIndex, 1)
# Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), github.com/mydatamyconsent/sdk.ContextServerVariables, map[string]string{
"basePath": "v2",
})
2
3
Note, enum values are always validated and all unused variables are silently ignored.
# URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), github.com/mydatamyconsent/sdk.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), github.com/mydatamyconsent/sdk.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
2
3
4
5
6
7
8
# Documentation for API Endpoints
All URIs are relative to https://api.mydatamyconsent.com
Class | Method | HTTP request | Description |
---|---|---|---|
DataConsentRequestsApi | CancelIndividualDataConsentRequest | Put /v1/consent-requests/individual/{requestId}/cancel | Cancel the individual data consent request by Id. |
DataConsentRequestsApi | CancelOrganizationDataConsentRequest | Put /v1/consent-requests/organization/{requestId}/cancel | Cancel the organization data consent request by Id. |
DataConsentRequestsApi | CreateIndividualDataConsentRequest | Post /v1/consent-requests/individual | Create data consent request for an individual. |
DataConsentRequestsApi | CreateOrganizationDataConsentRequest | Post /v1/consent-requests/organization | Create data consent request for an organization. |
DataConsentRequestsApi | GetAllConsentRequestsToIndividuals | Get /v1/consent-requests/individuals | Get all Consent Requests sent to individuals. |
DataConsentRequestsApi | GetAllConsentRequestsToOrganizations | Get /v1/consent-requests/organizations | Get all Consent Requests sent to organizations. |
DataConsentRequestsApi | GetIndividualConsentRequestById | Get /v1/consent-requests/individuals/{requestId} | Get individual data consent request by id. |
DataConsentRequestsApi | GetOrganizationConsentRequestById | Get /v1/consent-requests/organizations/{requestId} | Get a OrganizationConsent Request by Id. |
DataConsentsApi | DownloadConsentedDocumentAnalysis | Get /v1/consents/{consentId}/documents/{documentId}/analysis | Get analysis of a consented document. |
DataConsentsApi | DownloadIndividualConsentedDocumentById | Get /v1/consents/individuals/{consentId}/documents/{documentId}/download | Download individual consented document by document id. |
DataConsentsApi | DownloadOrganizationConsentedDocumentById | Get /v1/consents/organizations/{consentId}/documents/{documentId}/download | Download organization consent document based on document id. |
DataConsentsApi | GetAllConsentedFinancialAccounts | Get /v1/consents/individuals/{consentId}/financial-accounts | Get all individual consented financial accounts. |
DataConsentsApi | GetConsentFinancialAccounts | Get /v1/consents/organizations/{consentId}/financial-accounts | Get all organizational consented financial accounts. |
DataConsentsApi | GetConsentedAccountById | Get /v1/consents/individuals/{consentId}/financial-accounts/{accountId} | Get individual consented financial account details based on account id. |
DataConsentsApi | GetConsentedDocumentById | Get /v1/consents/individuals/{consentId}/documents/{documentId} | Get individual consented document by document id. |
DataConsentsApi | GetConsentedFinancialAccount | Get /v1/consents/organizations/{consentId}/financial-accounts/{accountId} | Get organization consented financial account details based on account id. |
DataConsentsApi | GetConsentedFinancialAccountInsights | Get /v1/consents/{consentId}/financial-accounts/{accountId}/insights | Get consented financial account insights. |
DataConsentsApi | GetConsentedFinancialAccountTransactions | Get /v1/consents/individuals/{consentId}/financial-accounts/{accountId}/transactions | Get individual consented financial account transactions of an individual based on accountId. |
DataConsentsApi | GetConsents | Get /v1/consents/individuals | Get the paginated list of individual data consents. |
DataConsentsApi | GetIndividualConsentedDocuments | Get /v1/consents/individuals/{consentId}/documents | Get individual consented documents by consent id. |
DataConsentsApi | GetIndividualDataConsentById | Get /v1/consents/individuals/{consentId} | Get individuals data consent details by consent id. |
DataConsentsApi | GetOrgConsentedAccountTransactions | Get /v1/consents/organizations/{consentId}/financial-accounts/{accountId}/transactions | Get organization consented financial account transactions of an individual based on accountId. |
DataConsentsApi | GetOrganizationConsentedDocumentById | Get /v1/consents/organizations/{consentId}/documents/{documentId} | Get organization consent document based on document id. |
DataConsentsApi | GetOrganizationConsentedDocuments | Get /v1/consents/organizations/{consentId}/documents | Get organization consented documents by consent id. |
DataConsentsApi | GetOrganizationDataConsentById | Get /v1/consents/organizations/{consentId} | Get organizations data consent details by consent id. |
DataConsentsApi | GetOrganizationDataConsents | Get /v1/consents/organizations | Get the paginated list of organization data consents. |
DataProcessingAgreementsApi | CreateDataProcessingAgreement | Post /v1/data-agreements | Create a data processing agreement. |
DataProcessingAgreementsApi | DeleteDataProcessingAgreementById | Delete /v1/data-agreements/{id} | Delete a data processing agreement. This will not delete a published or a agreement in use with consents. |
DataProcessingAgreementsApi | GetDataProcessingAgreementById | Get /v1/data-agreements/{id} | Get data processing agreement by id. |
DataProcessingAgreementsApi | GetDataProcessingAgreements | Get /v1/data-agreements | Get paginated data processing agreements. |
DataProcessingAgreementsApi | TerminateDataProcessingAgreementById | Put /v1/data-agreements/{id}/terminate | Terminate a data processing agreement. |
DataProcessingAgreementsApi | UpdateDataProcessingAgreement | Put /v1/data-agreements/{id} | Update a data processing agreement. |
DataProviderDiscoveryApi | GetDataProviderById | Get /v1/data-providers/{providerId} | Get a Data Provider details by provider id. |
DataProviderDiscoveryApi | GetDataProviders | Get /v1/data-providers | Discover all data providers in My Data My Consent by country and filters. |
DigiLockerCompatIssuerApi | DigilockerCompatIssueDocument | Post /issuer/issuedoc/1/xml | Digilocker Compatible endpoint to issue document. |
DocumentsApi | GetIssuedDocumentById | Get /v1/documents/issued/{documentId} | Get issued document. |
DocumentsApi | GetIssuedDocuments | Get /v1/documents/issued | Get paginated list of issued documents of given document type. |
DocumentsApi | GetRegisteredDocumentTypes | Get /v1/documents/types | Get paginated list of registered document types. |
DocumentsApi | IssueDocumentToIndividual | Post /v1/documents/issue/individual | Issue a new document to an individual user. |
DocumentsApi | IssueDocumentToOrganization | Post /v1/documents/issue/organization | Issue a new document to an organization. |
DocumentsApi | UploadDocumentForIndividual | Post /v1/documents/issue/individual/upload/{issueRequestId} | Upload a document for issuance request of individual. |
DocumentsApi | UploadDocumentForOrganization | Post /v1/documents/issue/organization/upload/{issueRequestId} | Upload a document for issuance request of organization. |
SupportedIdentifiersApi | GetAllSupportedIdentifiers | Get /v1/supported-identifiers/{countryIso2Code} | Get all supported identifiers by country. |
# Documentation For Models
- Activity
- ApprovedConsentRequest
- BankAccountType
- BillPaymentOrderItem
- CollectibleTypes
- ConsentRequestReceiver
- CreateDataConsentRequest
- CreateDataProcessingAgreement
- DataConsent
- DataConsentDetails
- DataConsentDetailsPaginatedList
- DataConsentDocument
- DataConsentDocumentIssuer
- DataConsentFinancialsDto
- DataConsentRequest
- DataConsentRequestDetails
- DataConsentRequestedFinancialAccount
- DataConsentStatus
- DataProcessingAgreement
- DataProcessingAgreementBase
- DataProcessingAgreementPaginatedList
- DataProtectionOfficer
- DataProvider
- DataProviderPaginatedList
- DocumentCategoryType
- DocumentDigitalSignature
- DocumentIssueRequest
- DocumentIssueRequestDetails
- DocumentIssueRequestStatus
- DocumentReceiver
- DocumentSubCategoryType
- DocumentType
- DocumentTypePaginatedList
- DocumentsRequired
- Error
- ErrorType
- Financial
- FinancialAccount
- FinancialAccountDetailsRequired
- FinancialAccounts
- IdentificationStrategy
- Identifier
- IndividualDataConsentRequestDetails
- IndividualDataConsentRequestDetailsPaginatedList
- IssuedDocument
- IssuedDocumentDetails
- IssuedDocumentPaginatedList
- Life
- OrganizationDataConsentRequestDetails
- OrganizationDataConsentRequestDetailsPaginatedList
- OrganizationFinancialAccountDto
- OrganizationFinancialTransactionsDto
- OrganizationFinancialTransactionsDtoPaginatedList
- PaymentRequest
- ProblemDetails
- PushUriRequest
- PushUriResponse
- SharedWith
- StringStringKeyValuePair
- SupportedEntityType
- SupportedIdentifier
- UpdateDataProcessingAgreement
- UriDetails
- UserAccountFinancialTransactionsDto
- UserAccountFinancialTransactionsDtoPaginatedList
# Documentation For Authorization
# oauth2
- Type: OAuth
- Flow: application
- Authorization URL: https://accounts.mydatamyconsent.com/connect/authorize
- Scopes:
- developer: Developer API
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)
2
Or via OAuth2 module to automatically refresh tokens and perform user authentication.
import "golang.org/x/oauth2"
/* Perform OAuth2 round trip request and obtain a token */
tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)
2
3
4
5
6
7
# Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime