Yolva.Bitrix.OAuth2 0.1.200-alpha

This is a prerelease version of Yolva.Bitrix.OAuth2.
dotnet add package Yolva.Bitrix.OAuth2 --version 0.1.200-alpha
                    
NuGet\Install-Package Yolva.Bitrix.OAuth2 -Version 0.1.200-alpha
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Yolva.Bitrix.OAuth2" Version="0.1.200-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Yolva.Bitrix.OAuth2" Version="0.1.200-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Yolva.Bitrix.OAuth2" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Yolva.Bitrix.OAuth2 --version 0.1.200-alpha
                    
#r "nuget: Yolva.Bitrix.OAuth2, 0.1.200-alpha"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Yolva.Bitrix.OAuth2@0.1.200-alpha
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Yolva.Bitrix.OAuth2&version=0.1.200-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Yolva.Bitrix.OAuth2&version=0.1.200-alpha&prerelease
                    
Install as a Cake Tool

BitrixSDK

Create Client:

public IBitrixService BitrixCreateClient()
{
      var configCredential = configuration.GetSection("Credential");
      var credential = new System.Net.NetworkCredential(configCredential["login"], configCredential["password"]);
      return new BitrixClient(
          new AuthParameters(
              new Site24(configuration["Url"]),
              credential,
              configuration["ClientId"],
              configuration["ClientSecret"])
          ) as IBitrixService;
}

Retrieve Entity (example: Crm.Contact):

var query = new Bitrix24QueryBuilder("crm.contact.list")
                    .AddSelect("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "PHONE", "UF_CRM_1654007527292");
                    .AddFilter("NAME","Alexander") //$NAME, !NAME, >NAME
                    .Order("NAME",OrderEnum.ASC);
var response=await client.RetrieveListAsync<BitrixResponse<CrmContactAdvanced>>(query);

Retrieve all records of Entity (example: Crm.Contact):

var query = new Bitrix24QueryBuilder("crm.contact.list")
  .AddSelect("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "PHONE", "UF_CRM_1654007527292");
var contacts = new List<CrmContactAdvanced>();
BitrixResponse<CrmContactAdvanced> response;
int next = 0;
do
{
  query.Start(next);
  response = await client.RetrieveListAsync<BitrixResponse<CrmContactAdvanced>>(query);
  contacts.AddRange(response?.result);
  next += 50;//max step 50
} while (response.next != null && response.next > 0);

Create (example: Crm.Contact):

client.CreateAsync<CrmContactAdvanced>("crm.contact.add",new CrmContactAdvanced
            {
                NAME ="loh",
                LAST_NAME="pidor"
            })

Update (example: Crm.Contact):

await client.UpdateAsync<CrmContactAdvanced>("crm.contact.update",new CrmContactAdvanced
            {
                ID= 42055,
                NAME ="loh",
                LAST_NAME="pidor"
            })

Delete (example: Crm.Contact):

await client.DeleteAsync("crm.contact.delete",42055);

You can inherit several basic entity (Crm.Company,Crm.Contact,Crm.Deal,Crm.Lead) classes (Example: Crm.Contact): <details> <summary>Example</summary>

    public class CrmContactAdvanced : CrmContact
    {
        [JsonProperty("UF_CRM_1651072052487")]
        public long? LevelJobTitle { get; set; }

        [JsonProperty("UF_CRM_1653304186684")]
        public long? AreaOfResponsibility { get; set; }
        [JsonProperty("UF_CRM_1654587148")]
        public string? VersionOfUpload { get; set; }
        [JsonProperty("UF_CRM_1654081507849")]
        public bool? ChangeAfterUpload { get; set; }
        #region Allow

        #region Разрешить рассылку по емейл
        [JsonIgnore]
        public bool AllowMailingList { get; set; } = true;

        [JsonProperty("UF_CRM_1651072592783")]
        public long _AllowMailingList { get => AllowMailingList ? 139 : 140; }
        #endregion
        #region Электронная почта
        [JsonIgnore]
        public bool AllowEmail { get; set; } = true;

        [JsonProperty("UF_CRM_1651072611458")]
        public long _AllowEmail { get => AllowEmail ? 141 : 142; }
        #endregion
        #region Звонки
        [JsonIgnore]
        public bool AllowCall { get; set; } = true;

        [JsonProperty("UF_CRM_1651072629406")]
        public long _AllowCall { get => AllowCall ? 143 : 144; }
        #endregion
        #region Факсы
        [JsonIgnore]
        public bool AllowFax { get; set; } = true;

        [JsonProperty("UF_CRM_1651072651716")]
        public long _AllowFax { get => AllowFax ? 145 : 146; }
        #endregion
        #region Почта
        [JsonIgnore]
        public bool? AllowMail { get; set; } = true;

        [JsonProperty("UF_CRM_1651072675328")]
        public long _AllowMail { get => AllowMail==null?267:(AllowMail.Value ? 147 : 148); }
        #endregion
        #region Участвует в экспорте контактов
        [JsonIgnore]
        public bool AllowExport { get; set; } = true;

        [JsonProperty("EXPORT")]
        public char _AllowExport { get => AllowExport ? 'Y' : 'N'; }
        #endregion
        #region Активный
        [JsonIgnore]
        public bool IsActive { get; set; } = true;

        [JsonProperty("UF_CRM_1651072757837")]
        public long _IsActive { get => IsActive ? 149 : 150; }
        #endregion
        #endregion
    }

</details>

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Yolva.Bitrix.OAuth2:

Package Downloads
Yolva.Bitrix.Client

Bitrix Client

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.200-alpha 193 6/14/2022
0.1.100-alpha 183 6/6/2022