casparser

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

README

Cas Parser Go API Library

Go Reference

The Cas Parser Go library provides convenient access to the Cas Parser REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/CASParser/cas-parser-go" // imported as casparser
)

Or to pin the version:

go get -u 'github.com/CASParser/cas-parser-go@v0.2.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/CASParser/cas-parser-go"
	"github.com/CASParser/cas-parser-go/option"
)

func main() {
	client := casparser.NewClient(
		option.WithAPIKey("My API Key"),      // defaults to os.LookupEnv("CAS_PARSER_API_KEY")
		option.WithEnvironmentEnvironment1(), // or option.WithEnvironmentProduction() | option.WithEnvironmentEnvironment2(); defaults to option.WithEnvironmentProduction()
	)
	response, err := client.Credits.Check(context.TODO())
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.EnabledFeatures)
}

Request fields

The casparser library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, casparser.String(string), casparser.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := casparser.ExampleParams{
	ID:   "id_xxx",                // required property
	Name: casparser.String("..."), // optional property

	Point: casparser.Point{
		X: 0,                // required field will serialize as 0
		Y: casparser.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: casparser.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[casparser.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := casparser.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Credits.Check(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *casparser.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Credits.Check(context.TODO())
if err != nil {
	var apierr *casparser.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/credits": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Credits.Check(
	ctx,
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper casparser.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := casparser.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Credits.Check(context.TODO(), option.WithMaxRetries(5))
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
response, err := client.Credits.Check(context.TODO(), option.WithResponseInto(&response))
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", response)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: casparser.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := casparser.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (CAS_PARSER_API_KEY, CAS_PARSER_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AccessTokenNewParams added in v0.2.0

type AccessTokenNewParams struct {
	// Token validity in minutes (max 60)
	ExpiryMinutes param.Opt[int64] `json:"expiry_minutes,omitzero"`
	// contains filtered or unexported fields
}

func (AccessTokenNewParams) MarshalJSON added in v0.2.0

func (r AccessTokenNewParams) MarshalJSON() (data []byte, err error)

func (*AccessTokenNewParams) UnmarshalJSON added in v0.2.0

func (r *AccessTokenNewParams) UnmarshalJSON(data []byte) error

type AccessTokenNewResponse added in v0.2.0

type AccessTokenNewResponse struct {
	// The at\_ prefixed access token
	AccessToken string `json:"access_token"`
	// Token validity in seconds
	ExpiresIn int64 `json:"expires_in"`
	// Always "api_key" - token is a drop-in replacement for x-api-key header
	TokenType string `json:"token_type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccessToken respjson.Field
		ExpiresIn   respjson.Field
		TokenType   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AccessTokenNewResponse) RawJSON added in v0.2.0

func (r AccessTokenNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AccessTokenNewResponse) UnmarshalJSON added in v0.2.0

func (r *AccessTokenNewResponse) UnmarshalJSON(data []byte) error

type AccessTokenService added in v0.2.0

type AccessTokenService struct {
	Options []option.RequestOption
}

AccessTokenService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccessTokenService method instead.

func NewAccessTokenService added in v0.2.0

func NewAccessTokenService(opts ...option.RequestOption) (r AccessTokenService)

NewAccessTokenService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccessTokenService) New added in v0.2.0

Generate a short-lived access token from your API key.

**Use this endpoint from your backend** to create tokens that can be safely passed to frontend/SDK.

Access tokens:

- Are prefixed with `at_` for easy identification - Valid for up to 60 minutes - Can be used in place of API keys on all v4 endpoints - Cannot be used to generate other access tokens

type CamsKfintechParseParams added in v0.2.0

type CamsKfintechParseParams struct {
	// Password for the PDF file (if required)
	Password param.Opt[string] `json:"password,omitzero"`
	// Base64 encoded CAS PDF file (required if pdf_url not provided)
	PdfFile param.Opt[string] `json:"pdf_file,omitzero" format:"base64"`
	// URL to the CAS PDF file (required if pdf_file not provided)
	PdfURL param.Opt[string] `json:"pdf_url,omitzero" format:"uri"`
	// contains filtered or unexported fields
}

func (CamsKfintechParseParams) MarshalJSON added in v0.2.0

func (r CamsKfintechParseParams) MarshalJSON() (data []byte, err error)

func (*CamsKfintechParseParams) UnmarshalJSON added in v0.2.0

func (r *CamsKfintechParseParams) UnmarshalJSON(data []byte) error

type CamsKfintechService added in v0.2.0

type CamsKfintechService struct {
	Options []option.RequestOption
}

CamsKfintechService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCamsKfintechService method instead.

func NewCamsKfintechService added in v0.2.0

func NewCamsKfintechService(opts ...option.RequestOption) (r CamsKfintechService)

NewCamsKfintechService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CamsKfintechService) Parse added in v0.2.0

This endpoint specifically parses CAMS/KFintech CAS (Consolidated Account Statement) PDF files and returns data in a unified format. Use this endpoint when you know the PDF is from CAMS or KFintech.

type CdslFetchRequestOtpParams added in v0.2.0

type CdslFetchRequestOtpParams struct {
	// CDSL BO ID (16 digits)
	BoID string `json:"bo_id,required"`
	// Date of birth (YYYY-MM-DD)
	Dob string `json:"dob,required"`
	// PAN number
	Pan string `json:"pan,required"`
	// contains filtered or unexported fields
}

func (CdslFetchRequestOtpParams) MarshalJSON added in v0.2.0

func (r CdslFetchRequestOtpParams) MarshalJSON() (data []byte, err error)

func (*CdslFetchRequestOtpParams) UnmarshalJSON added in v0.2.0

func (r *CdslFetchRequestOtpParams) UnmarshalJSON(data []byte) error

type CdslFetchRequestOtpResponse added in v0.2.0

type CdslFetchRequestOtpResponse struct {
	Msg string `json:"msg"`
	// Session ID for verify step
	SessionID string `json:"session_id"`
	Status    string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Msg         respjson.Field
		SessionID   respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CdslFetchRequestOtpResponse) RawJSON added in v0.2.0

func (r CdslFetchRequestOtpResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CdslFetchRequestOtpResponse) UnmarshalJSON added in v0.2.0

func (r *CdslFetchRequestOtpResponse) UnmarshalJSON(data []byte) error

type CdslFetchService added in v0.2.0

type CdslFetchService struct {
	Options []option.RequestOption
}

CdslFetchService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCdslFetchService method instead.

func NewCdslFetchService added in v0.2.0

func NewCdslFetchService(opts ...option.RequestOption) (r CdslFetchService)

NewCdslFetchService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CdslFetchService) RequestOtp added in v0.2.0

**Step 1 of 2**: Request OTP for CDSL CAS fetch.

This endpoint:

1. Solves reCAPTCHA automatically (~15-20 seconds) 2. Submits login credentials to CDSL portal 3. Triggers OTP to user's registered mobile number

After user receives OTP, call `/v4/cdsl/fetch/{session_id}/verify` to complete.

func (*CdslFetchService) VerifyOtp added in v0.2.0

**Step 2 of 2**: Verify OTP and retrieve CDSL CAS files.

After successful verification, CAS PDFs are fetched from CDSL portal, uploaded to cloud storage, and returned as direct download URLs.

type CdslFetchVerifyOtpParams added in v0.2.0

type CdslFetchVerifyOtpParams struct {
	// OTP received on mobile
	Otp string `json:"otp,required"`
	// Number of monthly statements to fetch (default 6)
	NumPeriods param.Opt[int64] `json:"num_periods,omitzero"`
	// contains filtered or unexported fields
}

func (CdslFetchVerifyOtpParams) MarshalJSON added in v0.2.0

func (r CdslFetchVerifyOtpParams) MarshalJSON() (data []byte, err error)

func (*CdslFetchVerifyOtpParams) UnmarshalJSON added in v0.2.0

func (r *CdslFetchVerifyOtpParams) UnmarshalJSON(data []byte) error

type CdslFetchVerifyOtpResponse added in v0.2.0

type CdslFetchVerifyOtpResponse struct {
	Files  []CdslFetchVerifyOtpResponseFile `json:"files"`
	Msg    string                           `json:"msg"`
	Status string                           `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Files       respjson.Field
		Msg         respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CdslFetchVerifyOtpResponse) RawJSON added in v0.2.0

func (r CdslFetchVerifyOtpResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CdslFetchVerifyOtpResponse) UnmarshalJSON added in v0.2.0

func (r *CdslFetchVerifyOtpResponse) UnmarshalJSON(data []byte) error

type CdslFetchVerifyOtpResponseFile added in v0.2.0

type CdslFetchVerifyOtpResponseFile struct {
	Filename string `json:"filename"`
	// Direct download URL (cloud storage)
	URL string `json:"url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Filename    respjson.Field
		URL         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CdslFetchVerifyOtpResponseFile) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*CdslFetchVerifyOtpResponseFile) UnmarshalJSON added in v0.2.0

func (r *CdslFetchVerifyOtpResponseFile) UnmarshalJSON(data []byte) error

type CdslParsePdfParams added in v0.2.0

type CdslParsePdfParams struct {
	// Password for the PDF file (if required)
	Password param.Opt[string] `json:"password,omitzero"`
	// Base64 encoded CAS PDF file (required if pdf_url not provided)
	PdfFile param.Opt[string] `json:"pdf_file,omitzero" format:"base64"`
	// URL to the CAS PDF file (required if pdf_file not provided)
	PdfURL param.Opt[string] `json:"pdf_url,omitzero" format:"uri"`
	// contains filtered or unexported fields
}

func (CdslParsePdfParams) MarshalJSON added in v0.2.0

func (r CdslParsePdfParams) MarshalJSON() (data []byte, err error)

func (*CdslParsePdfParams) UnmarshalJSON added in v0.2.0

func (r *CdslParsePdfParams) UnmarshalJSON(data []byte) error

type CdslService added in v0.2.0

type CdslService struct {
	Options []option.RequestOption
	Fetch   CdslFetchService
}

CdslService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCdslService method instead.

func NewCdslService added in v0.2.0

func NewCdslService(opts ...option.RequestOption) (r CdslService)

NewCdslService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CdslService) ParsePdf added in v0.2.0

func (r *CdslService) ParsePdf(ctx context.Context, body CdslParsePdfParams, opts ...option.RequestOption) (res *UnifiedResponse, err error)

This endpoint specifically parses CDSL CAS (Consolidated Account Statement) PDF files and returns data in a unified format. Use this endpoint when you know the PDF is from CDSL.

type Client

type Client struct {
	Options      []option.RequestOption
	Credits      CreditService
	Logs         LogService
	AccessToken  AccessTokenService
	VerifyToken  VerifyTokenService
	CamsKfintech CamsKfintechService
	Cdsl         CdslService
	ContractNote ContractNoteService
	Inbox        InboxService
	Kfintech     KfintechService
	Nsdl         NsdlService
	Smart        SmartService
}

Client creates a struct with services and top level methods that help with interacting with the cas-parser API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (CAS_PARSER_API_KEY, CAS_PARSER_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type ContractNoteParseParams added in v0.2.0

type ContractNoteParseParams struct {
	// Password for the PDF file (usually PAN number for Zerodha)
	Password param.Opt[string] `json:"password,omitzero"`
	// Base64 encoded contract note PDF file
	PdfFile param.Opt[string] `json:"pdf_file,omitzero" format:"base64"`
	// URL to the contract note PDF file
	PdfURL param.Opt[string] `json:"pdf_url,omitzero" format:"uri"`
	// Optional broker type override. If not provided, system will auto-detect.
	//
	// Any of "zerodha", "groww", "upstox", "icici".
	BrokerType ContractNoteParseParamsBrokerType `json:"broker_type,omitzero"`
	// contains filtered or unexported fields
}

func (ContractNoteParseParams) MarshalJSON added in v0.2.0

func (r ContractNoteParseParams) MarshalJSON() (data []byte, err error)

func (*ContractNoteParseParams) UnmarshalJSON added in v0.2.0

func (r *ContractNoteParseParams) UnmarshalJSON(data []byte) error

type ContractNoteParseParamsBrokerType added in v0.2.0

type ContractNoteParseParamsBrokerType string

Optional broker type override. If not provided, system will auto-detect.

const (
	ContractNoteParseParamsBrokerTypeZerodha ContractNoteParseParamsBrokerType = "zerodha"
	ContractNoteParseParamsBrokerTypeGroww   ContractNoteParseParamsBrokerType = "groww"
	ContractNoteParseParamsBrokerTypeUpstox  ContractNoteParseParamsBrokerType = "upstox"
	ContractNoteParseParamsBrokerTypeIcici   ContractNoteParseParamsBrokerType = "icici"
)

type ContractNoteParseResponse added in v0.2.0

type ContractNoteParseResponse struct {
	Data   ContractNoteParseResponseData `json:"data"`
	Msg    string                        `json:"msg"`
	Status string                        `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		Msg         respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ContractNoteParseResponse) RawJSON added in v0.2.0

func (r ContractNoteParseResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponse) UnmarshalJSON added in v0.2.0

func (r *ContractNoteParseResponse) UnmarshalJSON(data []byte) error

type ContractNoteParseResponseData added in v0.2.0

type ContractNoteParseResponseData struct {
	BrokerInfo ContractNoteParseResponseDataBrokerInfo `json:"broker_info"`
	// Breakdown of various charges and fees
	ChargesSummary   ContractNoteParseResponseDataChargesSummary   `json:"charges_summary"`
	ClientInfo       ContractNoteParseResponseDataClientInfo       `json:"client_info"`
	ContractNoteInfo ContractNoteParseResponseDataContractNoteInfo `json:"contract_note_info"`
	// Summary of derivatives transactions
	DerivativesTransactions []ContractNoteParseResponseDataDerivativesTransaction `json:"derivatives_transactions"`
	// Detailed breakdown of all individual trades
	DetailedTrades []ContractNoteParseResponseDataDetailedTrade `json:"detailed_trades"`
	// Summary of equity transactions grouped by security
	EquityTransactions []ContractNoteParseResponseDataEquityTransaction `json:"equity_transactions"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BrokerInfo              respjson.Field
		ChargesSummary          respjson.Field
		ClientInfo              respjson.Field
		ContractNoteInfo        respjson.Field
		DerivativesTransactions respjson.Field
		DetailedTrades          respjson.Field
		EquityTransactions      respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ContractNoteParseResponseData) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponseData) UnmarshalJSON added in v0.2.0

func (r *ContractNoteParseResponseData) UnmarshalJSON(data []byte) error

type ContractNoteParseResponseDataBrokerInfo added in v0.2.0

type ContractNoteParseResponseDataBrokerInfo struct {
	// Auto-detected or specified broker type
	//
	// Any of "zerodha", "groww", "upstox", "icici", "unknown".
	BrokerType string `json:"broker_type"`
	// Broker company name
	Name string `json:"name"`
	// SEBI registration number of the broker
	SebiRegistration string `json:"sebi_registration"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BrokerType       respjson.Field
		Name             respjson.Field
		SebiRegistration respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ContractNoteParseResponseDataBrokerInfo) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponseDataBrokerInfo) UnmarshalJSON added in v0.2.0

func (r *ContractNoteParseResponseDataBrokerInfo) UnmarshalJSON(data []byte) error

type ContractNoteParseResponseDataChargesSummary added in v0.2.0

type ContractNoteParseResponseDataChargesSummary struct {
	// Central GST amount
	Cgst float64 `json:"cgst"`
	// Exchange transaction charges
	ExchangeTransactionCharges float64 `json:"exchange_transaction_charges"`
	// Integrated GST amount
	Igst float64 `json:"igst"`
	// Final net amount receivable or payable
	NetAmountReceivablePayable float64 `json:"net_amount_receivable_payable"`
	// Net pay-in/pay-out obligation
	PayInPayOutObligation float64 `json:"pay_in_pay_out_obligation"`
	// SEBI turnover fees
	SebiTurnoverFees float64 `json:"sebi_turnover_fees"`
	// Securities Transaction Tax
	SecuritiesTransactionTax float64 `json:"securities_transaction_tax"`
	// State GST amount
	Sgst float64 `json:"sgst"`
	// Stamp duty charges
	StampDuty float64 `json:"stamp_duty"`
	// Taxable brokerage amount
	TaxableValueBrokerage float64 `json:"taxable_value_brokerage"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Cgst                       respjson.Field
		ExchangeTransactionCharges respjson.Field
		Igst                       respjson.Field
		NetAmountReceivablePayable respjson.Field
		PayInPayOutObligation      respjson.Field
		SebiTurnoverFees           respjson.Field
		SecuritiesTransactionTax   respjson.Field
		Sgst                       respjson.Field
		StampDuty                  respjson.Field
		TaxableValueBrokerage      respjson.Field
		ExtraFields                map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Breakdown of various charges and fees

func (ContractNoteParseResponseDataChargesSummary) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponseDataChargesSummary) UnmarshalJSON added in v0.2.0

func (r *ContractNoteParseResponseDataChargesSummary) UnmarshalJSON(data []byte) error

type ContractNoteParseResponseDataClientInfo added in v0.2.0

type ContractNoteParseResponseDataClientInfo struct {
	// Client address
	Address string `json:"address"`
	// GST state code
	GstStateCode string `json:"gst_state_code"`
	// Client name
	Name string `json:"name"`
	// Client PAN number
	Pan string `json:"pan"`
	// GST place of supply
	PlaceOfSupply string `json:"place_of_supply"`
	// Unique Client Code
	Ucc string `json:"ucc"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address       respjson.Field
		GstStateCode  respjson.Field
		Name          respjson.Field
		Pan           respjson.Field
		PlaceOfSupply respjson.Field
		Ucc           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ContractNoteParseResponseDataClientInfo) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponseDataClientInfo) UnmarshalJSON added in v0.2.0

func (r *ContractNoteParseResponseDataClientInfo) UnmarshalJSON(data []byte) error

type ContractNoteParseResponseDataContractNoteInfo added in v0.2.0

type ContractNoteParseResponseDataContractNoteInfo struct {
	// Contract note reference number
	ContractNoteNumber string `json:"contract_note_number"`
	// Settlement date for the trades
	SettlementDate time.Time `json:"settlement_date" format:"date"`
	// Settlement reference number
	SettlementNumber string `json:"settlement_number"`
	// Date when trades were executed
	TradeDate time.Time `json:"trade_date" format:"date"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ContractNoteNumber respjson.Field
		SettlementDate     respjson.Field
		SettlementNumber   respjson.Field
		TradeDate          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ContractNoteParseResponseDataContractNoteInfo) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponseDataContractNoteInfo) UnmarshalJSON added in v0.2.0

func (r *ContractNoteParseResponseDataContractNoteInfo) UnmarshalJSON(data []byte) error

type ContractNoteParseResponseDataDerivativesTransaction added in v0.2.0

type ContractNoteParseResponseDataDerivativesTransaction struct {
	// Brokerage charged per unit
	BrokeragePerUnit float64 `json:"brokerage_per_unit"`
	// Transaction type (Buy/Sell/Bring Forward/Carry Forward)
	BuySellBfCf string `json:"buy_sell_bf_cf"`
	// Closing rate per unit
	ClosingRatePerUnit float64 `json:"closing_rate_per_unit"`
	// Derivatives contract description
	ContractDescription string `json:"contract_description"`
	// Net total amount
	NetTotal float64 `json:"net_total"`
	// Quantity traded
	Quantity float64 `json:"quantity"`
	// Weighted Average Price per unit
	WapPerUnit float64 `json:"wap_per_unit"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BrokeragePerUnit    respjson.Field
		BuySellBfCf         respjson.Field
		ClosingRatePerUnit  respjson.Field
		ContractDescription respjson.Field
		NetTotal            respjson.Field
		Quantity            respjson.Field
		WapPerUnit          respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ContractNoteParseResponseDataDerivativesTransaction) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponseDataDerivativesTransaction) UnmarshalJSON added in v0.2.0

type ContractNoteParseResponseDataDetailedTrade added in v0.2.0

type ContractNoteParseResponseDataDetailedTrade struct {
	// Brokerage charged for this trade
	Brokerage float64 `json:"brokerage"`
	// Transaction type (B for Buy, S for Sell)
	BuySell string `json:"buy_sell"`
	// Closing rate per unit
	ClosingRatePerUnit float64 `json:"closing_rate_per_unit"`
	// Exchange name
	Exchange string `json:"exchange"`
	// Net rate per unit
	NetRatePerUnit float64 `json:"net_rate_per_unit"`
	// Net total for this trade
	NetTotal float64 `json:"net_total"`
	// Order reference number
	OrderNumber string `json:"order_number"`
	// Time when order was placed
	OrderTime string `json:"order_time"`
	// Quantity traded
	Quantity float64 `json:"quantity"`
	// Additional remarks or notes
	Remarks string `json:"remarks"`
	// Security name with exchange and ISIN
	SecurityDescription string `json:"security_description"`
	// Trade reference number
	TradeNumber string `json:"trade_number"`
	// Time when trade was executed
	TradeTime string `json:"trade_time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Brokerage           respjson.Field
		BuySell             respjson.Field
		ClosingRatePerUnit  respjson.Field
		Exchange            respjson.Field
		NetRatePerUnit      respjson.Field
		NetTotal            respjson.Field
		OrderNumber         respjson.Field
		OrderTime           respjson.Field
		Quantity            respjson.Field
		Remarks             respjson.Field
		SecurityDescription respjson.Field
		TradeNumber         respjson.Field
		TradeTime           respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ContractNoteParseResponseDataDetailedTrade) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponseDataDetailedTrade) UnmarshalJSON added in v0.2.0

func (r *ContractNoteParseResponseDataDetailedTrade) UnmarshalJSON(data []byte) error

type ContractNoteParseResponseDataEquityTransaction added in v0.2.0

type ContractNoteParseResponseDataEquityTransaction struct {
	// Total quantity purchased
	BuyQuantity float64 `json:"buy_quantity"`
	// Total value of buy transactions
	BuyTotalValue float64 `json:"buy_total_value"`
	// Weighted Average Price for buy transactions
	BuyWap float64 `json:"buy_wap"`
	// ISIN code of the security
	Isin string `json:"isin"`
	// Net amount payable/receivable for this security
	NetObligation float64 `json:"net_obligation"`
	// Name of the security
	SecurityName string `json:"security_name"`
	// Trading symbol
	SecuritySymbol string `json:"security_symbol"`
	// Total quantity sold
	SellQuantity float64 `json:"sell_quantity"`
	// Total value of sell transactions
	SellTotalValue float64 `json:"sell_total_value"`
	// Weighted Average Price for sell transactions
	SellWap float64 `json:"sell_wap"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BuyQuantity    respjson.Field
		BuyTotalValue  respjson.Field
		BuyWap         respjson.Field
		Isin           respjson.Field
		NetObligation  respjson.Field
		SecurityName   respjson.Field
		SecuritySymbol respjson.Field
		SellQuantity   respjson.Field
		SellTotalValue respjson.Field
		SellWap        respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ContractNoteParseResponseDataEquityTransaction) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*ContractNoteParseResponseDataEquityTransaction) UnmarshalJSON added in v0.2.0

type ContractNoteService added in v0.2.0

type ContractNoteService struct {
	Options []option.RequestOption
}

ContractNoteService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewContractNoteService method instead.

func NewContractNoteService added in v0.2.0

func NewContractNoteService(opts ...option.RequestOption) (r ContractNoteService)

NewContractNoteService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ContractNoteService) Parse added in v0.2.0

