コード例 #1
0
        public static async Task <PrintNodePrintJob> GetAsync(int id)
        {
            var response = await ApiHelper.Get("/printjobs/" + id);

            var list = JsonConvert.DeserializeObject <IEnumerable <PrintNodePrintJob> >(response);

            return(list.FirstOrDefault());
        }
コード例 #2
0
        public async Task <IEnumerable <PrintNodePrintJobState> > GetStates()
        {
            var response = await ApiHelper.Get("/printjobs/" + Id + "/states");

            var list = JsonConvert.DeserializeObject <IEnumerable <IEnumerable <PrintNodePrintJobState> > >(response);

            return(list.FirstOrDefault());
        }
コード例 #3
0
        public static async Task <PrintNodePrinter> GetAsync(long id)
        {
            var response = await ApiHelper.Get("/printers/" + id);

            var list = JsonConvert.DeserializeObject <List <PrintNodePrinter> >(response);

            return(list.FirstOrDefault());
        }
コード例 #4
0
        public static async Task <PrintNodeComputer> GetAsync(long id, PrintNodeDelegatedClientContext clientContext = null)
        {
            var response = await ApiHelper.Get("/computers/" + id, clientContext);

            var list = JsonConvert.DeserializeObject <List <PrintNodeComputer> >(response);

            return(list.FirstOrDefault());
        }
コード例 #5
0
        public static async Task <PrintNodePrinter> GetAsync(long id, PrintNodeDelegatedClientContext clientContext = null)
        {
            var response = await ApiHelper.Get("/printers/" + id, clientContext);

            var list = JsonConvert.DeserializeObject <List <PrintNodePrinter> >(response);

            // Set clientContext on each printer object;
            list.ForEach(p => p.ClientContext = clientContext);

            return(list.FirstOrDefault());
        }
コード例 #6
0
        public static async Task <IEnumerable <PrintNodePrinter> > ListAsync(PrintNodeDelegatedClientContext clientContext = null)
        {
            var response = await ApiHelper.Get("/printers", clientContext);

            var list = JsonConvert.DeserializeObject <List <PrintNodePrinter> >(response);

            // Set clientContext on each printer object;
            list.ForEach(p => p.ClientContext = clientContext);

            return(list);
        }
コード例 #7
0
        public static async Task <IEnumerable <PrintNodePrintJob> > ListForPrinterAsync(int printerId, PrintNodeDelegatedClientContext clientContext = null)
        {
            var response = await ApiHelper.Get("/printers/" + printerId + "/printjobs");

            var list = JsonConvert.DeserializeObject <List <PrintNodePrintJob> >(response);

            // Set clientContext on each job object;
            list.ForEach(j => j.ClientContext = clientContext);

            return(list);
        }
コード例 #8
0
        public static async Task <bool> Exists()
        {
            try
            {
                var response = await ApiHelper.Get("/whoami");

                return(!string.IsNullOrEmpty(response));
            }
            catch
            {
                return(false);
            }
        }
コード例 #9
0
        public static async Task <bool> Exists(PrintNodeDelegatedClientContext clientContext = null)
        {
            try
            {
                var response = await ApiHelper.Get("/whoami", clientContext);

                return(!string.IsNullOrEmpty(response));
            }
            catch
            {
                return(false);
            }
        }
コード例 #10
0
        public static async Task <IEnumerable <PrintNodePrintJob> > ListForPrinterAsync(int printerId)
        {
            var response = await ApiHelper.Get("/printers/" + printerId + "/printjobs");

            return(JsonConvert.DeserializeObject <IEnumerable <PrintNodePrintJob> >(response));
        }
コード例 #11
0
        public static async Task <IEnumerable <IEnumerable <PrintNodePrintJobState> > > ListAsync()
        {
            var response = await ApiHelper.Get("/printjobs/states");

            return(JsonConvert.DeserializeObject <IEnumerable <IEnumerable <PrintNodePrintJobState> > >(response));
        }
コード例 #12
0
        public static async Task <IEnumerable <PrintNodeComputer> > ListAsync()
        {
            var response = await ApiHelper.Get("/computers");

            return(JsonConvert.DeserializeObject <List <PrintNodeComputer> >(response));
        }
コード例 #13
0
        public static async Task <PrintNodeScale> GetAsync(long computerId, string deviceName)
        {
            var response = await ApiHelper.Get("/computer/" + computerId + "/scales/" + deviceName);

            return(JsonConvert.DeserializeObject <PrintNodeScale>(response));
        }
コード例 #14
0
        public static async Task <string> GetKeyAsync(string clientId)
        {
            var response = await ApiHelper.Get("/client/key/" + clientId + "?version=4.7.1&edition=printnode");

            return(JsonConvert.DeserializeObject <string>(response));
        }
コード例 #15
0
        public static async Task <IEnumerable <PrintNodeComputer> > ListAsync(PrintNodeDelegatedClientContext clientContext = null)
        {
            var response = await ApiHelper.Get("/computers", clientContext);

            return(JsonConvert.DeserializeObject <List <PrintNodeComputer> >(response));
        }
コード例 #16
0
        public static async Task <IEnumerable <IEnumerable <PrintNodePrintJobState> > > ListAsync(PrintNodeDelegatedClientContext clientContext = null)
        {
            var response = await ApiHelper.Get("/printjobs/states", clientContext);

            return(JsonConvert.DeserializeObject <IEnumerable <IEnumerable <PrintNodePrintJobState> > >(response));
        }
コード例 #17
0
        public static async Task <IEnumerable <PrintNodeScale> > ListForComputerAsync(long computerId)
        {
            var response = await ApiHelper.Get("/computer/" + computerId + "/scales");

            return(JsonConvert.DeserializeObject <List <PrintNodeScale> >(response));
        }