Exemplo n.º 1
0
        public static TSignableRequest Import <TSignableRequest>(string exportedRequest)
            where TSignableRequest : SignableRequest
        {
            var jsonModel = Encoding.UTF8.GetString(Convert.FromBase64String(exportedRequest));
            var model     = JsonSerializer.Deserialize <SignedRequestModel>(jsonModel);

            SignableRequest request = null;

            if (typeof(TSignableRequest) == typeof(CreateCardRequest))
            {
                request = new CreateCardRequest();
            }

            if (typeof(TSignableRequest) == typeof(RevokeCardRequest))
            {
                request = new RevokeCardRequest();
            }

            if (request == null)
            {
                throw new NotSupportedException();
            }

            request.RestoreRequest(model.ContentSnapshot, model.Meta.Signatures);

            return((TSignableRequest)request);
        }
Exemplo n.º 2
0
        public async Task RevokeCardAsync(RevokeCardRequest request)
        {
            var postRequest = Request.Create(RequestMethod.Delete)
                              .WithEndpoint($"/v4/card/{request.CardId}")
                              .WithBody(request.GetRequestModel());

            await this.CardsConnection.Send(postRequest).ConfigureAwait(false);
        }