Skip to content

Commit

Permalink
local generation
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarco committed Jan 31, 2025
1 parent 7731d18 commit c797770
Show file tree
Hide file tree
Showing 54 changed files with 2,457 additions and 967 deletions.
74 changes: 66 additions & 8 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
lockVersion: 2.0.0
id: f83d894c-c934-499f-8a8d-e128395ae8ff
management:
docChecksum: df920daa1ffe269a97cd51bb03a07002
docChecksum: 8a535acf4d6882a9b0f29742d4b68279
docVersion: "1.0"
speakeasyVersion: 1.480.0
generationVersion: 2.499.0
releaseVersion: 0.3.0
configChecksum: bc8186c34fbd0f4882cade12d98ead4b
speakeasyVersion: 1.481.1
generationVersion: 2.500.5
releaseVersion: 0.3.1
configChecksum: cd9f15119203542c204e1be62977bd58
repoURL: https://github.com/novuhq/novu-py.git
installationURL: https://github.com/novuhq/novu-py.git
published: true
Expand All @@ -15,14 +15,14 @@ features:
acceptHeaders: 3.0.0
additionalDependencies: 1.0.0
constsAndDefaults: 1.0.5
core: 5.10.7
core: 5.10.9
defaultEnabledRetries: 0.2.0
deprecations: 3.0.2
devContainers: 3.0.0
enumUnions: 0.1.0
envVarSecurityUsage: 0.3.2
examples: 3.0.1
flattening: 3.1.0
flattening: 3.1.1
globalSecurity: 3.0.2
globalSecurityCallbacks: 1.0.0
globalSecurityFlattening: 1.0.0
Expand Down Expand Up @@ -130,8 +130,10 @@ generatedFiles:
- docs/models/feedresponsedto.md
- docs/models/fieldfilterpartdto.md
- docs/models/filtertopicsresponsedto.md
- docs/models/getsubscriberpreferencesdto.md
- docs/models/getsubscriberpreferencesresponsedto.md
- docs/models/gettopicresponsedto.md
- docs/models/globalpreferencedto.md
- docs/models/integrationresponsedto.md
- docs/models/integrationscontrollercreateintegrationrequest.md
- docs/models/integrationscontrollercreateintegrationresponse.md
Expand Down Expand Up @@ -211,7 +213,10 @@ generatedFiles:
- docs/models/ordinalvalue.md
- docs/models/ordinalvalueenum.md
- docs/models/overrides.md
- docs/models/overrideschannel.md
- docs/models/parameter.md
- docs/models/patchpreferencechannelsdto.md
- docs/models/patchsubscriberpreferencesdto.md
- docs/models/patchsubscriberrequestdto.md
- docs/models/patchsubscriberrequestdtodata.md
- docs/models/payload.md
Expand All @@ -226,13 +231,16 @@ generatedFiles:
- docs/models/renametopicresponsedto.md
- docs/models/replycallback.md
- docs/models/security.md
- docs/models/source.md
- docs/models/status.md
- docs/models/stepfilterdto.md
- docs/models/steptypeenum.md
- docs/models/subscriberchanneldto.md
- docs/models/subscriberfeedresponsedto.md
- docs/models/subscriberpayloaddto.md
- docs/models/subscriberresponsedto.md
- docs/models/subscriberscontrollergetsubscriberpreferencesrequest.md
- docs/models/subscriberscontrollergetsubscriberpreferencesresponse.md
- docs/models/subscriberscontrollergetsubscriberrequest.md
- docs/models/subscriberscontrollergetsubscriberresponse.md
- docs/models/subscriberscontrollerpatchsubscriberrequest.md
Expand All @@ -241,6 +249,8 @@ generatedFiles:
- docs/models/subscriberscontrollerremovesubscriberresponse.md
- docs/models/subscriberscontrollersearchsubscribersrequest.md
- docs/models/subscriberscontrollersearchsubscribersresponse.md
- docs/models/subscriberscontrollerupdatesubscriberpreferencesrequest.md
- docs/models/subscriberscontrollerupdatesubscriberpreferencesresponse.md
- docs/models/subscribersv1controllerbulkcreatesubscribersrequest.md
- docs/models/subscribersv1controllerbulkcreatesubscribersresponse.md
- docs/models/subscribersv1controllerchataccessoauthrequest.md
Expand Down Expand Up @@ -317,6 +327,7 @@ generatedFiles:
- docs/models/triggereventresponsedto.md
- docs/models/triggereventtoallrequestdto.md
- docs/models/triggereventtoallrequestdtoactor.md
- docs/models/triggereventtoallrequestdtooverrides.md
- docs/models/triggereventtoallrequestdtotenant.md
- docs/models/triggerrecipientstypeenum.md
- docs/models/triggerreservedvariableresponse.md
Expand All @@ -340,7 +351,9 @@ generatedFiles:
- docs/models/validationerrordtovalue.md
- docs/models/value.md
- docs/models/weekdays.md
- docs/models/workflowinfodto.md
- docs/models/workflowintegrationstatus.md
- docs/models/workflowpreferencedto.md
- docs/models/workflowresponse.md
- docs/models/workflowresponsedata.md
- docs/sdks/authentication/README.md
Expand Down Expand Up @@ -433,8 +446,10 @@ generatedFiles:
- src/novu_py/models/feedresponsedto.py
- src/novu_py/models/fieldfilterpartdto.py
- src/novu_py/models/filtertopicsresponsedto.py
- src/novu_py/models/getsubscriberpreferencesdto.py
- src/novu_py/models/getsubscriberpreferencesresponsedto.py
- src/novu_py/models/gettopicresponsedto.py
- src/novu_py/models/globalpreferencedto.py
- src/novu_py/models/integrationresponsedto.py
- src/novu_py/models/integrationscontroller_createintegrationop.py
- src/novu_py/models/integrationscontroller_getactiveintegrationsop.py
Expand Down Expand Up @@ -476,6 +491,9 @@ generatedFiles:
- src/novu_py/models/notificationtriggervariableresponse.py
- src/novu_py/models/ordinalenum.py
- src/novu_py/models/ordinalvalueenum.py
- src/novu_py/models/overrides.py
- src/novu_py/models/patchpreferencechannelsdto.py
- src/novu_py/models/patchsubscriberpreferencesdto.py
- src/novu_py/models/patchsubscriberrequestdto.py
- src/novu_py/models/preference.py
- src/novu_py/models/preferencechannels.py
Expand All @@ -493,9 +511,11 @@ generatedFiles:
- src/novu_py/models/subscriberpayloaddto.py
- src/novu_py/models/subscriberresponsedto.py
- src/novu_py/models/subscriberscontroller_getsubscriberop.py
- src/novu_py/models/subscriberscontroller_getsubscriberpreferencesop.py
- src/novu_py/models/subscriberscontroller_patchsubscriberop.py
- src/novu_py/models/subscriberscontroller_removesubscriberop.py
- src/novu_py/models/subscriberscontroller_searchsubscribersop.py
- src/novu_py/models/subscriberscontroller_updatesubscriberpreferencesop.py
- src/novu_py/models/subscribersv1controller_bulkcreatesubscribersop.py
- src/novu_py/models/subscribersv1controller_chataccessoauthop.py
- src/novu_py/models/subscribersv1controller_chatoauthcallbackop.py
Expand Down Expand Up @@ -549,6 +569,8 @@ generatedFiles:
- src/novu_py/models/updatesubscriberpreferenceresponsedto.py
- src/novu_py/models/updatesubscriberrequestdto.py
- src/novu_py/models/validationerrordto.py
- src/novu_py/models/workflowinfodto.py
- src/novu_py/models/workflowpreferencedto.py
- src/novu_py/models/workflowresponse.py
- src/novu_py/notifications.py
- src/novu_py/novu_messages.py
Expand Down Expand Up @@ -607,7 +629,7 @@ examples:
EventsController_triggerBulk:
speakeasy-default-events-controller-trigger-bulk:
requestBody:
application/json: {"events": [{"name": "workflow_identifier", "payload": {"comment_id": "string", "post": {"text": "string"}}, "overrides": {"fcm": {"data": {"key": "value"}}}, "to": {"subscriberId": "<id>"}}, {"name": "workflow_identifier", "payload": {"comment_id": "string", "post": {"text": "string"}}, "overrides": {"fcm": {"data": {"key": "value"}}}, "to": {"topicKey": "<value>", "type": "Subscriber"}}, {"name": "workflow_identifier", "payload": {"comment_id": "string", "post": {"text": "string"}}, "overrides": {"fcm": {"data": {"key": "value"}}}, "to": ["SUBSCRIBER_ID", "SUBSCRIBER_ID"]}]}
application/json: {"events": [{"name": "workflow_identifier", "payload": {"comment_id": "string", "post": {"text": "string"}}, "overrides": {"fcm": {"data": {"key": "value"}}}, "to": {"subscriberId": "<id>"}}, {"name": "workflow_identifier", "payload": {"comment_id": "string", "post": {"text": "string"}}, "overrides": {"fcm": {"data": {"key": "value"}}}, "to": [{"topicKey": "<value>", "type": "Subscriber"}]}, {"name": "workflow_identifier", "payload": {"comment_id": "string", "post": {"text": "string"}}, "overrides": {"fcm": {"data": {"key": "value"}}}, "to": ["SUBSCRIBER_ID", "SUBSCRIBER_ID"]}]}
responses:
"201":
application/json: [{"acknowledged": true, "status": "error"}, {"acknowledged": true, "status": "no_workflow_active_steps_defined"}, {"acknowledged": true, "status": "trigger_not_active"}]
Expand Down Expand Up @@ -1470,5 +1492,41 @@ examples:
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123", "errors": {"fieldName1": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName2": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName3": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName4": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}}}
"500":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}
SubscribersController_getSubscriberPreferences:
speakeasy-default-subscribers-controller-get-subscriber-preferences:
parameters:
path:
subscriberId: "<id>"
header: {}
responses:
"200":
application/json: {"global": {"enabled": true, "channels": {}}, "workflows": [{"enabled": true, "channels": {}, "overrides": [{"channel": "in_app", "source": "template"}], "workflow": {"slug": "<value>", "identifier": "<value>", "name": "<value>"}}, {"enabled": false, "channels": {}, "overrides": [], "workflow": {"slug": "<value>", "identifier": "<value>", "name": "<value>"}}, {"enabled": false, "channels": {}, "overrides": [], "workflow": {"slug": "<value>", "identifier": "<value>", "name": "<value>"}}]}
"414":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}
"400":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}
"422":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123", "errors": {"fieldName1": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName2": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName3": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName4": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}}}
"500":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}
SubscribersController_updateSubscriberPreferences:
speakeasy-default-subscribers-controller-update-subscriber-preferences:
parameters:
path:
subscriberId: "<id>"
header: {}
requestBody:
application/json: {"channels": {}}
responses:
"200":
application/json: {"global": {"enabled": false, "channels": {}}, "workflows": [{"enabled": true, "channels": {}, "overrides": [{"channel": "chat", "source": "template"}, {"channel": "push", "source": "subscriber"}, {"channel": "push", "source": "template"}], "workflow": {"slug": "<value>", "identifier": "<value>", "name": "<value>"}}, {"enabled": true, "channels": {}, "overrides": [], "workflow": {"slug": "<value>", "identifier": "<value>", "name": "<value>"}}]}
"414":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}
"400":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}
"422":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123", "errors": {"fieldName1": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName2": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName3": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}, "fieldName4": {"messages": ["Field is required", "Invalid format"], "value": "xx xx xx "}}}
"500":
application/json: {"statusCode": 404, "timestamp": "2024-12-12T13:00:00Z", "path": "/api/v1/resource", "message": "Resource not found.", "ctx": {"workflowId": "some_wf_id", "stepId": "some_wf_id"}, "errorId": "abc123"}
examplesVersion: 1.0.0
generatedTests: {}
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ generation:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: true
python:
version: 0.3.0
version: 0.3.1
additionalDependencies:
dev:
- pytest>=6.0.0
Expand Down
12 changes: 6 additions & 6 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
speakeasyVersion: 1.480.0
speakeasyVersion: 1.481.1
sources:
novu-OAS:
sourceNamespace: novu-oas
sourceRevisionDigest: sha256:2f2b2bbec58fe6dd2249927dc6cad537de65b1ec7c272eb355b2fa85ff36993e
sourceBlobDigest: sha256:f1f23afd38066a7a52e04d578cb3102c4a48406c4e1d90ca7219ccad681698d3
sourceRevisionDigest: sha256:440e5a529f600c918908bbe22b108a7ca890dafa5c4cc4a68f0e09ea632c54be
sourceBlobDigest: sha256:6069d31f5e273690c45ca9f77302879921f2a385dd2fefed297a93f7bbc36865
tags:
- latest
- "1.0"
targets:
novu:
source: novu-OAS
sourceNamespace: novu-oas
sourceRevisionDigest: sha256:2f2b2bbec58fe6dd2249927dc6cad537de65b1ec7c272eb355b2fa85ff36993e
sourceBlobDigest: sha256:f1f23afd38066a7a52e04d578cb3102c4a48406c4e1d90ca7219ccad681698d3
sourceRevisionDigest: sha256:440e5a529f600c918908bbe22b108a7ca890dafa5c4cc4a68f0e09ea632c54be
sourceBlobDigest: sha256:6069d31f5e273690c45ca9f77302879921f2a385dd2fefed297a93f7bbc36865
codeSamplesNamespace: novu-oas-python-code-samples
codeSamplesRevisionDigest: sha256:8f51bfe0a8221600379dee0ab850388b53a16437508020d5d2632143799ce63f
codeSamplesRevisionDigest: sha256:bec0e753e998822f3fbafc46e31ee7b3aed98bfb2fd43d4c3d677491afabfc97
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ speakeasyVersion: latest
sources:
novu-OAS:
inputs:
- location: https://api.novu.co/openapi.sdk.yaml
- location: http://127.0.0.1:3000/openapi.sdk.yaml
overlays:
- location: .speakeasy/speakeasy-modifications-overlay.yaml
registry:
Expand Down
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,37 @@ pip install novu-py
```bash
poetry add novu-py
```

### Shell and script usage with `uv`

You can use this SDK in a Python shell with [uv](https://docs.astral.sh/uv/) and the `uvx` command that comes with it like so:

```shell
uvx --from novu-py python
```

It's also possible to write a standalone Python script without needing to set up a whole project like so:

```python
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.9"
# dependencies = [
# "novu-py",
# ]
# ///

from novu_py import Novu

sdk = Novu(
# SDK arguments
)

# Rest of script here...
```

Once that is saved to a file, you can run it with `uv run script.py` where
`script.py` can be replaced with the actual file name.
<!-- End SDK Installation [installation] -->

<!-- Start IDE Support [idesupport] -->
Expand Down Expand Up @@ -504,7 +535,9 @@ asyncio.run(main())
* [list](docs/sdks/preferences/README.md#list) - Get subscriber preferences
* [update_global](docs/sdks/preferences/README.md#update_global) - Update subscriber global preferences
* [retrieve_by_level](docs/sdks/preferences/README.md#retrieve_by_level) - Get subscriber preferences by level
* [update](docs/sdks/preferences/README.md#update) - Update subscriber preference
* [update_legacy](docs/sdks/preferences/README.md#update_legacy) - Update subscriber preference
* [retrieve](docs/sdks/preferences/README.md#retrieve) - Get subscriber preferences
* [update](docs/sdks/preferences/README.md#update) - Update subscriber global or workflow specific preferences

#### [subscribers.properties](docs/sdks/properties/README.md)

Expand Down Expand Up @@ -543,7 +576,7 @@ with Novu(
secret_key=os.getenv("NOVU_SECRET_KEY", ""),
) as novu:

res = novu.subscribers.list(limit=10)
res = novu.subscribers.list()

while res is not None:
# Handle items
Expand Down
9 changes: 9 additions & 0 deletions docs/models/getsubscriberpreferencesdto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# GetSubscriberPreferencesDto


## Fields

| Field | Type | Required | Description |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
| `global_` | [models.GlobalPreferenceDto](../models/globalpreferencedto.md) | :heavy_check_mark: | Global preference settings |
| `workflows` | List[[models.WorkflowPreferenceDto](../models/workflowpreferencedto.md)] | :heavy_check_mark: | Workflow-specific preference settings |
9 changes: 9 additions & 0 deletions docs/models/globalpreferencedto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# GlobalPreferenceDto


## Fields

| Field | Type | Required | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `enabled` | *bool* | :heavy_check_mark: | Whether notifications are enabled globally |
| `channels` | [models.PreferenceChannels](../models/preferencechannels.md) | :heavy_check_mark: | Channel-specific preference settings |
Loading

0 comments on commit c797770

Please sign in to comment.