anthonyreilly / NetCoreForce

Salesforce REST API toolkit for .NET Standard and .NET Core
MIT License
110 stars 63 forks source link

API Version not working #23

Closed senj closed 4 years ago

senj commented 4 years ago

I am loading config from config file:

{
  "AuthInfo": {
    "ClientId": "",
    "ClientSecret": "",
    "Username": "",
    "Password": "",
    "ApiVersion": "v48.0",
    "AuthorizationEndpoint": "https://test.salesforce.com/services/oauth2/authorize",
    "TokenRequestEndpoint": "https://test.salesforce.com/services/oauth2/token",
    "TokenRevocationEndpoint": "https://test.salesforce.com/services/oauth2/revoke"
  },
  "OutputDirectory": "Models/Salesforce/Generated",
  "Objects": [
    "Account",
    "Contact",
    "User",
    "RecordType",
    "UserRole",
    "Profile",
    "UserLicense",
    "ContactPointAddress"
  ],
  "ClassPrefix": "Sf",
  "ClassSuffix": null,
  "ClassNamespace": "Account.Generated",
  "IncludeCustom": true,
  "IncludeReferences": true
}

I get this output:

Loading config file modelgenerator_config.json
Generate models for Account, Contact, User, RecordType, UserRole, Profile, UserLicense, ContactPointAddress
Connected to Salesforce
Output directory: Models/Salesforce/Generated
Included: Account, Contact, User, RecordType, UserRole, Profile, UserLicense, ContactPointAddress
Generating model for Account - Writing: Models/Salesforce/Generated\TtsSfAccount.cs
Generating model for Contact - Writing: Models/Salesforce/Generated\TtsSfContact.cs
Generating model for Profile - Writing: Models/Salesforce/Generated\TtsSfProfile.cs
Generating model for RecordType - Writing: Models/Salesforce/Generated\TtsSfRecordType.cs
Generating model for User - Writing: Models/Salesforce/Generated\TtsSfUser.cs
Generating model for UserLicense - Writing: Models/Salesforce/Generated\TtsSfUserLicense.cs
Generating model for UserRole - Writing: Models/Salesforce/Generated\TtsSfUserRole.cs
Done.

Nevertheless, I do not get the object I need (ContactPointAddress) I think it always defaults to v41 (https://github.com/anthonyreilly/NetCoreForce/blob/master/src/NetCoreForce.ModelGenerator/GenConfig.cs)

If I run DescribeGloballocally with v48 I get the object.

senj commented 4 years ago

I found the issue in: https://github.com/anthonyreilly/NetCoreForce/blob/52311a4e998ac44cc4ad44f12d9eec309576bef6/src/NetCoreForce.ModelGenerator/Program.cs#L338 new AuthenticationClient should use config.AuthInfo.ApiVersion, else it defaults to v44.

anthonyreilly commented 4 years ago

Thanks for finding this, the next release will correctly use the API version. I also just noticed that ContactPointAddress is introduced in v49: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_contactpointaddress.htm?search_text=ContactPointAddress