This endpoint parses Contract Note PDF files from various brokers including Zerodha, Groww, Upstox, ICICI Securities, and others.

**What is a Contract Note?** A contract note is a legal document that provides details of all trades executed by an investor. It includes:

- Trade details with timestamps, quantities, and prices - Brokerage and charges breakdown - Settlement information - Regulatory compliance details

**Supported Brokers:**

- Zerodha Broking Limited - Groww Invest Tech Private Limited - Upstox (RKSV Securities) - ICICI Securities Limited - Auto-detection for unknown brokers

**Key Features:**

  • **Auto-detection**: Automatically identifies broker type from PDF content
  • **Comprehensive parsing**: Extracts equity transactions, derivatives transactions, detailed trades, and charges
  • **Flexible input**: Accepts both file upload and URL-based PDF input
  • **Password protection**: Supports password-protected PDFs

The API returns structured data including contract note information, client details, transaction summaries, and detailed trade-by-trade breakdowns.

type CreditCheckResponse added in v0.2.0

type CreditCheckResponse struct {
	// List of API features enabled for your plan
	EnabledFeatures []string `json:"enabled_features"`
	// Whether the account has unlimited credits
	IsUnlimited bool `json:"is_unlimited"`
	// Total credit limit for billing period
	Limit int64 `json:"limit"`
	// Remaining credits (null if unlimited)
	Remaining float64 `json:"remaining,nullable"`
	// When credits reset (ISO 8601)
	ResetsAt time.Time `json:"resets_at,nullable" format:"date-time"`
	// Number of credits used this billing period
	Used float64 `json:"used"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnabledFeatures respjson.Field
		IsUnlimited     respjson.Field
		Limit           respjson.Field
		Remaining       respjson.Field
		ResetsAt        respjson.Field
		Used            respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (CreditCheckResponse) RawJSON added in v0.2.0

func (r CreditCheckResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*CreditCheckResponse) UnmarshalJSON added in v0.2.0

func (r *CreditCheckResponse) UnmarshalJSON(data []byte) error

type CreditService added in v0.2.0

type CreditService struct {
	Options []option.RequestOption
}

CreditService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCreditService method instead.

func NewCreditService added in v0.2.0

func NewCreditService(opts ...option.RequestOption) (r CreditService)

NewCreditService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CreditService) Check added in v0.2.0

func (r *CreditService) Check(ctx context.Context, opts ...option.RequestOption) (res *CreditCheckResponse, err error)

Check your remaining API credits and usage for the current billing period.

Returns:

- Number of API calls used and remaining credits - Credit limit and reset date - List of enabled features for your plan

Credits reset at the start of each billing period.

type Error

type Error = apierror.Error

type InboxCheckConnectionStatusParams added in v0.2.0

type InboxCheckConnectionStatusParams struct {
	XInboxToken string `header:"x-inbox-token,required" json:"-"`
	// contains filtered or unexported fields
}

type InboxCheckConnectionStatusResponse added in v0.2.0

type InboxCheckConnectionStatusResponse struct {
	// Whether the token is valid and usable
	Connected bool `json:"connected"`
	// Email address of the connected account
	Email    string `json:"email" format:"email"`
	Provider string `json:"provider"`
	Status   string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Connected   respjson.Field
		Email       respjson.Field
		Provider    respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxCheckConnectionStatusResponse) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*InboxCheckConnectionStatusResponse) UnmarshalJSON added in v0.2.0

func (r *InboxCheckConnectionStatusResponse) UnmarshalJSON(data []byte) error

type InboxConnectEmailParams added in v0.2.0

type InboxConnectEmailParams struct {
	// Your callback URL to receive the inbox_token (must be http or https)
	RedirectUri string `json:"redirect_uri,required" format:"uri"`
	// State parameter for CSRF protection (returned in redirect)
	State param.Opt[string] `json:"state,omitzero"`
	// contains filtered or unexported fields
}

func (InboxConnectEmailParams) MarshalJSON added in v0.2.0

func (r InboxConnectEmailParams) MarshalJSON() (data []byte, err error)

func (*InboxConnectEmailParams) UnmarshalJSON added in v0.2.0

func (r *InboxConnectEmailParams) UnmarshalJSON(data []byte) error

type InboxConnectEmailResponse added in v0.2.0

type InboxConnectEmailResponse struct {
	// Seconds until the OAuth URL expires (typically 10 minutes)
	ExpiresIn int64 `json:"expires_in"`
	// Redirect user to this URL to start OAuth flow
	OAuthURL string `json:"oauth_url" format:"uri"`
	Status   string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ExpiresIn   respjson.Field
		OAuthURL    respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxConnectEmailResponse) RawJSON added in v0.2.0

func (r InboxConnectEmailResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxConnectEmailResponse) UnmarshalJSON added in v0.2.0

func (r *InboxConnectEmailResponse) UnmarshalJSON(data []byte) error

type InboxDisconnectEmailParams added in v0.2.0

type InboxDisconnectEmailParams struct {
	XInboxToken string `header:"x-inbox-token,required" json:"-"`
	// contains filtered or unexported fields
}

type InboxDisconnectEmailResponse added in v0.2.0

type InboxDisconnectEmailResponse struct {
	Msg    string `json:"msg"`
	Status string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Msg         respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxDisconnectEmailResponse) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*InboxDisconnectEmailResponse) UnmarshalJSON added in v0.2.0

func (r *InboxDisconnectEmailResponse) UnmarshalJSON(data []byte) error

type InboxListCasFilesParams added in v0.2.0

type InboxListCasFilesParams struct {
	XInboxToken string `header:"x-inbox-token,required" json:"-"`
	// End date in ISO format (YYYY-MM-DD). Defaults to today.
	EndDate param.Opt[time.Time] `json:"end_date,omitzero" format:"date"`
	// Start date in ISO format (YYYY-MM-DD). Defaults to 30 days ago.
	StartDate param.Opt[time.Time] `json:"start_date,omitzero" format:"date"`
	// Filter by CAS provider(s):
	//
	// - `cdsl` → eCAS@cdslstatement.com
	// - `nsdl` → NSDL-CAS@nsdl.co.in
	// - `cams` → donotreply@camsonline.com
	// - `kfintech` → samfS@kfintech.com
	//
	// Any of "cdsl", "nsdl", "cams", "kfintech".
	CasTypes []string `json:"cas_types,omitzero"`
	// contains filtered or unexported fields
}

func (InboxListCasFilesParams) MarshalJSON added in v0.2.0

func (r InboxListCasFilesParams) MarshalJSON() (data []byte, err error)

func (*InboxListCasFilesParams) UnmarshalJSON added in v0.2.0

func (r *InboxListCasFilesParams) UnmarshalJSON(data []byte) error

type InboxListCasFilesResponse added in v0.2.0

type InboxListCasFilesResponse struct {
	// Number of CAS files found
	Count  int64                           `json:"count"`
	Files  []InboxListCasFilesResponseFile `json:"files"`
	Status string                          `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Files       respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (InboxListCasFilesResponse) RawJSON added in v0.2.0

func (r InboxListCasFilesResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*InboxListCasFilesResponse) UnmarshalJSON added in v0.2.0

func (r *InboxListCasFilesResponse) UnmarshalJSON(data []byte) error

type InboxListCasFilesResponseFile added in v0.2.0

type InboxListCasFilesResponseFile struct {
	// Detected CAS provider based on sender email
	//
	// Any of "cdsl", "nsdl", "cams", "kfintech".
	CasType string `json:"cas_type"`
	// URL expiration time in seconds (default 86400 = 24 hours)
	ExpiresIn int64 `json:"expires_in"`
	// Standardized filename (provider_YYYYMMDD_uniqueid.pdf)
	Filename string `json:"filename"`
	// Date the email was received
	MessageDate time.Time `json:"message_date" format:"date"`
	// Unique identifier for the email message (use for subsequent API calls)
	MessageID string `json:"message_id"`
	// Original attachment filename from the email
	OriginalFilename string `json:"original_filename"`
	// File size in bytes
	Size int64 `json:"size"`
	// Direct download URL (presigned, expires based on expires_in)
	URL string `json:"url" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CasType          respjson.Field
		ExpiresIn        respjson.Field
		Filename         respjson.Field
		MessageDate      respjson.Field
		MessageID        respjson.Field
		OriginalFilename respjson.Field
		Size             respjson.Field
		URL              respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A CAS file found in the user's email inbox

func (InboxListCasFilesResponseFile) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*InboxListCasFilesResponseFile) UnmarshalJSON added in v0.2.0

func (r *InboxListCasFilesResponseFile) UnmarshalJSON(data []byte) error

type InboxService added in v0.2.0

type InboxService struct {
	Options []option.RequestOption
}

InboxService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewInboxService method instead.

func NewInboxService added in v0.2.0

func NewInboxService(opts ...option.RequestOption) (r InboxService)

NewInboxService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*InboxService) CheckConnectionStatus added in v0.2.0

Verify if an `inbox_token` is still valid and check connection status.

Use this to check if the user needs to re-authenticate (e.g., if they revoked access in their email provider settings).

func (*InboxService) ConnectEmail added in v0.2.0

Initiate OAuth flow to connect user's email inbox.

Returns an `oauth_url` that you should redirect the user to. After authorization, they are redirected back to your `redirect_uri` with the following query parameters:

**On success:**

- `inbox_token` - Encrypted token to store client-side - `email` - Email address of the connected account - `state` - Your original state parameter (for CSRF verification)

**On error:**

- `error` - Error code (e.g., `access_denied`, `token_exchange_failed`) - `state` - Your original state parameter

**Store the `inbox_token` client-side** and use it for all subsequent inbox API calls.

func (*InboxService) DisconnectEmail added in v0.2.0

Revoke email access and invalidate the token.

This calls the provider's token revocation API (e.g., Google's revoke endpoint) to ensure the user's consent is properly removed.

After calling this, the `inbox_token` becomes unusable.

func (*InboxService) ListCasFiles added in v0.2.0

func (r *InboxService) ListCasFiles(ctx context.Context, params InboxListCasFilesParams, opts ...option.RequestOption) (res *InboxListCasFilesResponse, err error)

Search the user's email inbox for CAS files from known senders (CAMS, KFintech, CDSL, NSDL).

Files are uploaded to temporary cloud storage. **URLs expire in 24 hours.**

Optionally filter by CAS provider and date range.

**Billing:** 0.2 credits per request (charged regardless of success or number of files found).

type KfintechGenerateCasParams added in v0.2.0

type KfintechGenerateCasParams struct {
	// Email address to receive the CAS document
	Email string `json:"email,required"`
	// Start date (YYYY-MM-DD)
	FromDate string `json:"from_date,required"`
	// Password for the PDF
	Password string `json:"password,required"`
	// End date (YYYY-MM-DD)
	ToDate string `json:"to_date,required"`
	// PAN number (optional)
	PanNo param.Opt[string] `json:"pan_no,omitzero"`
	// contains filtered or unexported fields
}

func (KfintechGenerateCasParams) MarshalJSON added in v0.2.0

func (r KfintechGenerateCasParams) MarshalJSON() (data []byte, err error)

func (*KfintechGenerateCasParams) UnmarshalJSON added in v0.2.0

func (r *KfintechGenerateCasParams) UnmarshalJSON(data []byte) error

type KfintechGenerateCasResponse added in v0.2.0

type KfintechGenerateCasResponse struct {
	Msg    string `json:"msg"`
	Status string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Msg         respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (KfintechGenerateCasResponse) RawJSON added in v0.2.0

func (r KfintechGenerateCasResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*KfintechGenerateCasResponse) UnmarshalJSON added in v0.2.0

func (r *KfintechGenerateCasResponse) UnmarshalJSON(data []byte) error

type KfintechService added in v0.2.0

type KfintechService struct {
	Options []option.RequestOption
}

KfintechService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewKfintechService method instead.

func NewKfintechService added in v0.2.0

func NewKfintechService(opts ...option.RequestOption) (r KfintechService)

NewKfintechService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*KfintechService) GenerateCas added in v0.2.0

Generate CAS via KFintech mailback. The CAS PDF will be sent to the investor's email.

This is an async operation - the investor receives the CAS via email within a few minutes. For instant CAS retrieval, use CDSL Fetch (`/v4/cdsl/fetch`).

type LinkedHolder added in v0.2.0

type LinkedHolder struct {
	// Name of the account holder
	Name string `json:"name"`
	// PAN of the account holder
	Pan string `json:"pan"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Pan         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (LinkedHolder) RawJSON added in v0.2.0

func (r LinkedHolder) RawJSON() string

Returns the unmodified JSON received from the API

func (*LinkedHolder) UnmarshalJSON added in v0.2.0

func (r *LinkedHolder) UnmarshalJSON(data []byte) error

type LogGetSummaryParams added in v0.2.0

type LogGetSummaryParams struct {
	// End time filter (ISO 8601). Defaults to now.
	EndTime param.Opt[time.Time] `json:"end_time,omitzero" format:"date-time"`
	// Start time filter (ISO 8601). Defaults to start of current month.
	StartTime param.Opt[time.Time] `json:"start_time,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (LogGetSummaryParams) MarshalJSON added in v0.2.0

func (r LogGetSummaryParams) MarshalJSON() (data []byte, err error)

func (*LogGetSummaryParams) UnmarshalJSON added in v0.2.0

func (r *LogGetSummaryParams) UnmarshalJSON(data []byte) error

type LogGetSummaryResponse added in v0.2.0

type LogGetSummaryResponse struct {
	Status  string                       `json:"status"`
	Summary LogGetSummaryResponseSummary `json:"summary"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Status      respjson.Field
		Summary     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (LogGetSummaryResponse) RawJSON added in v0.2.0

func (r LogGetSummaryResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogGetSummaryResponse) UnmarshalJSON added in v0.2.0

func (r *LogGetSummaryResponse) UnmarshalJSON(data []byte) error

type LogGetSummaryResponseSummary added in v0.2.0

type LogGetSummaryResponseSummary struct {
	// Usage breakdown by feature
	ByFeature []LogGetSummaryResponseSummaryByFeature `json:"by_feature"`
	// Total credits consumed in the period
	TotalCredits float64 `json:"total_credits"`
	// Total API requests made in the period
	TotalRequests int64 `json:"total_requests"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ByFeature     respjson.Field
		TotalCredits  respjson.Field
		TotalRequests respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (LogGetSummaryResponseSummary) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*LogGetSummaryResponseSummary) UnmarshalJSON added in v0.2.0

func (r *LogGetSummaryResponseSummary) UnmarshalJSON(data []byte) error

type LogGetSummaryResponseSummaryByFeature added in v0.2.0

type LogGetSummaryResponseSummaryByFeature struct {
	// Credits consumed by this feature
	Credits float64 `json:"credits"`
	// API feature name
	Feature string `json:"feature"`
	// Number of requests for this feature
	Requests int64 `json:"requests"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Credits     respjson.Field
		Feature     respjson.Field
		Requests    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (LogGetSummaryResponseSummaryByFeature) RawJSON added in v0.2.0

Returns the unmodified JSON received from the API

func (*LogGetSummaryResponseSummaryByFeature) UnmarshalJSON added in v0.2.0

func (r *LogGetSummaryResponseSummaryByFeature) UnmarshalJSON(data []byte) error

type LogNewParams added in v0.2.0

type LogNewParams struct {
	// End time filter (ISO 8601). Defaults to now.
	EndTime param.Opt[time.Time] `json:"end_time,omitzero" format:"date-time"`
	// Maximum number of logs to return
	Limit param.Opt[int64] `json:"limit,omitzero"`
	// Start time filter (ISO 8601). Defaults to 30 days ago.
	StartTime param.Opt[time.Time] `json:"start_time,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (LogNewParams) MarshalJSON added in v0.2.0

func (r LogNewParams) MarshalJSON() (data []byte, err error)

func (*LogNewParams) UnmarshalJSON added in v0.2.0

func (r *LogNewParams) UnmarshalJSON(data []byte) error

type LogNewResponse added in v0.2.0

type LogNewResponse struct {
	// Number of logs returned
	Count  int64               `json:"count"`
	Logs   []LogNewResponseLog `json:"logs"`
	Status string              `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Logs        respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (LogNewResponse) RawJSON added in v0.2.0

func (r LogNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogNewResponse) UnmarshalJSON added in v0.2.0

func (r *LogNewResponse) UnmarshalJSON(data []byte) error

type LogNewResponseLog added in v0.2.0

type LogNewResponseLog struct {
	// Credits consumed for this request
	Credits float64 `json:"credits"`
	// API feature used
	Feature string `json:"feature"`
	// API endpoint path
	Path string `json:"path"`
	// Unique request identifier
	RequestID string `json:"request_id"`
	// HTTP response status code
	StatusCode int64 `json:"status_code"`
	// When the request was made
	Timestamp time.Time `json:"timestamp" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Credits     respjson.Field
		Feature     respjson.Field
		Path        respjson.Field
		RequestID   respjson.Field
		StatusCode  respjson.Field
		Timestamp   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (LogNewResponseLog) RawJSON added in v0.2.0

func (r LogNewResponseLog) RawJSON() string

Returns the unmodified JSON received from the API

func (*LogNewResponseLog) UnmarshalJSON added in v0.2.0

func (r *LogNewResponseLog) UnmarshalJSON(data []byte) error

type LogService added in v0.2.0

type LogService struct {
	Options []option.RequestOption
}

LogService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewLogService method instead.

func NewLogService added in v0.2.0

func NewLogService(opts ...option.RequestOption) (r LogService)

NewLogService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*LogService) GetSummary added in v0.2.0

func (r *LogService) GetSummary(ctx context.Context, body LogGetSummaryParams, opts ...option.RequestOption) (res *LogGetSummaryResponse, err error)

Get aggregated usage statistics grouped by feature.

Useful for understanding which API features are being used most and tracking usage trends.

func (*LogService) New added in v0.2.0

func (r *LogService) New(ctx context.Context, body LogNewParams, opts ...option.RequestOption) (res *LogNewResponse, err error)

Retrieve detailed API usage logs for your account.

Returns a list of API calls with timestamps, features used, status codes, and credits consumed. Useful for monitoring usage patterns and debugging.

type NsdlParseParams added in v0.2.0

type NsdlParseParams struct {
	// Password for the PDF file (if required)
	Password param.Opt[string] `json:"password,omitzero"`
	// Base64 encoded CAS PDF file (required if pdf_url not provided)
	PdfFile param.Opt[string] `json:"pdf_file,omitzero" format:"base64"`
	// URL to the CAS PDF file (required if pdf_file not provided)
	PdfURL param.Opt[string] `json:"pdf_url,omitzero" format:"uri"`
	// contains filtered or unexported fields
}

func (NsdlParseParams) MarshalJSON added in v0.2.0

func (r NsdlParseParams) MarshalJSON() (data []byte, err error)

func (*NsdlParseParams) UnmarshalJSON added in v0.2.0

func (r *NsdlParseParams) UnmarshalJSON(data []byte) error

type NsdlService added in v0.2.0

type NsdlService struct {
	Options []option.RequestOption
}

NsdlService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewNsdlService method instead.

func NewNsdlService added in v0.2.0

func NewNsdlService(opts ...option.RequestOption) (r NsdlService)

NewNsdlService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*NsdlService) Parse added in v0.2.0

func (r *NsdlService) Parse(ctx context.Context, body NsdlParseParams, opts ...option.RequestOption) (res *UnifiedResponse, err error)

This endpoint specifically parses NSDL CAS (Consolidated Account Statement) PDF files and returns data in a unified format. Use this endpoint when you know the PDF is from NSDL.

type SmartParseCasPdfParams added in v0.2.0

type SmartParseCasPdfParams struct {
	// Password for the PDF file (if required)
	Password param.Opt[string] `json:"password,omitzero"`
	// Base64 encoded CAS PDF file (required if pdf_url not provided)
	PdfFile param.Opt[string] `json:"pdf_file,omitzero" format:"base64"`
	// URL to the CAS PDF file (required if pdf_file not provided)
	PdfURL param.Opt[string] `json:"pdf_url,omitzero" format:"uri"`
	// contains filtered or unexported fields
}

func (SmartParseCasPdfParams) MarshalJSON added in v0.2.0

func (r SmartParseCasPdfParams) MarshalJSON() (data []byte, err error)

func (*SmartParseCasPdfParams) UnmarshalJSON added in v0.2.0

func (r *SmartParseCasPdfParams) UnmarshalJSON(data []byte) error

type SmartService added in v0.2.0

type SmartService struct {
	Options []option.RequestOption
}

SmartService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSmartService method instead.

func NewSmartService added in v0.2.0

func NewSmartService(opts ...option.RequestOption) (r SmartService)

NewSmartService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SmartService) ParseCasPdf added in v0.2.0

func (r *SmartService) ParseCasPdf(ctx context.Context, body SmartParseCasPdfParams, opts ...option.RequestOption) (res *UnifiedResponse, err error)

This endpoint parses CAS (Consolidated Account Statement) PDF files from NSDL, CDSL, or CAMS/KFintech and returns data in a unified format. It auto-detects the CAS type and transforms the data into a consistent structure regardless of the source.

type Transaction added in v0.2.0

type Transaction struct {
	// Additional transaction-specific fields that vary by source
	AdditionalInfo TransactionAdditionalInfo `json:"additional_info"`
	// Transaction amount in currency (computed from units × price/NAV)
	Amount float64 `json:"amount,nullable"`
	// Balance units after transaction
	Balance float64 `json:"balance"`
	// Transaction date (YYYY-MM-DD)
	Date time.Time `json:"date" format:"date"`
	// Transaction description/particulars
	Description string `json:"description"`
	// Dividend rate (for DIVIDEND_PAYOUT transactions)
	DividendRate float64 `json:"dividend_rate,nullable"`
	// NAV/price per unit on transaction date
	Nav float64 `json:"nav,nullable"`
	// Transaction type. Possible values are PURCHASE, PURCHASE_SIP, REDEMPTION,
	// SWITCH_IN, SWITCH_IN_MERGER, SWITCH_OUT, SWITCH_OUT_MERGER, DIVIDEND_PAYOUT,
	// DIVIDEND_REINVEST, SEGREGATION, STAMP_DUTY_TAX, TDS_TAX, STT_TAX, MISC,
	// REVERSAL, UNKNOWN.
	//
	// Any of "PURCHASE", "PURCHASE_SIP", "REDEMPTION", "SWITCH_IN",
	// "SWITCH_IN_MERGER", "SWITCH_OUT", "SWITCH_OUT_MERGER", "DIVIDEND_PAYOUT",
	// "DIVIDEND_REINVEST", "SEGREGATION", "STAMP_DUTY_TAX", "TDS_TAX", "STT_TAX",
	// "MISC", "REVERSAL", "UNKNOWN".
	Type TransactionType `json:"type"`
	// Number of units involved in transaction
	Units float64 `json:"units"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Amount         respjson.Field
		Balance        respjson.Field
		Date           respjson.Field
		Description    respjson.Field
		DividendRate   respjson.Field
		Nav            respjson.Field
		Type           respjson.Field
		Units          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Unified transaction schema for all holding types (MF folios, equities, bonds, etc.)

func (Transaction) RawJSON added in v0.2.0

func (r Transaction) RawJSON() string

Returns the unmodified JSON received from the API

func (*Transaction) UnmarshalJSON added in v0.2.0

func (r *Transaction) UnmarshalJSON(data []byte) error

type TransactionAdditionalInfo added in v0.2.0

type TransactionAdditionalInfo struct {
	// Capital withdrawal amount (CDSL MF transactions)
	CapitalWithdrawal float64 `json:"capital_withdrawal"`
	// Units credited (demat transactions)
	Credit float64 `json:"credit"`
	// Units debited (demat transactions)
	Debit float64 `json:"debit"`
	// Income distribution amount (CDSL MF transactions)
	IncomeDistribution float64 `json:"income_distribution"`
	// Order/transaction reference number (demat transactions)
	OrderNo string `json:"order_no"`
	// Price per unit (NSDL/CDSL MF transactions)
	Price float64 `json:"price"`
	// Stamp duty charged
	StampDuty float64 `json:"stamp_duty"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CapitalWithdrawal  respjson.Field
		Credit             respjson.Field
		Debit              respjson.Field
		IncomeDistribution respjson.Field
		OrderNo            respjson.Field
		Price              respjson.Field
		StampDuty          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional transaction-specific fields that vary by source

func (TransactionAdditionalInfo) RawJSON added in v0.2.0

func (r TransactionAdditionalInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*TransactionAdditionalInfo) UnmarshalJSON added in v0.2.0

func (r *TransactionAdditionalInfo) UnmarshalJSON(data []byte) error

type TransactionType added in v0.2.0

type TransactionType string

Transaction type. Possible values are PURCHASE, PURCHASE_SIP, REDEMPTION, SWITCH_IN, SWITCH_IN_MERGER, SWITCH_OUT, SWITCH_OUT_MERGER, DIVIDEND_PAYOUT, DIVIDEND_REINVEST, SEGREGATION, STAMP_DUTY_TAX, TDS_TAX, STT_TAX, MISC, REVERSAL, UNKNOWN.

const (
	TransactionTypePurchase         TransactionType = "PURCHASE"
	TransactionTypePurchaseSip      TransactionType = "PURCHASE_SIP"
	TransactionTypeRedemption       TransactionType = "REDEMPTION"
	TransactionTypeSwitchIn         TransactionType = "SWITCH_IN"
	TransactionTypeSwitchInMerger   TransactionType = "SWITCH_IN_MERGER"
	TransactionTypeSwitchOut        TransactionType = "SWITCH_OUT"
	TransactionTypeSwitchOutMerger  TransactionType = "SWITCH_OUT_MERGER"
	TransactionTypeDividendPayout   TransactionType = "DIVIDEND_PAYOUT"
	TransactionTypeDividendReinvest TransactionType = "DIVIDEND_REINVEST"
	TransactionTypeSegregation      TransactionType = "SEGREGATION"
	TransactionTypeStampDutyTax     TransactionType = "STAMP_DUTY_TAX"
	TransactionTypeTdsTax           TransactionType = "TDS_TAX"
	TransactionTypeSttTax           TransactionType = "STT_TAX"
	TransactionTypeMisc             TransactionType = "MISC"
	TransactionTypeReversal         TransactionType = "REVERSAL"
	TransactionTypeUnknown          TransactionType = "UNKNOWN"
)

type UnifiedResponse

type UnifiedResponse struct {
	DematAccounts []UnifiedResponseDematAccount `json:"demat_accounts"`
	Insurance     UnifiedResponseInsurance      `json:"insurance"`
	Investor      UnifiedResponseInvestor       `json:"investor"`
	Meta          UnifiedResponseMeta           `json:"meta"`
	MutualFunds   []UnifiedResponseMutualFund   `json:"mutual_funds"`
	// List of NPS accounts
	Nps     []UnifiedResponseNp    `json:"nps"`
	Summary UnifiedResponseSummary `json:"summary"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DematAccounts respjson.Field
		Insurance     respjson.Field
		Investor      respjson.Field
		Meta          respjson.Field
		MutualFunds   respjson.Field
		Nps           respjson.Field
		Summary       respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponse) RawJSON

func (r UnifiedResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponse) UnmarshalJSON

func (r *UnifiedResponse) UnmarshalJSON(data []byte) error

type UnifiedResponseDematAccount

type UnifiedResponseDematAccount struct {
	// Additional information specific to the demat account type
	AdditionalInfo UnifiedResponseDematAccountAdditionalInfo `json:"additional_info"`
	// Beneficiary Owner ID (primarily for CDSL)
	BoID string `json:"bo_id"`
	// Client ID
	ClientID string `json:"client_id"`
	// Type of demat account
	//
	// Any of "NSDL", "CDSL".
	DematType string `json:"demat_type"`
	// Depository Participant ID
	DpID string `json:"dp_id"`
	// Depository Participant name
	DpName   string                              `json:"dp_name"`
	Holdings UnifiedResponseDematAccountHoldings `json:"holdings"`
	// List of account holders linked to this demat account
	LinkedHolders []LinkedHolder `json:"linked_holders"`
	// Total value of the demat account
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		BoID           respjson.Field
		ClientID       respjson.Field
		DematType      respjson.Field
		DpID           respjson.Field
		DpName         respjson.Field
		Holdings       respjson.Field
		LinkedHolders  respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseDematAccount) RawJSON

func (r UnifiedResponseDematAccount) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccount) UnmarshalJSON

func (r *UnifiedResponseDematAccount) UnmarshalJSON(data []byte) error

type UnifiedResponseDematAccountAdditionalInfo

type UnifiedResponseDematAccountAdditionalInfo struct {
	// Beneficiary Owner status (CDSL)
	BoStatus string `json:"bo_status"`
	// Beneficiary Owner sub-status (CDSL)
	BoSubStatus string `json:"bo_sub_status"`
	// Beneficiary Owner type (CDSL)
	BoType string `json:"bo_type"`
	// Basic Services Demat Account status (CDSL)
	Bsda string `json:"bsda"`
	// Email associated with the demat account (CDSL)
	Email string `json:"email" format:"email"`
	// List of linked PAN numbers (NSDL)
	LinkedPans []string `json:"linked_pans"`
	// Nominee details (CDSL)
	Nominee string `json:"nominee"`
	// Account status (CDSL)
	Status string `json:"status"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BoStatus    respjson.Field
		BoSubStatus respjson.Field
		BoType      respjson.Field
		Bsda        respjson.Field
		Email       respjson.Field
		LinkedPans  respjson.Field
		Nominee     respjson.Field
		Status      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional information specific to the demat account type

func (UnifiedResponseDematAccountAdditionalInfo) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountAdditionalInfo) UnmarshalJSON

func (r *UnifiedResponseDematAccountAdditionalInfo) UnmarshalJSON(data []byte) error

type UnifiedResponseDematAccountHoldings

type UnifiedResponseDematAccountHoldings struct {
	Aifs                 []UnifiedResponseDematAccountHoldingsAif                `json:"aifs"`
	CorporateBonds       []UnifiedResponseDematAccountHoldingsCorporateBond      `json:"corporate_bonds"`
	DematMutualFunds     []UnifiedResponseDematAccountHoldingsDematMutualFund    `json:"demat_mutual_funds"`
	Equities             []UnifiedResponseDematAccountHoldingsEquity             `json:"equities"`
	GovernmentSecurities []UnifiedResponseDematAccountHoldingsGovernmentSecurity `json:"government_securities"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Aifs                 respjson.Field
		CorporateBonds       respjson.Field
		DematMutualFunds     respjson.Field
		Equities             respjson.Field
		GovernmentSecurities respjson.Field
		ExtraFields          map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseDematAccountHoldings) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldings) UnmarshalJSON

func (r *UnifiedResponseDematAccountHoldings) UnmarshalJSON(data []byte) error

type UnifiedResponseDematAccountHoldingsAif

type UnifiedResponseDematAccountHoldingsAif struct {
	// Additional information specific to the AIF
	AdditionalInfo UnifiedResponseDematAccountHoldingsAifAdditionalInfo `json:"additional_info"`
	// ISIN code of the AIF
	Isin string `json:"isin"`
	// Name of the AIF
	Name string `json:"name"`
	// List of transactions for this holding (beta)
	Transactions []Transaction `json:"transactions"`
	// Number of units held
	Units float64 `json:"units"`
	// Current market value of the holding
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Isin           respjson.Field
		Name           respjson.Field
		Transactions   respjson.Field
		Units          respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseDematAccountHoldingsAif) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsAif) UnmarshalJSON

func (r *UnifiedResponseDematAccountHoldingsAif) UnmarshalJSON(data []byte) error

type UnifiedResponseDematAccountHoldingsAifAdditionalInfo added in v0.1.0

type UnifiedResponseDematAccountHoldingsAifAdditionalInfo struct {
	// Closing balance units for the statement period (beta)
	CloseUnits float64 `json:"close_units,nullable"`
	// Opening balance units for the statement period (beta)
	OpenUnits float64 `json:"open_units,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CloseUnits  respjson.Field
		OpenUnits   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional information specific to the AIF

func (UnifiedResponseDematAccountHoldingsAifAdditionalInfo) RawJSON added in v0.1.0

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsAifAdditionalInfo) UnmarshalJSON added in v0.1.0

type UnifiedResponseDematAccountHoldingsCorporateBond

type UnifiedResponseDematAccountHoldingsCorporateBond struct {
	// Additional information specific to the corporate bond
	AdditionalInfo UnifiedResponseDematAccountHoldingsCorporateBondAdditionalInfo `json:"additional_info"`
	// ISIN code of the corporate bond
	Isin string `json:"isin"`
	// Name of the corporate bond
	Name string `json:"name"`
	// List of transactions for this holding (beta)
	Transactions []Transaction `json:"transactions"`
	// Number of units held
	Units float64 `json:"units"`
	// Current market value of the holding
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Isin           respjson.Field
		Name           respjson.Field
		Transactions   respjson.Field
		Units          respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseDematAccountHoldingsCorporateBond) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsCorporateBond) UnmarshalJSON

type UnifiedResponseDematAccountHoldingsCorporateBondAdditionalInfo added in v0.1.0

type UnifiedResponseDematAccountHoldingsCorporateBondAdditionalInfo struct {
	// Closing balance units for the statement period (beta)
	CloseUnits float64 `json:"close_units,nullable"`
	// Opening balance units for the statement period (beta)
	OpenUnits float64 `json:"open_units,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CloseUnits  respjson.Field
		OpenUnits   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional information specific to the corporate bond

func (UnifiedResponseDematAccountHoldingsCorporateBondAdditionalInfo) RawJSON added in v0.1.0

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsCorporateBondAdditionalInfo) UnmarshalJSON added in v0.1.0

type UnifiedResponseDematAccountHoldingsDematMutualFund

type UnifiedResponseDematAccountHoldingsDematMutualFund struct {
	// Additional information specific to the mutual fund
	AdditionalInfo UnifiedResponseDematAccountHoldingsDematMutualFundAdditionalInfo `json:"additional_info"`
	// ISIN code of the mutual fund
	Isin string `json:"isin"`
	// Name of the mutual fund
	Name string `json:"name"`
	// List of transactions for this holding (beta)
	Transactions []Transaction `json:"transactions"`
	// Number of units held
	Units float64 `json:"units"`
	// Current market value of the holding
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Isin           respjson.Field
		Name           respjson.Field
		Transactions   respjson.Field
		Units          respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseDematAccountHoldingsDematMutualFund) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsDematMutualFund) UnmarshalJSON

type UnifiedResponseDematAccountHoldingsDematMutualFundAdditionalInfo added in v0.1.0

type UnifiedResponseDematAccountHoldingsDematMutualFundAdditionalInfo struct {
	// Closing balance units for the statement period (beta)
	CloseUnits float64 `json:"close_units,nullable"`
	// Opening balance units for the statement period (beta)
	OpenUnits float64 `json:"open_units,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CloseUnits  respjson.Field
		OpenUnits   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional information specific to the mutual fund

func (UnifiedResponseDematAccountHoldingsDematMutualFundAdditionalInfo) RawJSON added in v0.1.0

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsDematMutualFundAdditionalInfo) UnmarshalJSON added in v0.1.0

type UnifiedResponseDematAccountHoldingsEquity

type UnifiedResponseDematAccountHoldingsEquity struct {
	// Additional information specific to the equity
	AdditionalInfo UnifiedResponseDematAccountHoldingsEquityAdditionalInfo `json:"additional_info"`
	// ISIN code of the equity
	Isin string `json:"isin"`
	// Name of the equity
	Name string `json:"name"`
	// List of transactions for this holding (beta)
	Transactions []Transaction `json:"transactions"`
	// Number of units held
	Units float64 `json:"units"`
	// Current market value of the holding
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Isin           respjson.Field
		Name           respjson.Field
		Transactions   respjson.Field
		Units          respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseDematAccountHoldingsEquity) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsEquity) UnmarshalJSON

func (r *UnifiedResponseDematAccountHoldingsEquity) UnmarshalJSON(data []byte) error

type UnifiedResponseDematAccountHoldingsEquityAdditionalInfo added in v0.1.0

type UnifiedResponseDematAccountHoldingsEquityAdditionalInfo struct {
	// Closing balance units for the statement period (beta)
	CloseUnits float64 `json:"close_units,nullable"`
	// Opening balance units for the statement period (beta)
	OpenUnits float64 `json:"open_units,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CloseUnits  respjson.Field
		OpenUnits   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional information specific to the equity

func (UnifiedResponseDematAccountHoldingsEquityAdditionalInfo) RawJSON added in v0.1.0

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsEquityAdditionalInfo) UnmarshalJSON added in v0.1.0

type UnifiedResponseDematAccountHoldingsGovernmentSecurity

type UnifiedResponseDematAccountHoldingsGovernmentSecurity struct {
	// Additional information specific to the government security
	AdditionalInfo UnifiedResponseDematAccountHoldingsGovernmentSecurityAdditionalInfo `json:"additional_info"`
	// ISIN code of the government security
	Isin string `json:"isin"`
	// Name of the government security
	Name string `json:"name"`
	// List of transactions for this holding (beta)
	Transactions []Transaction `json:"transactions"`
	// Number of units held
	Units float64 `json:"units"`
	// Current market value of the holding
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Isin           respjson.Field
		Name           respjson.Field
		Transactions   respjson.Field
		Units          respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseDematAccountHoldingsGovernmentSecurity) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsGovernmentSecurity) UnmarshalJSON

type UnifiedResponseDematAccountHoldingsGovernmentSecurityAdditionalInfo added in v0.1.0

type UnifiedResponseDematAccountHoldingsGovernmentSecurityAdditionalInfo struct {
	// Closing balance units for the statement period (beta)
	CloseUnits float64 `json:"close_units,nullable"`
	// Opening balance units for the statement period (beta)
	OpenUnits float64 `json:"open_units,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CloseUnits  respjson.Field
		OpenUnits   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional information specific to the government security

func (UnifiedResponseDematAccountHoldingsGovernmentSecurityAdditionalInfo) RawJSON added in v0.1.0

Returns the unmodified JSON received from the API

func (*UnifiedResponseDematAccountHoldingsGovernmentSecurityAdditionalInfo) UnmarshalJSON added in v0.1.0

type UnifiedResponseInsurance

type UnifiedResponseInsurance struct {
	LifeInsurancePolicies []UnifiedResponseInsuranceLifeInsurancePolicy `json:"life_insurance_policies"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		LifeInsurancePolicies respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseInsurance) RawJSON

func (r UnifiedResponseInsurance) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponseInsurance) UnmarshalJSON

