maldworth / aldsoft.acord

.NET Helper Library for Serializing and Deserializing ACORD LA XML
MIT License
15 stars 6 forks source link

MIB 401 builder #6

Open JHutchFL opened 6 years ago

JHutchFL commented 6 years ago

I am trying to construct an MIB Inquiry (v=2.38) request but when I get to the MIBRequest object there is no builder, am I missing something or would I have to implement builder on my own or is it possible to form the request with the library as is?

        var builder = TXLife_Type.CreateBuilder()
            .Version("2.38.00")
            .AddTXLifeRequest(new TXLifeRequest_Type
            {
                PrimaryObjectID= "Context_Holding_1=",
                TransRefGUID = "ACORD_001_Relation_Samples",
                TransType = OLI_LU_TRANS_TYPE_CODES._401,
                TransExeDate = DateTime.Parse("2006-09-28"),
                TransExeTime = DateTime.Parse("12:35:02"),
                TransMode = TRANS_MODE_CODES.OLI_TRANS_MODE_ORIGINAL,
                PendingResponseOK = OLI_LU_BOOLEAN.OLI_BOOL_FALSE,
                TestIndicator = OLI_LU_BOOLEAN.OLI_BOOL_TRUE,
                MIBRequest = MIBRequest_Type.CreateBuilder() //doesn't exist
maldworth commented 6 years ago

The "Builder" which is really just a FluentApi was made on the main objects to help follow the business rules (from the documentation) and guide the user to making a successful and valid object. You can see a table here of the types I have made a builder for. I know there are hundreds of types and making a builder is a manual process which takes time, so the easiest option is use a builder if available, otherwise you will need to new the object up yourself.

Or make a builder for the object and submit a PR :)

JHutchFL commented 6 years ago

Thanks for the quick reply, I am working on a POC and will try newing up and object myself - would love to contribute after.

I see the: MIBRecipientList MIBPriority MIBSearchDepth

but no collection to hold the MIBServiceDescriptor_Type - I have an Items and OlifeExtension object remaining on MIBRequest - any guidance on where to put those instances - add to items collection?

        var builder = TXLife_Type.CreateBuilder()
            .Version("2.38.00")
            .AddTXLifeRequest(new TXLifeRequest_Type
            {
                PrimaryObjectID = "Context_Holding_1=",
                TransRefGUID = "ACORD_001_Relation_Samples",
                TransType = OLI_LU_TRANS_TYPE_CODES._401,
                TransExeDate = DateTime.Parse("2006-09-28"),
                TransExeTime = DateTime.Parse("12:35:02"),
                TransMode = TRANS_MODE_CODES.OLI_TRANS_MODE_ORIGINAL,
                PendingResponseOK = OLI_LU_BOOLEAN.OLI_BOOL_FALSE,
                TestIndicator = OLI_LU_BOOLEAN.OLI_BOOL_TRUE,
                MIBRequest = new MIBRequest_Type {
                    MIBPriority = new TC_MIB_PRIORITY
                    {
                        tc = "",
                        Value = ""
                    },
                    MIBRecipientList = new List<string>(),
                    MIBSearchDepth = new TC_MIB_SEARCHDEPTH
                    {
                        tc = "1="
                    },
                    OLifEExtension = new List<OLifEExtension_Type>(),
                    Items = new List<object>()
                }
JHutchFL commented 6 years ago

Seems it was the Items collection, thanks!