Skip to content

Instantly share code, notes, and snippets.

View allenmichael's full-sized avatar

Allen-Michael Grobelny allenmichael

  • Amazon Web Services
  • Austin, TX
  • X @amsxbg
View GitHub Profile
BoxFile file = new BoxFile(serviceAccountClient, source.get("id").asText().intern());
OutputStream stream = new ByteArrayOutputStream();
file.download(stream);
// Insert Epi. code
String metadataTemplate = "productClassification";
String metadataField = "/partSku";
String partSku = ""; // Replace with Epi return part SKU.
file.createMetadata(metadataTemplate, new Metadata().add(metadataField, partSku));
# Metadata commands
box files metadata create 278109288966 enterprise cli
box files metadata update 278109288966 enterprise cli --replace -p "/settings" -v "of"
box files metadata update 278109288966 enterprise cli --remove -p "/settings"
box files metadata update 278109288966 enterprise cli -a -p "/settings" -v "off"
# Metadata Date Value
box files metadata update 278109288966 enterprise cli -a -p "/home" -v "2002-10-02T10:00:00-05:00"
# Metadata Enum Value
box files metadata update 278109288966 enterprise cli -a -p "/env" -v "admin"
@allenmichael
allenmichael / Dockerfile
Last active February 12, 2018 21:47
Java, .Net Core, and Node.js build tools
FROM microsoft/dotnet
RUN apt-get update
RUN apt-get install -y curl unzip zip
RUN dotnet new -i Amazon.Lambda.Templates::*
RUN apt-get install -y groff-base
RUN wget https://bootstrap.pypa.io/get-pip.py
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"strings"
"time"
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Box.V2.Config;
using Box.V2.JWTAuth;
namespace BoxGetAllUsers
{
package com.box;
import com.box.sdk.BoxConfig;
import com.box.sdk.BoxDeveloperEditionAPIConnection;
import com.box.sdk.BoxFile;
import com.box.sdk.BoxFolder;
import com.box.sdk.BoxItem;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
'use strict';
const box = require('box-node-sdk');
const fs = require('fs');
const util = require('util');
const path = require('path');
let configFile = fs.readFileSync('config.json');
configFile = JSON.parse(configFile);
let session = box.getPreconfiguredInstance(configFile);
let client = session.getAppAuthClient("enterprise");
class BoxFolderTreeBuilder {
constructor(boxClient, options) {
options = options || {};
boxClient._useIterators = true;
this.boxClient = boxClient;
this.maxDepth = options.maxDepth || -1;
this.rootFolderId = options.rootFolderId || "0";
}
async buildFolderTreeWithFlatLists() {
package com.box;
import java.util.ArrayList;
import com.box.sdk.BoxDeveloperEditionAPIConnection;
import com.box.sdk.BoxFile;
import com.box.sdk.BoxFolder;
import com.box.sdk.BoxItem;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
public class BoxFolderTreeBuilder
{
public BoxClient BoxClient { get; set; }
public string RootFolderId { get; set; }
public int MaxDepth { get; set; }
public BoxFolderTreeBuilder(BoxClient boxClient, string rootFolderId = "0", int maxDepth = -1)
{
this.BoxClient = boxClient;
this.RootFolderId = rootFolderId;