func (r *UnifiedResponseInsurance) UnmarshalJSON(data []byte) error

type UnifiedResponseInsuranceLifeInsurancePolicy

type UnifiedResponseInsuranceLifeInsurancePolicy struct {
	// Additional information specific to the policy
	AdditionalInfo any `json:"additional_info"`
	// Name of the life assured
	LifeAssured string `json:"life_assured"`
	// Name of the insurance policy
	PolicyName string `json:"policy_name"`
	// Insurance policy number
	PolicyNumber string `json:"policy_number"`
	// Premium amount
	PremiumAmount float64 `json:"premium_amount"`
	// Frequency of premium payment (e.g., Annual, Monthly)
	PremiumFrequency string `json:"premium_frequency"`
	// Insurance company name
	Provider string `json:"provider"`
	// Status of the policy (e.g., Active, Lapsed)
	Status string `json:"status"`
	// Sum assured amount
	SumAssured float64 `json:"sum_assured"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo   respjson.Field
		LifeAssured      respjson.Field
		PolicyName       respjson.Field
		PolicyNumber     respjson.Field
		PremiumAmount    respjson.Field
		PremiumFrequency respjson.Field
		Provider         respjson.Field
		Status           respjson.Field
		SumAssured       respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseInsuranceLifeInsurancePolicy) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseInsuranceLifeInsurancePolicy) UnmarshalJSON

func (r *UnifiedResponseInsuranceLifeInsurancePolicy) UnmarshalJSON(data []byte) error

type UnifiedResponseInvestor

type UnifiedResponseInvestor struct {
	// Address of the investor
	Address string `json:"address"`
	// CAS ID of the investor (only for NSDL and CDSL)
	CasID string `json:"cas_id"`
	// Email address of the investor
	Email string `json:"email" format:"email"`
	// Mobile number of the investor
	Mobile string `json:"mobile"`
	// Name of the investor
	Name string `json:"name"`
	// PAN (Permanent Account Number) of the investor
	Pan string `json:"pan"`
	// Postal code of the investor's address
	Pincode string `json:"pincode"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address     respjson.Field
		CasID       respjson.Field
		Email       respjson.Field
		Mobile      respjson.Field
		Name        respjson.Field
		Pan         respjson.Field
		Pincode     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseInvestor) RawJSON

