Skip to content

Commit b82f674

Browse files
feat(api): add discoveries resource and list method
1 parent f6056c0 commit b82f674

10 files changed

Lines changed: 160 additions & 4 deletions

File tree

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 55
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lightspark%2Fgrid-eb44d3f73a6098f2dd410cb9896a3e5c2f7dbbae384cd1e8839523d18b5788bf.yml
3-
openapi_spec_hash: 49c97ed17fd291f0f22878afc202c40b
4-
config_hash: c48f66ccc627ca8bf39dfe231e26485c
1+
configured_endpoints: 56
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lightspark%2Fgrid-b0440178b0ded045e9e936cff9373c6bddcf557b037a1249bc328bdac2e47b55.yml
3+
openapi_spec_hash: 540510758de98ab16827bda43bc207cd
4+
config_hash: ea9b15789114706ecc042dc8184a6ca7

api.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,3 +368,13 @@ Methods:
368368
- <code title="get /verifications/{verificationId}">client.verifications.<a href="./src/resources/verifications.ts">retrieve</a>(verificationID) -> VerificationRetrieveResponse</code>
369369
- <code title="get /verifications">client.verifications.<a href="./src/resources/verifications.ts">list</a>({ ...params }) -> VerificationListResponsesDefaultPagination</code>
370370
- <code title="post /verifications">client.verifications.<a href="./src/resources/verifications.ts">submit</a>({ ...params }) -> VerificationSubmitResponse</code>
371+
372+
# Discoveries
373+
374+
Types:
375+
376+
- <code><a href="./src/resources/discoveries.ts">DiscoveryListResponse</a></code>
377+
378+
Methods:
379+
380+
- <code title="get /discoveries">client.discoveries.<a href="./src/resources/discoveries.ts">list</a>({ ...params }) -> DiscoveryListResponse</code>

packages/mcp-server/src/code-tool-worker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ const fuse = new Fuse(
160160
'client.verifications.list',
161161
'client.verifications.retrieve',
162162
'client.verifications.submit',
163+
'client.discoveries.list',
163164
],
164165
{ threshold: 1, shouldSort: true },
165166
);

packages/mcp-server/src/local-docs-search.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,20 @@ const EMBEDDED_METHODS: MethodEntry[] = [
979979
markdown:
980980
"## submit\n\n`client.verifications.submit(customerId: string): { id: string; createdAt: string; customerId: string; errors: object[]; verificationStatus: 'RESOLVE_ERRORS' | 'PENDING_MANUAL_REVIEW' | 'IN_PROGRESS' | 'APPROVED' | 'REJECTED'; updatedAt?: string; }`\n\n**post** `/verifications`\n\nTrigger KYC (individual) or KYB (business) verification for a customer. The response indicates whether all required information has been provided. If data is missing, the `errors` array describes exactly what needs to be supplied before verification can proceed.\n\nCall this endpoint again after resolving errors to re-submit.\n\n\n### Parameters\n\n- `customerId: string`\n The ID of the customer to verify\n\n### Returns\n\n- `{ id: string; createdAt: string; customerId: string; errors: { reason: string; resourceId: string; type: string; acceptedDocumentTypes?: string[]; field?: string; }[]; verificationStatus: 'RESOLVE_ERRORS' | 'PENDING_MANUAL_REVIEW' | 'IN_PROGRESS' | 'APPROVED' | 'REJECTED'; updatedAt?: string; }`\n\n - `id: string`\n - `createdAt: string`\n - `customerId: string`\n - `errors: { reason: string; resourceId: string; type: string; acceptedDocumentTypes?: string[]; field?: string; }[]`\n - `verificationStatus: 'RESOLVE_ERRORS' | 'PENDING_MANUAL_REVIEW' | 'IN_PROGRESS' | 'APPROVED' | 'REJECTED'`\n - `updatedAt?: string`\n\n### Example\n\n```typescript\nimport LightsparkGrid from '@lightsparkdev/grid';\n\nconst client = new LightsparkGrid();\n\nconst response = await client.verifications.submit({ customerId: 'Customer:019542f5-b3e7-1d02-0000-000000000001' });\n\nconsole.log(response);\n```",
981981
},
982+
{
983+
name: 'list',
984+
endpoint: '/discoveries',
985+
httpMethod: 'get',
986+
summary: 'List available receiving institution names',
987+
description:
988+
'Retrieve available payment institution names for a given country and currency. Use this endpoint\nto look up supported banks and payment providers for a specific corridor.\nIf no country and currency parameter are provided, all payment institutions will be returned\n\nThe `bankName` field in each result is the value to pass as `bankName` when\ncreating an external account via `POST /customers/external-accounts`.\n',
989+
stainlessPath: '(resource) discoveries > (method) list',
990+
qualified: 'client.discoveries.list',
991+
params: ['country?: string;', 'currency?: string;'],
992+
response: '{ data?: { bankName: string; country: string; currency: string; displayName: string; }[]; }',
993+
markdown:
994+
"## list\n\n`client.discoveries.list(country?: string, currency?: string): { data?: object[]; }`\n\n**get** `/discoveries`\n\nRetrieve available payment institution names for a given country and currency. Use this endpoint\nto look up supported banks and payment providers for a specific corridor.\nIf no country and currency parameter are provided, all payment institutions will be returned\n\nThe `bankName` field in each result is the value to pass as `bankName` when\ncreating an external account via `POST /customers/external-accounts`.\n\n\n### Parameters\n\n- `country?: string`\n ISO 3166-1 alpha-2 country code (e.g. PH)\n\n- `currency?: string`\n ISO 4217 currency code (e.g. PHP)\n\n### Returns\n\n- `{ data?: { bankName: string; country: string; currency: string; displayName: string; }[]; }`\n\n - `data?: { bankName: string; country: string; currency: string; displayName: string; }[]`\n\n### Example\n\n```typescript\nimport LightsparkGrid from '@lightsparkdev/grid';\n\nconst client = new LightsparkGrid();\n\nconst discoveries = await client.discoveries.list();\n\nconsole.log(discoveries);\n```",
995+
},
982996
];
983997

