Skip to content

Commit 34d2df4

Browse files
Merge pull request #7 from CASParser/release-please--branches--main--changes--next
release: 0.5.0
2 parents f10133a + 8c1b394 commit 34d2df4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2057
-122
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.4.0"
2+
".": "0.5.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-56b0f699c5437d9e5326626d35dfc972c17d01f12cb416c7f4854c8ea6d0e95e.yml
3-
openapi_spec_hash: 158f405c1880706266d83e6ff16b9d2f
4-
config_hash: 41c337f5cda03b13880617490f82bad0
1+
configured_endpoints: 21
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-d9763d006969b49a1473851069fdfa429eb13133b64103a62963bb70ddb22305.yml
3+
openapi_spec_hash: 6aee689b7a759b12c85c088c15e29bc0
4+
config_hash: 4ab3e1ee76a463e0ed214541260ee12e

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## 0.5.0 (2026-02-23)
4+
5+
Full Changelog: [v0.4.0...v0.5.0](https://github.com/CASParser/cas-parser-php/compare/v0.4.0...v0.5.0)
6+
7+
### Features
8+
9+
* **api:** api update ([d8c85b9](https://github.com/CASParser/cas-parser-php/commit/d8c85b904f3df1c7242527d1dd66996d0e8cd6e8))
10+
* **api:** api update ([92b50de](https://github.com/CASParser/cas-parser-php/commit/92b50de8ea771c015e38a2635f1ee5c011156008))
11+
* **api:** api update ([c0fc7b8](https://github.com/CASParser/cas-parser-php/commit/c0fc7b8b4284930ca1d6eec4c58e88b026cf2da5))
12+
* **api:** manual updates ([83a811c](https://github.com/CASParser/cas-parser-php/commit/83a811cd2ac157f781caeabff6e8e0f4b757435e))
13+
14+
15+
### Chores
16+
17+
* **internal:** remove mock server code ([e868489](https://github.com/CASParser/cas-parser-php/commit/e8684893f2f7c4ab6d75c2be56fc9f2d7c6a5323))
18+
* update mock server docs ([8a17bde](https://github.com/CASParser/cas-parser-php/commit/8a17bdee09cb200c74522cdf7ed35f8934ba4ecd))
19+
320
## 0.4.0 (2026-02-14)
421

522
Full Changelog: [v0.3.0...v0.4.0](https://github.com/CASParser/cas-parser-php/compare/v0.3.0...v0.4.0)

scripts/mock

Lines changed: 0 additions & 41 deletions
This file was deleted.

scripts/test

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,6 @@ set -e
44

55
cd "$(dirname "$0")/.."
66

7-
RED='\033[0;31m'
8-
GREEN='\033[0;32m'
9-
YELLOW='\033[0;33m'
10-
NC='\033[0m' # No Color
117

12-
function prism_is_running() {
13-
curl --silent "http://localhost:4010" >/dev/null 2>&1
14-
}
15-
16-
kill_server_on_port() {
17-
pids=$(lsof -t -i tcp:"$1" || echo "")
18-
if [ "$pids" != "" ]; then
19-
kill "$pids"
20-
echo "Stopped $pids."
21-
fi
22-
}
23-
24-
function is_overriding_api_base_url() {
25-
[ -n "$TEST_API_BASE_URL" ]
26-
}
27-
28-
if ! is_overriding_api_base_url && ! prism_is_running ; then
29-
# When we exit this script, make sure to kill the background mock server process
30-
trap 'kill_server_on_port 4010' EXIT
31-
32-
# Start the dev server
33-
./scripts/mock --daemon
34-
fi
35-
36-
if is_overriding_api_base_url ; then
37-
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
38-
echo
39-
elif ! prism_is_running ; then
40-
echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
41-
echo -e "running against your OpenAPI spec."
42-
echo
43-
echo -e "To run the server, pass in the path or url of your OpenAPI"
44-
echo -e "spec to the prism command:"
45-
echo
46-
echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
47-
echo
48-
49-
exit 1
50-
else
51-
echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
52-
echo
53-
fi
548

559
exec -- ./vendor/bin/pest --colors=always

src/AccessToken/AccessTokenCreateParams.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*
1515
* **Use this endpoint from your backend** to create tokens that can be safely passed to frontend/SDK.
1616
*
17+
* **Legacy path:** `/v1/access-token` (still supported)
18+
*
1719
* Access tokens:
1820
* - Are prefixed with `at_` for easy identification
1921
* - Valid for up to 60 minutes

src/Client.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use CasParser\Services\CdslService;
1212
use CasParser\Services\ContractNoteService;
1313
use CasParser\Services\CreditsService;
14+
use CasParser\Services\InboundEmailService;
1415
use CasParser\Services\InboxService;
1516
use CasParser\Services\KfintechService;
1617
use CasParser\Services\LogsService;
@@ -83,6 +84,11 @@ class Client extends BaseClient
8384
*/
8485
public SmartService $smart;
8586

87+
/**
88+
* @api
89+
*/
90+
public InboundEmailService $inboundEmail;
91+
8692
/**
8793
* @param RequestOpts|null $requestOptions
8894
*/
@@ -134,6 +140,7 @@ public function __construct(
134140
$this->kfintech = new KfintechService($this);
135141
$this->nsdl = new NsdlService($this);
136142
$this->smart = new SmartService($this);
143+
$this->inboundEmail = new InboundEmailService($this);
137144
}
138145

139146
/** @return array<string,string> */
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CasParser\InboundEmail;
6+
7+
use CasParser\Core\Attributes\Optional;
8+
use CasParser\Core\Attributes\Required;
9+
use CasParser\Core\Concerns\SdkModel;
10+
use CasParser\Core\Concerns\SdkParams;
11+
use CasParser\Core\Contracts\BaseModel;
12+
use CasParser\InboundEmail\InboundEmailCreateParams\AllowedSource;
13+
14+
/**
15+
* Create a dedicated inbound email address for collecting CAS statements via email forwarding.
16+
*
17+
* **How it works:**
18+
* 1. Create an inbound email with your webhook URL
19+
* 2. Display the email address to your user (e.g., "Forward your CAS to ie_xxx@import.casparser.in")
20+
* 3. When an investor forwards a CAS email, we verify the sender and deliver to your webhook
21+
*
22+
* **Webhook Delivery:**
23+
* - We POST to your `callback_url` with JSON body containing files (matching EmailCASFile schema)
24+
* - Failed deliveries are retried automatically with exponential backoff
25+
*
26+
* **Inactivity:**
27+
* - Inbound emails with no activity in 30 days are marked inactive
28+
* - Active inbound emails remain operational indefinitely
29+
*
30+
* @see CasParser\Services\InboundEmailService::create()
31+
*
32+
* @phpstan-type InboundEmailCreateParamsShape = array{
33+
* callbackURL: string,
34+
* alias?: string|null,
35+
* allowedSources?: list<AllowedSource|value-of<AllowedSource>>|null,
36+
* metadata?: array<string,string>|null,
37+
* reference?: string|null,
38+
* }
39+
*/
40+
final class InboundEmailCreateParams implements BaseModel
41+
{
42+
/** @use SdkModel<InboundEmailCreateParamsShape> */
43+
use SdkModel;
44+
use SdkParams;
45+
46+
/**
47+
* Webhook URL where we POST email notifications.
48+
* Must be HTTPS in production (HTTP allowed for localhost during development).
49+
*/
50+
#[Required('callback_url')]
51+
public string $callbackURL;
52+
53+
/**
54+
* Optional custom email prefix for user-friendly addresses.
55+
* - Must be 3-32 characters
56+
* - Alphanumeric + hyphens only
57+
* - Must start and end with letter/number
58+
* - Example: `john-portfolio@import.casparser.in`
59+
* - If omitted, generates random ID like `ie_abc123xyz@import.casparser.in`.
60+
*/
61+
#[Optional]
62+
public ?string $alias;
63+
64+
/**
65+
* Filter emails by CAS provider. If omitted, accepts all providers.
66+
* - `cdsl` → eCAS@cdslstatement.com
67+
* - `nsdl` → NSDL-CAS@nsdl.co.in
68+
* - `cams` → donotreply@camsonline.com
69+
* - `kfintech` → samfS@kfintech.com.
70+
*
71+
* @var list<value-of<AllowedSource>>|null $allowedSources
72+
*/
73+
#[Optional('allowed_sources', list: AllowedSource::class)]
74+
public ?array $allowedSources;
75+
76+
/**
77+
* Optional key-value pairs (max 10) to include in webhook payload.
78+
* Useful for passing context like plan_type, campaign_id, etc.
79+
*
80+
* @var array<string,string>|null $metadata
81+
*/
82+
#[Optional(map: 'string')]
83+
public ?array $metadata;
84+
85+
/**
86+
* Your internal identifier (e.g., user_id, account_id).
87+
* Returned in webhook payload for correlation.
88+
*/
89+
#[Optional]
90+
public ?string $reference;
91+
92+
/**
93+
* `new InboundEmailCreateParams()` is missing required properties by the API.
94+
*
95+
* To enforce required parameters use
96+
* ```
97+
* InboundEmailCreateParams::with(callbackURL: ...)
98+
* ```
99+
*
100+
* Otherwise ensure the following setters are called
101+
*
102+
* ```
103+
* (new InboundEmailCreateParams)->withCallbackURL(...)
104+
* ```
105+
*/
106+
public function __construct()
107+
{
108+
$this->initialize();
109+
}
110+
111+
/**
112+
* Construct an instance from the required parameters.
113+
*
114+
* You must use named parameters to construct any parameters with a default value.
115+
*
116+
* @param list<AllowedSource|value-of<AllowedSource>>|null $allowedSources
117+
* @param array<string,string>|null $metadata
118+
*/
119+
public static function with(
120+
string $callbackURL,
121+
?string $alias = null,
122+
?array $allowedSources = null,
123+
?array $metadata = null,
124+
?string $reference = null,
125+
): self {
126+
$self = new self;
127+
128+
$self['callbackURL'] = $callbackURL;
129+
130+
null !== $alias && $self['alias'] = $alias;
131+
null !== $allowedSources && $self['allowedSources'] = $allowedSources;
132+
null !== $metadata && $self['metadata'] = $metadata;
133+
null !== $reference && $self['reference'] = $reference;
134+
135+
return $self;
136+
}
137+
138+
/**
139+
* Webhook URL where we POST email notifications.
140+
* Must be HTTPS in production (HTTP allowed for localhost during development).
141+
*/
142+
public function withCallbackURL(string $callbackURL): self
143+
{
144+
$self = clone $this;
145+
$self['callbackURL'] = $callbackURL;
146+
147+
return $self;
148+
}
149+
150+
/**
151+
* Optional custom email prefix for user-friendly addresses.
152+
* - Must be 3-32 characters
153+
* - Alphanumeric + hyphens only
154+
* - Must start and end with letter/number
155+
* - Example: `john-portfolio@import.casparser.in`
156+
* - If omitted, generates random ID like `ie_abc123xyz@import.casparser.in`.
157+
*/
158+
public function withAlias(string $alias): self
159+
{
160+
$self = clone $this;
161+
$self['alias'] = $alias;
162+
163+
return $self;
164+
}
165+
166+
/**
167+
* Filter emails by CAS provider. If omitted, accepts all providers.
168+
* - `cdsl` → eCAS@cdslstatement.com
169+
* - `nsdl` → NSDL-CAS@nsdl.co.in
170+
* - `cams` → donotreply@camsonline.com
171+
* - `kfintech` → samfS@kfintech.com.
172+
*
173+
* @param list<AllowedSource|value-of<AllowedSource>> $allowedSources
174+
*/
175+
public function withAllowedSources(array $allowedSources): self
176+
{
177+
$self = clone $this;
178+
$self['allowedSources'] = $allowedSources;
179+
180+
return $self;
181+
}
182+
183+
/**
184+
* Optional key-value pairs (max 10) to include in webhook payload.
185+
* Useful for passing context like plan_type, campaign_id, etc.
186+
*
187+
* @param array<string,string> $metadata
188+
*/
189+
public function withMetadata(array $metadata): self
190+
{
191+
$self = clone $this;
192+
$self['metadata'] = $metadata;
193+
194+
return $self;
195+
}
196+
197+
/**
198+
* Your internal identifier (e.g., user_id, account_id).
199+
* Returned in webhook payload for correlation.
200+
*/
201+
public function withReference(string $reference): self
202+
{
203+
$self = clone $this;
204+
$self['reference'] = $reference;
205+
206+
return $self;
207+
}
208+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace CasParser\InboundEmail\InboundEmailCreateParams;
6+
7+
enum AllowedSource: string
8+
{
9+
case CDSL = 'cdsl';
10+
11+
case NSDL = 'nsdl';
12+
13+
case CAMS = 'cams';
14+
15+
case KFINTECH = 'kfintech';
16+
}

0 commit comments

Comments
 (0)