func (r UnifiedResponseInvestor) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponseInvestor) UnmarshalJSON

func (r *UnifiedResponseInvestor) UnmarshalJSON(data []byte) error

type UnifiedResponseMeta

type UnifiedResponseMeta struct {
	// Type of CAS detected and processed
	//
	// Any of "NSDL", "CDSL", "CAMS_KFINTECH".
	CasType string `json:"cas_type"`
	// Timestamp when the response was generated
	GeneratedAt     time.Time                          `json:"generated_at" format:"date-time"`
	StatementPeriod UnifiedResponseMetaStatementPeriod `json:"statement_period"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CasType         respjson.Field
		GeneratedAt     respjson.Field
		StatementPeriod respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseMeta) RawJSON

func (r UnifiedResponseMeta) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponseMeta) UnmarshalJSON

func (r *UnifiedResponseMeta) UnmarshalJSON(data []byte) error

type UnifiedResponseMetaStatementPeriod

type UnifiedResponseMetaStatementPeriod struct {
	// Start date of the statement period
	From time.Time `json:"from" format:"date"`
	// End date of the statement period
	To time.Time `json:"to" format:"date"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		From        respjson.Field
		To          respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseMetaStatementPeriod) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseMetaStatementPeriod) UnmarshalJSON

