Skip to content

Commit d666a0b

Browse files
feat(api): manual updates
1 parent 58b6b46 commit d666a0b

17 files changed

Lines changed: 1051 additions & 30 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 12
1+
configured_endpoints: 21
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-d9763d006969b49a1473851069fdfa429eb13133b64103a62963bb70ddb22305.yml
33
openapi_spec_hash: 6aee689b7a759b12c85c088c15e29bc0
4-
config_hash: 41c337f5cda03b13880617490f82bad0
4+
config_hash: d54f39abb185904495bef7c5f8702746

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const client = new CasParser({
3636
environment: 'environment_1', // or 'production' | 'environment_2'; defaults to 'production'
3737
});
3838

39-
const unifiedResponse = await client.camsKfintech.parse();
39+
const response = await client.credits.check();
4040

41-
console.log(unifiedResponse.demat_accounts);
41+
console.log(response.enabled_features);
4242
```
4343

4444
### Request & Response types
@@ -54,7 +54,7 @@ const client = new CasParser({
5454
environment: 'environment_1', // or 'production' | 'environment_2'; defaults to 'production'
5555
});
5656

57-
const unifiedResponse: CasParser.UnifiedResponse = await client.camsKfintech.parse();
57+
const response: CasParser.CreditCheckResponse = await client.credits.check();
5858
```
5959

6060
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -67,7 +67,7 @@ a subclass of `APIError` will be thrown:
6767

6868
<!-- prettier-ignore -->
6969
```ts
70-
const unifiedResponse = await client.camsKfintech.parse().catch(async (err) => {
70+
const response = await client.credits.check().catch(async (err) => {
7171
if (err instanceof CasParser.APIError) {
7272
console.log(err.status); // 400
7373
console.log(err.name); // BadRequestError
@@ -107,7 +107,7 @@ const client = new CasParser({
107107
});
108108

109109
// Or, configure per-request:
110-
await client.camsKfintech.parse({
110+
await client.credits.check({
111111
maxRetries: 5,
112112
});
113113
```
@@ -124,7 +124,7 @@ const client = new CasParser({
124124
});
125125

