intercom / intercom-dotnet

Intercom API client library for .NET
https://developers.intercom.io/reference
Apache License 2.0
63 stars 53 forks source link

Add support for extra company attributes on Users endpoint #123

Closed thewheat closed 6 years ago

thewheat commented 6 years ago

Fixes #108: https://github.com/intercom/intercom-dotnet/issues/108

thewheat commented 6 years ago

Test code

using System;
using System.Collections.Generic;
using Intercom.Clients;
using Intercom.Core;
using Intercom.Data;

namespace use_intercom
{
    class Program
    {
        static void Main(string[] args)
        {
            string TOKEN = "INSERT_TOKEN_HERE=";
            UsersClient usersClient = new UsersClient(new Authentication(TOKEN));
            CompanyClient companiesClient = new CompanyClient(new Authentication(TOKEN));
            Company c = new Company { website = "http://company1take2.com", industry ="the ind", size = 11, company_id = "1", name = "Co 1" };
            List<Company> companies = new List<Company>();
            companies.Add(c);
            usersClient.Create(new User
            {
                user_id = "1",
                name = "User 1",
                companies = companies
            });
            Company cc = companiesClient.View(new Company { company_id = "1" });
            Console.WriteLine(cc.id);
            Console.WriteLine(cc.website);
            Console.WriteLine(cc.industry);
            Console.WriteLine(cc.size);

        }
    }
}

Output image