func (r *UnifiedResponseMetaStatementPeriod) UnmarshalJSON(data []byte) error

type UnifiedResponseMutualFund

type UnifiedResponseMutualFund struct {
	// Additional folio information
	AdditionalInfo UnifiedResponseMutualFundAdditionalInfo `json:"additional_info"`
	// Asset Management Company name
	Amc string `json:"amc"`
	// Folio number
	FolioNumber string `json:"folio_number"`
	// List of account holders linked to this mutual fund folio
	LinkedHolders []LinkedHolder `json:"linked_holders"`
	// Registrar and Transfer Agent name
	Registrar string                            `json:"registrar"`
	Schemes   []UnifiedResponseMutualFundScheme `json:"schemes"`
	// Total value of the folio
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Amc            respjson.Field
		FolioNumber    respjson.Field
		LinkedHolders  respjson.Field
		Registrar      respjson.Field
		Schemes        respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseMutualFund) RawJSON

func (r UnifiedResponseMutualFund) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponseMutualFund) UnmarshalJSON

func (r *UnifiedResponseMutualFund) UnmarshalJSON(data []byte) error

type UnifiedResponseMutualFundAdditionalInfo

type UnifiedResponseMutualFundAdditionalInfo struct {
	// KYC status of the folio
	KYC string `json:"kyc"`
	// PAN associated with the folio
	Pan string `json:"pan"`
	// PAN KYC status
	Pankyc string `json:"pankyc"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		KYC         respjson.Field
		Pan         respjson.Field
		Pankyc      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional folio information

func (UnifiedResponseMutualFundAdditionalInfo) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseMutualFundAdditionalInfo) UnmarshalJSON

func (r *UnifiedResponseMutualFundAdditionalInfo) UnmarshalJSON(data []byte) error

type UnifiedResponseMutualFundScheme

type UnifiedResponseMutualFundScheme struct {
	// Additional information specific to the scheme
	AdditionalInfo UnifiedResponseMutualFundSchemeAdditionalInfo `json:"additional_info"`
	// Cost of investment
	Cost float64                             `json:"cost"`
	Gain UnifiedResponseMutualFundSchemeGain `json:"gain"`
	// ISIN code of the scheme
	Isin string `json:"isin"`
	// Scheme name
	Name string `json:"name"`
	// Net Asset Value per unit
	Nav float64 `json:"nav"`
	// List of nominees
	Nominees     []string      `json:"nominees"`
	Transactions []Transaction `json:"transactions"`
	// Type of mutual fund scheme
	//
	// Any of "Equity", "Debt", "Hybrid", "Other".
	Type string `json:"type"`
	// Number of units held
	Units float64 `json:"units"`
	// Current market value of the holding
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Cost           respjson.Field
		Gain           respjson.Field
		Isin           respjson.Field
		Name           respjson.Field
		Nav            respjson.Field
		Nominees       respjson.Field
		Transactions   respjson.Field
		Type           respjson.Field
		Units          respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseMutualFundScheme) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseMutualFundScheme) UnmarshalJSON

func (r *UnifiedResponseMutualFundScheme) UnmarshalJSON(data []byte) error

type UnifiedResponseMutualFundSchemeAdditionalInfo

type UnifiedResponseMutualFundSchemeAdditionalInfo struct {
	// Financial advisor name (CAMS/KFintech)
	Advisor string `json:"advisor"`
	// AMFI code for the scheme (CAMS/KFintech)
	Amfi string `json:"amfi"`
	// Closing balance units for the statement period
	CloseUnits float64 `json:"close_units,nullable"`
	// Opening balance units for the statement period
	OpenUnits float64 `json:"open_units,nullable"`
	// RTA code for the scheme (CAMS/KFintech)
	RtaCode string `json:"rta_code"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Advisor     respjson.Field
		Amfi        respjson.Field
		CloseUnits  respjson.Field
		OpenUnits   respjson.Field
		RtaCode     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional information specific to the scheme

func (UnifiedResponseMutualFundSchemeAdditionalInfo) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseMutualFundSchemeAdditionalInfo) UnmarshalJSON

