Example #1
0
        public async Task <HttpRequestMessage> Create(ResourceBase value)
        {
            var request = new HttpRequestMessage(value.Method, await RequestUri(value));

            request.Content = value.Content;
            request.Headers.Add("Authorization", (await m_partnerAccessToken.Get()).PartnerToken());

            return(request);
        }
        public async Task <PartnerAccessTokenDto> Get()
        {
            if (m_partnerAccess == null || HasExpired())
            {
                var access = await m_decorated.Get();

                m_partnerAccess = access;
                m_expiryTime    = m_time.UtcNow().AddSeconds(access.expires_in);
            }

            return(m_partnerAccess);
        }
        public async Task <string> Get(string businessId)
        {
            var organization = new SearchOrganization(businessId);
            var request      = new HttpRequestMessage(organization.Method, m_endpoint.Uri() + organization.ResourceUri);

            request.Headers.Add("Authorization", (await m_partnerAccessToken.Get()).PartnerToken());

            var organizations = await m_response.GetResponse <OrganizationsDto>(request);

            if (!organizations.organizations.Any())
            {
                throw new OrganizationNotFoundException(businessId);
            }

            return(organizations.organizations.First().uuid);
        }