Git Product home page Git Product logo

query-builder-for-driveapi's Introduction

Query Builder for DriveAPI

npm npm bundle size npm Libraries.io SourceRank

Easily generate queries for the Google Drive API.

๐Ÿ“ฆ Installation

npm install query-builder-for-driveapi

๐Ÿš€ Quick start

How to import

// ECMAScript
import QueryBuilder from 'query-builder-for-driveapi'

// CommonJS
const QueryBuilder = require('query-builder-for-driveapi').default

How to build a query

  1. Create a new instance

    const query = new QueryBuilder()
  2. Add inputs

    query.inParents('folderId')
    query.name().contains('something')

    or

    query.inParents('folderId').name().contains('something')
  3. Build query

    query.build() // return string

Methods

Commonly used terms and operators are supported. You can find a list of all those supported by the Drive API at Google Developers.

Terms

Term Method Return Description
parents inParents(folderId: string) Instance Indicates whether the parent collection contains the specified ID.
name name() Instance Select the term name to be used with methods like: contains(), isEqualTo() and isNotEqualTo()
fullText fullText() Instance Select the term fullText to be used with methods like: contains()
mimeType mimeType() Instance Select the term mimeType to be used with methods like: contains(), isEqualTo() and isNotEqualTo()
modifiedTime modifiedTime() Instance Select the term modifiedTime to be used with methods like: isLessThan(), isLessThanOrEqualTo(), isEqualTo(), isNotEqualTo(), isGreaterThanOrEqualTo() and isGreaterThan()
createdTime createdTime() Instance Select the term createdTime to be used with methods like: isLessThan(), isLessThanOrEqualTo(), isEqualTo(), isNotEqualTo(), isGreaterThanOrEqualTo() and isGreaterThan()

Operators

Operator Method Return Description
contains contains(value: string) Instance N/A
= isEqualTo(value: string) Instance N/A
!= isNotEqualTo(value: string) Instance N/A
< isLessThan(value: string) Instance N/A
<= isLessThanOrEqualTo(value: string) Instance N/A
> isGreaterThan(value: string) Instance N/A
>= isGreaterThanOrEqualTo(value: string) Instance N/A
not not() Instance Negate the following term.

Build

Method Return Description
build() String Returns a string with the inputs joined with the and operator.

License

MIT License ยฉ 2023 - Brian Fernandez

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.