func (r *UnifiedResponseMutualFundSchemeAdditionalInfo) UnmarshalJSON(data []byte) error

type UnifiedResponseMutualFundSchemeGain

type UnifiedResponseMutualFundSchemeGain struct {
	// Absolute gain or loss
	Absolute float64 `json:"absolute"`
	// Percentage gain or loss
	Percentage float64 `json:"percentage"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Absolute    respjson.Field
		Percentage  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseMutualFundSchemeGain) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseMutualFundSchemeGain) UnmarshalJSON

func (r *UnifiedResponseMutualFundSchemeGain) UnmarshalJSON(data []byte) error

type UnifiedResponseNp added in v0.1.0

type UnifiedResponseNp struct {
	// Additional information specific to the NPS account
	AdditionalInfo any `json:"additional_info"`
	// Central Record Keeping Agency name
	Cra   string                  `json:"cra"`
	Funds []UnifiedResponseNpFund `json:"funds"`
	// List of account holders linked to this NPS account
	LinkedHolders []LinkedHolder `json:"linked_holders"`
	// Permanent Retirement Account Number (PRAN)
	Pran string `json:"pran"`
	// Total value of the NPS account
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Cra            respjson.Field
		Funds          respjson.Field
		LinkedHolders  respjson.Field
		Pran           respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseNp) RawJSON added in v0.1.0

func (r UnifiedResponseNp) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponseNp) UnmarshalJSON added in v0.1.0

func (r *UnifiedResponseNp) UnmarshalJSON(data []byte) error

type UnifiedResponseNpFund added in v0.1.0

type UnifiedResponseNpFund struct {
	// Additional information specific to the NPS fund
	AdditionalInfo UnifiedResponseNpFundAdditionalInfo `json:"additional_info"`
	// Cost of investment
	Cost float64 `json:"cost"`
	// Name of the NPS fund
	Name string `json:"name"`
	// Net Asset Value per unit
	Nav float64 `json:"nav"`
	// Number of units held
	Units float64 `json:"units"`
	// Current market value of the holding
	Value float64 `json:"value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AdditionalInfo respjson.Field
		Cost           respjson.Field
		Name           respjson.Field
		Nav            respjson.Field
		Units          respjson.Field
		Value          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseNpFund) RawJSON added in v0.1.0