984998
const EMBEDDED_READMES: { language: string; content: string }[] = [];

packages/mcp-server/src/methods.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ export const sdkMethods: SdkMethod[] = [
341341
httpMethod: 'post',
342342
httpPath: '/verifications',
343343
},
344+
{
345+
clientCallName: 'client.discoveries.list',
346+
fullyQualifiedName: 'discoveries.list',
347+
httpMethod: 'get',
348+
httpPath: '/discoveries',
349+
},
344350
];
345351

346352
function allowedMethodsForCodeTool(options: McpOptions | undefined): SdkMethod[] | undefined {

scripts/detect-breaking-changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ TEST_PATHS=(
3030
tests/api-resources/beneficial-owners.test.ts
3131
tests/api-resources/documents.test.ts
3232
tests/api-resources/verifications.test.ts
33+
tests/api-resources/discoveries.test.ts
3334
tests/index.test.ts
3435
)
3536

src/client.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {
4242
CryptoEstimateWithdrawalFeeParams,
4343
CryptoEstimateWithdrawalFeeResponse,
4444
} from './resources/crypto';
45+
import { Discoveries, DiscoveryListParams, DiscoveryListResponse } from './resources/discoveries';
4546
import {
4647
DocumentListParams,
4748
DocumentListResponse,
@@ -1011,6 +1012,10 @@ export class LightsparkGrid {
10111012
* Endpoints for Know Your Customer (KYC) and Know Your Business (KYB) verification, including managing beneficial owners and triggering verification for customers.
10121013
*/
10131014
verifications: API.Verifications = new API.Verifications(this);
1015+
/**
1016+
* Endpoints for discovering available payment rails, banks, and providers for a given country and currency corridor.
1017+
*/
1018+
discoveries: API.Discoveries = new API.Discoveries(this);
10141019
}
10151020

10161021
LightsparkGrid.Config = Config;
@@ -1032,6 +1037,7 @@ LightsparkGrid.Crypto = Crypto;
10321037
LightsparkGrid.BeneficialOwners = BeneficialOwners;
10331038
LightsparkGrid.Documents = Documents;
10341039
LightsparkGrid.Verifications = Verifications;
1040+
LightsparkGrid.Discoveries = Discoveries;
10351041

10361042
export declare namespace LightsparkGrid {
10371043
export type RequestOptions = Opts.RequestOptions;
@@ -1214,5 +1220,11 @@ export declare namespace LightsparkGrid {
12141220
type VerificationSubmitParams as VerificationSubmitParams,
12151221
};
12161222

1223+
export {
1224+
Discoveries as Discoveries,
1225+
type DiscoveryListResponse as DiscoveryListResponse,
1226+
type DiscoveryListParams as DiscoveryListParams,
1227+
};
1228+
12171229
export type BulkCustomerImportErrorEntry = API.BulkCustomerImportErrorEntry;
12181230
}

src/resources/discoveries.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../core/resource';
4+
import { APIPromise } from '../core/api-promise';
5+
import { RequestOptions } from '../internal/request-options';
6+
7+
/**
8+
* Endpoints for discovering available payment rails, banks, and providers for a given country and currency corridor.
9+
*/
10+
export class Discoveries extends APIResource {
11+
/**
12+
* Retrieve available payment institution names for a given country and currency.
13+
* Use this endpoint to look up supported banks and payment providers for a
14+
* specific corridor. If no country and currency parameter are provided, all
15+
* payment institutions will be returned
16+
*
17+
* The `bankName` field in each result is the value to pass as `bankName` when
18+
* creating an external account via `POST /customers/external-accounts`.
19+
*/
20+
list(
21+
query: DiscoveryListParams | null | undefined = {},
22+
options?: RequestOptions,
23+
): APIPromise<DiscoveryListResponse> {
24+
return this._client.get('/discoveries', { query, ...options });
25+
}
26+
}
27+
28+
export interface DiscoveryListResponse {
29+
/**
30+
* List of payment rails matching the filter criteria
31+
*/
32+
data?: Array<DiscoveryListResponse.Data>;
33+
}
34+
35+
export namespace DiscoveryListResponse {
36+
export interface Data {
37+
/**
38+
* Canonical name for this payment rail. Pass this value as `bankName` when
39+
* creating an external account.
40+
*/
41+
bankName: string;
42+
43+
/**
44+
* ISO 3166-1 alpha-2 country code.
45+
*/
46+
country: string;
47+
48+
/**
49+
* ISO 4217 currency code.
50+
*/
51+
currency: string;
52+
53+
/**
54+
* Human-friendly display name for this payment rail.
55+
*/
56+
displayName: string;
57+
}
58+
}
59+
60+
export interface DiscoveryListParams {
61+
/**
62+
* ISO 3166-1 alpha-2 country code (e.g. PH)
63+
*/
64+
country?: string;
65+
66+
/**
67+
* ISO 4217 currency code (e.g. PHP)
68+
*/
69+
currency?: string;
70+
}
71+
72+
export declare namespace Discoveries {
73+
export {
74+
type DiscoveryListResponse as DiscoveryListResponse,
75+
type DiscoveryListParams as DiscoveryListParams,
76+
};
77+
}

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export {
4242
type CustomerListInternalAccountsParams,
4343
type CustomerOneovesDefaultPagination,
4444
} from './customers/customers';
45+
export { Discoveries, type DiscoveryListResponse, type DiscoveryListParams } from './discoveries';
4546
export {
4647
Documents,
4748
type DocumentRetrieveResponse,
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import LightsparkGrid from '@lightsparkdev/grid';
4+
5+
const client = new LightsparkGrid({
6+
username: 'My Username',
7+
password: 'My Password',
8+
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
9+
});
10+
11+
describe('resource discoveries', () => {
12+
// Mock server tests are disabled
13+
test.skip('list', async () => {
14+
const responsePromise = client.discoveries.list();
15+
const rawResponse = await responsePromise.asResponse();
16+
expect(rawResponse).toBeInstanceOf(Response);
17+
const response = await responsePromise;
18+
expect(response).not.toBeInstanceOf(Response);
19+
const dataAndResponse = await responsePromise.withResponse();
20+
expect(dataAndResponse.data).toBe(response);
21+
expect(dataAndResponse.response).toBe(rawResponse);
22+
});
23+
24+
// Mock server tests are disabled
25+
test.skip('list: request options and params are passed correctly', async () => {
26+
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
27+
await expect(
28+
client.discoveries.list(
29+
{ country: 'country', currency: 'currency' },
30+
{ path: '/_stainless_unknown_path' },
31+
),
32+
).rejects.toThrow(LightsparkGrid.NotFoundError);
33+
});
34+
});

0 commit comments

Comments
 (0)