public static async Task <PrintNodeComputer> GetAsync(long id, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/computers/{id}", options);

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

            return(list.FirstOrDefault());
        }
        public static async Task <PrintNodePrintJob> GetAsync(long id, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/printjobs/{id}", options);

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

            return(list.FirstOrDefault());
        }
Exemple #3
0
        public async Task <long> AddPrintJob(PrintNodePrintJob job, PrintNodeRequestOptions options = null)
        {
            job.PrinterId = Id;

            var response = await PrintNodeApiHelper.Post("/printjobs", job, options);

            return(JsonConvert.DeserializeObject <long>(response));
        }
        public async Task <IEnumerable <PrintNodePrintJobState> > GetStates(PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/printjobs/{Id}/states", options);

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

            return(list.FirstOrDefault());
        }
        public static async Task <bool> DeleteAsync(long id, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Delete("/account", options, new Dictionary <string, string>
            {
                { "X-Child-Account-By-Id", id.ToString() }
            });

            return(JsonConvert.DeserializeObject <bool>(response));
        }
        public async Task <PrintNodeChildAccount> UpdateAsync(PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Patch("/account", this, options, new Dictionary <string, string>
            {
                { "X-Child-Account-By-Id", Id.ToString() }
            });

            return(JsonConvert.DeserializeObject <PrintNodeChildAccount>(response));
        }
        public async Task <long> Print(PrintNodeRequestOptions options = null)
        {
            if (Printer == null && PrinterId == 0)
            {
                throw new Exception("Printer or PrinterId required");
            }

            var response = await PrintNodeApiHelper.Post("/printjobs", this, options);

            return(JsonConvert.DeserializeObject <long>(response));
        }
        public async Task <PrintNodeChildAccount> CreateAsync(PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Post("/account", new
            {
                Account = this,
                ApiKeys,
                Tags
            }, options);

            return(JsonConvert.DeserializeObject <PrintNodeChildAccount>(response, new PrintNodeChildAccountCreationResponseConverter()));
        }
        public static async Task <bool> Exists(PrintNodeRequestOptions options = null)
        {
            try
            {
                var response = await PrintNodeApiHelper.Get("/whoami", options);

                return(!string.IsNullOrEmpty(response));
            }
            catch
            {
                return(false);
            }
        }
        public async Task <IEnumerable <PrintNodePrinter> > ListPrinters(PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/computers/{Id}/printers", options);

            return(JsonConvert.DeserializeObject <List <PrintNodePrinter> >(response));
        }
        public static async Task <IEnumerable <PrintNodePrintJob> > ListForPrinterAsync(long printerId, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/printers/{printerId}/printjobs", options);

            return(JsonConvert.DeserializeObject <IEnumerable <PrintNodePrintJob> >(response));
        }
        public static async Task <string> GetKeyAsync(string clientId, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/client/key/{clientId}?version=4.7.1&edition=printnode", options);

            return(JsonConvert.DeserializeObject <string>(response));
        }
Exemple #13
0
        public static async Task <PrintNodeScale> GetAsync(long computerId, string deviceName, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/computer/{computerId}/scales/{deviceName}", options);

            return(JsonConvert.DeserializeObject <PrintNodeScale>(response));
        }
Exemple #14
0
        public static async Task <IEnumerable <PrintNodeScale> > ListForComputerAsync(long computerId, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/computer/{computerId}/scales", options);

            return(JsonConvert.DeserializeObject <List <PrintNodeScale> >(response));
        }
        public static async Task <IEnumerable <IEnumerable <PrintNodePrintJobState> > > ListAsync(PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get("/printjobs/states", options);

            return(JsonConvert.DeserializeObject <IEnumerable <IEnumerable <PrintNodePrintJobState> > >(response));
        }