func (r UnifiedResponseNpFund) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponseNpFund) UnmarshalJSON added in v0.1.0

func (r *UnifiedResponseNpFund) UnmarshalJSON(data []byte) error

type UnifiedResponseNpFundAdditionalInfo added in v0.1.0

type UnifiedResponseNpFundAdditionalInfo struct {
	// Fund manager name
	Manager string `json:"manager"`
	// NPS tier (Tier I or Tier II)
	//
	// Any of 1, 2.
	Tier float64 `json:"tier,nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Manager     respjson.Field
		Tier        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Additional information specific to the NPS fund

func (UnifiedResponseNpFundAdditionalInfo) RawJSON added in v0.1.0

Returns the unmodified JSON received from the API

func (*UnifiedResponseNpFundAdditionalInfo) UnmarshalJSON added in v0.1.0

func (r *UnifiedResponseNpFundAdditionalInfo) UnmarshalJSON(data []byte) error

type UnifiedResponseSummary

type UnifiedResponseSummary struct {
	Accounts UnifiedResponseSummaryAccounts `json:"accounts"`
	// Total portfolio value across all accounts
	TotalValue float64 `json:"total_value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Accounts    respjson.Field
		TotalValue  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseSummary) RawJSON

func (r UnifiedResponseSummary) RawJSON() string

