How to use the cloudinary.api function in cloudinary

To help you get started, we’ve selected a few cloudinary examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github olymp / olymp / _ / cms / cloudinary / server / cloudinary.es6 View on Github external
new Promise((yay, nay) => {
    cloudinary.api.resources(
      (result) => {
        if (result.error) {
          return nay(result.error);
        }

        // Aktuelle Bilder an Ausgabe-Array anhängen (max 500)
        const results =
          result.resources && result.resources.length
            ? images.concat(result.resources.map(transform))
            : [];

        // Falls noch weitere Bilder in Mediathek sind, diese auch laden
        if (result.next_cursor) {
          console.error('WARNING, MORE THAN 500 IMAGES!');
          return getImages(config, results, result.next_cursor).then(yay);
        }
github affanshahid / multer-storage-cloudinary / test / basic.js View on Github external
submitForm(parser, form, function (err, req) {
      expect(req.file).to.not.be.ok;
      expect(err.code).to.equal('LIMIT_UNEXPECTED_FILE');
      expect(err.field).to.equal('incorrect');

      cloudinary.api.resources(function (res) {
        expect(res).to.be.ok;
        expect(res.resources).to.have.length(0);
        done();
      }, {
        type: 'upload',
        prefix: folder + '/'
      });
    });
  });
github affanshahid / multer-storage-cloudinary / test / basic.js View on Github external
afterEach(function (done) {
    this.timeout(10000);
    cloudinary.api.delete_resources_by_prefix(folder + '/', () => {
      done();
    });
  });
github keystonejs / keystone-classic / admin / api / cloudinary.js View on Github external
autocomplete: function(req, res) {
		var max = req.query.max || 10;
		var prefix = req.query.prefix || '';
		var next = req.query.next || null;

		cloudinary.api.resources(function(result) {
			if (result.error) {
				res.json({ error: { message: result.error.message } });
			} else {
				res.json({
					next: result.next_cursor,
					items: result.resources
				});
			}
		}, { 
			type: 'upload',
			prefix: prefix,
			max_results: max,
			next_cursor: next
		});
	},
github ReactFinland / graphql-api / server / routes / resolve-image.ts View on Github external
function initImageRegistry() {
  cloudinary.api.resources(
    result => {
      if (!result.resources) {
        throw new Error("No image resources!");
      }

      resources = result.resources.map(resource => ({
        id: resource.public_id,
        url: resource.secure_url,
      }));
    },
    {
      max_results: 500,
    }
  );
}
github olymp / olymp / _ / cms / cloudinary / server / cloudinary.es6 View on Github external
new Promise(yay =>
    cloudinary.api.resource(
      id,
      (result) => {
        yay(result);
      },
      Object.assign({}, config, {
        tags: true,
        context: true,
        type: 'upload',
        colors: true,
        pages: true,
        prefix: APP && APP !== 'gzk' ? `${APP}/` : '',
      }),
    ),
  ).then(transform);
github olymp / olymp / _ / cms / cloudinary / server / cloudinary.js View on Github external
return new Promise(function (yay) {
    return cloudinary.api.resource(id, function (result) {
      yay(result);
    }, Object.assign({}, config, {
      tags: true,
      context: true,
      type: 'upload',
      colors: true,
      pages: true,
      prefix: APP && APP !== 'gzk' ? APP + '/' : ''
    }));
  }).then(transform);
};
github keystonejs / keystone-classic / admin / api / cloudinary.js View on Github external
get: function(req, res) {
		cloudinary.api.resource(req.query.id, function(result) {
			if (result.error) {
				res.json({ error: { message: result.error.message } });
			} else {
				res.json({ item: result });	
			}
		});
	}
};
github olymp / olymp / _ / cms / cloudinary / server / cloudinary.js View on Github external
return new Promise(function (yay) {
    cloudinary.api.update(id, function (result) {
      return yay(result);
    }, Object.assign({}, config, {
      prefix: APP ? APP + '/' : '',
      tags: (tags || []).join(','),
      context: context.join('|')
    }));
  }).then(transform);
};