sk_api_schema 0.10.6 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -2
  3. data/CHANGELOG.md +4 -0
  4. data/README.rdoc +1 -1
  5. data/Rakefile +0 -10
  6. data/json/v1.0/account.json +13 -0
  7. data/json/v1.0/contact.json +7 -1
  8. data/json/v1.0/credit_note.json +6 -0
  9. data/json/v1.0/invoice.json +6 -0
  10. data/json/v1.0/order.json +6 -0
  11. data/json/v1.0/product.json +0 -4
  12. data/json/v1.0/recurring.json +6 -0
  13. data/json/v2.0/README.md +28 -0
  14. data/json/v2.0/account.json +31 -18
  15. data/json/v2.0/account_billing.json +15 -7
  16. data/json/v2.0/account_entry.json +19 -16
  17. data/json/v2.0/address.json +7 -6
  18. data/json/v2.0/attachment.json +17 -16
  19. data/json/v2.0/auth_permission.json +6 -5
  20. data/json/v2.0/comment.json +15 -9
  21. data/json/v2.0/company.json +11 -8
  22. data/json/v2.0/contact.json +45 -49
  23. data/json/v2.0/credit_note.json +59 -84
  24. data/json/v2.0/divider_item.json +9 -8
  25. data/json/v2.0/document.json +41 -36
  26. data/json/v2.0/email.json +29 -22
  27. data/json/v2.0/email_template.json +15 -10
  28. data/json/v2.0/estimate.json +59 -76
  29. data/json/v2.0/export.json +26 -16
  30. data/json/v2.0/export_template.json +15 -9
  31. data/json/v2.0/invoice.json +62 -92
  32. data/json/v2.0/language.json +14 -6
  33. data/json/v2.0/line_item.json +14 -13
  34. data/json/v2.0/order.json +59 -75
  35. data/json/v2.0/payment.json +17 -12
  36. data/json/v2.0/payment_reminder.json +53 -71
  37. data/json/v2.0/pdf_template.json +14 -8
  38. data/json/v2.0/product.json +16 -13
  39. data/json/v2.0/recurring.json +57 -54
  40. data/json/v2.0/sub.json +14 -7
  41. data/json/v2.0/sub_total_item.json +10 -9
  42. data/json/v2.0/tag.json +13 -5
  43. data/json/v2.0/task.json +31 -16
  44. data/json/v2.0/text_template.json +16 -10
  45. data/json/v2.0/user.json +8 -8
  46. data/lib/sk_api_schema/version.rb +1 -1
  47. data/sk_api_schema.gemspec +1 -1
  48. data/spec/sk_api_schema_spec.rb +35 -19
  49. data/spec/spec_helper.rb +1 -2
  50. metadata +7 -7
  51. data/json/v2.0/client.json +0 -318
@@ -1,25 +1,33 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "tag",
3
- "name": "tag",
4
5
  "description":"A tag",
5
6
  "properties":{
6
7
  "id":{
7
8
  "description":"Unique identifier - UUID",
8
9
  "identity":true,
9
- "readonly":true,
10
+ "readOnly":true,
11
+ "type":"string",
12
+ "maxLength": 22,
13
+ "minLength":22
14
+ },
15
+ "company_id":{
16
+ "description":"Company",
17
+ "readOnly":true,
10
18
  "type":"string",
11
19
  "maxLength": 22,
12
20
  "minLength":22
13
21
  },
14
22
  "name":{
15
23
  "description": "The tag itself",
16
- "readonly":true,
24
+ "readOnly":true,
17
25
  "type":"string",
18
26
  "maxLength": 50
19
27
  },
20
28
  "taggings_count":{
21
29
  "description": "Usage count of this tag, for all objects in whole company scope.",
22
- "readonly":true,
30
+ "readOnly":true,
23
31
  "type":"number"
24
32
  }
25
33
  },
