@delopay/sdk 0.60.0 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +421 -421
- package/dist/{chunk-6GBHQKUX.js → chunk-ADPSXHH7.js} +87 -1
- package/dist/chunk-ADPSXHH7.js.map +1 -0
- package/dist/index.cjs +86 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +1 -1
- package/dist/internal.cjs +86 -0
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/package.json +64 -63
- package/dist/chunk-6GBHQKUX.js.map +0 -1
|
@@ -100,6 +100,92 @@ var ApiKeys = class {
|
|
|
100
100
|
async list(merchantId) {
|
|
101
101
|
return this.request("GET", `/api-keys/${encodeURIComponent(merchantId)}/list`);
|
|
102
102
|
}
|
|
103
|
+
// --- Profile-scoped (shop-level) API keys ---------------------------------
|
|
104
|
+
//
|
|
105
|
+
// JWT-authenticated routes under `/account/{merchantId}/profile/api-keys`.
|
|
106
|
+
// The caller's shop (business profile) comes from the JWT, never from the
|
|
107
|
+
// request, so a shop-scoped user can only mint/list/manage keys pinned to
|
|
108
|
+
// their own shop. Requires a backend with profile-scoped API key support
|
|
109
|
+
// (DeloPay-net/delopay-backend#344).
|
|
110
|
+
/**
|
|
111
|
+
* Create a new API key pinned to the caller's shop (business profile).
|
|
112
|
+
* `POST /account/{merchantId}/profile/api-keys`
|
|
113
|
+
*
|
|
114
|
+
* @param merchantId - The merchant account ID.
|
|
115
|
+
* @param params - Key creation parameters (name, expiry, etc.).
|
|
116
|
+
* @returns The newly created key including the plaintext secret (shown once
|
|
117
|
+
* only) and the `profile_id` it is pinned to.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* const { api_key } = await delopay.apiKeys.createByProfile('merch_123', {
|
|
122
|
+
* name: 'Shop key',
|
|
123
|
+
* expiration: 'never',
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
async createByProfile(merchantId, params) {
|
|
128
|
+
return this.request("POST", `/account/${encodeURIComponent(merchantId)}/profile/api-keys`, {
|
|
129
|
+
body: params
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* List API keys pinned to the caller's shop (business profile) only.
|
|
134
|
+
* `GET /account/{merchantId}/profile/api-keys`
|
|
135
|
+
*
|
|
136
|
+
* @param merchantId - The merchant account ID.
|
|
137
|
+
* @param params - Optional pagination constraints (`limit`, `skip`).
|
|
138
|
+
* @returns Array of API key metadata objects belonging to the caller's shop.
|
|
139
|
+
*/
|
|
140
|
+
async listByProfile(merchantId, params) {
|
|
141
|
+
return this.request("GET", `/account/${encodeURIComponent(merchantId)}/profile/api-keys`, {
|
|
142
|
+
query: params
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Retrieve metadata about a shop-pinned API key (does not return the
|
|
147
|
+
* plaintext secret). `GET /account/{merchantId}/profile/api-keys/{keyId}`
|
|
148
|
+
*
|
|
149
|
+
* @param merchantId - The merchant account ID.
|
|
150
|
+
* @param keyId - The API key ID.
|
|
151
|
+
* @returns The API key metadata.
|
|
152
|
+
*/
|
|
153
|
+
async retrieveByProfile(merchantId, keyId) {
|
|
154
|
+
return this.request(
|
|
155
|
+
"GET",
|
|
156
|
+
`/account/${encodeURIComponent(merchantId)}/profile/api-keys/${encodeURIComponent(keyId)}`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Update a shop-pinned API key's name, description, or expiry.
|
|
161
|
+
* `POST /account/{merchantId}/profile/api-keys/{keyId}`
|
|
162
|
+
*
|
|
163
|
+
* @param merchantId - The merchant account ID.
|
|
164
|
+
* @param keyId - The API key ID to update.
|
|
165
|
+
* @param params - Fields to update.
|
|
166
|
+
* @returns The updated API key metadata.
|
|
167
|
+
*/
|
|
168
|
+
async updateByProfile(merchantId, keyId, params) {
|
|
169
|
+
return this.request(
|
|
170
|
+
"POST",
|
|
171
|
+
`/account/${encodeURIComponent(merchantId)}/profile/api-keys/${encodeURIComponent(keyId)}`,
|
|
172
|
+
{ body: params }
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Revoke a shop-pinned API key, immediately invalidating it.
|
|
177
|
+
* `DELETE /account/{merchantId}/profile/api-keys/{keyId}`
|
|
178
|
+
*
|
|
179
|
+
* @param merchantId - The merchant account ID.
|
|
180
|
+
* @param keyId - The API key ID to revoke.
|
|
181
|
+
* @returns Revocation confirmation.
|
|
182
|
+
*/
|
|
183
|
+
async revokeByProfile(merchantId, keyId) {
|
|
184
|
+
return this.request(
|
|
185
|
+
"DELETE",
|
|
186
|
+
`/account/${encodeURIComponent(merchantId)}/profile/api-keys/${encodeURIComponent(keyId)}`
|
|
187
|
+
);
|
|
188
|
+
}
|
|
103
189
|
};
|
|
104
190
|
|
|
105
191
|
// src/resources/authentication.ts
|
|
@@ -4150,4 +4236,4 @@ export {
|
|
|
4150
4236
|
applyBrandingVariables,
|
|
4151
4237
|
shadowFor
|
|
4152
4238
|
};
|
|
4153
|
-
//# sourceMappingURL=chunk-
|
|
4239
|
+
//# sourceMappingURL=chunk-ADPSXHH7.js.map
|