001package com.box.sdk; 002 003import com.box.sdk.internal.utils.JsonUtils; 004import com.eclipsesource.json.JsonObject; 005 006public class BoxAIExtractMetadataTemplate extends BoxJSONObject { 007 /** 008 * The type of object this class represents. 009 */ 010 public static final String TYPE = "metadata_template"; 011 /** 012 * The scope of the metadata template that can either be global or enterprise. 013 */ 014 private String scope; 015 /** 016 * The template key of the metadata template. 017 */ 018 private String templateKey; 019 020 /** 021 * Constructs a BoxAIExtractMetadataTemplate object with a given scope and template key. 022 * @param templateKey the template key of the metadata template. 023 * @param scope the scope of the metadata template. 024 */ 025 public BoxAIExtractMetadataTemplate(String templateKey, String scope) { 026 this.templateKey = templateKey; 027 this.scope = scope; 028 } 029 030 @Override 031 void parseJSONMember(JsonObject.Member member) { 032 super.parseJSONMember(member); 033 String memberName = member.getName(); 034 if (memberName.equals("scope")) { 035 this.scope = member.getValue().asString(); 036 } else if (memberName.equals("template_key")) { 037 this.templateKey = member.getValue().asString(); 038 } 039 } 040 041 public JsonObject getJSONObject() { 042 JsonObject jsonObject = new JsonObject(); 043 JsonUtils.addIfNotNull(jsonObject, "type", TYPE); 044 JsonUtils.addIfNotNull(jsonObject, "scope", this.scope); 045 JsonUtils.addIfNotNull(jsonObject, "template_key", this.templateKey); 046 return jsonObject; 047 } 048 049 public String getScope() { 050 return this.scope; 051 } 052 053 public String getTemplateKey() { 054 return this.templateKey; 055 } 056}