@@ -1,24 +1,32 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "task",
3
- "name": "task",
4
- "description":"An Task in SK.",
5
+ "description":"An Task",
6
+ "required" : ["name", "description"],
5
7
  "properties":{
6
8
  "id":{
7
9
  "description":"Unique identifier - UUID",
8
10
  "identity":true,
9
- "readonly":true,
11
+ "readOnly":true,
12
+ "type":"string",
13
+ "maxLength": 22,
14
+ "minLength":22
15
+ },
16
+ "company_id":{
17
+ "description":"Company",
18
+ "readOnly":true,
10
19
  "type":"string",
11
20
  "maxLength": 22,
12
21
  "minLength":22
13
22
  },
14
23
  "name":{
15
24
  "description": "The task title.",
16
- "required":true,
17
- "type":"string"
25
+ "type":"string",
26
+ "maxLength": 255
18
27
  },
19
28
  "description":{
20
29
  "description": "Notes, explanations for the task.",
21
- "required":true,
22
30
  "type":"string"
23
31
  },
24
32
  "status":{
@@ -35,20 +43,27 @@
35
43
  },
36
44
  "contact":{
37
45
  "description": "The contact for the task. Use contact_id field to set a contact.",
38
- "readonly":true,
46
+ "readOnly":true,
39
47
  "type":"object",
40
- "properties":{"$ref":"./contact.json#properties"}
48
+ "$ref":"./contact.json#"
41
49
  },
42
50
  "documents":{
43
- "description": "A tasks can have many related documents.",
51
+ "description": "A task can have many related documents.",
52
+ "readOnly":true,
44
53
  "type":"array",
45
- "properties" : {"$ref":"./document.json#properties"}
54
+ "items": {
55
+ "type": "object",
56
+ "$ref" : "./document.json#"
57
+ }
46
58
  },
47
59
  "attachments":{
48
60
  "description": "Attached files, uploads.",
49
- "readonly":true,
61
+ "readOnly":true,
50
62
  "type":"array",
51
- "properties":{"$ref":"./attachment.json#properties"}
63
+ "items": {
64
+ "type": "object",
65
+ "$ref" : "./attachment.json#"
66
+ }
52
67
  },
53
68
  "assignee_id":{
54
69
  "description": "User who should do the tasks.",
@@ -65,19 +80,19 @@
65
80
  "closed_at":{
66
81
  "description": "Date the task was completed.",
67
82
  "format":"date",
68
- "readonly":true,
83
+ "readOnly":true,
69
84
  "type":"string"
70
85
  },
71
86
  "created_at":{
72
87
  "description": "Date the object was created in SK. Never changes afterwards",
73
88
  "format":"date-time",
74
- "readonly":true,
89
+ "readOnly":true,
75
90
  "type":"string"
76
91
  },
77
92
  "updated_at":{
78
93
  "description": "Date the object was edited in SK.",
79
94
  "format":"date-time",
80
- "readonly":true,
95
+ "readOnly":true,
81
96
  "type":"string"
82
97
  }
83
98
  },
@@ -1,44 +1,50 @@
1
- { "type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "text_template",
3
- "name": "text_template",
4
- "description":"An text_template in SK",
5
+ "description":"A text snippet template to be used in documents and emails",
6
+ "required" : ["name", "text", "kind"],
5
7
  "properties":{
6
8
  "id":{
7
9
  "description":"Unique identifier - UUID",
8
10
  "identity":true,
9
- "readonly":true,
11
+ "readOnly":true,
12
+ "type":"string",
13
+ "maxLength": 22,
14
+ "minLength":22
15
+ },
16
+ "company_id":{
17
+ "description":"Company",
18
+ "readOnly":true,
10
19
  "type":"string",
11
20
  "maxLength": 22,
12
21
  "minLength":22
13
22
  },
14
23
  "name":{
15
24
  "description": "A meaningful name.",
16
- "required":true,
17
25
  "type":"string",
18
26
  "maxLength": 50
19
27
  },
20
28
  "text":{
21
29
  "description": "Text which may contain placeholders, replaced when the template is used.",
22
- "required":true,
23
30
  "type":"string",
24
- "format":"text"
31
+ "format":"string"
25
32
  },
26
33
  "kind":{
27
34
  "description": "Kind of object the template can be used for. If empty the snippet can be used global. In this case watch not all placeholders are available: a client has different fields than an invoice.",
28
- "required":true,
29
35
  "enum": ["","invoice", "estimate", "credit_note", "payment_reminder", "order", "contact", "email"],
30
36
  "type":"string"
31
37
  },
32
38
  "created_at":{
33
39
  "description": "Date the object was created in SK. Never changes afterwards",
34
40
  "format":"date-time",
35
- "readonly":true,
41
+ "readOnly":true,
36
42
  "type":"string"
37
43
  },
38
44
  "updated_at":{
39
45
  "description": "Date the object was edited in SK.",
40
46
  "format":"date-time",
41
- "readonly":true,
47
+ "readOnly":true,
42
48
  "type":"string"
43
49
  },
44
50
  "team_id":{
@@ -1,12 +1,14 @@
1
- {"type":"object",
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+ "type":"object",
2
4
  "title": "user",
3
- "name": "user",
4
- "description": "A user as seen by SalesKing",
5
+ "description": "A SalesKing user",
6
+ "required" : ["email", "language"],
5
7
  "properties":{
6
8
  "id":{
7
9
  "description":"Unique identifier - UUID",
8
10
  "identity":true,
9
- "readonly":true,
11
+ "readOnly":true,
10
12
  "type":"string",
11
13
  "maxLength": 22,
12
14
  "minLength":22
@@ -38,7 +40,6 @@
38
40
  },
39
41
  "language":{
40
42
  "description": "The users language, reflected in the interface.",
41
- "required":true,
42
43
  "type":"string",
43
44
  "maxLength": 10
44
45
  },
@@ -48,7 +49,6 @@
48
49
  },
49
50
  "email":{
50
51
  "description": "Email address of the user. Unique in SK",
51
- "required":true,
52
52
  "type":"string",
53
53
  "maxLength": 100
54
54
  },
@@ -84,13 +84,13 @@
84
84
  "created_at":{
85
85
  "description": "Date the record was created in SK. Never changes afterwards.",
86
86
  "format":"date-time",
87
- "readonly":true,
87
+ "readOnly":true,
88
88
  "type":"string"
89
89
  },
90
90
  "updated_at":{
91
91
  "description": "Last date when the record was edited.",
92
92
  "format":"date-time",
93
- "readonly":true,
93
+ "readOnly":true,
94
94
  "type":"string"
95
95
  }
96
96
  },
@@ -1,7 +1,7 @@
1
1
  module SK
2
2
  module Api
3
3
  class Schema
4
- VERSION='0.10.6'
4
+ VERSION='0.11.0'
5
5
  end
6
6
  end
7
7
  end
@@ -19,9 +19,9 @@ Besides ruby users can use a small lib with utility methods to load and test the
19
19
  s.require_paths = ['lib']
20
20
 
21
21
  s.add_runtime_dependency 'activesupport'
22
- s.add_development_dependency 'rdoc'
23
22
  s.add_development_dependency 'rspec'
24
23
  s.add_development_dependency 'simplecov'
24
+ s.add_development_dependency 'json_schema_validator'
25
25
  s.add_development_dependency 'rake', '>= 0.9.2'
26
26
 
27
27
  end
@@ -7,44 +7,51 @@ describe SK::Api::Schema do
7
7
  SK::Api::Schema.registry_reset
8
8
  end
9
9
 
10
- it "should provide schema path" do
11
- File.exists?(SK::Api::Schema.path).should be
10
+ it "provides schema path" do
11
+ expect(File.exists?(SK::Api::Schema.path)).to be true
12
12
  end
13
13
 
14
- it "should read json schema file" do
14
+ it "reads json schema file" do
15
15
  schema = SK::Api::Schema.read(:invoice, 'v1.0')
16
- schema[:title].should == 'invoice'
17
- schema[:type].should == 'object'
18
- schema['properties'].should be_a Hash
19
- schema['properties']['id']['identity'].should == true
16
+ expect(schema[:title]).to eq 'invoice'
17
+ expect(schema[:type]).to eq 'object'
18
+ expect(schema['properties']).to be_a Hash
19
+ expect(schema['properties']['id']['identity']).to be true
20
20
  end
21
21
 
22
- it "should read json schema file with simple version" do
22
+ it "reads json schema file with simple version" do
23
23
  schema = SK::Api::Schema.read(:invoice, '1.0')
24
- schema[:title].should == 'invoice'
25
- schema[:type].should == 'object'
26
- schema['properties'].should be_a Hash
27
- schema['properties']['id']['identity'].should == true
24
+ expect(schema[:title]).to eq 'invoice'
25
+ expect(schema[:type]).to eq 'object'
26
+ expect(schema['properties']).to be_a Hash
27
+ expect(schema['properties']['id']['identity']).to be true
28
28
  end
29
29
 
30
- it "should read all json schemas" do
30
+ it "reads all json schemas" do
31
31
  schemas = SK::Api::Schema.read_all('1.0')
32
32
 
33
33
  file_path = File.join(File.dirname(__FILE__), '../json', 'v1.0', '*.json')
34
34
  # just check file count
35
- schemas.length.should == Dir.glob( file_path ).length
35
+ expect(schemas.length).to eq Dir.glob( file_path ).length
36
+ end
37
+
38
+ it "reads v2 json schemas" do
39
+ schemas = SK::Api::Schema.read_all('2.0')
40
+
41
+ file_path = File.join(File.dirname(__FILE__), '../json', 'v2.0', '*.json')
42
+ expect(schemas.length).to eq Dir.glob( file_path ).length
36
43
  end
37
44
 
38
45
  it "should raise error if version folder does not exist" do
39
- lambda{
46
+ expect{
40
47
  SK::Api::Schema.read(:invoice, 'v3.0')
41
- }.should raise_error
48
+ }.to raise_error(Errno::ENOENT)
42
49
  end
43
50
 
44
51
  it "should raise error if schema file does not exist" do
45
- lambda{
52
+ expect{
46
53
  SK::Api::Schema.read(:nope, 'v1.0')
47
- }.should raise_error
54
+ }.to raise_error(Errno::ENOENT)
48
55
  end
49
56
 
50
57
  it "should add schema to registry" do
@@ -52,7 +59,6 @@ describe SK::Api::Schema do
52
59
  File.should_not_receive(:open)
53
60
  SK::Api::Schema.read(:credit_note, 'v1.0')
54
61
  end
55
-
56
62
  end
57
63
 
58
64
  context 'object parsing' do
@@ -144,6 +150,16 @@ describe SK::Api::Schema do
144
150
  end
145
151
 
146
152
  end
153
+
154
+ context 'validate v2 schemata' do
155
+ it 'should validate all' do
156
+ schema_path = File.join(SK::Api::Schema.path, 'v2.0')
157
+ errors = JsonSchemaValidator.validate_schemas(schema_path)
158
+ errors.each do |name, error|
159
+ expect(error).to be_empty
160
+ end
161
+ end
162
+ end
147
163
  end
148
164
 
149
165
  ################################################################################
@@ -11,8 +11,7 @@ SimpleCov.coverage_dir 'coverage'
11
11
  require 'rubygems'
12
12
  require 'rspec'
13
13
  require 'sk_api_schema'
14
-
15
-
14
+ require 'json_schema_validator'
16
15
 
17
16
  RSpec.configure do |config|
18
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sk_api_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.6
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Leciejewski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-30 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rdoc
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: simplecov
56
+ name: json_schema_validator
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -128,13 +128,13 @@ files:
128
128
  - json/v1.0/task.json
129
129
  - json/v1.0/text_template.json
130
130
  - json/v1.0/user.json
131
+ - json/v2.0/README.md
131
132
  - json/v2.0/account.json
132
133
  - json/v2.0/account_billing.json
133
134
  - json/v2.0/account_entry.json
134
135
  - json/v2.0/address.json
135
136
  - json/v2.0/attachment.json
136
137
  - json/v2.0/auth_permission.json
137
- - json/v2.0/client.json
138
138
  - json/v2.0/comment.json
139
139
  - json/v2.0/company.json
140
140
  - json/v2.0/contact.json
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.2.2
189
+ rubygems_version: 2.4.8
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: SalesKing API - JSON Schema
@@ -1,318 +0,0 @@
1
- {"type":"object",
2
- "title": "client",
3
- "name": "client",
4
- "description": "A client as seen by SalesKing. This resource is DEPRECATED please use contacts instead with type-field set 'Client'",
5
- "properties":{
6
- "id":{
7
- "description":"Unique identifier - UUID",
8
- "identity":true,
9
- "readonly":true,
10
- "type":"string",
11
- "maxLength": 22,
12
- "minLength":22
13
- },
14
- "number":{
15
- "description": "Unique number, auto-created by SK for new client without number.",
16
- "type":"string",
17
- "maxLength": 50
18
- },
19
- "organisation":{
20
- "description": "Name of a company. This or lastname must be present",
21
- "required" : true,
22
- "type":"string",
23
- "maxLength": 100
24
- },
25
- "last_name":{
26
- "description": "Last name of a person. At least this or the organisation field must be filled for new records",
27
- "type":"string",
28
- "maxLength": 50
29
- },
30
- "first_name":{
31
- "description": "First name of a person.",
32
- "type":"string",
33
- "maxLength": 50
34
- },
35
- "gender":{
36
- "description": "Can be empty for a company. Is used in salutation",
37
- "enum":["male", "female"],
38
- "type":"string"
39
- },
40
- "notes":{
41
- "description": "Notes for a contact. For day to day information you should use comments instead.",
42
- "type":"string",
43
- "format": "text"
44
- },
45
- "position":{
46
- "description": "Position of a person in a company.",
47
- "type":"string",
48
- "maxLength": 50
49
- },
50
- "title":{
51
- "description": "Academical title of a person e.g. Dr., Prof",
52
- "type":"string",
53
- "maxLength": 50
54
- },
55
- "tax_number":{
56
- "description": "Tax number, normally applies to a private person",
57
- "type":"string",
58
- "maxLength": 30
59
- },
60
- "vat_number":{
61
- "description": "VAT number, for a company or person paying value added taxes.",
62
- "type":"string",
63
- "maxLength": 30
64
- },
65
- "email":{
66
- "description": "Email address of the contact.",
67
- "type":"string",
68
- "maxLength": 100
69
- },
70
- "url":{
71
- "description": "An url associated with the person, e.g its company website.",
72
- "type":"string",
73
- "maxLength": 255
74
- },
75
- "birthday":{
76
- "description": "The birthday. YYYY-MM-DD",
77
- "format":"date",
78
- "type":"string"
79
- },
80
- "tag_list":{
81
- "description": "Space separated list of tags. Are split and saved as Tag objects on create, update.",
82
- "type":"string"
83
- },
84
- "created_at":{
85
- "description": "Date the record was created in SK. Never changes afterwards.",
86
- "format":"date-time",
87
- "readonly":true,
88
- "type":"string"
89
- },
90
- "updated_at":{
91
- "description": "Last date when the record was edited.",
92
- "format":"date-time",
93
- "readonly":true,
94
- "type":"string"
95
- },
96
- "language":{
97
- "description": "Should be a valid language short-code: de-DE, fr, en-GB; like defined in your account language menu. When the client is emailed, a localized version of a multi-language template(email, pdf) will be used if available. The language will also be set for new documents.",
98
- "type":"string",
99
- "maxLength": 10
100
- },
101
- "currency":{
102
- "description": "Currency code as defined by the ISO 4217 standard(3-letter UPCASE: EUR, USD). If set the currency is taken for new documents.",
103
- "type":"string",
104
- "maxLength": 3,
105
- "minLength": 3
106
- },
107
- "payment_method":{
108
- "description": "Default payment method for used for new documemts",
109
- "enum":["cash","bank_transfer","credit_card","paypal","direct_debit","cheque", "moneybookers", "premium_sms"],
110
- "type":"string"
111
- },
112
- "bank_name":{
113
- "description": "Bank name",
114
- "type":"string",
115
- "maxLength": 70
116
- },
117
- "bank_number":{
118
- "description": "Bank number",
119
- "type":"string",
120
- "maxLength": 35
121
- },
122
- "bank_account_number":{
123
- "description": "Bank account number.",
124
- "type":"string",
125
- "maxLength": 35
126
- },
127
- "bank_iban":{
128
- "description": "IBAN Number of the bank account. Is validated",
129
- "type":"string",
130
- "maxLength": 35
131
- },
132
- "bank_swift":{
133
- "description": "SWIFT BIC- Bank Identifier Code",
134
- "type":"string",
135
- "maxLength": 11
136
- },
137
- "bank_owner":{
138
- "description": "Bank account owner",
139
- "type":"string",
140
- "maxLength": 70
141
- },
142
- "phone_fax":{
143
- "description": "Fax number",
144
- "type":"string",
145
- "maxLength": 30
146
- },
147
- "phone_office":{
148
- "description": "Office phone number",
149
- "type":"string",
150
- "maxLength": 30
151
- },
152
- "phone_home":{
153
- "description": "Private phone number",
154
- "type":"string",
155
- "maxLength": 30
156
- },
157
- "phone_mobile":{
158
- "description": "Mobile phone number",
159
- "type":"string",
160
- "maxLength": 30
161
- },
162
- "lock_version":{
163
- "description": "Increased on every edit, so SK can detect/prevent a concurrent edit by another user. First save wins.",
164
- "type":"integer"
165
- },
166
- "cash_discount":{
167
- "description": "Default cash discount for new invoices.",
168
- "type":"number"
169
- },
170
- "due_days":{
171
- "description": "Default due days for new invoices.",
172
- "type":"integer"
173
- },
174
- "address_field":{
175
- "description": "Returns the address field used on new docs. Consist of Organisation name and default(first) address",
176
- "readonly":true,
177
- "type":"string"
178
- },
179
- "addresses":{
180
- "description": "A client can have many addresses, sorted by date descending(new first). Default address is the most recent one.",
181
- "type":"array",
182
- "properties" : {"$ref":"./address.json#properties"}
183
- },
184
- "team_id":{
185
- "description": "A team uuid. If set only the team and its parent teams can see the record.",
186
- "type":"string",
187
- "maxLength": 22,
188
- "minLength":22
189
- }
190
- },
191
- "links":[
192
- { "rel": "self",
193
- "href": "clients/{id}"
194
- },
195
- { "rel": "instances",
196
- "href": "clients",
197
- "properties" : {
198
- "page":{
199
- "title" : "Page",
200
- "description": "In paginated results set the page to look for",
201
- "type":"number"
202
- },
203
- "per_page":{
204
- "title" : "Per page",
205
- "description": "Results per page. Default is 50, max is 200",
206
- "type":"number"
207
- },
208
- "filter[q]":{
209
- "title" : "Search",
210
- "description": "Wildcard search in first, last_name, organisation, email, number",
211
- "type":"string"
212
- },
213
- "filter[tags]":{
214
- "title" : "Tags",
215
- "description": "Filter by a space delimited list of tags",
216
- "type":"string"
217
- },
218
- "filter[ids]":{
219
- "title" : "Clients",
220
- "description": "A single or a list of client uuids, comma separated",
221
- "type" : "string"
222
- },
223
- "filter[created_at_from]":{
224
- "title" : "From date",
225
- "description": "Objects with a creation on/after the date(>=). ISO 8601 format YYY-MM-DDThh:mm:ss+z or just a date YYY-MM-DD. If date is given the time is set to the start of the day(00:00:00) so all objects created on this day are included. A time should be already utc time",
226
- "format" : "date-time",
227
- "type" : "string"
228
- },
229
- "filter[created_at_to]":{
230
- "title" : "To date",
231
- "description": "Objects with a creation until the date(<=). ISO 8601 format YYY-MM-DDThh:mm:ss+z or just a date YYY-MM-DD. If date is given the time is set to the end of the day(23:59:59) so all objects created on that day are included. A time should be already utc time.",
232
- "format" : "date-time",
233
- "type" : "string"
234
- },
235
- "filter[birthday_from]":{
236
- "title" : "From birthday date",
237
- "description": "Contacts with a birthday after and on the date. Leave the birthday-to date blank to only search on this day. YYYY-MM-DD",
238
- "format" : "date",
239
- "type" : "string"
240
- },
241
- "filter[birthday_to]":{
242
- "title" : "To birthday date",
243
- "description": "Contacts with a birthday date before and on the date. YYYY-MM-DD",
244
- "format" : "date",
245
- "type" : "string"
246
- },
247
- "filter[creator_ids]":{
248
- "title" : "Creator",
249
- "description": "Objects created by the given users uuids, comma separated",
250
- "type" : "string"
251
- },
252
- "filter[number]":{
253
- "title" : "By number",
254
- "description": "Search by number where the number is matched from the start: number%",
255
- "type" : "string"
256
- },
257
- "filter[languages]":{
258
- "title" : "Languages",
259
- "description": "A single or a list of language codes, comma separated",
260
- "type" : "string"
261
- },
262
- "sort_by":{
263
- "title" : "Sort by",
264
- "description": "Sort the results by the given field => number",
265
- "enum":["organisation", "number","email","first_name","last_name", "created_at", "updated_at"],
266
- "type": "string"
267
- },
268
- "sort":{
269
- "title" : "Sort",
270
- "enum":["ASC","DESC"],
271
- "description": "Sort the results in ASC or DESC"
272
- }
273
- }
274
- },
275
- { "rel": "destroy",
276
- "href": "clients/{id}",
277
- "method": "DELETE"
278
- },
279
- { "rel": "update",
280
- "href": "clients/{id}",
281
- "method": "PUT"
282
- },
283
- { "rel": "create",
284
- "href": "clients",
285
- "method": "POST"
286
- },
287
- { "rel": "documents",
288
- "href": "clients/{id}/documents"
289
- },
290
- { "rel": "attachments",
291
- "href": "clients/{id}/attachments"
292
- },
293
- { "rel": "invoices",
294
- "href": "clients/{id}/invoices"
295
- },
296
- { "rel": "estimates",
297
- "href": "clients/{id}/estimates"
298
- },
299
- { "rel": "orders",
300
- "href": "clients/{id}/orders"
301
- },
302
- { "rel": "credit_notes",
303
- "href": "clients/{id}/credit_notes"
304
- },
305
- { "rel": "recurrings",
306
- "href": "clients/{id}/recurrings"
307
- },
308
- { "rel": "payment_reminders",
309
- "href": "clients/{id}/payment_reminders"
310
- },
311
- { "rel": "comments",
312
- "href": "clients/{id}/comments"
313
- },
314
- { "rel": "emails",
315
- "href": "clients/{id}/emails"
316
- }
317
- ]
318
- }