示例#1
0
        internal static async Task GetElements(CommandExecutionContext context, Dictionary <string, List <string> > options, List <string> values)
        {
            if (options.ContainsKey(Constants.WORKSPACE_ID))
            {
                if (options.ContainsKey(Constants.ELEMENT_ID))
                {
                    OnshapeElement element = await context.Client.GetWorkspaceElement(options[Constants.DOCUMENT_ID][0], options[Constants.WORKSPACE_ID][0], options[Constants.ELEMENT_ID][0]);

                    Console.WriteLine(JsonConvert.SerializeObject(element));
                }
                else
                {
                    List <OnshapeElement> elements = await context.Client.GetWorkspaceElements(options[Constants.DOCUMENT_ID][0], options[Constants.WORKSPACE_ID][0]);

                    Console.WriteLine(JsonConvert.SerializeObject(elements));
                }
            }
            else
            {
                if (options.ContainsKey(Constants.ELEMENT_ID))
                {
                    OnshapeElement element = await context.Client.GetVersionElement(options[Constants.DOCUMENT_ID][0], options[Constants.VERSION_ID][0], options[Constants.ELEMENT_ID][0]);

                    Console.WriteLine(JsonConvert.SerializeObject(element));
                }
                else
                {
                    List <OnshapeElement> elements = await context.Client.GetVersionElements(options[Constants.DOCUMENT_ID][0], options[Constants.VERSION_ID][0]);

                    Console.WriteLine(JsonConvert.SerializeObject(elements));
                }
            }
        }
 public async Task <OnshapeElement> UpdateVersionElement(String documentId, String versionId, OnshapeElement value)
 {
     return(await HttpPost <OnshapeElement>(String.Format(Constants.ELEMENT_API_URI, documentId, "v", versionId, value.id), value));
 }
 public async Task <OnshapeElement> UpdateWorkspaceElement(String documentId, String workspaceId, OnshapeElement value)
 {
     return(await HttpPost <OnshapeElement>(String.Format(Constants.ELEMENT_API_URI, documentId, "w", workspaceId, value.id), value));
 }