diff --git a/.gitignore b/.gitignore index 0f14b90..9c6a3cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,61 +1,3 @@ -# Created by https://www.gitignore.io/api/matlab - -### Matlab ### -##--------------------------------------------------- -## Remove autosaves generated by the Matlab editor -## We have git for backups! -##--------------------------------------------------- - -# Windows default autosave extension -*.asv - -# OSX / *nix default autosave extension -*.m~ - -# Compiled MEX binaries (all platforms) -*.mex* - -# Simulink Code Generation -slprj/ - -# Session info -octave-workspace - -# Simulink autosave extension -*.autosave - - -# End of https://www.gitignore.io/api/matlab - - -# Created by https://www.gitignore.io/api/macos - -### macOS ### -*.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - - -# End of https://www.gitignore.io/api/macos \ No newline at end of file +.DS_Store +build +*.mltbx \ No newline at end of file diff --git a/Adapter/Login.m b/Adapter/Login.m deleted file mode 100644 index 9ca83af..0000000 --- a/Adapter/Login.m +++ /dev/null @@ -1,26 +0,0 @@ -%----------------------------------------------------------- -%Download passcode.m from Supplementary Functions package -%----------------------------------------------------------- - -function Login(username,basePath) - -%----------------------------------------------------------- -%Description: Log into server -% -%input Args: -% basePath(str) = https://mms.org -% username(str) = JPL username -% passcode = JPL password (type in passcode text box) -%----------------------------------------------------------- - - LoginRequest(); - Matlab_MMS_client.setBasePath(basePath) - out.username = username; - out.password = passcode(); - %Matlab_MMS_client.setBasicAuth(out.username, out.password); - tick = TicketApi.post_ticket(out); - Matlab_MMS_client.setTicketAuth(tick.data.ticket); - - clear out - -end \ No newline at end of file diff --git a/Matlab-MMS-client/Artifact.m b/Matlab-MMS-client/Artifact.m deleted file mode 100644 index 7030f32..0000000 --- a/Matlab-MMS-client/Artifact.m +++ /dev/null @@ -1,18 +0,0 @@ -classdef Artifact - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Artifact model with keys defined and defaults populated. - out = struct(); - out.id = ''; - out.contentType = ''; - out.checksum = ''; - out.artifactLocation = ''; - out.name = ''; - end - end -end - - diff --git a/Matlab-MMS-client/ArtifactApi.m b/Matlab-MMS-client/ArtifactApi.m deleted file mode 100644 index 7f2957c..0000000 --- a/Matlab-MMS-client/ArtifactApi.m +++ /dev/null @@ -1,355 +0,0 @@ -%% -classdef ArtifactApi - properties - end - methods(Static) - function out = delete_artifact(projectId, refId, artifactId, optionalArguments) - % delete_artifact Delete artifact - % - % HTTPResponse = delete_artifact(projectId, refId, artifactId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % artifactId (string) - artifact identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'DELETE'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/artifacts/{artifact_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - relativePath = strrep(relativePath, strcat('{', 'artifact_id', '}'), artifactId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = delete_artifacts_in_batch(projectId, refId, body, optionalArguments) - % delete_artifacts_in_batch Delete artifact(s) in batch - % - % HTTPResponse = delete_artifacts_in_batch(projectId, refId, body, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % body (Artifacts) - - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'DELETE'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/artifacts'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_artifact(projectId, refId, artifactId, optionalArguments) - % get_artifact Get artifact - % - % HTTPResponse = get_artifact(projectId, refId, artifactId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % artifactId (string) - artifact identifier - % OptionalArgument(s): - % depth (double) - - % extended (logical) - - % commitId (string) - - % - % e.g. optionalArguments = struct('depth', depthvalue, 'extended', extendedvalue, 'commitId', commitIdvalue) - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/artifacts/{artifact_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - relativePath = strrep(relativePath, strcat('{', 'artifact_id', '}'), artifactId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if isfield(optionalArguments, 'depth') - queryParamsInputs = setfield(queryParamsInputs, 'depth', getfield(optionalArguments, 'depth')); - end - if isfield(optionalArguments, 'extended') - queryParamsInputs = setfield(queryParamsInputs, 'extended', getfield(optionalArguments, 'extended')); - end - if isfield(optionalArguments, 'commitId') - queryParamsInputs = setfield(queryParamsInputs, 'commitId', getfield(optionalArguments, 'commitId')); - end - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_artifact_history(projectId, refId, artifactId, optionalArguments) - % get_artifact_history Get artifact history - % - % HTTPResponse = get_artifact_history(projectId, refId, artifactId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % artifactId (string) - artifact identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/artifacts/{artifact_id}/commits'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - relativePath = strrep(relativePath, strcat('{', 'artifact_id', '}'), artifactId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_artifacts(projectId, refId, optionalArguments) - % get_artifacts Get artifacts - % - % HTTPResponse = get_artifacts(projectId, refId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % OptionalArgument(s): - % commitId (string) - - % - % e.g. optionalArguments = struct('commitId', commitIdvalue) - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/artifacts'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if isfield(optionalArguments, 'commitId') - queryParamsInputs = setfield(queryParamsInputs, 'commitId', getfield(optionalArguments, 'commitId')); - end - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_artifacts_in_batch(projectId, refId, body, optionalArguments) - % get_artifacts_in_batch Get artifact(s) in batch - % - % HTTPResponse = get_artifacts_in_batch(projectId, refId, body, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % body (Artifacts) - - % OptionalArgument(s): - % commitId (string) - - % - % e.g. optionalArguments = struct('commitId', commitIdvalue) - global basePath; - httpMethod = 'PUT'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/artifacts'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if isfield(optionalArguments, 'commitId') - queryParamsInputs = setfield(queryParamsInputs, 'commitId', getfield(optionalArguments, 'commitId')); - end - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = post_artifact(projectId, refId, id, file, optionalArguments) - % post_artifact Create and/or update artifact - % - % HTTPResponse = post_artifact(projectId, refId, id, file, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % id (string) - - % file (File) - - % OptionalArgument(s): - % contentType (string) - When the content type cannot be automatically detected, this explicitly defined value is used. - % name (string) - - % source (string) - - % comment (string) - - % - % e.g. optionalArguments = struct('contentType', contentTypevalue, 'name', namevalue, 'source', sourcevalue, 'comment', commentvalue) - global basePath; - httpMethod = 'POST'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/artifacts'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - end -end - - - - - - - diff --git a/Matlab-MMS-client/Artifacts.m b/Matlab-MMS-client/Artifacts.m deleted file mode 100644 index 67f4337..0000000 --- a/Matlab-MMS-client/Artifacts.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Artifacts - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Artifacts model with keys defined and defaults populated. - out = struct(); - out.artifacts = []; - end - end -end - - diff --git a/Matlab-MMS-client/Commit.m b/Matlab-MMS-client/Commit.m deleted file mode 100644 index 18838c1..0000000 --- a/Matlab-MMS-client/Commit.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Commit - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Commit model with keys defined and defaults populated. - out = struct(); - out.id = ''; - end - end -end - - diff --git a/Matlab-MMS-client/Commits.m b/Matlab-MMS-client/Commits.m deleted file mode 100644 index 5befaa6..0000000 --- a/Matlab-MMS-client/Commits.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Commits - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Commits model with keys defined and defaults populated. - out = struct(); - out.commits = []; - end - end -end - - diff --git a/Matlab-MMS-client/Documents.m b/Matlab-MMS-client/Documents.m deleted file mode 100644 index 32924ba..0000000 --- a/Matlab-MMS-client/Documents.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Documents - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Documents model with keys defined and defaults populated. - out = struct(); - out.documents = []; - end - end -end - - diff --git a/Matlab-MMS-client/Element.m b/Matlab-MMS-client/Element.m deleted file mode 100644 index fd8e2b7..0000000 --- a/Matlab-MMS-client/Element.m +++ /dev/null @@ -1,15 +0,0 @@ -classdef Element - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Element model with keys defined and defaults populated. - out = struct(); - out.id = ''; - out.name = ''; - end - end -end - - diff --git a/Matlab-MMS-client/ElementApi.m b/Matlab-MMS-client/ElementApi.m deleted file mode 100644 index 5e1c69f..0000000 --- a/Matlab-MMS-client/ElementApi.m +++ /dev/null @@ -1,356 +0,0 @@ -%% -classdef ElementApi - properties - end - methods(Static) - function out = delete_element(projectId, refId, elementId, optionalArguments) - % delete_element Delete element - % - % HTTPResponse = delete_element(projectId, refId, elementId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % elementId (string) - element identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'DELETE'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/elements/{element_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - relativePath = strrep(relativePath, strcat('{', 'element_id', '}'), elementId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = delete_elements_in_batch(projectId, refId, body, optionalArguments) - % delete_elements_in_batch Delete element(s) in batch - % - % HTTPResponse = delete_elements_in_batch(projectId, refId, body, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % body (Elements) - - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'DELETE'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/elements'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_element(projectId, refId, elementId, optionalArguments) - % get_element Get element - % - % HTTPResponse = get_element(projectId, refId, elementId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % elementId (string) - element identifier - % OptionalArgument(s): - % depth (double) - - % extended (logical) - - % commitId (string) - - % - % e.g. optionalArguments = struct('depth', depthvalue, 'extended', extendedvalue, 'commitId', commitIdvalue) - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/elements/{element_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - relativePath = strrep(relativePath, strcat('{', 'element_id', '}'), elementId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if isfield(optionalArguments, 'depth') - queryParamsInputs = setfield(queryParamsInputs, 'depth', getfield(optionalArguments, 'depth')); - end - if isfield(optionalArguments, 'extended') - queryParamsInputs = setfield(queryParamsInputs, 'extended', getfield(optionalArguments, 'extended')); - end - if isfield(optionalArguments, 'commitId') - queryParamsInputs = setfield(queryParamsInputs, 'commitId', getfield(optionalArguments, 'commitId')); - end - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_element_history(projectId, refId, elementId, optionalArguments) - % get_element_history Get element history - % - % HTTPResponse = get_element_history(projectId, refId, elementId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % elementId (string) - element identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/elements/{element_id}/commits'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - relativePath = strrep(relativePath, strcat('{', 'element_id', '}'), elementId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_elements(projectId, refId, optionalArguments) - % get_elements Get elements - % - % HTTPResponse = get_elements(projectId, refId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % OptionalArgument(s): - % extended (logical) - - % commitId (string) - - % - % e.g. optionalArguments = struct('extended', extendedvalue, 'commitId', commitIdvalue) - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/elements'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if isfield(optionalArguments, 'extended') - queryParamsInputs = setfield(queryParamsInputs, 'extended', getfield(optionalArguments, 'extended')); - end - if isfield(optionalArguments, 'commitId') - queryParamsInputs = setfield(queryParamsInputs, 'commitId', getfield(optionalArguments, 'commitId')); - end - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_elements_in_batch(projectId, refId, body, optionalArguments) - % get_elements_in_batch Get element(s) in batch - % - % HTTPResponse = get_elements_in_batch(projectId, refId, body, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % body (Elements) - - % OptionalArgument(s): - % depth (double) - - % extended (logical) - - % commitId (string) - - % - % e.g. optionalArguments = struct('depth', depthvalue, 'extended', extendedvalue, 'commitId', commitIdvalue) - global basePath; - httpMethod = 'PUT'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/elements'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if isfield(optionalArguments, 'depth') - queryParamsInputs = setfield(queryParamsInputs, 'depth', getfield(optionalArguments, 'depth')); - end - if isfield(optionalArguments, 'extended') - queryParamsInputs = setfield(queryParamsInputs, 'extended', getfield(optionalArguments, 'extended')); - end - if isfield(optionalArguments, 'commitId') - queryParamsInputs = setfield(queryParamsInputs, 'commitId', getfield(optionalArguments, 'commitId')); - end - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = post_elements(projectId, refId, body, optionalArguments) - % post_elements Create and/or update element(s) - % - % HTTPResponse = post_elements(projectId, refId, body, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % body (Elements) - [e1,e2,e3] - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'POST'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/elements'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - elems2post = Utils.getObjStruct(body, "elements"); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', elems2post, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - end -end \ No newline at end of file diff --git a/Matlab-MMS-client/Elements.m b/Matlab-MMS-client/Elements.m deleted file mode 100644 index e6d04cd..0000000 --- a/Matlab-MMS-client/Elements.m +++ /dev/null @@ -1,16 +0,0 @@ -classdef Elements - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Elements model with keys defined and defaults populated. - out = struct(); - out.elements = []; - out.comment = ''; - out.source = ''; - end - end -end - - diff --git a/Matlab-MMS-client/Groups.m b/Matlab-MMS-client/Groups.m deleted file mode 100644 index 39af4db..0000000 --- a/Matlab-MMS-client/Groups.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Groups - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Groups model with keys defined and defaults populated. - out = struct(); - out.groups = []; - end - end -end - - diff --git a/Matlab-MMS-client/LoginRequest.m b/Matlab-MMS-client/LoginRequest.m deleted file mode 100644 index f259708..0000000 --- a/Matlab-MMS-client/LoginRequest.m +++ /dev/null @@ -1,15 +0,0 @@ -classdef LoginRequest - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the LoginRequest model with keys defined and defaults populated. - out = struct(); - out.username = ''; - out.password = ''; - end - end -end - - diff --git a/Matlab-MMS-client/LoginResponse.m b/Matlab-MMS-client/LoginResponse.m deleted file mode 100644 index e1ee900..0000000 --- a/Matlab-MMS-client/LoginResponse.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef LoginResponse - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the LoginResponse model with keys defined and defaults populated. - out = struct(); - out.data = []; - end - end -end - - diff --git a/Matlab-MMS-client/LoginResponseData.m b/Matlab-MMS-client/LoginResponseData.m deleted file mode 100644 index 438cee3..0000000 --- a/Matlab-MMS-client/LoginResponseData.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef LoginResponseData - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the LoginResponseData model with keys defined and defaults populated. - out = struct(); - out.ticket = ''; - end - end -end - - diff --git a/Matlab-MMS-client/Matlab_MMS_client.m b/Matlab-MMS-client/Matlab_MMS_client.m deleted file mode 100644 index 8606f08..0000000 --- a/Matlab-MMS-client/Matlab_MMS_client.m +++ /dev/null @@ -1,57 +0,0 @@ -classdef Matlab_MMS_client - properties - end - methods(Static) - - % Set basic authentication method named Basic. - function setBasicAuth(username, password) - auth_str = matlab.net.base64encode(strcat(username, ':', password)); - setenv(upper('Matlab-MMS-client_Basic_Auth'), char(strcat("Basic ", auth_str))); - end - - function out = getBasicAuth() - out = getenv(upper('Matlab-MMS-client_Basic_Auth')); - end - - function out = isBasicAuthSet() - out = ~isempty(getenv(upper('Matlab-MMS-client_Basic_Auth'))) || getenv(upper('Matlab-MMS-client_Basic_Auth')) ~= ""; - end - - % Set apiKey authentication method named Ticket. - function setTicketAuth(ticket) - setenv(upper('Matlab-MMS-client_Ticket_Auth'), char(ticket)); - end - - function out = getTicketAuth() - out = getenv(upper('Matlab-MMS-client_Ticket_Auth')); - end - - function out = isTicketAuthSet() - out = ~isempty(getenv(upper('Matlab-MMS-client_Ticket_Auth'))) || getenv(upper('Matlab-MMS-client_Ticket_Auth')) ~= ""; - end - - function setBasePath(pathInput) - global basePath; - basePath = pathInput; - end - - function out = getBasePath() - global basePath; - out = basePath; - end - - function out = request(httpRequestArgs) - if strcmp(upper(httpRequestArgs.options.RequestMethod), upper('GET')) - out = webread(httpRequestArgs.url, httpRequestArgs.options); - else - bodyJsonString = []; - if isfield(httpRequestArgs, 'body') - bodyJsonString = jsonencode(httpRequestArgs.body); - bodyJsonString = strrep(bodyJsonString, '"x_', '"_'); - end - - out = webwrite(httpRequestArgs.url, bodyJsonString, httpRequestArgs.options); - end - end - end -end \ No newline at end of file diff --git a/Matlab-MMS-client/Mounts.m b/Matlab-MMS-client/Mounts.m deleted file mode 100644 index 5e9413d..0000000 --- a/Matlab-MMS-client/Mounts.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Mounts - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Mounts model with keys defined and defaults populated. - out = struct(); - out.mounts = []; - end - end -end - - diff --git a/Matlab-MMS-client/Org.m b/Matlab-MMS-client/Org.m deleted file mode 100644 index 5e80b98..0000000 --- a/Matlab-MMS-client/Org.m +++ /dev/null @@ -1,15 +0,0 @@ -classdef Org - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Org model with keys defined and defaults populated. - out = struct(); - out.id = ''; - out.name = ''; - end - end -end - - diff --git a/Matlab-MMS-client/OrgApi.m b/Matlab-MMS-client/OrgApi.m deleted file mode 100644 index c52908d..0000000 --- a/Matlab-MMS-client/OrgApi.m +++ /dev/null @@ -1,178 +0,0 @@ -%% -classdef OrgApi - properties - end - methods(Static) - function out = delete_org(orgId, optionalArguments) - % delete_org Delete org - % - % HTTPResponse = delete_org(orgId, optionalArguments) - % - % Required Argument(s): - % orgId (string) - org identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'DELETE'; - queryParamsInputs = struct(); - relativePath = '/orgs/{org_id}'; - relativePath = strrep(relativePath, strcat('{', 'org_id', '}'), orgId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_org(orgId, optionalArguments) - % get_org Get org - % - % HTTPResponse = get_org(orgId, optionalArguments) - % - % Required Argument(s): - % orgId (string) - org identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/orgs/{org_id}'; - relativePath = strrep(relativePath, strcat('{', 'org_id', '}'), orgId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_orgs(optionalArguments) - % get_orgs Get all orgs - % - % HTTPResponse = get_orgs(optionalArguments) - % - % Required Argument(s): - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/orgs'; - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = post_orgs(body, optionalArguments) - % post_orgs Create and/or update org(s) - % - % HTTPResponse = post_orgs(body, optionalArguments) - % - % Required Argument(s): - % body (Orgs) - - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'POST'; - queryParamsInputs = struct(); - relativePath = '/orgs'; - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - end -end - - - - - - - diff --git a/Matlab-MMS-client/Orgs.m b/Matlab-MMS-client/Orgs.m deleted file mode 100644 index 585ba89..0000000 --- a/Matlab-MMS-client/Orgs.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Orgs - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Orgs model with keys defined and defaults populated. - out = struct(); - out.orgs = []; - end - end -end - - diff --git a/Matlab-MMS-client/OtherApi.m b/Matlab-MMS-client/OtherApi.m deleted file mode 100644 index b3deb5b..0000000 --- a/Matlab-MMS-client/OtherApi.m +++ /dev/null @@ -1,145 +0,0 @@ -%% -classdef OtherApi - properties - end - methods(Static) - function out = get_documents(projectId, refId, optionalArguments) - % get_documents Get documents - % - % HTTPResponse = get_documents(projectId, refId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/documents'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab-MMS-client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab-MMS-client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab-MMS-client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab-MMS-client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab-MMS-client.request(httpRequestArgs); - end - - function out = get_groups(projectId, refId, optionalArguments) - % get_groups Get groups - % - % HTTPResponse = get_groups(projectId, refId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/groups'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab-MMS-client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab-MMS-client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab-MMS-client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab-MMS-client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_mounts(projectId, refId, optionalArguments) - % get_mounts Get mounts - % - % HTTPResponse = get_mounts(projectId, refId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/mounts'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab-MMS-client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab-MMS-client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab-MMS-client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab-MMS-client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - end -end - - - - - - - diff --git a/Matlab-MMS-client/Project.m b/Matlab-MMS-client/Project.m deleted file mode 100644 index b2882e8..0000000 --- a/Matlab-MMS-client/Project.m +++ /dev/null @@ -1,17 +0,0 @@ -classdef Project - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Project model with keys defined and defaults populated. - out = struct(); - out.id = ''; - out.name = ''; - out.orgId = ''; - out.type = 'Project'; - end - end -end - - diff --git a/Matlab-MMS-client/ProjectApi.m b/Matlab-MMS-client/ProjectApi.m deleted file mode 100644 index 14873df..0000000 --- a/Matlab-MMS-client/ProjectApi.m +++ /dev/null @@ -1,307 +0,0 @@ -%% -classdef ProjectApi - properties - end - methods(Static) - function out = delete_project(projectId, optionalArguments) - % delete_project Delete project - % - % HTTPResponse = delete_project(projectId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'DELETE'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_project(projectId, optionalArguments) - % get_project Get project - % - % HTTPResponse = get_project(projectId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_project_commit(projectId, commitId, optionalArguments) - % get_project_commit Get project commit - % - % HTTPResponse = get_project_commit(projectId, commitId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % commitId (string) - commit identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/commits/{commit_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'commit_id', '}'), commitId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_projects(optionalArguments) - % get_projects Get all projects - % - % HTTPResponse = get_projects(optionalArguments) - % - % Required Argument(s): - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects'; - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_projects_by_org(orgId, optionalArguments) - % get_projects_by_org Get all projects in org - % - % HTTPResponse = get_projects_by_org(orgId, optionalArguments) - % - % Required Argument(s): - % orgId (string) - org identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/orgs/{org_id}/projects'; - relativePath = strrep(relativePath, strcat('{', 'org_id', '}'), orgId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = post_projects(body, optionalArguments) - % post_projects Create and/or update project(s) - % - % HTTPResponse = post_projects(body, optionalArguments) - % - % Required Argument(s): - % body (Projects) - - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'POST'; - queryParamsInputs = struct(); - relativePath = '/projects'; - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = post_projects_by_org(orgId, body, optionalArguments) - % post_projects_by_org Create and/or update project(s) in org - % - % HTTPResponse = post_projects_by_org(orgId, body, optionalArguments) - % - % Required Argument(s): - % orgId (string) - org identifier - % body (Projects) - - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'POST'; - queryParamsInputs = struct(); - relativePath = '/orgs/{org_id}/projects'; - relativePath = strrep(relativePath, strcat('{', 'org_id', '}'), orgId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - end -end - - - - - - - diff --git a/Matlab-MMS-client/Projects.m b/Matlab-MMS-client/Projects.m deleted file mode 100644 index 6a6b06e..0000000 --- a/Matlab-MMS-client/Projects.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Projects - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Projects model with keys defined and defaults populated. - out = struct(); - out.projects = []; - end - end -end - - diff --git a/Matlab-MMS-client/Ref.m b/Matlab-MMS-client/Ref.m deleted file mode 100644 index 2c083dd..0000000 --- a/Matlab-MMS-client/Ref.m +++ /dev/null @@ -1,17 +0,0 @@ -classdef Ref - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Ref model with keys defined and defaults populated. - out = struct(); - out.id = ''; - out.name = ''; - out.parentRefId = ''; - out.type = 'Branch'; - end - end -end - - diff --git a/Matlab-MMS-client/RefApi.m b/Matlab-MMS-client/RefApi.m deleted file mode 100644 index 0f4133f..0000000 --- a/Matlab-MMS-client/RefApi.m +++ /dev/null @@ -1,230 +0,0 @@ -%% -classdef RefApi - properties - end - methods(Static) - function out = delete_ref(projectId, refId, optionalArguments) - % delete_ref Delete ref - % - % HTTPResponse = delete_ref(projectId, refId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'DELETE'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_ref(projectId, refId, optionalArguments) - % get_ref Get ref - % - % HTTPResponse = get_ref(projectId, refId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_ref_history(projectId, refId, optionalArguments) - % get_ref_history Get ref history - % - % HTTPResponse = get_ref_history(projectId, refId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % refId (string) - ref identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs/{ref_id}/commits'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - relativePath = strrep(relativePath, strcat('{', 'ref_id', '}'), refId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = get_refs(projectId, optionalArguments) - % get_refs Get all refs in project - % - % HTTPResponse = get_refs(projectId, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = post_refs(projectId, body, optionalArguments) - % post_refs Create and/or update ref(s) - % - % HTTPResponse = post_refs(projectId, body, optionalArguments) - % - % Required Argument(s): - % projectId (string) - project identifier - % body (Refs) - - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'POST'; - queryParamsInputs = struct(); - relativePath = '/projects/{project_id}/refs'; - relativePath = strrep(relativePath, strcat('{', 'project_id', '}'), projectId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - end -end - - - - - - - diff --git a/Matlab-MMS-client/Refs.m b/Matlab-MMS-client/Refs.m deleted file mode 100644 index 188cc3d..0000000 --- a/Matlab-MMS-client/Refs.m +++ /dev/null @@ -1,14 +0,0 @@ -classdef Refs - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the Refs model with keys defined and defaults populated. - out = struct(); - out.refs = []; - end - end -end - - diff --git a/Matlab-MMS-client/TicketApi.m b/Matlab-MMS-client/TicketApi.m deleted file mode 100644 index 3eff316..0000000 --- a/Matlab-MMS-client/TicketApi.m +++ /dev/null @@ -1,91 +0,0 @@ -%% -classdef TicketApi - properties - end - methods(Static) - function out = get_ticket(ticketId, optionalArguments) - % get_ticket Get ticket - % - % HTTPResponse = get_ticket(ticketId, optionalArguments) - % - % Required Argument(s): - % ticketId (string) - ticket identifier - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'GET'; - queryParamsInputs = struct(); - relativePath = '/mms/login/ticket/{ticket_id}'; - relativePath = strrep(relativePath, strcat('{', 'ticket_id', '}'), ticketId); - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - if Matlab_MMS_client.isTicketAuthSet() - queryParamsInputs = setfield(queryParamsInputs, 'alf_ticket', Matlab_MMS_client.getTicketAuth()); - end - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - if ~isempty(char(Matlab_MMS_client.getBasicAuth())) - headers = [headers; "Authorization", string(Matlab_MMS_client.getBasicAuth())]; - end - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - - function out = post_ticket(body, optionalArguments) - % post_ticket Create ticket - % - % HTTPResponse = post_ticket(body, optionalArguments) - % - % Required Argument(s): - % body (LoginRequest) - - % OptionalArgument(s): - % - % e.g. optionalArguments = struct() - global basePath; - httpMethod = 'POST'; - queryParamsInputs = struct(); - relativePath = '/api/login'; - if ~exist('optionalArguments') - optionalArguments = struct(); - end - - - - if ~exist('queryParamsInputs') - queryParamsInputs = struct(); - end - - query = string(matlab.net.QueryParameter(queryParamsInputs)); - if ~isempty(query) - query = strcat('?', query); - end - contextPath = '/alfresco/service'; - url = sprintf('%s%s%s%s', basePath, contextPath, relativePath, query); - headers = ["Content-Type", "application/json"]; - options = weboptions('HeaderFields', headers, 'MediaType', 'application/json', 'RequestMethod', httpMethod, 'Timeout', Inf('double')); - httpRequestArgs = struct('url', url, 'body', body, 'options', options); - out = Matlab_MMS_client.request(httpRequestArgs); - end - end -end - - - - - - - diff --git a/Matlab-MMS-client/TicketResponse.m b/Matlab-MMS-client/TicketResponse.m deleted file mode 100644 index ea452a6..0000000 --- a/Matlab-MMS-client/TicketResponse.m +++ /dev/null @@ -1,16 +0,0 @@ -classdef TicketResponse - properties - end - methods(Static) - function out = construct() - %% construct - %% Description: Construct a struct that represents the TicketResponse model with keys defined and defaults populated. - out = struct(); - out.username = ''; - out.first = ''; - out.last = ''; - end - end -end - - diff --git a/Matlab-MMS-client/Utils.m b/Matlab-MMS-client/Utils.m deleted file mode 100644 index 87a8c0d..0000000 --- a/Matlab-MMS-client/Utils.m +++ /dev/null @@ -1,53 +0,0 @@ -classdef Utils - properties - basePath - end - methods(Static) - function out = wrapObj(objList, type) - % Wrap a list of object struct(s). This function is added to counter the two Matlab's jsonecode/decode behavior 1) It drops " [] " when the list of value only has one element. 2) If the key name starts with an " _ ", it prepends an " x " as in "x_" - - jsonString = jsonencode(objList); - jsonString = strrep(jsonString, '"x_', '"_'); - objects = sprintf('{"%s":%s}', type, jsonString); - out = objects - end - - function ret = getObjStruct(objList, type) - ret = jsondecode(wrapObj(objList, type)); - end - - function out = getIdList(ids, type) - objIds = {}; - - for i = 1:length(ids) - objIds{i,1} = struct('id', ids(i)); - end - - out = Utils.wrapObj(objIds, type); - end - - function ret = getIdsStruct(idList, type) - ret = jsondecode(getIdList(idList, type)); - end - - end -end - -function out = getIdList(ids, type) - objIds = {}; - - for i = 1:length(ids) - objIds{i,1} = struct('id', ids(i)); - end - - out = Utils.wrapObj(ids, type); -end - -function out = wrapObj(objList, type) - % Wrap a list of object struct(s). This function is added to counter the two Matlab's jsonecode/decode behavior 1) It drops " [] " when the list of value only has one element. 2) If the key name starts with an " _ ", it prepends an " x " as in "x_" - - jsonString = jsonencode(objList); - jsonString = strrep(jsonString, '"x_', '"_'); - objects = sprintf('{"%s":%s}', type, jsonString); - out = objects; -end \ No newline at end of file diff --git a/README.md b/README.md index 2c5e9bc..ec3a3fe 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,35 @@ -# MMS-MATLAB-Adapter +# MATLAB MDK -0.1.0 \ No newline at end of file +[![Download](https://api.bintray.com/packages/openmbee/maven/matlab-mdk/images/download.svg)](https://bintray.com/openmbee/maven/matlab-mdk/_latestVersion) + +MATLAB MDK is a toolbox for [MATLAB](https://www.mathworks.com/products/matlab.html) that enables interactions with the [MMS](https://github.com/Open-MBEE/mms) such as retrieving analysis inputs and publishing analysis outputs, e.g. computed values, plots, tables. + +# Quickstart + +# Prerequisites + +* [MATLAB](https://www.mathworks.com/products/matlab.html) + +## Installation + +1. [Download](https://bintray.com/openmbee/maven/matlab-mdk/_latestVersion) the MATLAB MDK toolbox, e.g. `matlab-mdk-*.mltbx`. + +2. Double-click (or right click > "Open With" > "MATLAB", as applicable) the downloaded `matlab-mdk-*.mltbx` file. See [MATLAB documentation](https://www.mathworks.com/help/matlab/matlab_env/get-add-ons.html#buytlxo-3) for more info. MATLAB should prompt with the following window. + + ![MATLAB Installation](doc/images/matlab-installation.png) + +3. Return to the MATLAB main window and in the Command Window run `doc(MMS)` to test the installation. + + Example output: + + ![MATLAB Documentation](doc/images/matlab-documentation.png) + +4. Check out the [example functions](examples). + +> The toolbox can also be installed headlessly using [`matlab.addons.install`](https://www.mathworks.com/help/matlab/ref/matlab.addons.install.html). + +# Local Development + +* Run `build.sh` to generate matlab-mdk build directory. +* Run the MATLAB Toolbox Packager from main menu "Home" > "Environment" ribbon > "Add-Ons" > "Package Toolbox" > "Open Project" > [`matlab-mdk.prj`](matlab-mdk.prj). See [MATLAB documentation](https://www.mathworks.com/help/matlab/matlab_prog/create-and-share-custom-matlab-toolboxes.html#buf2ahi-3) for more info. +* Follow the [Installation](#Installation) instructions. \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..a7d70dd --- /dev/null +++ b/build.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +VERSION=3.4.2 + +rm -r build/ +mkdir -p build/ +cp -r examples build/ + +echo "Installing with mms-matlab-client:${VERSION}" +echo "Downloading from https://dl.bintray.com/openmbee/maven/gov/nasa/jpl/mms/mms-matlab-client/${VERSION}/mms-matlab-client-${VERSION}.zip" +curl -sL "https://dl.bintray.com/openmbee/maven/gov/nasa/jpl/mms/mms-matlab-client/${VERSION}/mms-matlab-client-${VERSION}.zip" -o mms-matlab-client.zip +unzip -q mms-matlab-client.zip -d build/ +rm mms-matlab-client.zip + +echo "Run MATLAB Toolbox Packager on $(pwd)/build/" \ No newline at end of file diff --git a/doc/images/matlab-documentation.png b/doc/images/matlab-documentation.png new file mode 100644 index 0000000..1cc30a4 Binary files /dev/null and b/doc/images/matlab-documentation.png differ diff --git a/doc/images/matlab-installation.png b/doc/images/matlab-installation.png new file mode 100644 index 0000000..0bd07b2 Binary files /dev/null and b/doc/images/matlab-installation.png differ diff --git a/examples/login.m b/examples/login.m new file mode 100644 index 0000000..1d9f78d --- /dev/null +++ b/examples/login.m @@ -0,0 +1,21 @@ +function login(username,basePath) + +%----------------------------------------------------------- +%Description: Log into server +% +%input Args: +% basePath(str) = https://mms.org +% username(str) = JPL username +% passcode = JPL password (type in passcode text box) +%----------------------------------------------------------- + + MMS.setBasePath(basePath) + out.username = username; + out.password = passcode(); + %MMS.setBasicAuth(out.username, out.password); + ticket = MMS.TicketApi.post_ticket(out); + MMS.setTicketAuth(ticket.data.ticket); + + clear out + +end \ No newline at end of file diff --git a/Supplementary Functions/passcode.m b/examples/passcode.m similarity index 100% rename from Supplementary Functions/passcode.m rename to examples/passcode.m diff --git a/Adapter/postImagefromURL.m b/examples/postImagefromURL.m similarity index 84% rename from Adapter/postImagefromURL.m rename to examples/postImagefromURL.m index c26f78c..8727cbd 100644 --- a/Adapter/postImagefromURL.m +++ b/examples/postImagefromURL.m @@ -1,6 +1,6 @@ function postImagefromURL(username, basePath, project, ref, name1, name2, picUrl1,picUrl2,desiredFields) - Login(username, basePath); + login(username, basePath); pic1 = strcat(''); pic2 = strcat(''); @@ -8,5 +8,5 @@ function postImagefromURL(username, basePath, project, ref, name1, name2, picUrl s = struct('id','_hidden_MMS_1529082050667_32fffb1e-e0e4-40da-9e74-2f586f711818_pei','type','InstanceSpecification','name',name1,'documentation', pic1); t = struct('id','_hidden_MMS_1529358324856_8442b90f-4e70-4359-be1e-ff6eef6e2259_pei','type','InstanceSpecification','name',name2,'documentation', pic2); - posted = ElementApi.post_elements(project,ref,[s,t]); + posted = MMS.ElementApi.post_elements(project,ref,[s,t]); end \ No newline at end of file diff --git a/Adapter/removeFields.m b/examples/removeFields.m similarity index 100% rename from Adapter/removeFields.m rename to examples/removeFields.m diff --git a/Adapter/UpdateDocumentation.m b/examples/updateDocumentation.m similarity index 64% rename from Adapter/UpdateDocumentation.m rename to examples/updateDocumentation.m index c2a4bf8..72a2979 100644 --- a/Adapter/UpdateDocumentation.m +++ b/examples/updateDocumentation.m @@ -1,4 +1,4 @@ -function UpdateDocumentation(username, basePath, project, ref, id1, id2, content1, content2, desiredFields) +function updateDocumentation(username, basePath, project, ref, id1, id2, content1, content2, desiredFields) %------------------------------------------------------ %Description: Update documentation of a presentation % element. @@ -15,17 +15,17 @@ function UpdateDocumentation(username, basePath, project, ref, id1, id2, content %"documentation"] %------------------------------------------------------ - Login(username, basePath); + login(username, basePath); - json1 = ElementApi.get_element(project, ref, id1); - json2 = ElementApi.get_element(project, ref, id2); + json1 = MMS.ElementApi.get_element(project, ref, id1); + json2 = MMS.ElementApi.get_element(project, ref, id2); out1 = removeFields(json1, desiredFields); out2 = removeFields(json2, desiredFields); - out1 = setfield(out1,'documentation', content1); - out2 = setfield(out2,'documentation', content2); + out1 = setfield(out1, 'documentation', content1); + out2 = setfield(out2, 'documentation', content2); - posted = ElementApi.post_elements(project, ref, [out1,out2]); + posted = MMS.ElementApi.post_elements(project, ref, [out1,out2]); end \ No newline at end of file diff --git a/Adapter/UpdateName.m b/examples/updateName.m similarity index 71% rename from Adapter/UpdateName.m rename to examples/updateName.m index e56a362..ebdf83f 100644 --- a/Adapter/UpdateName.m +++ b/examples/updateName.m @@ -1,4 +1,4 @@ -function UpdateName(username, basePath, project, ref, id1, id2, newName1, newName2, desiredFields) +function updateName(username, basePath, project, ref, id1, id2, newName1, newName2, desiredFields) %------------------------------------------------------ %Description: Update name of an element @@ -14,10 +14,10 @@ function UpdateName(username, basePath, project, ref, id1, id2, newName1, newNam %desiredFields(str array): fields to update["id" %"name"] %------------------------------------------------------ - Login(username, basePath); + login(username, basePath); - json1 = ElementApi.get_element(project, ref, id1); - json2 = ElementApi.get_element(project, ref, id2); + json1 = MMS.ElementApi.get_element(project, ref, id1); + json2 = MMS.ElementApi.get_element(project, ref, id2); out1 = removeFields(json1, desiredFields); out2 = removeFields(json2, desiredFields); @@ -25,5 +25,5 @@ function UpdateName(username, basePath, project, ref, id1, id2, newName1, newNam out1 = setfield(out1,'name', newName1); out2 = setfield(out2,'name', newName2); - posted = ElementApi.post_elements(project, ref, [out1,out2]) + posted = MMS.ElementApi.post_elements(project, ref, [out1,out2]) end \ No newline at end of file diff --git a/images/openmbee-logo.png b/images/openmbee-logo.png new file mode 100644 index 0000000..1e51dd3 Binary files /dev/null and b/images/openmbee-logo.png differ diff --git a/images/openmbee-logo.svg b/images/openmbee-logo.svg new file mode 100644 index 0000000..435495b --- /dev/null +++ b/images/openmbee-logo.svg @@ -0,0 +1,27 @@ + + + + Artboard + Created with Sketch. + + + + \ No newline at end of file diff --git a/matlab-mdk.prj b/matlab-mdk.prj new file mode 100644 index 0000000..0e61480 --- /dev/null +++ b/matlab-mdk.prj @@ -0,0 +1,139 @@ + + + MATLAB MDK + OpenMBEE + + OpenMBEE + MATLAB Model Development Kit + MATLAB MDK is a toolbox for MATLAB that enables interactions with the MMS such as retrieving analysis inputs and publishing analysis outputs, e.g. computed values, plots, tables. + ${PROJECT_ROOT}/images/openmbee-logo.png + 3.4.2 + ${PROJECT_ROOT}/build/matlab-mdk.mltbx + + + + + 01e8d1cc-a0fa-42a5-b682-30cfbab8c2ff + .swagger-* + true + + + + + + + + + false + + + + + + false + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${PROJECT_ROOT}/build + + + ${PROJECT_ROOT}/build/+MMS + ${PROJECT_ROOT}/build/LICENSE + ${PROJECT_ROOT}/build/MMS.m + ${PROJECT_ROOT}/build/examples + + + + + + matlab-mdk/build/matlab-mdk.mltbx + + + + /Applications/R2019a/MATLAB_R2019a.app + + + + + + + + + true + + + + + true + + + + + true + + + + + true + + + + + true + true + false + false + false + false + false + false + 10.14.6 + false + true + maci64 + true + + + \ No newline at end of file