summaryrefslogtreecommitdiff
path: root/libeufin/api-common.rst
blob: 58ae7e37c21a0a627b9b42df36ebf9af09ffc7d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
====================================
Common LibEuFin HTTP API Conventions
====================================


Contact details
^^^^^^^^^^^^^^^

.. ts:def:: EmailAddress

  type EmailAddress = string;

.. ts:def:: PhoneNumber

  type PhoneNumber = string;

Phone numbers should start with the ``+`` symbol and the country code.

Ratios and Fees
^^^^^^^^^^^^^^^

.. ts:def:: LibeufinNumber

   type LibeufinNumber = number;

**Note:** this quantity is normally enforced to have at most
two decimal digits.  The reason is to preserve the 2-decimal
digits policy of the `Amount` type, as `LibeufinNumber` is used
to multiply `Amount`. 

Amounts
^^^^^^^

.. ts:def:: Amount

  type Amount = string;

Amounts have the ``$currency:X.Y`` format, where the
fractional part is optional and may contain at most two
digits.

Permissions
^^^^^^^^^^^

This type epresses which permissions for a subject
apply on a resource.

.. ts:def:: LibeufinPermission

  interface LibeufinPermission {
    subjectType: string;
    subjectId: string;
    resourceType: string;
    resourceId: string;
    permissionName: string
  }
Fetch params
^^^^^^^^^^^^

.. _fetch-params:

.. ts:def:: FetchParams

  interface FetchParams {

    // Because transactions are delivered by banks in "batches",
    // then every batch can have different qualities.  This value
    // lets the request specify which type of batch ought to be
    // returned.  Currently, the following two type are supported:
    //
    // 'report': typically includes only non booked transactions.
    // 'statement': typically includes only booked transactions.
    level: "report" | "statement" | "all";

    // This type indicates the time range of the query.
    // It allows the following values:
    //
    // 'latest': retrieves the last transactions from the bank.
    //           If there are older unread transactions, those will *not*
    //           be downloaded.
    //
    // 'all': retrieves all the transactions from the bank,
    //        until the oldest.
    //
    // 'previous-days': currently *not* implemented, it will allow
    //                  the request to download transactions from
    //                  today until N days before.
    //
    // 'since-last': retrieves all the transactions since the last
    //               time one was downloaded.
    //
    rangeType: "latest" | "all" | "previous-days" | "since-last";
  };