diff --git a/README.md b/README.md index 2a1d868..788e275 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ harrier dev The visual content is setup in the api-content.jinja template stype page -The content set by this template is reffered to as sections, each section is set out in api.yml +The content set by this template is referred to as sections, each section is set out in api.yml ## Deploying diff --git a/data/actions.json b/data/actions.json index e094be6..93b0171 100644 --- a/data/actions.json +++ b/data/actions.json @@ -896,13 +896,6 @@ "help_text": "When an Administrator exports data about Reports.", "subject_types": [] }, - { - "key": "EXPORTED_USERS", - "value": "EXPORTED_USERS", - "msg": "Exported Users", - "help_text": "When an Administrator exports data about Users.", - "subject_types": [] - }, { "key": "CLIENTS_EXPORT", "value": "CLIENTS_EXPORT", @@ -910,6 +903,20 @@ "help_text": "When an Administrator exports data about Clients.", "subject_types": [] }, + { + "key": "CONTRACTOR_EXPORT", + "value": "CONTRACTOR_EXPORT", + "msg": "Exported Tutors", + "help_text": "When an Administrator exports data about Tutors.", + "subject_types": [] + }, + { + "key": "SERVICE_RECIPIENTS_EXPORT", + "value": "SERVICE_RECIPIENTS_EXPORT", + "msg": "Exported Students", + "help_text": "When an Administrator exports data about Students.", + "subject_types": [] + }, { "key": "EDITED_SYSTEM_SETTINGS", "value": "EDITED_SYSTEM_SETTINGS", diff --git a/pages/agents/agents.yml b/pages/agents/agents.yml index 08b1107..a2013e1 100644 --- a/pages/agents/agents.yml +++ b/pages/agents/agents.yml @@ -39,3 +39,20 @@ sections: code_type: POST code_url: /api/agents/ response: /agents/update-an-agent.json + - + title: Add a Label to an Agent + id: label-add-to-an-agent + description: /agents/label-add-to-an-agent.md + code: /agents/label-add-to-an-agent.py + code_type: POST + code_url: /api/agents//add_label/ + response: /agents/label-add-to-an-agent.json + - + title: Removing a Label from an Agent + id: label-remove-from-an-agent + description: /agents/label-remove-from-an-agent.md + code: /agents/label-remove-from-an-agent.py + code_type: POST + code_url: /api/agents//add_label/ + response: /agents/label-remove-from-an-agent.json + diff --git a/pages/agents/get-an-agent.json b/pages/agents/get-an-agent.json index ac03f41..b740d93 100644 --- a/pages/agents/get-an-agent.json +++ b/pages/agents/get-an-agent.json @@ -21,6 +21,13 @@ "clients": [], "last_updated": "2020-03-16T12:23:39.056867Z", "calendar_colour": "Brown", - "labels": [], + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], "extra_attrs": [] } diff --git a/pages/agents/label-add-to-an-agent.json b/pages/agents/label-add-to-an-agent.json new file mode 100644 index 0000000..475ff91 --- /dev/null +++ b/pages/agents/label-add-to-an-agent.json @@ -0,0 +1,41 @@ +{ + "id": 65, + "user": { + "title": null, + "first_name": "Billy", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London" + }, + "commission_rate": null, + "clients": [], + "last_updated": "2020-03-16T12:23:39.056867Z", + "calendar_colour": "Brown", + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ] +} diff --git a/pages/agents/label-add-to-an-agent.md b/pages/agents/label-add-to-an-agent.md new file mode 100644 index 0000000..437ecbe --- /dev/null +++ b/pages/agents/label-add-to-an-agent.md @@ -0,0 +1,5 @@ +### Adding a Label to an Agent + +For more information on Labels, see the [Labels](#label-object) section. Bear in mind that if the Label has been set up to email admins when added to an object, adding a Label through the API will trigger the email. + +If you add a Label that has already been added to an object, the Label will not be added again and you will get a normal `200` response. diff --git a/pages/agents/label-add-to-an-agent.py b/pages/agents/label-add-to-an-agent.py new file mode 100644 index 0000000..601eabf --- /dev/null +++ b/pages/agents/label-add-to-an-agent.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/agents/65/add_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/agents/label-remove-from-an-agent.json b/pages/agents/label-remove-from-an-agent.json new file mode 100644 index 0000000..8983f8d --- /dev/null +++ b/pages/agents/label-remove-from-an-agent.json @@ -0,0 +1,34 @@ +{ + "id": 65, + "user": { + "title": null, + "first_name": "Billy", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London" + }, + "commission_rate": null, + "clients": [], + "last_updated": "2020-03-16T12:23:39.056867Z", + "calendar_colour": "Brown", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ] +} diff --git a/pages/agents/label-remove-from-an-agent.md b/pages/agents/label-remove-from-an-agent.md new file mode 100644 index 0000000..37a66bf --- /dev/null +++ b/pages/agents/label-remove-from-an-agent.md @@ -0,0 +1,5 @@ +### Removing a Label from an Agent + +For more information on Labels, see the [Labels](#label-object) section. + +If you remove a Label that has already been removed to an object, you will get a normal `200` response. diff --git a/pages/agents/label-remove-from-an-agent.py b/pages/agents/label-remove-from-an-agent.py new file mode 100644 index 0000000..eb89066 --- /dev/null +++ b/pages/agents/label-remove-from-an-agent.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/agents/65/remove_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/clients/clients.yml b/pages/clients/clients.yml index 7be6785..69d3201 100644 --- a/pages/clients/clients.yml +++ b/pages/clients/clients.yml @@ -39,3 +39,19 @@ sections: code_type: POST code_url: /api/clients/ response: /clients/update-a-client.json + - + title: Add a Label to a Client + id: label-add-to-a-client + description: /clients/label-add-to-a-client.md + code: /clients/label-add-to-a-client.py + code_type: POST + code_url: /api/clients//add_label/ + response: /clients/label-add-to-a-client.json + - + title: Removing a Label from a Client + id: label-remove-from-a-client + description: /clients/label-remove-from-a-client.md + code: /clients/label-remove-from-a-client.py + code_type: POST + code_url: /api/clients//add_label/ + response: /clients/label-remove-from-a-client.json diff --git a/pages/clients/get-a-client.json b/pages/clients/get-a-client.json index 20fc18f..f8c633f 100644 --- a/pages/clients/get-a-client.json +++ b/pages/clients/get-a-client.json @@ -64,7 +64,14 @@ } ], "calendar_colour": "ForestGreen", - "labels": [], + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], "extra_attrs": [ { "id": 1, diff --git a/pages/clients/label-add-to-a-client.json b/pages/clients/label-add-to-a-client.json new file mode 100644 index 0000000..f8c633f --- /dev/null +++ b/pages/clients/label-add-to-a-client.json @@ -0,0 +1,86 @@ +{ + "id": 3, + "user": { + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null + }, + "status": "live", + "is_taxable": true, + "received_notifications": [ + "invoice_reminders", + "invoices", + "apt_reminders", + "pfi_reminders", + "credit-requests", + "low_balance_reminders", + "broadcasts" + ], + "charge_via_branch": false, + "invoices_count": 4, + "payment_pending": "100.50", + "auto_charge": true, + "associated_admin": { + "id": 2, + "first_name": "Diana", + "last_name": "Lafayette", + "email": "diana_lafayette@example.com" + }, + "associated_agent": null, + "pipeline_stage": null, + "paid_recipients": [ + { + "id": 4, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/4/" + }, + { + "id": 6, + "first_name": "Harry", + "last_name": "Hoskins", + "email": "harry_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/6/" + }, + { + "id": 5, + "first_name": "Archie", + "last_name": "Hoskins", + "email": "archie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/5/" + } + ], + "calendar_colour": "ForestGreen", + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], + "extra_attrs": [ + { + "id": 1, + "value": "", + "type": "Date", + "machine_name": "client-dob", + "name": "Date of birth" + } + ], + "invoice_balance": "-120.00", + "available_balance": "-220.50" +} diff --git a/pages/clients/label-add-to-a-client.md b/pages/clients/label-add-to-a-client.md new file mode 100644 index 0000000..789ead2 --- /dev/null +++ b/pages/clients/label-add-to-a-client.md @@ -0,0 +1,5 @@ +### Adding a Label to a Client + +For more information on Labels, see the [Labels](#label-object) section. Bear in mind that if the Label has been set up to email admins when added to an object, adding a Label through the API will trigger the email. + +If you add a Label that has already been added to an object, the Label will not be added again and you will get a normal `200` response. diff --git a/pages/clients/label-add-to-a-client.py b/pages/clients/label-add-to-a-client.py new file mode 100644 index 0000000..a256b83 --- /dev/null +++ b/pages/clients/label-add-to-a-client.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/clients/3/add_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/clients/label-remove-from-a-client.json b/pages/clients/label-remove-from-a-client.json new file mode 100644 index 0000000..b016bfa --- /dev/null +++ b/pages/clients/label-remove-from-a-client.json @@ -0,0 +1,34 @@ +{ + "id": 65, + "user": { + "title": null, + "first_name": "Billy", + "last_name": "Bob2", + "email": "billy_bob@example.com", + "mobile": "07123 456 789", + "phone": "0208 123 4567", + "street": "8 Albert Road", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "E80 1FA", + "latitude": "51.5373258999999990", + "longitude": "-0.1496343000000000", + "date_created": "2020-02-18T16:13:04.193340Z", + "timezone": "Europe/London" + }, + "commission_rate": null, + "clients": [], + "last_updated": "2020-03-16T12:23:39.056867Z", + "calendar_colour": "Brown", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "1993-06-23", + "type": "Date", + "machine_name": "user-dob", + "name": "Date of birth" + } + ] +} diff --git a/pages/clients/label-remove-from-a-client.md b/pages/clients/label-remove-from-a-client.md new file mode 100644 index 0000000..1a2ef8c --- /dev/null +++ b/pages/clients/label-remove-from-a-client.md @@ -0,0 +1,5 @@ +### Removing a Label from a Client + +For more information on Labels, see the [Labels](#label-object) section. + +If you remove a Label that has already been removed to an object, you will get a normal `200` response. diff --git a/pages/clients/label-remove-from-a-client.py b/pages/clients/label-remove-from-a-client.py new file mode 100644 index 0000000..6892537 --- /dev/null +++ b/pages/clients/label-remove-from-a-client.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/clients/3/remove_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/contractors/contractors.yml b/pages/contractors/contractors.yml index f42c7ec..b24bcb3 100644 --- a/pages/contractors/contractors.yml +++ b/pages/contractors/contractors.yml @@ -47,4 +47,20 @@ sections: code_type: POST code_url: /api/contractors/ response: /contractors/update-a-contractor.json + - + title: Add a Label to a Contractor + id: label-add-to-a-contractor + description: /contractors/label-add-to-a-contractor.md + code: /contractors/label-add-to-a-contractor.py + code_type: POST + code_url: /api/contractors//add_label/ + response: /contractors/label-add-to-a-contractor.json + - + title: Removing a Label from a Contractor + id: label-remove-from-a-contractor + description: /contractors/label-remove-from-a-contractor.md + code: /contractors/label-remove-from-a-contractor.py + code_type: POST + code_url: /api/contractors//add_label/ + response: /contractors/label-remove-from-a-contractor.json diff --git a/pages/contractors/get-a-contractor.json b/pages/contractors/get-a-contractor.json index 11af289..cfadc4c 100644 --- a/pages/contractors/get-a-contractor.json +++ b/pages/contractors/get-a-contractor.json @@ -39,7 +39,14 @@ "review_duration": "00:00:00", "last_updated": "2020-04-06T15:36:16.924625+01:00", "calendar_colour": "#757575", - "labels": [], + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], "extra_attrs": [], "work_done_details": { "amount_owed": 264.49, diff --git a/pages/contractors/label-add-to-a-contractor.json b/pages/contractors/label-add-to-a-contractor.json new file mode 100644 index 0000000..f8c633f --- /dev/null +++ b/pages/contractors/label-add-to-a-contractor.json @@ -0,0 +1,86 @@ +{ + "id": 3, + "user": { + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null + }, + "status": "live", + "is_taxable": true, + "received_notifications": [ + "invoice_reminders", + "invoices", + "apt_reminders", + "pfi_reminders", + "credit-requests", + "low_balance_reminders", + "broadcasts" + ], + "charge_via_branch": false, + "invoices_count": 4, + "payment_pending": "100.50", + "auto_charge": true, + "associated_admin": { + "id": 2, + "first_name": "Diana", + "last_name": "Lafayette", + "email": "diana_lafayette@example.com" + }, + "associated_agent": null, + "pipeline_stage": null, + "paid_recipients": [ + { + "id": 4, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/4/" + }, + { + "id": 6, + "first_name": "Harry", + "last_name": "Hoskins", + "email": "harry_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/6/" + }, + { + "id": 5, + "first_name": "Archie", + "last_name": "Hoskins", + "email": "archie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/5/" + } + ], + "calendar_colour": "ForestGreen", + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], + "extra_attrs": [ + { + "id": 1, + "value": "", + "type": "Date", + "machine_name": "client-dob", + "name": "Date of birth" + } + ], + "invoice_balance": "-120.00", + "available_balance": "-220.50" +} diff --git a/pages/contractors/label-add-to-a-contractor.md b/pages/contractors/label-add-to-a-contractor.md new file mode 100644 index 0000000..89c8331 --- /dev/null +++ b/pages/contractors/label-add-to-a-contractor.md @@ -0,0 +1,5 @@ +### Adding a Label to a Contractor + +For more information on Labels, see the [Labels](#label-object) section. Bear in mind that if the Label has been set up to email admins when added to an object, adding a Label through the API will trigger the email. + +If you add a Label that has already been added to an object, the Label will not be added again and you will get a normal `200` response. diff --git a/pages/contractors/label-add-to-a-contractor.py b/pages/contractors/label-add-to-a-contractor.py new file mode 100644 index 0000000..2e9de34 --- /dev/null +++ b/pages/contractors/label-add-to-a-contractor.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/contractors/568433/add_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/contractors/label-remove-from-a-contractor.json b/pages/contractors/label-remove-from-a-contractor.json new file mode 100644 index 0000000..d780f7f --- /dev/null +++ b/pages/contractors/label-remove-from-a-contractor.json @@ -0,0 +1,79 @@ +{ + "id": 3, + "user": { + "title": "Mr", + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "mobile": "0207 1128 953", + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2020-01-01T12:00:00.000000Z", + "timezone": null + }, + "status": "live", + "is_taxable": true, + "received_notifications": [ + "invoice_reminders", + "invoices", + "apt_reminders", + "pfi_reminders", + "credit-requests", + "low_balance_reminders", + "broadcasts" + ], + "charge_via_branch": false, + "invoices_count": 4, + "payment_pending": "100.50", + "auto_charge": true, + "associated_admin": { + "id": 2, + "first_name": "Diana", + "last_name": "Lafayette", + "email": "diana_lafayette@example.com" + }, + "associated_agent": null, + "pipeline_stage": null, + "paid_recipients": [ + { + "id": 4, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/4/" + }, + { + "id": 6, + "first_name": "Harry", + "last_name": "Hoskins", + "email": "harry_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/6/" + }, + { + "id": 5, + "first_name": "Archie", + "last_name": "Hoskins", + "email": "archie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/recipients/5/" + } + ], + "calendar_colour": "ForestGreen", + "labels": [], + "extra_attrs": [ + { + "id": 1, + "value": "", + "type": "Date", + "machine_name": "client-dob", + "name": "Date of birth" + } + ], + "invoice_balance": "-120.00", + "available_balance": "-220.50" +} diff --git a/pages/contractors/label-remove-from-a-contractor.md b/pages/contractors/label-remove-from-a-contractor.md new file mode 100644 index 0000000..3075e88 --- /dev/null +++ b/pages/contractors/label-remove-from-a-contractor.md @@ -0,0 +1,5 @@ +### Removing a Label from a Contractor + +For more information on Labels, see the [Labels](#label-object) section. + +If you remove a Label that has already been removed to an object, you will get a normal `200` response. diff --git a/pages/contractors/label-remove-from-a-contractor.py b/pages/contractors/label-remove-from-a-contractor.py new file mode 100644 index 0000000..4ee0e78 --- /dev/null +++ b/pages/contractors/label-remove-from-a-contractor.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/contractors/568433/remove_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/labels/label-object.md b/pages/labels/label-object.md index 414a7ad..85c0dc9 100644 --- a/pages/labels/label-object.md +++ b/pages/labels/label-object.md @@ -1,5 +1,5 @@ ### Label Object -Label objects are used to categorise and group objects in TutorCruncher. They are used to group Administrators, Tutors, Affiliates, Clients, Students and Jobs. +Label objects are used to categorise and group objects in TutorCruncher. They are used to group Administrators, Tutors, Affiliates, Clients, Students and Jobs. See [our help docs](https://help.tutorcruncher.com/en/articles/8237919-labels) for more information. diff --git a/pages/recipients/get-a-recipient.json b/pages/recipients/get-a-recipient.json index 859c413..af7d15e 100644 --- a/pages/recipients/get-a-recipient.json +++ b/pages/recipients/get-a-recipient.json @@ -29,6 +29,13 @@ "academic_year": null, "last_updated": "2019-11-24T16:11:48.312507Z", "calendar_colour": "Khaki", - "labels": [], + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], "extra_attrs": [] } diff --git a/pages/recipients/label-add-to-a-recipient.json b/pages/recipients/label-add-to-a-recipient.json new file mode 100644 index 0000000..af7d15e --- /dev/null +++ b/pages/recipients/label-add-to-a-recipient.json @@ -0,0 +1,41 @@ +{ + "id": 4, + "user": { + "title": null, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null + }, + "default_rate": null, + "paying_client": { + "id": 3, + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/clients/3/" + }, + "associated_clients": [], + "academic_year": null, + "last_updated": "2019-11-24T16:11:48.312507Z", + "calendar_colour": "Khaki", + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], + "extra_attrs": [] +} diff --git a/pages/recipients/label-add-to-a-recipient.md b/pages/recipients/label-add-to-a-recipient.md new file mode 100644 index 0000000..80b345d --- /dev/null +++ b/pages/recipients/label-add-to-a-recipient.md @@ -0,0 +1,5 @@ +### Adding a Label to a Recipient + +For more information on Labels, see the [Labels](#label-object) section. Bear in mind that if the Label has been set up to email admins when added to an object, adding a Label through the API will trigger the email. + +If you add a Label that has already been added to an object, the Label will not be added again and you will get a normal `200` response. diff --git a/pages/recipients/label-add-to-a-recipient.py b/pages/recipients/label-add-to-a-recipient.py new file mode 100644 index 0000000..2ff60b4 --- /dev/null +++ b/pages/recipients/label-add-to-a-recipient.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/recipients/4/add_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/recipients/label-remove-from-a-recipient.json b/pages/recipients/label-remove-from-a-recipient.json new file mode 100644 index 0000000..6a7cfc3 --- /dev/null +++ b/pages/recipients/label-remove-from-a-recipient.json @@ -0,0 +1,34 @@ +{ + "id": 4, + "user": { + "title": null, + "first_name": "Arthur", + "last_name": "Hoskins", + "email": "arthur_hoskins@example.com", + "mobile": null, + "phone": null, + "street": "12 Helmet Row", + "state": null, + "town": "London", + "country": "United Kingdom (GB)", + "postcode": "EC1V 3QJ", + "latitude": "51.5249280000000027", + "longitude": "-0.0944689940000000", + "date_created": "2019-11-24T16:11:48.312507Z", + "timezone": null + }, + "default_rate": null, + "paying_client": { + "id": 3, + "first_name": "Jamie", + "last_name": "Hoskins", + "email": "jamie_hoskins@example.com", + "url": "https://secure.tutorcruncher.com/api/clients/3/" + }, + "associated_clients": [], + "academic_year": null, + "last_updated": "2019-11-24T16:11:48.312507Z", + "calendar_colour": "Khaki", + "labels": [], + "extra_attrs": [] +} diff --git a/pages/recipients/label-remove-from-a-recipient.md b/pages/recipients/label-remove-from-a-recipient.md new file mode 100644 index 0000000..837cbbc --- /dev/null +++ b/pages/recipients/label-remove-from-a-recipient.md @@ -0,0 +1,5 @@ +### Removing a Label from a Recipient + +For more information on Labels, see the [Labels](#label-object) section. + +If you remove a Label that has already been removed to an object, you will get a normal `200` response. diff --git a/pages/recipients/label-remove-from-a-recipient.py b/pages/recipients/label-remove-from-a-recipient.py new file mode 100644 index 0000000..76d3eb6 --- /dev/null +++ b/pages/recipients/label-remove-from-a-recipient.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/recipients/4/remove_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/recipients/recipients.yml b/pages/recipients/recipients.yml index adac7b2..df022fb 100644 --- a/pages/recipients/recipients.yml +++ b/pages/recipients/recipients.yml @@ -39,3 +39,19 @@ sections: code_type: POST code_url: /api/recipients/ response: /recipients/update-a-recipient.json + - + title: Add a Label to a Recipient + id: label-add-to-a-recipient + description: /recipients/label-add-to-a-recipient.md + code: /recipients/label-add-to-a-recipient.py + code_type: POST + code_url: /api/recipients//add_label/ + response: /recipients/label-add-to-a-recipient.json + - + title: Removing a Label from a Recipient + id: label-remove-from-a-recipient + description: /recipients/label-remove-from-a-recipient.md + code: /recipients/label-remove-from-a-recipient.py + code_type: POST + code_url: /api/recipients//add_label/ + response: /recipients/label-remove-from-a-recipient.json diff --git a/pages/services/get-a-service.json b/pages/services/get-a-service.json index 4f155ff..f7ded4d 100644 --- a/pages/services/get-a-service.json +++ b/pages/services/get-a-service.json @@ -27,7 +27,14 @@ "inactivity_time": 14, "is_bookable": false, "is_deleted": false, - "labels": [], + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], "last_updated": "2023-04-18T17:44:08.058199+01:00", "latest_apt_ahc": "2023-04-18T17:44:08.058206+01:00", "name": "Example Name", diff --git a/pages/services/label-add-to-a-service.json b/pages/services/label-add-to-a-service.json new file mode 100644 index 0000000..f7ded4d --- /dev/null +++ b/pages/services/label-add-to-a-service.json @@ -0,0 +1,63 @@ +{ + "allow_proposed_rates": true, + "branch": 17597, + "branch_tax_setup": "Default Company Tax (20%)", + "cap": null, + "colour": "Khaki", + "conjobs": [ + { + "contractor": 1865741, + "contractor_permissions": "add-edit-complete", + "name": "James Higgins", + "pay_rate": "45.00" + } + ], + "contractor_tax_setup": "Default Tutor Tax (no tax)", + "created": "2023-04-18T17:44:08.058135+01:00", + "description": "Example description for the Service which will appear on TutorCruncher", + "dft_charge_type": "hourly", + "dft_charge_rate": 45.0, + "dft_contractor_permissions": "add-edit-complete", + "dft_contractor_rate": 35.0, + "dft_location": null, + "dft_max_srs": 10, + "extra_attrs": [], + "extra_fee_per_apt": null, + "id": 719520, + "inactivity_time": 14, + "is_bookable": false, + "is_deleted": false, + "labels": [ + { + "id": 2, + "name": "Very important", + "machine_name": "very-important", + "url": "https://secure.tutorcruncher.com/api/labels/2/" + } + ], + "last_updated": "2023-04-18T17:44:08.058199+01:00", + "latest_apt_ahc": "2023-04-18T17:44:08.058206+01:00", + "name": "Example Name", + "net_gross": "gross", + "rcrs": [ + { + "recipient": 1865698, + "recipient_name": "Arthur Hoskins", + "paying_client": 1865697, + "paying_client_name": "Jamie Hoskins", + "charge_rate": "35.00", + "agent": null, + "agent_name": null, + "agent_percentage": null + } + ], + "report_required": false, + "require_con_job": false, + "require_rcr": false, + "review_units": 0, + "sales_codes": null, + "desired_skills": [], + "sr_premium": "0.00", + "status": "pending", + "total_apt_units": 0 +} diff --git a/pages/services/label-add-to-a-service.md b/pages/services/label-add-to-a-service.md new file mode 100644 index 0000000..5a853b9 --- /dev/null +++ b/pages/services/label-add-to-a-service.md @@ -0,0 +1,5 @@ +### Adding a Label to a Service + +For more information on Labels, see the [Labels](#label-object) section. Bear in mind that if the Label has been set up to email admins when added to an object, adding a Label through the API will trigger the email. + +If you add a Label that has already been added to an object, the Label will not be added again and you will get a normal `200` response. diff --git a/pages/services/label-add-to-a-service.py b/pages/services/label-add-to-a-service.py new file mode 100644 index 0000000..ab11cf2 --- /dev/null +++ b/pages/services/label-add-to-a-service.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/services/719520/add_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/services/label-remove-from-a-service.json b/pages/services/label-remove-from-a-service.json new file mode 100644 index 0000000..3091ce4 --- /dev/null +++ b/pages/services/label-remove-from-a-service.json @@ -0,0 +1,56 @@ +{ + "allow_proposed_rates": true, + "branch": 17597, + "branch_tax_setup": "Default Company Tax (20%)", + "cap": null, + "colour": "Khaki", + "conjobs": [ + { + "contractor": 1865741, + "contractor_permissions": "add-edit-complete", + "name": "James Higgins", + "pay_rate": "45.00" + } + ], + "contractor_tax_setup": "Default Tutor Tax (no tax)", + "created": "2023-04-18T17:44:08.058135+01:00", + "description": "Example description for the Service which will appear on TutorCruncher", + "dft_charge_type": "hourly", + "dft_charge_rate": 45.0, + "dft_contractor_permissions": "add-edit-complete", + "dft_contractor_rate": 35.0, + "dft_location": null, + "dft_max_srs": 10, + "extra_attrs": [], + "extra_fee_per_apt": null, + "id": 719520, + "inactivity_time": 14, + "is_bookable": false, + "is_deleted": false, + "labels": [], + "last_updated": "2023-04-18T17:44:08.058199+01:00", + "latest_apt_ahc": "2023-04-18T17:44:08.058206+01:00", + "name": "Example Name", + "net_gross": "gross", + "rcrs": [ + { + "recipient": 1865698, + "recipient_name": "Arthur Hoskins", + "paying_client": 1865697, + "paying_client_name": "Jamie Hoskins", + "charge_rate": "35.00", + "agent": null, + "agent_name": null, + "agent_percentage": null + } + ], + "report_required": false, + "require_con_job": false, + "require_rcr": false, + "review_units": 0, + "sales_codes": null, + "desired_skills": [], + "sr_premium": "0.00", + "status": "pending", + "total_apt_units": 0 +} diff --git a/pages/services/label-remove-from-a-service.md b/pages/services/label-remove-from-a-service.md new file mode 100644 index 0000000..103ff7f --- /dev/null +++ b/pages/services/label-remove-from-a-service.md @@ -0,0 +1,5 @@ +### Removing a Label from a Service + +For more information on Labels, see the [Labels](#label-object) section. + +If you remove a Label that has already been removed to an object, you will get a normal `200` response. diff --git a/pages/services/label-remove-from-a-service.py b/pages/services/label-remove-from-a-service.py new file mode 100644 index 0000000..e053603 --- /dev/null +++ b/pages/services/label-remove-from-a-service.py @@ -0,0 +1,8 @@ +import pprint, requests + +headers = {'Authorization': 'token '} +data = { + 'label': 2, +} +r = requests.post('https://secure.tutorcruncher.com/api/services/719520/remove_label/', json=data, headers=headers) +pprint.pprint(r.json()) diff --git a/pages/services/services.yml b/pages/services/services.yml index d0b9f6b..594682f 100644 --- a/pages/services/services.yml +++ b/pages/services/services.yml @@ -39,3 +39,19 @@ sections: code_type: PUT code_url: /api/services// response: /services/update-a-service.json + - + title: Add a Label to a Service + id: label-add-to-a-service + description: /services/label-add-to-a-service.md + code: /services/label-add-to-a-service.py + code_type: POST + code_url: /api/services//add_label/ + response: /services/label-add-to-a-service.json + - + title: Add a Label to a Recipient + id: label-add-to-a-recipient + description: /recipients/label-add-to-a-recipient.md + code: /recipients/label-add-to-a-recipient.py + code_type: POST + code_url: /api/recipients//add_label/ + response: /recipients/label-add-to-a-recipient.json