Skip to content

Commit

Permalink
Rename version to threads (#26)
Browse files Browse the repository at this point in the history
Signed-off-by: Aravinda Vishwanathapura <[email protected]>
  • Loading branch information
aravindavk authored Dec 20, 2023
1 parent 3643d4e commit 0695bb4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
12 changes: 6 additions & 6 deletions js/folders.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export default class Folder {
this.name = name;
}

static async create(conn, name, region, version, template) {
static async create(conn, name, region, threads, template) {
return await conn.httpPost(`/api/folders`, {
name: name,
region: region,
version: version,
threads: threads,
template: template
})
}
Expand All @@ -25,11 +25,11 @@ export default class Folder {
)
}

async update(name="", region="", version=false, template="") {
async update(name="", region="", threads=false, template="") {
return await conn.httpPut(`/api/folders/${this.name}`, {
name: name,
region: region,
version: version,
threads: threads,
template: template
})
}
Expand All @@ -40,8 +40,8 @@ export default class Folder {
)
}

async createObject(path, data, object_type, version=false, template="") {
return await Document.create(this.conn, this.name, path, data, object_type, version, template);
async createObject(path, data, object_type, threads=false, template="") {
return await Document.create(this.conn, this.name, path, data, object_type, threads, template);
}

async listObjects() {
Expand Down
12 changes: 6 additions & 6 deletions js/kadalu_content_apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ export default class ContentAPI {
return await Region.create(this, name, address);
}

async createFolder(name, region, version, template) {
return await Folder.create(this, name, region, version, template);
async createFolder(name, region, threads, template) {
return await Folder.create(this, name, region, threads, template);
}

async listFolders() {
Expand All @@ -246,12 +246,12 @@ export default class ContentAPI {
return new Folder(this, name);
}

async createObject(path, data, object_type, version = false, template = "") {
return await Document.create(this, "/", path, data, object_type, version, template);
async createObject(path, data, object_type, threads = false, template = "") {
return await Document.create(this, "/", path, data, object_type, threads, template);
}

async uploadObject(filePath, object_type, path = "", version = false, template = "") {
return await Document.upload(this, "/", filePath, object_type, path, version, template);
async uploadObject(filePath, object_type, path = "", threads = false, template = "") {
return await Document.upload(this, "/", filePath, object_type, path, threads, template);
}

async listObjects() {
Expand Down
4 changes: 2 additions & 2 deletions js/objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class Document {
this.path = path;
}

static async create(conn, folder_name, path, data, object_type, version, template) {
static async create(conn, folder_name, path, data, object_type, threads, template) {
folder_name = folder_name.replace(/^\//, "");
let url;
if (folder_name === "") {
Expand All @@ -27,7 +27,7 @@ export default class Document {
path: path,
type: object_type,
data: data,
version: version,
threads: threads,
template: template
})
}
Expand Down
12 changes: 6 additions & 6 deletions python/kadalu_content_apis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def create_region(self, name, address):
return Region.create(self, name, address)


def create_folder(self, name, region="", version=False, template=None):
def create_folder(self, name, region="", threads=False, template=None):
""" Create a new Folder """
return Folder.create(self, name, region, version, template)
return Folder.create(self, name, region, threads, template)


def list_folders(self, page=1, page_size=30):
Expand All @@ -72,14 +72,14 @@ def folder(self, name):
return Folder(self, name)


def create_object(self, path, data, object_type, version=False, template=None):
def create_object(self, path, data, object_type, threads=False, template=None):
""" Create default("/") object """
return Document.create(self, "/", path, data, object_type, version, template)
return Document.create(self, "/", path, data, object_type, threads, template)

# TODO: Add path to `upload_object`
def upload_object(self, file_path, object_type, path="", version=False, template=None):
def upload_object(self, file_path, object_type, path="", threads=False, template=None):
""" Create default("/") object """
return Document.upload_create(self, "/", file_path, object_type, path, version, template)
return Document.upload_create(self, "/", file_path, object_type, path, threads, template)


def list_objects(self, page=1, page_size=30):
Expand Down
16 changes: 8 additions & 8 deletions python/kadalu_content_apis/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ def __init__(self, conn=None, name=None, data={}):

# TODO: Handle Invalid Region Name, when only name is passed.
@classmethod
def create(cls, conn, name, region, version, template):
def create(cls, conn, name, region, threads, template):
""" Create folder """

resp = conn.http_post(
f"{conn.url}/api/folders/",
{
"name" : name,
"region": region,
"version": version,
"threads": threads,
"template": template
}
)
Expand Down Expand Up @@ -58,15 +58,15 @@ def get(self):
outdata.conn = self.conn
return outdata

def update(self, name=None, region=None, version=None, template=None):
def update(self, name=None, region=None, threads=None, template=None):
""" Update folders """

resp = self.conn.http_put(
f"{self.conn.url}/api/folders/{self.name}",
{
"name": name,
"region": region,
"version": version,
"threads": threads,
"template": template
}
)
Expand All @@ -85,14 +85,14 @@ def delete(self, recursive=False):
return response_object_or_error(Folder, resp, 204)


def create_object(self, path, data, object_type, version=False, template=None):
def create_object(self, path, data, object_type, threads=False, template=None):
""" Create object with folder-name """
return Document.create(self.conn, self.name, path, data, object_type, version, template)
return Document.create(self.conn, self.name, path, data, object_type, threads, template)


def upload_object(self, file_path, object_type, path="", version=False, template=None):
def upload_object(self, file_path, object_type, path="", threads=False, template=None):
""" Create default("/") object """
return Document.upload_create(self.conn, self.name, file_path, object_type, path, version, template)
return Document.upload_create(self.conn, self.name, file_path, object_type, path, threads, template)


def list_objects(self, page=1, page_size=30):
Expand Down
8 changes: 4 additions & 4 deletions python/kadalu_content_apis/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def __init__(self, conn=None, folder_name=None, path=None, data={}):


@classmethod
def create(cls, conn, folder_name, path, data, object_type, version, template):
def create(cls, conn, folder_name, path, data, object_type, threads, template):
""" Create object of both default("/") and with folder-name """

folder_name = folder_name.lstrip("/")
Expand All @@ -34,7 +34,7 @@ def create(cls, conn, folder_name, path, data, object_type, version, template):
"path": path,
"type": object_type,
"data": data,
"version": version,
"threads": threads,
"template": template
}
)
Expand All @@ -44,7 +44,7 @@ def create(cls, conn, folder_name, path, data, object_type, version, template):
return outdata

@classmethod
def upload_create(cls, conn, folder_name, file_path, object_type, path, version, template):
def upload_create(cls, conn, folder_name, file_path, object_type, path, threads, template):
""" Upload object data at file_path """

file_content = ""
Expand All @@ -65,7 +65,7 @@ def upload_create(cls, conn, folder_name, file_path, object_type, path, version,
data = {
"path": path,
"type": object_type,
"version": json.dumps(version),
"threads": json.dumps(threads),
"template": template
}

Expand Down

0 comments on commit 0695bb4

Please sign in to comment.