コード例 #1
0
        public static async void ClientTest()
        {
            string clientName    = String.Format("Very Big Company {0} {1}", DateTime.Now.ToString("h:mm:ss tt"), DateTime.Now.ToString("dd/MM/yyyy"));
            string newClientName = String.Format("A really Very Big Company {0} {1}", DateTime.Now.ToString("h:mm:ss tt"), DateTime.Now.ToString("dd/MM/yyyy"));
            string notes         = "Notes on a really very big company.";

            TogglSharpAPI.V8.Client client = await TogglSharpAPI.V8.Client.Create(clientName, MeV8.DefaultWId);

            TogglSharpAPI.V8.Client clientTwo = await TogglSharpAPI.V8.Client.Retrieve(client.Id);

            if (client.Id != clientTwo.Id)
            {
                throw new Exception("Client ID's don't match.");
            }

            client = await client.Update(newClientName, notes);

            List <TogglSharpAPI.V8.Project> projects = await client.RetrieveProjects();

            if (projects == null)
            {
                Debug.WriteLine("Projects is NULL but it could be that there are no projects.");
            }
            List <TogglSharpAPI.V8.Client> myClients = await TogglSharpAPI.V8.Client.Retrieve();

            if (myClients == null)
            {
                throw new Exception("No clients found, expected to find at the least the client created above.");
            }
            Debugger.Break();
            await client.Delete();

            Debugger.Break();
        }
コード例 #2
0
        public static async void DeleteClient()
        {
            string clientName = String.Format("TogglSharpAPI {0} {1}", DateTime.Now.ToString("h:mm:ss tt"), DateTime.Now.ToString("dd/MM/yyyy"));

            TogglSharpAPI.V8.Client client = await TogglSharpAPI.V8.Client.Create(clientName, MeV8.DefaultWId);

            Debugger.Break();
            var deleted = await client.Delete();

            Debugger.Break();
        }