Returns the unmodified JSON received from the API

func (*UnifiedResponseSummary) UnmarshalJSON

func (r *UnifiedResponseSummary) UnmarshalJSON(data []byte) error

type UnifiedResponseSummaryAccounts

type UnifiedResponseSummaryAccounts struct {
	Demat       UnifiedResponseSummaryAccountsDemat       `json:"demat"`
	Insurance   UnifiedResponseSummaryAccountsInsurance   `json:"insurance"`
	MutualFunds UnifiedResponseSummaryAccountsMutualFunds `json:"mutual_funds"`
	Nps         UnifiedResponseSummaryAccountsNps         `json:"nps"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Demat       respjson.Field
		Insurance   respjson.Field
		MutualFunds respjson.Field
		Nps         respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseSummaryAccounts) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseSummaryAccounts) UnmarshalJSON

func (r *UnifiedResponseSummaryAccounts) UnmarshalJSON(data []byte) error

type UnifiedResponseSummaryAccountsDemat

type UnifiedResponseSummaryAccountsDemat struct {
	// Number of demat accounts
	Count int64 `json:"count"`
	// Total value of demat accounts
	TotalValue float64 `json:"total_value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		TotalValue  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseSummaryAccountsDemat) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseSummaryAccountsDemat) UnmarshalJSON

func (r *UnifiedResponseSummaryAccountsDemat) UnmarshalJSON(data []byte) error

type UnifiedResponseSummaryAccountsInsurance

type UnifiedResponseSummaryAccountsInsurance struct {
	// Number of insurance policies
	Count int64 `json:"count"`
	// Total value of insurance policies
	TotalValue float64 `json:"total_value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		TotalValue  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseSummaryAccountsInsurance) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseSummaryAccountsInsurance) UnmarshalJSON

func (r *UnifiedResponseSummaryAccountsInsurance) UnmarshalJSON(data []byte) error

type UnifiedResponseSummaryAccountsMutualFunds

type UnifiedResponseSummaryAccountsMutualFunds struct {
	// Number of mutual fund folios
	Count int64 `json:"count"`
	// Total value of mutual funds
	TotalValue float64 `json:"total_value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		TotalValue  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseSummaryAccountsMutualFunds) RawJSON

Returns the unmodified JSON received from the API

func (*UnifiedResponseSummaryAccountsMutualFunds) UnmarshalJSON

func (r *UnifiedResponseSummaryAccountsMutualFunds) UnmarshalJSON(data []byte) error

type UnifiedResponseSummaryAccountsNps added in v0.1.0

type UnifiedResponseSummaryAccountsNps struct {
	// Number of NPS accounts
	Count int64 `json:"count"`
	// Total value of NPS accounts
	TotalValue float64 `json:"total_value"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		TotalValue  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (UnifiedResponseSummaryAccountsNps) RawJSON added in v0.1.0

Returns the unmodified JSON received from the API

func (*UnifiedResponseSummaryAccountsNps) UnmarshalJSON added in v0.1.0

func (r *UnifiedResponseSummaryAccountsNps) UnmarshalJSON(data []byte) error

type VerifyTokenService added in v0.2.0

type VerifyTokenService struct {
	Options []option.RequestOption
}

VerifyTokenService contains methods and other services that help with interacting with the cas-parser API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewVerifyTokenService method instead.

func NewVerifyTokenService added in v0.2.0

func NewVerifyTokenService(opts ...option.RequestOption) (r VerifyTokenService)

NewVerifyTokenService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*VerifyTokenService) Verify added in v0.2.0

Verify an access token and check if it's still valid. Useful for debugging token issues.

type VerifyTokenVerifyResponse added in v0.2.0

type VerifyTokenVerifyResponse struct {
	// Error message (only shown if invalid)
	Error string `json:"error"`
	// Masked API key (only shown if valid)
	MaskedAPIKey string `json:"masked_api_key"`
	// Whether the token is valid
	Valid bool `json:"valid"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Error        respjson.Field
		MaskedAPIKey respjson.Field
		Valid        respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VerifyTokenVerifyResponse) RawJSON added in v0.2.0

func (r VerifyTokenVerifyResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VerifyTokenVerifyResponse) UnmarshalJSON added in v0.2.0

func (r *VerifyTokenVerifyResponse) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL