Skip to content

Commit 040554b

Browse files
committed
updated docs based on the new implementation
1 parent f380925 commit 040554b

File tree

1 file changed

+37
-38
lines changed

1 file changed

+37
-38
lines changed

collections/_sdk/effects/note.md

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ from canvas_sdk.effects.note.note import Note
4242
from canvas_sdk.handlers.base import BaseHandler
4343

4444

45-
class Protocol(BaseHandler):
45+
class MyHandler(BaseHandler):
4646
def compute(self):
4747
note_effect = Note(
4848
note_type_id="note-type-uuid",
@@ -80,7 +80,7 @@ from canvas_sdk.effects.note.note import Note
8080
from canvas_sdk.handlers.base import BaseHandler
8181

8282

83-
class Protocol(BaseHandler):
83+
class MyHandler(BaseHandler):
8484
def compute(self):
8585
note_effect = Note(instance_id="existing-note-uuid")
8686
note_effect.title = "Updated Consultation Notes"
@@ -121,7 +121,7 @@ from canvas_sdk.effects.fax.note import FaxNoteEffect
121121
from canvas_sdk.handlers.base import BaseHandler
122122

123123

124-
class Protocol(BaseHandler):
124+
class MyHandler(BaseHandler):
125125
def compute(self):
126126
# Basic fax without coversheet
127127
fax_effect = FaxNoteEffect(
@@ -140,7 +140,7 @@ from canvas_sdk.effects.fax.note import FaxNoteEffect
140140
from canvas_sdk.handlers.base import BaseHandler
141141

142142

143-
class Protocol(BaseHandler):
143+
class MyHandler(BaseHandler):
144144
def compute(self):
145145
# Fax with coversheet
146146
fax_effect = FaxNoteEffect(
@@ -177,7 +177,7 @@ from canvas_sdk.effects.note.note import Note
177177
from canvas_sdk.handlers.base import BaseHandler
178178

179179

180-
class Protocol(BaseHandler):
180+
class MyHandler(BaseHandler):
181181
def compute(self):
182182
note_effect = Note(instance_id="existing-note-uuid")
183183
return [note_effect.push_charges()]
@@ -204,7 +204,7 @@ from canvas_sdk.effects.note.note import Note
204204
from canvas_sdk.handlers.base import BaseHandler
205205

206206

207-
class Protocol(BaseHandler):
207+
class MyHandler(BaseHandler):
208208
def compute(self):
209209
note_effect = Note(instance_id="existing-note-uuid")
210210
return [note_effect.lock()]
@@ -231,7 +231,7 @@ from canvas_sdk.effects.note.note import Note
231231
from canvas_sdk.handlers.base import BaseHandler
232232

233233

234-
class Protocol(BaseHandler):
234+
class MyHandler(BaseHandler):
235235
def compute(self):
236236
note_effect = Note(instance_id="existing-note-uuid")
237237
return [note_effect.sign()]
@@ -258,7 +258,7 @@ from canvas_sdk.effects.note.note import Note
258258
from canvas_sdk.handlers.base import BaseHandler
259259

260260

261-
class Protocol(BaseHandler):
261+
class MyHandler(BaseHandler):
262262
def compute(self):
263263
note_effect = Note(instance_id="existing-note-uuid")
264264
return [note_effect.unlock()]
@@ -274,35 +274,34 @@ If the same user freezes an already-frozen note, the freeze timer is extended wi
274274

275275
#### Attributes
276276

277-
| Attribute | Type | Description | Required |
278-
|------------|-----------------|--------------------------------------------------------------------|----------|
279-
| `note_id` | `UUID` or `str` | Identifier of the note to freeze | Yes |
280-
| `duration` | `int` | Duration in seconds before the note is automatically unfrozen | No |
281-
| `user_id` | `str` or `None` | Identifier of the user who is freezing the note (the "lock owner") | No |
282-
| `blur` | `bool` | Whether to blur the note body for users other than the lock owner | No |
277+
| Attribute | Type | Description | Required |
278+
|---------------|-----------------|--------------------------------------------------------------------|----------|
279+
| `instance_id` | `UUID` or `str` | Identifier of the note to freeze | Yes |
280+
| `duration` | `int` | Duration in seconds before the note is automatically unfrozen | No |
281+
| `user_id` | `str` or `None` | Identifier of the user who is freezing the note (the "lock owner") | No |
282+
| `blur` | `bool` | Whether to blur the note body for users other than the lock owner | No |
283283

284284
**Defaults**: `duration` = 300 (5 minutes), `blur` = False
285285

286286
#### Example Usage
287287

288288
```python
289-
from canvas_sdk.effects.note.freeze import FreezeNoteEffect
289+
from canvas_sdk.effects.note.note import Note
290290
from canvas_sdk.events import EventType
291291
from canvas_sdk.handlers.base import BaseHandler
292292

293293

294-
class Protocol(BaseHandler):
294+
class MyHandler(BaseHandler):
295295
RESPONDS_TO = EventType.Name(EventType.NOTE_BODY_UPDATED)
296296

297297
def compute(self):
298-
freeze_effect = FreezeNoteEffect(
299-
note_id=self.target,
298+
note_effect = Note(instance_id=self.target)
299+
300+
return [note_effect.freeze(
300301
duration=300,
301302
user_id=self.context.get("user", {}).get("id"),
302303
blur=True,
303-
)
304-
305-
return [freeze_effect.apply()]
304+
)]
306305
```
307306

308307
### Unfreeze
@@ -311,22 +310,22 @@ Unfreezes a previously frozen note, allowing all users to edit it again. This al
311310

312311
#### Attributes
313312

314-
| Attribute | Type | Description | Required |
315-
|-----------|-----------------|------------------------------------|----------|
316-
| `note_id` | `UUID` or `str` | Identifier of the note to unfreeze | Yes |
313+
| Attribute | Type | Description | Required |
314+
|---------------|-----------------|------------------------------------|----------|
315+
| `instance_id` | `UUID` or `str` | Identifier of the note to unfreeze | Yes |
317316

318317
#### Example Usage
319318

320319
```python
321-
from canvas_sdk.effects.note.freeze import UnfreezeNoteEffect
320+
from canvas_sdk.effects.note.note import Note
322321
from canvas_sdk.handlers.base import BaseHandler
323322

324323

325-
class Protocol(BaseHandler):
324+
class MyHandler(BaseHandler):
326325
def compute(self):
327-
unfreeze_effect = UnfreezeNoteEffect(note_id="existing-note-uuid")
326+
note_effect = Note(instance_id="existing-note-uuid")
328327

329-
return [unfreeze_effect.apply()]
328+
return [note_effect.unfreeze()]
330329
```
331330

332331
### Check In
@@ -348,7 +347,7 @@ from canvas_sdk.effects.note.note import Note
348347
from canvas_sdk.handlers.base import BaseHandler
349348

350349

351-
class Protocol(BaseHandler):
350+
class MyHandler(BaseHandler):
352351
def compute(self):
353352
note_effect = Note(instance_id="existing-note-uuid")
354353
return [note_effect.check_in()]
@@ -375,7 +374,7 @@ from canvas_sdk.effects.note.note import Note
375374
from canvas_sdk.handlers.base import BaseHandler
376375

377376

378-
class Protocol(BaseHandler):
377+
class MyHandler(BaseHandler):
379378
def compute(self):
380379
note_effect = Note(instance_id="existing-note-uuid")
381380
return [note_effect.no_show()]
@@ -418,7 +417,7 @@ from canvas_sdk.effects.note.appointment import ScheduleEvent
418417
from canvas_sdk.handlers.base import BaseHandler
419418

420419

421-
class Protocol(BaseHandler):
420+
class MyHandler(BaseHandler):
422421
def compute(self):
423422
schedule_event_effect = ScheduleEvent(
424423
note_type_id="schedule-event-note-type-uuid",
@@ -460,7 +459,7 @@ from canvas_sdk.effects.note.base import AppointmentIdentifier
460459
from canvas_sdk.handlers.base import BaseHandler
461460

462461

463-
class Protocol(BaseHandler):
462+
class MyHandler(BaseHandler):
464463
def compute(self):
465464
schedule_event_effect = ScheduleEvent(instance_id="existing-event-uuid")
466465
schedule_event_effect.start_time = datetime.datetime.now() + datetime.timedelta(days=1)
@@ -501,7 +500,7 @@ from canvas_sdk.effects.note.appointment import ScheduleEvent
501500
from canvas_sdk.handlers.base import BaseHandler
502501

503502

504-
class Protocol(BaseHandler):
503+
class MyHandler(BaseHandler):
505504
def compute(self):
506505
schedule_event_effect = ScheduleEvent(instance_id="existing-event-uuid")
507506
schedule_event_effect.start_time = datetime.datetime.now() + datetime.timedelta(hours=3)
@@ -523,7 +522,7 @@ from canvas_sdk.effects.note.appointment import ScheduleEvent
523522
from canvas_sdk.handlers.base import BaseHandler
524523

525524

526-
class Protocol(BaseHandler):
525+
class MyHandler(BaseHandler):
527526
def compute(self):
528527
schedule_event_effect = ScheduleEvent(instance_id="existing-event-uuid")
529528

@@ -564,7 +563,7 @@ from canvas_sdk.effects.note.appointment import Appointment
564563
from canvas_sdk.handlers.base import BaseHandler
565564

566565

567-
class Protocol(BaseHandler):
566+
class MyHandler(BaseHandler):
568567
def compute(self):
569568
appointment_effect = Appointment(
570569
appointment_note_type_id="appointment-note-type-uuid",
@@ -607,7 +606,7 @@ from canvas_sdk.effects.note.appointment import Appointment
607606
from canvas_sdk.handlers.base import BaseHandler
608607

609608

610-
class Protocol(BaseHandler):
609+
class MyHandler(BaseHandler):
611610
def compute(self):
612611
appointment_effect = Appointment(instance_id="existing-appointment-uuid")
613612
appointment_effect.start_time = datetime.datetime.now() + datetime.timedelta(hours=2)
@@ -645,7 +644,7 @@ from canvas_sdk.effects.note.appointment import Appointment
645644
from canvas_sdk.handlers.base import BaseHandler
646645

647646

648-
class Protocol(BaseHandler):
647+
class MyHandler(BaseHandler):
649648
def compute(self):
650649
appointment_effect = Appointment(instance_id="existing-appointment-uuid")
651650
appointment_effect.start_time = datetime.datetime.now() + datetime.timedelta(days=1)
@@ -665,7 +664,7 @@ from canvas_sdk.effects.note.appointment import Appointment
665664
from canvas_sdk.handlers.base import BaseHandler
666665

667666

668-
class Protocol(BaseHandler):
667+
class MyHandler(BaseHandler):
669668
def compute(self):
670669
appointment_effect = Appointment(instance_id="existing-appointment-uuid")
671670

0 commit comments

Comments
 (0)