ATProtoKit icon indicating copy to clipboard operation
ATProtoKit copied to clipboard

[Feature Request]: Provide public default initializers for public structs

Open wmalloc opened this issue 4 months ago • 1 comments

Summary

Public structs do not have public initializers

Pain points

I wanted to use the struct ComAtprotoLexicon.Server.CreateSessionRequestBody but I am unable to instantiate it.

'ComAtprotoLexicon.Server.CreateSessionRequestBody' initializer is inaccessible due to 'internal' protection level

would it be possible to update the models to have public initializers?

Considered Alternatives

None!

Is this a breaking change?

Yes

Library Examples

self.payload = .init(identifier: username, password: password, authFactorToken: authFactorToken)

Additional Context

No response

wmalloc avatar Aug 22 '25 04:08 wmalloc

Yes it would be possible, but it's an incredibly time-consuming process to implement every single one of them, especially since this is not the first time others have asked for a specific struct to have a public initializer. Once the lexicon generator has been implemented, it will automatically have the public initializers for you to use.

In the meantime, I encourage you to create a PR with it implemented and I will be more than happy to approve it and release it in the next update.

MasterJ93 avatar Aug 22 '25 05:08 MasterJ93