126126
// Override per-request:
127-
await client.camsKfintech.parse({
127+
await client.credits.check({
128128
timeout: 5 * 1000,
129129
});
130130
```
@@ -147,13 +147,13 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
147147
```ts
148148
const client = new CasParser();
149149

150-
const response = await client.camsKfintech.parse().asResponse();
150+
const response = await client.credits.check().asResponse();
151151
console.log(response.headers.get('X-My-Header'));
152152
console.log(response.statusText); // access the underlying Response object
153153

154-
const { data: unifiedResponse, response: raw } = await client.camsKfintech.parse().withResponse();
154+
const { data: response, response: raw } = await client.credits.check().withResponse();
155155
console.log(raw.headers.get('X-My-Header'));
156-
console.log(unifiedResponse.demat_accounts);
156+
console.log(response.enabled_features);
157157
```
158158

159159
### Logging
@@ -233,7 +233,7 @@ parameter. This library doesn't validate at runtime that the request matches the
233233
send will be sent as-is.
234234

235235
```ts
236-
client.camsKfintech.parse({
236+
client.credits.check({
237237
// ...
238238
// @ts-expect-error baz is not yet public
239239
baz: 'undocumented option',

api.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,45 @@
11
# Credits
22

3+
Types:
4+
5+
- <code><a href="./src/resources/credits.ts">CreditCheckResponse</a></code>
6+
7+
Methods:
8+
9+
- <code title="post /v1/credits">client.credits.<a href="./src/resources/credits.ts">check</a>() -> CreditCheckResponse</code>
10+
311
# Logs
412

13+
Types:
14+
15+
- <code><a href="./src/resources/logs.ts">LogCreateResponse</a></code>
16+
- <code><a href="./src/resources/logs.ts">LogGetSummaryResponse</a></code>
17+
18+
Methods:
19+
20+
- <code title="post /v1/usage">client.logs.<a href="./src/resources/logs.ts">create</a>({ ...params }) -> LogCreateResponse</code>
21+
- <code title="post /v1/usage/summary">client.logs.<a href="./src/resources/logs.ts">getSummary</a>({ ...params }) -> LogGetSummaryResponse</code>
22+
523
# AccessToken
624

25+
Types:
26+
27+
- <code><a href="./src/resources/access-token.ts">AccessTokenCreateResponse</a></code>
28+
29+
Methods:
30+
31+
- <code title="post /v1/token">client.accessToken.<a href="./src/resources/access-token.ts">create</a>({ ...params }) -> AccessTokenCreateResponse</code>
32+
733
# VerifyToken
834

35+
Types:
36+
37+
- <code><a href="./src/resources/verify-token.ts">VerifyTokenVerifyResponse</a></code>
38+
39+
Methods:
40+
41+
- <code title="post /v1/token/verify">client.verifyToken.<a href="./src/resources/verify-token.ts">verify</a>() -> VerifyTokenVerifyResponse</code>
42+
943
# CamsKfintech
1044

1145
Types:
@@ -83,3 +117,19 @@ Methods:
83117
Methods:
84118

85119
- <code title="post /v4/smart/parse">client.smart.<a href="./src/resources/smart.ts">parseCasPdf</a>({ ...params }) -> UnifiedResponse</code>
120+
121+
# InboundEmail
122+
123+
Types:
124+
125+
- <code><a href="./src/resources/inbound-email.ts">InboundEmailCreateResponse</a></code>
126+
- <code><a href="./src/resources/inbound-email.ts">InboundEmailRetrieveResponse</a></code>
127+
- <code><a href="./src/resources/inbound-email.ts">InboundEmailListResponse</a></code>
128+
- <code><a href="./src/resources/inbound-email.ts">InboundEmailDeleteResponse</a></code>
129+
130+
Methods:
131+
132+
- <code title="post /v4/inbound-email">client.inboundEmail.<a href="./src/resources/inbound-email.ts">create</a>({ ...params }) -> InboundEmailCreateResponse</code>
133+
- <code title="get /v4/inbound-email/{inbound_email_id}">client.inboundEmail.<a href="./src/resources/inbound-email.ts">retrieve</a>(inboundEmailID) -> InboundEmailRetrieveResponse</code>
134+
- <code title="get /v4/inbound-email">client.inboundEmail.<a href="./src/resources/inbound-email.ts">list</a>({ ...params }) -> InboundEmailListResponse</code>
135+
- <code title="delete /v4/inbound-email/{inbound_email_id}">client.inboundEmail.<a href="./src/resources/inbound-email.ts">delete</a>(inboundEmailID) -> InboundEmailDeleteResponse</code>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ For example:
2121
2222
\`\`\`
2323
async function run(client) {
24-
const unifiedResponse = await client.camsKfintech.parse();
24+
const response = await client.credits.check();
2525
26-
console.log(unifiedResponse.demat_accounts);
26+
console.log(response.enabled_features);
2727
}
2828
\`\`\`
2929

packages/mcp-server/src/methods.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,36 @@ export type SdkMethod = {
1010
};
1111

1212
export const sdkMethods: SdkMethod[] = [
13+
{
14+
clientCallName: 'client.credits.check',
15+
fullyQualifiedName: 'credits.check',
16+
httpMethod: 'post',
17+
httpPath: '/v1/credits',
18+
},
19+
{
20+
clientCallName: 'client.logs.create',
21+
fullyQualifiedName: 'logs.create',
22+
httpMethod: 'post',
23+
httpPath: '/v1/usage',
24+
},
25+
{
26+
clientCallName: 'client.logs.getSummary',
27+
fullyQualifiedName: 'logs.getSummary',
28+
httpMethod: 'post',
29+
httpPath: '/v1/usage/summary',
30+
},
31+
{
32+
clientCallName: 'client.accessToken.create',
33+
fullyQualifiedName: 'accessToken.create',
34+
httpMethod: 'post',
35+
httpPath: '/v1/token',
36+
},
37+
{
38+
clientCallName: 'client.verifyToken.verify',
39+
fullyQualifiedName: 'verifyToken.verify',
40+
httpMethod: 'post',
41+
httpPath: '/v1/token/verify',
42+
},
1343
{
1444
clientCallName: 'client.camsKfintech.parse',
1545
fullyQualifiedName: 'camsKfintech.parse',
@@ -82,6 +112,30 @@ export const sdkMethods: SdkMethod[] = [
82112
httpMethod: 'post',
83113
httpPath: '/v4/smart/parse',
84114
},
115+
{
116+
clientCallName: 'client.inboundEmail.create',
117+
fullyQualifiedName: 'inboundEmail.create',
118+
httpMethod: 'post',
119+
httpPath: '/v4/inbound-email',
120+
},
121+
{
122+
clientCallName: 'client.inboundEmail.retrieve',
123+
fullyQualifiedName: 'inboundEmail.retrieve',
124+
httpMethod: 'get',
125+
httpPath: '/v4/inbound-email/{inbound_email_id}',
126+
},
127+
{
128+
clientCallName: 'client.inboundEmail.list',
129+
fullyQualifiedName: 'inboundEmail.list',
130+
httpMethod: 'get',
131+
httpPath: '/v4/inbound-email',
132+
},
133+
{
134+
clientCallName: 'client.inboundEmail.delete',
135+
fullyQualifiedName: 'inboundEmail.delete',
136+
httpMethod: 'delete',
137+
httpPath: '/v4/inbound-email/{inbound_email_id}',
138+
},
85139
];
86140

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

src/client.ts

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as Errors from './core/error';
1616
import * as Uploads from './core/uploads';
1717
import * as API from './resources/index';
1818
import { APIPromise } from './core/api-promise';
19-
import { AccessToken } from './resources/access-token';
19+
import { AccessToken, AccessTokenCreateParams, AccessTokenCreateResponse } from './resources/access-token';
2020
import {
2121
CamsKfintech,
2222
CamsKfintechParseParams,
@@ -25,7 +25,16 @@ import {
2525
UnifiedResponse,
2626
} from './resources/cams-kfintech';
2727
import { ContractNote, ContractNoteParseParams, ContractNoteParseResponse } from './resources/contract-note';
28-
import { Credits } from './resources/credits';
28+
import { CreditCheckResponse, Credits } from './resources/credits';
29+
import {
30+
InboundEmail,
31+
InboundEmailCreateParams,
32+
InboundEmailCreateResponse,
33+
InboundEmailDeleteResponse,
34+
InboundEmailListParams,
35+
InboundEmailListResponse,
36+
InboundEmailRetrieveResponse,
37+
} from './resources/inbound-email';
2938
import {
3039
Inbox,
3140
InboxCheckConnectionStatusParams,
@@ -38,10 +47,16 @@ import {
3847
InboxListCasFilesResponse,
3948
} from './resources/inbox';
4049
import { Kfintech, KfintechGenerateCasParams, KfintechGenerateCasResponse } from './resources/kfintech';
41-
import { Logs } from './resources/logs';
50+
import {
51+
LogCreateParams,
52+
LogCreateResponse,
53+
LogGetSummaryParams,
54+
LogGetSummaryResponse,
55+
Logs,
56+
} from './resources/logs';
4257
import { Nsdl, NsdlParseParams } from './resources/nsdl';
4358
import { Smart, SmartParseCasPdfParams } from './resources/smart';
44-
import { VerifyToken } from './resources/verify-token';
59+
import { VerifyToken, VerifyTokenVerifyResponse } from './resources/verify-token';
4560
import { Cdsl, CdslParsePdfParams } from './resources/cdsl/cdsl';
4661
import { type Fetch } from './internal/builtin-types';
4762
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
@@ -794,6 +809,7 @@ export class CasParser {
794809
kfintech: API.Kfintech = new API.Kfintech(this);
795810
nsdl: API.Nsdl = new API.Nsdl(this);
796811
smart: API.Smart = new API.Smart(this);
812+
inboundEmail: API.InboundEmail = new API.InboundEmail(this);
797813
}
798814

799815
CasParser.Credits = Credits;
@@ -807,17 +823,28 @@ CasParser.Inbox = Inbox;
807823
CasParser.Kfintech = Kfintech;
808824
CasParser.Nsdl = Nsdl;
809825
CasParser.Smart = Smart;
826+
CasParser.InboundEmail = InboundEmail;
810827

811828
export declare namespace CasParser {
812829
export type RequestOptions = Opts.RequestOptions;
813830

814-
export { Credits as Credits };
831+
export { Credits as Credits, type CreditCheckResponse as CreditCheckResponse };
815832

816-
export { Logs as Logs };
833+
export {
834+
Logs as Logs,
835+
type LogCreateResponse as LogCreateResponse,
836+
type LogGetSummaryResponse as LogGetSummaryResponse,
837+
type LogCreateParams as LogCreateParams,
838+
type LogGetSummaryParams as LogGetSummaryParams,
839+
};
817840

818-
export { AccessToken as AccessToken };
841+
export {
842+
AccessToken as AccessToken,
843+
type AccessTokenCreateResponse as AccessTokenCreateResponse,
844+
type AccessTokenCreateParams as AccessTokenCreateParams,
845+
};
819846

820-
export { VerifyToken as VerifyToken };
847+
export { VerifyToken as VerifyToken, type VerifyTokenVerifyResponse as VerifyTokenVerifyResponse };
821848

822849
export {
823850
CamsKfintech as CamsKfintech,
@@ -856,4 +883,14 @@ export declare namespace CasParser {
856883
export { Nsdl as Nsdl, type NsdlParseParams as NsdlParseParams };
857884

858885
export { Smart as Smart, type SmartParseCasPdfParams as SmartParseCasPdfParams };
886+
887+
export {
888+
InboundEmail as InboundEmail,
889+
type InboundEmailCreateResponse as InboundEmailCreateResponse,
890+
type InboundEmailRetrieveResponse as InboundEmailRetrieveResponse,
891+
type InboundEmailListResponse as InboundEmailListResponse,
892+
type InboundEmailDeleteResponse as InboundEmailDeleteResponse,
893+
type InboundEmailCreateParams as InboundEmailCreateParams,
894+
type InboundEmailListParams as InboundEmailListParams,
895+
};
859896
}

src/resources/access-token.ts

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import { APIResource } from '../core/resource';
4+
import { APIPromise } from '../core/api-promise';
5+
import { RequestOptions } from '../internal/request-options';
46

5-
export class AccessToken extends APIResource {}
7+
export class AccessToken extends APIResource {
8+
/**
9+
* Generate a short-lived access token from your API key.
10+
*
11+
* **Use this endpoint from your backend** to create tokens that can be safely
12+
* passed to frontend/SDK.
13+
*
14+
* **Legacy path:** `/v1/access-token` (still supported)
15+
*
16+
* Access tokens:
17+
*
18+
* - Are prefixed with `at_` for easy identification
19+
* - Valid for up to 60 minutes
20+
* - Can be used in place of API keys on all v4 endpoints
21+
* - Cannot be used to generate other access tokens
22+
*
23+
* @example
24+
* ```ts
25+
* const accessToken = await client.accessToken.create();
26+
* ```
27+
*/
28+
create(
29+
body: AccessTokenCreateParams | null | undefined = {},
30+
options?: RequestOptions,
31+
): APIPromise<AccessTokenCreateResponse> {
32+
return this._client.post('/v1/token', { body, ...options });
33+
}
34+
}
35+
36+
export interface AccessTokenCreateResponse {
37+
/**
38+
* The at\_ prefixed access token
39+
*/
40+
access_token?: string;
41+
42+
/**
43+
* Token validity in seconds
44+
*/
45+
expires_in?: number;
46+
47+
/**
48+
* Always "api_key" - token is a drop-in replacement for x-api-key header
49+
*/
50+
token_type?: string;
51+
}
52+
53+
export interface AccessTokenCreateParams {
54+
/**
55+
* Token validity in minutes (max 60)
56+
*/
57+
expiry_minutes?: number;
58+
}
59+
60+
export declare namespace AccessToken {
61+
export {
62+
type AccessTokenCreateResponse as AccessTokenCreateResponse,
63+
type AccessTokenCreateParams as AccessTokenCreateParams,
64+
};
65+
}

0 commit comments

Comments
 (0)