Skip to content

Commit a7a0afe

Browse files
Merge pull request #3 from CASParser/release-please--branches--main--changes--next
release: 0.2.0
2 parents e2b558e + e071b1b commit a7a0afe

Some content is hidden

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

48 files changed

+541
-219
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.1.0"
2+
".": "0.2.0"
33
}

CHANGELOG.md

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

3+
## 0.2.0 (2025-09-13)
4+
5+
Full Changelog: [v0.1.0...v0.2.0](https://github.com/CASParser/cas-parser-php/compare/v0.1.0...v0.2.0)
6+
7+
### ⚠ BREAKING CHANGES
8+
9+
* expose services and service contracts
10+
11+
### Features
12+
13+
* **client:** add raw methods ([cec98f9](https://github.com/CASParser/cas-parser-php/commit/cec98f994a8f4b1dc12905a2dcd269cebbcc000d))
14+
* **client:** support raw responses ([db0fac3](https://github.com/CASParser/cas-parser-php/commit/db0fac37cc5a9f56fb8f095f4c895f91a206bfa5))
15+
* **client:** use real enums ([9b7428f](https://github.com/CASParser/cas-parser-php/commit/9b7428ffe0e2a19b1b7ad6c87e90ee14eddce749))
16+
* expose services and service contracts ([36e3c1d](https://github.com/CASParser/cas-parser-php/commit/36e3c1d53c72f8b86e8ccf565fd3399bb3847834))
17+
18+
19+
### Chores
20+
21+
* cleanup streaming ([d8d2163](https://github.com/CASParser/cas-parser-php/commit/d8d2163afa66e726f571c31276eaca485c4dda84))
22+
* document parameter object usage ([8e520a0](https://github.com/CASParser/cas-parser-php/commit/8e520a0452175fc10becdd28fc9bf5b37cecf434))
23+
* fix lints in UnionOf ([4fcc712](https://github.com/CASParser/cas-parser-php/commit/4fcc712c36036429b1f410f3c3ae88f3a8ad3147))
24+
* make more targeted phpstan ignores ([35208e4](https://github.com/CASParser/cas-parser-php/commit/35208e4d7fced2de5826111980cfd51bebd1ad74))
25+
326
## 0.1.0 (2025-09-03)
427

528
Full Changelog: [v0.0.2...v0.1.0](https://github.com/CASParser/cas-parser-php/compare/v0.0.2...v0.1.0)

src/CasGenerator/CasGeneratorGenerateCasParams.php

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,28 @@
1111
use CasParser\Core\Contracts\BaseModel;
1212

1313
/**
14+
* An object containing the method's parameters.
15+
* Example usage:
16+
* ```
17+
* $params = (new CasGeneratorGenerateCasParams); // set properties as needed
18+
* $client->casGenerator->generateCas(...$params->toArray());
19+
* ```
1420
* This endpoint generates CAS (Consolidated Account Statement) documents by submitting a mailback request to the specified CAS authority.
1521
* Currently only supports KFintech, with plans to support CAMS, CDSL, and NSDL in the future.
1622
*
23+
* @method toArray()
24+
* Returns the parameters as an associative array suitable for passing to the client method.
25+
*
26+
* `$client->casGenerator->generateCas(...$params->toArray());`
27+
*
1728
* @see CasParser\CasGenerator->generateCas
1829
*
1930
* @phpstan-type cas_generator_generate_cas_params = array{
2031
* email: string,
2132
* fromDate: string,
2233
* password: string,
2334
* toDate: string,
24-
* casAuthority?: CasAuthority::*,
35+
* casAuthority?: CasAuthority|value-of<CasAuthority>,
2536
* panNo?: string,
2637
* }
2738
*/
@@ -58,7 +69,7 @@ final class CasGeneratorGenerateCasParams implements BaseModel
5869
/**
5970
* CAS authority to generate the document from (currently only kfintech is supported).
6071
*
61-
* @var CasAuthority::*|null $casAuthority
72+
* @var value-of<CasAuthority>|null $casAuthority
6273
*/
6374
#[Api('cas_authority', enum: CasAuthority::class, optional: true)]
6475
public ?string $casAuthority;
@@ -99,14 +110,14 @@ public function __construct()
99110
*
100111
* You must use named parameters to construct any parameters with a default value.
101112
*
102-
* @param CasAuthority::* $casAuthority
113+
* @param CasAuthority|value-of<CasAuthority> $casAuthority
103114
*/
104115
public static function with(
105116
string $email,
106117
string $fromDate,
107118
string $password,
108119
string $toDate,
109-
?string $casAuthority = null,
120+
CasAuthority|string|null $casAuthority = null,
110121
?string $panNo = null,
111122
): self {
112123
$obj = new self;
@@ -116,7 +127,7 @@ public static function with(
116127
$obj->password = $password;
117128
$obj->toDate = $toDate;
118129

119-
null !== $casAuthority && $obj->casAuthority = $casAuthority;
130+
null !== $casAuthority && $obj->casAuthority = $casAuthority instanceof CasAuthority ? $casAuthority->value : $casAuthority;
120131
null !== $panNo && $obj->panNo = $panNo;
121132

122133
return $obj;
@@ -169,12 +180,12 @@ public function withToDate(string $toDate): self
169180
/**
170181
* CAS authority to generate the document from (currently only kfintech is supported).
171182
*
172-
* @param CasAuthority::* $casAuthority
183+
* @param CasAuthority|value-of<CasAuthority> $casAuthority
173184
*/
174-
public function withCasAuthority(string $casAuthority): self
185+
public function withCasAuthority(CasAuthority|string $casAuthority): self
175186
{
176187
$obj = clone $this;
177-
$obj->casAuthority = $casAuthority;
188+
$obj->casAuthority = $casAuthority instanceof CasAuthority ? $casAuthority->value : $casAuthority;
178189

179190
return $obj;
180191
}

src/CasGenerator/CasGeneratorGenerateCasParams/CasAuthority.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,16 @@
44

55
namespace CasParser\CasGenerator\CasGeneratorGenerateCasParams;
66

7-
use CasParser\Core\Concerns\SdkEnum;
8-
use CasParser\Core\Conversion\Contracts\ConverterSource;
9-
107
/**
118
* CAS authority to generate the document from (currently only kfintech is supported).
129
*/
13-
final class CasAuthority implements ConverterSource
10+
enum CasAuthority: string
1411
{
15-
use SdkEnum;
16-
17-
public const KFINTECH = 'kfintech';
12+
case KFINTECH = 'kfintech';
1813

19-
public const CAMS = 'cams';
14+
case CAMS = 'cams';
2015

21-
public const CDSL = 'cdsl';
16+
case CDSL = 'cdsl';
2217

23-
public const NSDL = 'nsdl';
18+
case NSDL = 'nsdl';
2419
}

src/CasGenerator/CasGeneratorGenerateCasResponse.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@
1010

1111
/**
1212
* @phpstan-type cas_generator_generate_cas_response = array{
13-
* msg?: string|null, status?: string|null
13+
* msg?: string, status?: string
1414
* }
15+
* When used in a response, this type parameter can define a $rawResponse property.
16+
* @template TRawResponse of object = object{}
17+
*
18+
* @mixin TRawResponse
1519
*/
1620
final class CasGeneratorGenerateCasResponse implements BaseModel
1721
{

src/CasParser/CasParserCamsKfintechParams.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@
1010
use CasParser\Core\Contracts\BaseModel;
1111

1212
/**
13+
* An object containing the method's parameters.
14+
* Example usage:
15+
* ```
16+
* $params = (new CasParserCamsKfintechParams); // set properties as needed
17+
* $client->casParser->camsKfintech(...$params->toArray());
18+
* ```
1319
* This endpoint specifically parses CAMS/KFintech CAS (Consolidated Account Statement) PDF files and returns data in a unified format.
1420
* Use this endpoint when you know the PDF is from CAMS or KFintech.
1521
*
22+
* @method toArray()
23+
* Returns the parameters as an associative array suitable for passing to the client method.
24+
*
25+
* `$client->casParser->camsKfintech(...$params->toArray());`
26+
*
1627
* @see CasParser\CasParser->camsKfintech
1728
*
1829
* @phpstan-type cas_parser_cams_kfintech_params = array{

src/CasParser/CasParserCdslParams.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@
1010
use CasParser\Core\Contracts\BaseModel;
1111

1212
/**
13+
* An object containing the method's parameters.
14+
* Example usage:
15+
* ```
16+
* $params = (new CasParserCdslParams); // set properties as needed
17+
* $client->casParser->cdsl(...$params->toArray());
18+
* ```
1319
* This endpoint specifically parses CDSL CAS (Consolidated Account Statement) PDF files and returns data in a unified format.
1420
* Use this endpoint when you know the PDF is from CDSL.
1521
*
22+
* @method toArray()
23+
* Returns the parameters as an associative array suitable for passing to the client method.
24+
*
25+
* `$client->casParser->cdsl(...$params->toArray());`
26+
*
1627
* @see CasParser\CasParser->cdsl
1728
*
1829
* @phpstan-type cas_parser_cdsl_params = array{

src/CasParser/CasParserNsdlParams.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@
1010
use CasParser\Core\Contracts\BaseModel;
1111

1212
/**
13+
* An object containing the method's parameters.
14+
* Example usage:
15+
* ```
16+
* $params = (new CasParserNsdlParams); // set properties as needed
17+
* $client->casParser->nsdl(...$params->toArray());
18+
* ```
1319
* This endpoint specifically parses NSDL CAS (Consolidated Account Statement) PDF files and returns data in a unified format.
1420
* Use this endpoint when you know the PDF is from NSDL.
1521
*
22+
* @method toArray()
23+
* Returns the parameters as an associative array suitable for passing to the client method.
24+
*
25+
* `$client->casParser->nsdl(...$params->toArray());`
26+
*
1627
* @see CasParser\CasParser->nsdl
1728
*
1829
* @phpstan-type cas_parser_nsdl_params = array{

src/CasParser/CasParserSmartParseParams.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,20 @@
1010
use CasParser\Core\Contracts\BaseModel;
1111

1212
/**
13+
* An object containing the method's parameters.
14+
* Example usage:
15+
* ```
16+
* $params = (new CasParserSmartParseParams); // set properties as needed
17+
* $client->casParser->smartParse(...$params->toArray());
18+
* ```
1319
* This endpoint parses CAS (Consolidated Account Statement) PDF files from NSDL, CDSL, or CAMS/KFintech and returns data in a unified format.
1420
* It auto-detects the CAS type and transforms the data into a consistent structure regardless of the source.
1521
*
22+
* @method toArray()
23+
* Returns the parameters as an associative array suitable for passing to the client method.
24+
*
25+
* `$client->casParser->smartParse(...$params->toArray());`
26+
*
1627
* @see CasParser\CasParser->smartParse
1728
*
1829
* @phpstan-type cas_parser_smart_parse_params = array{

src/CasParser/UnifiedResponse.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616

1717
/**
1818
* @phpstan-type unified_response = array{
19-
* dematAccounts?: list<DematAccount>|null,
20-
* insurance?: Insurance|null,
21-
* investor?: Investor|null,
22-
* meta?: Meta|null,
23-
* mutualFunds?: list<MutualFund>|null,
24-
* summary?: Summary|null,
19+
* dematAccounts?: list<DematAccount>,
20+
* insurance?: Insurance,
21+
* investor?: Investor,
22+
* meta?: Meta,
23+
* mutualFunds?: list<MutualFund>,
24+
* summary?: Summary,
2525
* }
26+
* When used in a response, this type parameter can define a $rawResponse property.
27+
* @template TRawResponse of object = object{}
28+
*
29+
* @mixin TRawResponse
2630
*/
2731
final class UnifiedResponse implements BaseModel
2832
{

0 commit comments

Comments
 (0)