Skip to content

Commit

Permalink
Merge pull request #3 from appirio-tech/submissionsMessaging
Browse files Browse the repository at this point in the history
Add submissions messaging
  • Loading branch information
samsep committed Oct 12, 2015
2 parents ca9601a + f9b278d commit 2eb6dfe
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 1 deletion.
45 changes: 45 additions & 0 deletions dist/main.js
Expand Up @@ -487,3 +487,48 @@
angular.module('appirio-tech-ng-api-services').factory('CopilotProjectDetailsAPIService', srv);

}).call(this);

(function() {
'use strict';
var srv, transformResponse;

transformResponse = function(response) {
var parsed, ref;
parsed = JSON.parse(response);
return (parsed != null ? (ref = parsed.result) != null ? ref.content : void 0 : void 0) || [];
};

srv = function($resource, API_URL) {
var methods, params, url;
url = API_URL + '/v3/projects/:projectId/submissions/:submissionId/threads/:threadId/messages';
params = {
projectId: '@projectId',
submissionId: '@submissionId',
threadId: '@threadId'
};
methods = {
get: {
method: 'GET'
},
query: {
method: 'GET',
isArray: true
},
post: {
method: 'POST'
},
patch: {
method: 'PATCH'
},
put: {
method: 'PUT'
}
};
return $resource(url, {}, methods);
};

srv.$inject = ['$resource', 'API_URL'];

angular.module('appirio-tech-ng-api-services').factory('SubmissionsMessagesAPIService', srv);

}).call(this);
2 changes: 1 addition & 1 deletion example/js-files.jade
Expand Up @@ -35,7 +35,7 @@
- scripts.push('submit-work-api.service')
- scripts.push('copilot-projects-api.service')
- scripts.push('copilot-project-details-api.service')

- scripts.push('submissions-messages-api.service')

- bowers.push('angular/angular')
- bowers.push('angular-resource/angular-resource')
Expand Down
37 changes: 37 additions & 0 deletions src/scripts/submissions-messages-api.service.coffee
@@ -0,0 +1,37 @@
'use strict'

transformResponse = (response) ->
parsed = JSON.parse response

parsed?.result?.content || []

srv = ($resource, API_URL) ->
url = API_URL + '/v3/projects/:projectId/submissions/:submissionId/threads/:threadId/messages'

params =
projectId: '@projectId'
submissionId: '@submissionId'
threadId: '@threadId'

methods =
get:
method: 'GET'

query:
method: 'GET'
isArray: true

post:
method: 'POST'

patch:
method: 'PATCH'

put:
method: 'PUT'

$resource url, {}, methods

srv.$inject = ['$resource', 'API_URL']

angular.module('appirio-tech-ng-api-services').factory 'SubmissionsMessagesAPIService', srv

0 comments on commit 2eb6dfe

Please sign in to comment.