コード例 #1
0
        public CybertillClient(CybertillConfig config)
        {
            _config = config;

            _client = new CybertillApi_v1_6Service
            {
                Url = _config.EndpointUrl
            };
        }
コード例 #2
0
        public void Init()
        {
            if (_authenticatedClient != null)
            {
                throw new InvalidOperationException("Client is already initialized");
            }

            var authResult = _client.authenticate_get(_config.Username, _config.AuthId);

            // This looks wacky but it's how Cybertill auth works
            var encodedAuthValue = Convert.ToBase64String(
                Encoding.UTF8.GetBytes(
                    $"{authResult}:{authResult}"
                    )
                );

            _authenticatedClient = new CybertillApi_v1_6Service
            {
                Url             = _config.EndpointUrl,
                AuthHeaderValue = encodedAuthValue
            };
        }