Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        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());
        }
Exemplo n.º 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));
        }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
        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()));
        }
Exemplo n.º 9
0
        public static async Task <bool> Exists(PrintNodeRequestOptions options = null)
        {
            try
            {
                var response = await PrintNodeApiHelper.Get("/whoami", options);

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

            return(JsonConvert.DeserializeObject <List <PrintNodePrinter> >(response));
        }
Exemplo n.º 11
0
        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));
        }
Exemplo n.º 12
0
        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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 15
0
        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));
        }