public static async Task UploadFileExample()
        {
            string   testFilePath = Directory.GetCurrentDirectory();
            FileInfo file         = new FileInfo(Path.Combine(testFilePath, "Files/ExampleAsApplied.zip"));

            if (!file.Exists)
            {
                throw new Exception("Missing file");
            }

            GetTreeResponse tree = await DataExchangeAPI.GetTree();

            if (tree.Success)
            {
                const string           nodeNameToSearchFor = "";
                TelematicsNodeResponse nodeToSendFileTo    = FindNode(tree.Data, nodeNameToSearchFor);

                PostSendFileResponse response = await DataExchangeAPI.PostSendFiles(nodeToSendFileTo.TelematicsNodeID, file);

                if (response.Status.Equals("Failed"))
                {
                    throw new Exception("Did not send the file correctly");
                }
            }

            await Task.CompletedTask;
        }
예제 #2
0
        public static async Task <PostSendFileResponse> UploadFileExample(string fileName, FileInfo file)
        {
            TelematicsV2         telematicsV2 = new TelematicsV2(publicKey, privateKey, userKey);
            PostSendFileResponse response     = await telematicsV2.PostSendFiles(telematicsNode, file);

            return(response);
        }