New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

query-builder-for-driveapi

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

query-builder-for-driveapi

Easily generate queries for the Google Drive API.

  • 3.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

query-builder-for-driveapi

Easily generate queries for the Google Drive™ API.

license node-current version unpacked-size downloads

Installation

npm install query-builder-for-driveapi

Get Started

Before we start with the basic usage, let's look at all the classes and enums exported from this package.

import QueryBuilder, { // Class builder for generating queries
  FileType, // Enum with basic file types (mime types)
  VisibilityLevel // Enum with visibility levels
} from 'query-builder-for-driveapi'

Basic Usage

// Create an instance of QueryBuilder
const qb = new QueryBuilder()

// Add inputs (queries) to the query builder
qb.collection({ parents: 'parent-id' })
qb.fileName('test.txt')

// Build the query into a string
const query = qb.build()
//=> 'parent-id' in parents and name = 'test.txt' and trashed = false

[!IMPORTANT] To avoid "accidents", the build() method adds a trashed = false to the query by default.
Note: If you want to change this behavior in your query, simply call the trashed() method before calling the build() method.

Method for Collections

CollectionMethod
parents
collection({
  [K in Collection]?: string | string[]
})
owners
writers
readers

Methods for fields

FieldOperator (if applicable)Method
name
  • Equal to (=): $eq
  • Not equal to (≠): $ne
  • Contains (⊇): $contains
fileName(string | string[])
fileName({
  [K in Operator]?: string | string[]
})
mimeType
fileType(string | string[])
fileType({
  [K in Operator]?: string | string[]
})
fullText
content(string | string[])
properties
property({
  [K in string]: unknown | unknown[]
})
appProperties
appProperty({
  [K in string]: unknown | unknown[]
})
visibility
  • Equal to (=): $eq
  • Not equal to (≠): $ne
visibility(string | string[])
visibility({
  [K in Operator]?: string | string[]
})
shortcutDetails.targetId
shortcutTargetId(string | string[])
shortcutTargetId({
  [K in Operator]?: string | string[]
})
orgUnitId
orgDriveId(string | string[])
orgDriveId({
  [K in Operator]?: string | string[]
})
sharedWithMe
shared(boolean?) // default: true
trashed
trashed(boolean?) // default: true
starred
starred(boolean?) // default: true
hidden
hidden(boolean?) // default: true
createdTime
  • Equal to (=): $eq
  • Not equal to (≠): $ne
  • Less than (<): $lt
  • Less than or equal to (≤): $lte
  • Greater than (>): $gt
  • Greater than or equal to (≥): $gte
createdAt(string | string[])
createdAt({
  [K in Operator]?: string | string[]
})
modifiedTime
updatedAt(string | string[])
updatedAt({
  [K in Operator]?: string | string[]
})
viewedByMeTime
viewedAt(string | string[])
viewedAt({
  [K in Operator]?: string | string[]
})
organizerCount
organizerCount(number | number[])
organizerCount({
  [K in Operator]?: number | number[]
})
memberCount
memberCount(number | number[])
memberCount({
  [K in Operator]?: number | number[]
})

Other Methods

MethodSample
negate(() => void)
const qb = new QueryBuilder()

// negates the queries in the callback
qb.negate(() => {
  qb.fileName('test.txt')
  qb.createdAt('2023-01-01')
})

qb.content('some content')

qb.build()
//=> not name = 'test.txt'
//      and not createdTime = '2023-01-01'
//      and fullText = 'some content'
//      and trashed = false

build()

© 2023 Brian Fernandez

This project is licensed under the MIT license. See the file LICENSE for details.

Disclaimer

No affiliation with Google Inc.

This package is a third-party offering and is not a product of Google Inc.

Google Drive™ is a trademark of Google Inc.

Keywords

FAQs

Package last updated on 26 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc