Skip to content

mydatamyconsent/dotnet-sdk

Repository files navigation

MyDataMyConsent - the C# library for the My Data My Consent - Developer API

Unleashing the power of 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.

This C# SDK is automatically generated by the OpenAPI Generator project:

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using MyDataMyConsent.Api;
using MyDataMyConsent.Client;
using MyDataMyConsent.Models;

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using MyDataMyConsent.Api;
using MyDataMyConsent.Client;
using MyDataMyConsent.Models;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.mydatamyconsent.com";
            // Configure OAuth2 access token for authorization: OAuth2ClientCredentials
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new DataProcessingAgreementsApi(config);
            var pageNo = 56;  // int? |  (optional) 
            var pageSize = 56;  // int? |  (optional) 

            try
            {
                // Get paginated data processing agreements.
                PaginatedListOfDataProcessingAgreements result = apiInstance.V1DataAgreementsGet(pageNo, pageSize);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling DataProcessingAgreementsApi.V1DataAgreementsGet: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.mydatamyconsent.com

Class Method HTTP request Description
DataProcessingAgreementsApi V1DataAgreementsGet GET /v1/data-agreements Get paginated data processing agreements.
DataProcessingAgreementsApi V1DataAgreementsIdDelete DELETE /v1/data-agreements/{id} Delete a data processing agreement this will not delete a published or a agreement in use with consents.
DataProcessingAgreementsApi V1DataAgreementsIdGet GET /v1/data-agreements/{id} Get data processing agreement by id.
DataProcessingAgreementsApi V1DataAgreementsIdPut PUT /v1/data-agreements/{id} Update data processing agreement.
DataProcessingAgreementsApi V1DataAgreementsIdTerminatePut PUT /v1/data-agreements/{id}/terminate Terminate a data processing agreement by id.
DataProcessingAgreementsApi V1DataAgreementsPost POST /v1/data-agreements Create a data processing agreement.
DataProvidersDiscoveryApi V1DataProvidersGet GET /v1/data-providers Discover all data providers in my data my consent by country and filters.
DataProvidersDiscoveryApi V1DataProvidersIdGet GET /v1/data-providers/{id} Get a data provider details by provider id.
IndividualsApi IssuerIssuedoc1XmlPost POST /issuer/issuedoc/1/xml Digilocker compatible endpoint to issue document.
IndividualsApi V1IndividualsConsentRequestsGet GET /v1/individuals/consent-requests Get all consent requests sent to Individuals.
IndividualsApi V1IndividualsConsentRequestsPost POST /v1/individuals/consent-requests Create individual consent request.
IndividualsApi V1IndividualsConsentRequestsRequestIdCancelPut PUT /v1/individuals/consent-requests/{request_id}/cancel Cancel the Individual data request by id.
IndividualsApi V1IndividualsConsentRequestsRequestIdGet GET /v1/individuals/consent-requests/{request_id} Get Individual data request by id.
IndividualsApi V1IndividualsConsentTemplatesGet GET /v1/individuals/consent-templates Get the paginated list of individual consent templates.
IndividualsApi V1IndividualsConsentTemplatesTemplateIdGet GET /v1/individuals/consent-templates/{template_id} Get Individual consent template details by consent id.
IndividualsApi V1IndividualsConsentsConsentIdDocumentsDocumentIdDownloadGet GET /v1/individuals/consents/{consent_id}/documents/{document_id}/download Download Individual consented document by document id.
IndividualsApi V1IndividualsConsentsConsentIdDocumentsDocumentIdGet GET /v1/individuals/consents/{consent_id}/documents/{document_id} Get Individual consented document by document id.
IndividualsApi V1IndividualsConsentsConsentIdDocumentsGet GET /v1/individuals/consents/{consent_id}/documents Get Individual consented document by consent id.
IndividualsApi V1IndividualsConsentsConsentIdFinancialAccountsAccountIdGet GET /v1/individuals/consents/{consent_id}/financial-accounts/{account_id} Get individual consented financial account details.
IndividualsApi V1IndividualsConsentsConsentIdFinancialAccountsAccountIdTransactionsGet GET /v1/individuals/consents/{consent_id}/financial-accounts/{account_id}/transactions Get individual consented financial account transactions.
IndividualsApi V1IndividualsConsentsConsentIdFinancialAccountsGet GET /v1/individuals/consents/{consent_id}/financial-accounts Get all individual consented financial accounts.
IndividualsApi V1IndividualsConsentsConsentIdGet GET /v1/individuals/consents/{consent_id} Get Individuals consent details by consent id.
IndividualsApi V1IndividualsConsentsConsentIdHealthFhirBundleGet GET /v1/individuals/consents/{consent_id}/health/fhir/bundle Get Individual consented document by consent id.
IndividualsApi V1IndividualsConsentsGet GET /v1/individuals/consents Get the paginated list of Individual consents.
IndividualsApi V1IndividualsDocumentsIssueIssueRequestIdUploadPost POST /v1/individuals/documents/issue/{issue_request_id}/upload Upload a document for issuance request of individual.
IndividualsApi V1IndividualsDocumentsIssuePost POST /v1/individuals/documents/issue Issue a new document to an individual user.
IndividualsApi V1IndividualsDocumentsIssuedDocumentIdGet GET /v1/individuals/documents/issued/{document_id} Get issued document.
IndividualsApi V1IndividualsDocumentsIssuedGet GET /v1/individuals/documents/issued Get paginated list of issued documents of given document type.
IndividualsApi V1IndividualsDocumentsTypesGet GET /v1/individuals/documents/types Get paginated list of registered document types.
OrganizationsApi V1OrganizationsConsentRequestsGet GET /v1/organizations/consent-requests Get all consent requests sent to Organizations.
OrganizationsApi V1OrganizationsConsentRequestsPost POST /v1/organizations/consent-requests Create consent request for an Organization.
OrganizationsApi V1OrganizationsConsentRequestsRequestIdCancelPut PUT /v1/organizations/consent-requests/{request_id}/cancel Cancel the Organization data request by id.
OrganizationsApi V1OrganizationsConsentRequestsRequestIdGet GET /v1/organizations/consent-requests/{request_id} Get Organization data request by id.
OrganizationsApi V1OrganizationsConsentTemplatesGet GET /v1/organizations/consent-templates Get the paginated list of organization consent templates.
OrganizationsApi V1OrganizationsConsentTemplatesTemplateIdGet GET /v1/organizations/consent-templates/{template_id} Get Organization consent template details by consent id.
OrganizationsApi V1OrganizationsConsentsConsentIdDocumentsDocumentIdDownloadGet GET /v1/organizations/consents/{consent_id}/documents/{document_id}/download Download Organization consent document by document id.
OrganizationsApi V1OrganizationsConsentsConsentIdDocumentsDocumentIdGet GET /v1/organizations/consents/{consent_id}/documents/{document_id} Get Organization consent document based on document id and consent id.
OrganizationsApi V1OrganizationsConsentsConsentIdDocumentsGet GET /v1/organizations/consents/{consent_id}/documents Get Organization consent document by consent id.
OrganizationsApi V1OrganizationsConsentsConsentIdFinancialAccountsAccountIdGet GET /v1/organizations/consents/{consent_id}/financial-accounts/{account_id} Get organization consented financial account details.
OrganizationsApi V1OrganizationsConsentsConsentIdFinancialAccountsAccountIdTransactionsGet GET /v1/organizations/consents/{consent_id}/financial-accounts/{account_id}/transactions Get organization consented financial account transactions.
OrganizationsApi V1OrganizationsConsentsConsentIdFinancialAccountsGet GET /v1/organizations/consents/{consent_id}/financial-accounts Get all organization consented financial accounts.
OrganizationsApi V1OrganizationsConsentsConsentIdGet GET /v1/organizations/consents/{consent_id} Get Organization consent request details by consent id.
OrganizationsApi V1OrganizationsConsentsGet GET /v1/organizations/consents Get the paginated list of Organization consents.
OrganizationsApi V1OrganizationsDocumentsIssuePost POST /v1/organizations/documents/issue Issue a new document to an organization.
OrganizationsApi V1OrganizationsDocumentsIssueUploadIssueRequestIdPost POST /v1/organizations/documents/issue/upload/{issue_request_id} Upload a document for issuance request of Organization.
OrganizationsApi V1OrganizationsDocumentsIssuedDocumentIdGet GET /v1/organizations/documents/issued/{document_id} Get issued document.
OrganizationsApi V1OrganizationsDocumentsIssuedGet GET /v1/organizations/documents/issued Get paginated list of issued documents of given document type.
OrganizationsApi V1OrganizationsDocumentsTypesGet GET /v1/organizations/documents/types Get paginated list of registered document types.
SupportedIdentifiersApi V1SupportedIdentifiersCountryIso2CodeGet GET /v1/supported-identifiers/{country_iso2_code} Get all supported identifiers by country.

Documentation for Models

Documentation for Authorization

OAuth2ClientCredentials

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
    • SupportedIdentifiers:Read: Read SupportedIdentifiers.
    • DataProviders:Read: Read DataProviders.
    • DataProcessingAgreements:Read: Read DataProcessingAgreements.
    • DataProcessingAgreements:Write: Read & Write DataProcessingAgreements.
    • Individuals:DocumentTypes:Read: Read Individual DocumentTypes.
    • Individuals:Documents:Read: Read Individual Issued Documents.
    • Individuals:Documents:Issue: Issue Individual Documents.
    • Organizations:DocumentTypes:Read: Read Organization DocumentTypes.
    • Organizations:Documents:Read: Read Organization Issued Documents.
    • Organizations:Documents:Issue: Issue Organization Documents.
    • Individuals:ConsentRequests:Request: Request Individual Consent requests.
    • Individuals:ConsentRequests:Cancel: Cancel Individual Consent requests.
    • Individuals:ConsentRequests:Read: Read Individual Consent requests.
    • Organizations:ConsentRequests:Request: Request Organization Consent requests.
    • Organizations:ConsentRequests:Cancel: Cancel Organization Consent requests.
    • Organizations:ConsentRequests:Read: Read Organization Consent requests.
    • Individuals:Consents:Read: Read Individual Consents.
    • Organizations:Consents:Read: Read Organization Consents.
    • Individuals:ConsentRequestTemplates:Read: Read Individual Consent Request templates.
    • Organizations:ConsentRequestTemplates:Read: Read Organization Consent Request templates.