karrio-cli 2025.5rc3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- karrio_cli/__init__.py +0 -0
- karrio_cli/__main__.py +105 -0
- karrio_cli/ai/README.md +335 -0
- karrio_cli/ai/__init__.py +0 -0
- karrio_cli/ai/commands.py +102 -0
- karrio_cli/ai/karrio_ai/__init__.py +1 -0
- karrio_cli/ai/karrio_ai/agent.py +972 -0
- karrio_cli/ai/karrio_ai/architecture/INTEGRATION_AGENT_PROMPT.md +497 -0
- karrio_cli/ai/karrio_ai/architecture/MAPPING_AGENT_PROMPT.md +355 -0
- karrio_cli/ai/karrio_ai/architecture/REAL_WORLD_TESTING.md +305 -0
- karrio_cli/ai/karrio_ai/architecture/SCHEMA_AGENT_PROMPT.md +183 -0
- karrio_cli/ai/karrio_ai/architecture/TESTING_AGENT_PROMPT.md +448 -0
- karrio_cli/ai/karrio_ai/architecture/TESTING_GUIDE.md +271 -0
- karrio_cli/ai/karrio_ai/enhanced_tools.py +943 -0
- karrio_cli/ai/karrio_ai/rag_system.py +503 -0
- karrio_cli/ai/karrio_ai/tests/test_agent.py +350 -0
- karrio_cli/ai/karrio_ai/tests/test_real_integration.py +360 -0
- karrio_cli/ai/karrio_ai/tests/test_real_world_scenarios.py +513 -0
- karrio_cli/commands/__init__.py +0 -0
- karrio_cli/commands/codegen.py +336 -0
- karrio_cli/commands/login.py +139 -0
- karrio_cli/commands/plugins.py +168 -0
- karrio_cli/commands/sdk.py +870 -0
- karrio_cli/common/queries.py +101 -0
- karrio_cli/common/utils.py +368 -0
- karrio_cli/resources/__init__.py +0 -0
- karrio_cli/resources/carriers.py +91 -0
- karrio_cli/resources/connections.py +207 -0
- karrio_cli/resources/events.py +151 -0
- karrio_cli/resources/logs.py +151 -0
- karrio_cli/resources/orders.py +144 -0
- karrio_cli/resources/shipments.py +210 -0
- karrio_cli/resources/trackers.py +287 -0
- karrio_cli/templates/__init__.py +9 -0
- karrio_cli/templates/__pycache__/__init__.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/__init__.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/address.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/address.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/docs.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/docs.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/documents.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/documents.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/manifest.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/manifest.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/pickup.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/pickup.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/rates.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/rates.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/sdk.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/sdk.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/shipments.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/shipments.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/tracking.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/tracking.cpython-312.pyc +0 -0
- karrio_cli/templates/address.py +308 -0
- karrio_cli/templates/docs.py +150 -0
- karrio_cli/templates/documents.py +428 -0
- karrio_cli/templates/manifest.py +396 -0
- karrio_cli/templates/pickup.py +839 -0
- karrio_cli/templates/rates.py +638 -0
- karrio_cli/templates/sdk.py +947 -0
- karrio_cli/templates/shipments.py +892 -0
- karrio_cli/templates/tracking.py +437 -0
- karrio_cli-2025.5rc3.dist-info/METADATA +165 -0
- karrio_cli-2025.5rc3.dist-info/RECORD +68 -0
- karrio_cli-2025.5rc3.dist-info/WHEEL +5 -0
- karrio_cli-2025.5rc3.dist-info/entry_points.txt +2 -0
- karrio_cli-2025.5rc3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,210 @@
|
|
1
|
+
import typer
|
2
|
+
import karrio_cli.common.utils as utils
|
3
|
+
import typing
|
4
|
+
import datetime
|
5
|
+
|
6
|
+
app = typer.Typer()
|
7
|
+
|
8
|
+
|
9
|
+
@app.command("list")
|
10
|
+
def list_shipments(
|
11
|
+
address: typing.Optional[str] = None,
|
12
|
+
carrier_name: typing.Optional[str] = None,
|
13
|
+
created_after: typing.Optional[datetime.datetime] = None,
|
14
|
+
created_before: typing.Optional[datetime.datetime] = None,
|
15
|
+
has_manifest: typing.Optional[bool] = None,
|
16
|
+
has_tracker: typing.Optional[bool] = None,
|
17
|
+
id: typing.Optional[str] = None,
|
18
|
+
keyword: typing.Optional[str] = None,
|
19
|
+
meta_key: typing.Optional[str] = None,
|
20
|
+
meta_value: typing.Optional[str] = None,
|
21
|
+
metadata_key: typing.Optional[str] = None,
|
22
|
+
metadata_value: typing.Optional[str] = None,
|
23
|
+
option_key: typing.Optional[str] = None,
|
24
|
+
option_value: typing.Optional[str] = None,
|
25
|
+
reference: typing.Optional[str] = None,
|
26
|
+
service: typing.Optional[str] = None,
|
27
|
+
status: typing.Optional[str] = None,
|
28
|
+
tracking_number: typing.Optional[str] = None,
|
29
|
+
limit: int = typer.Option(20, help="Number of results to return per page"),
|
30
|
+
offset: int = typer.Option(
|
31
|
+
0, help="The initial index from which to return the results"
|
32
|
+
),
|
33
|
+
pretty: bool = typer.Option(
|
34
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
35
|
+
),
|
36
|
+
line_numbers: bool = typer.Option(
|
37
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
38
|
+
),
|
39
|
+
):
|
40
|
+
"""
|
41
|
+
List all shipments with optional filters and pagination.
|
42
|
+
|
43
|
+
Examples:
|
44
|
+
```terminal
|
45
|
+
# Get all shipments and display as a table
|
46
|
+
kcli shipments list --limit 10 | jq -r '.results[] | [.id, .status, .carrier_name, .tracking_number] | @tsv' | column -t -s $'\t'
|
47
|
+
```
|
48
|
+
|
49
|
+
```terminal
|
50
|
+
# Get pending shipments and extract specific fields
|
51
|
+
kcli shipments list --status pending --limit 5 | jq '.results[] | {id, status, carrier: .carrier_name, tracking: .tracking_number}'
|
52
|
+
```
|
53
|
+
"""
|
54
|
+
params = {
|
55
|
+
"address": address,
|
56
|
+
"carrier_name": carrier_name,
|
57
|
+
"created_after": created_after.isoformat() if created_after else None,
|
58
|
+
"created_before": created_before.isoformat() if created_before else None,
|
59
|
+
"has_manifest": has_manifest,
|
60
|
+
"has_tracker": has_tracker,
|
61
|
+
"id": id,
|
62
|
+
"keyword": keyword,
|
63
|
+
"meta_key": meta_key,
|
64
|
+
"meta_value": meta_value,
|
65
|
+
"metadata_key": metadata_key,
|
66
|
+
"metadata_value": metadata_value,
|
67
|
+
"option_key": option_key,
|
68
|
+
"option_value": option_value,
|
69
|
+
"reference": reference,
|
70
|
+
"service": service,
|
71
|
+
"status": status,
|
72
|
+
"tracking_number": tracking_number,
|
73
|
+
"limit": limit,
|
74
|
+
"offset": offset,
|
75
|
+
}
|
76
|
+
|
77
|
+
# Remove None values from params
|
78
|
+
params = {k: v for k, v in params.items() if v is not None}
|
79
|
+
|
80
|
+
utils.make_get_request(
|
81
|
+
"v1/shipments", params=params, pretty_print=pretty, line_numbers=line_numbers
|
82
|
+
)
|
83
|
+
|
84
|
+
|
85
|
+
@app.command("retrieve")
|
86
|
+
def retrieve_shipment(
|
87
|
+
shipment_id: str,
|
88
|
+
pretty: bool = typer.Option(
|
89
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
90
|
+
),
|
91
|
+
line_numbers: bool = typer.Option(
|
92
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
93
|
+
),
|
94
|
+
):
|
95
|
+
"""
|
96
|
+
Retrieve a shipment by ID.
|
97
|
+
|
98
|
+
Example:
|
99
|
+
```terminal
|
100
|
+
kcli shipments retrieve shp_123456789 | jq '{id, status, carrier: .carrier_name, tracking: .tracking_number, created: .created_at}'
|
101
|
+
```
|
102
|
+
"""
|
103
|
+
utils.make_get_request(
|
104
|
+
f"v1/shipments/{shipment_id}", pretty_print=pretty, line_numbers=line_numbers
|
105
|
+
)
|
106
|
+
|
107
|
+
|
108
|
+
@app.command("buy-label")
|
109
|
+
def buy_label(
|
110
|
+
shipment_id: str,
|
111
|
+
selected_rate_id: str = typer.Option(..., help="The ID of the selected rate"),
|
112
|
+
label_type: str = typer.Option("PDF", help="The type of label to generate"),
|
113
|
+
property: typing.List[str] = typer.Option(
|
114
|
+
[],
|
115
|
+
"--property",
|
116
|
+
"-d",
|
117
|
+
help="Set nested properties (e.g. -d payment[paid_by]=sender)",
|
118
|
+
),
|
119
|
+
pretty: bool = typer.Option(
|
120
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
121
|
+
),
|
122
|
+
line_numbers: bool = typer.Option(
|
123
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
124
|
+
),
|
125
|
+
):
|
126
|
+
"""
|
127
|
+
Purchase a label for a shipment.
|
128
|
+
|
129
|
+
Example:
|
130
|
+
```terminal
|
131
|
+
kcli shipments buy-label shp_123456789 \
|
132
|
+
--selected-rate-id rate_987654321 \
|
133
|
+
--label-type PDF \
|
134
|
+
-d payment[paid_by]=sender \
|
135
|
+
-d payment[currency]=USD \
|
136
|
+
-d reference=order_12345 \
|
137
|
+
-d metadata[customer_id]=cust_9876 | jq '{id, status, label: .label_url, tracking: .tracking_number}'
|
138
|
+
```
|
139
|
+
"""
|
140
|
+
payload = {
|
141
|
+
"selected_rate_id": selected_rate_id,
|
142
|
+
"label_type": label_type,
|
143
|
+
}
|
144
|
+
|
145
|
+
try:
|
146
|
+
nested_properties = utils.parse_nested_properties(property)
|
147
|
+
payload.update(nested_properties)
|
148
|
+
except ValueError as e:
|
149
|
+
typer.echo(str(e), err=True)
|
150
|
+
raise typer.Exit(code=1)
|
151
|
+
|
152
|
+
utils.make_post_request(
|
153
|
+
f"v1/shipments/{shipment_id}/purchase",
|
154
|
+
payload=payload,
|
155
|
+
pretty_print=pretty,
|
156
|
+
line_numbers=line_numbers,
|
157
|
+
)
|
158
|
+
|
159
|
+
|
160
|
+
@app.command("cancel")
|
161
|
+
def cancel_shipment(
|
162
|
+
shipment_id: str,
|
163
|
+
pretty: bool = typer.Option(
|
164
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
165
|
+
),
|
166
|
+
line_numbers: bool = typer.Option(
|
167
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
168
|
+
),
|
169
|
+
):
|
170
|
+
"""
|
171
|
+
Cancel a shipment.
|
172
|
+
|
173
|
+
Example:
|
174
|
+
```terminal
|
175
|
+
kcli shipments cancel shp_123456789 | jq '{id, status, message: .cancellation.message}'
|
176
|
+
```
|
177
|
+
"""
|
178
|
+
utils.make_post_request(
|
179
|
+
f"v1/shipments/{shipment_id}/cancel",
|
180
|
+
payload={},
|
181
|
+
pretty_print=pretty,
|
182
|
+
line_numbers=line_numbers,
|
183
|
+
)
|
184
|
+
|
185
|
+
|
186
|
+
@app.command("fetch-rates")
|
187
|
+
def fetch_rates(
|
188
|
+
shipment_id: str,
|
189
|
+
pretty: bool = typer.Option(
|
190
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
191
|
+
),
|
192
|
+
line_numbers: bool = typer.Option(
|
193
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
194
|
+
),
|
195
|
+
):
|
196
|
+
"""
|
197
|
+
Fetch rates for a shipment.
|
198
|
+
|
199
|
+
Example:
|
200
|
+
|
201
|
+
```terminal
|
202
|
+
kcli shipments fetch-rates shp_123456789 | jq '.[] | {carrier: .carrier_name, service: .service, total_charge: .total_charge}'
|
203
|
+
```
|
204
|
+
"""
|
205
|
+
utils.make_post_request(
|
206
|
+
f"v1/shipments/{shipment_id}/rates",
|
207
|
+
payload={},
|
208
|
+
pretty_print=pretty,
|
209
|
+
line_numbers=line_numbers,
|
210
|
+
)
|
@@ -0,0 +1,287 @@
|
|
1
|
+
import typer
|
2
|
+
import typing
|
3
|
+
import datetime
|
4
|
+
import karrio_cli.common.utils as utils
|
5
|
+
|
6
|
+
app = typer.Typer()
|
7
|
+
|
8
|
+
|
9
|
+
@app.command("list")
|
10
|
+
def list_trackers(
|
11
|
+
carrier_name: typing.Optional[str] = None,
|
12
|
+
tracking_number: typing.Optional[str] = None,
|
13
|
+
status: typing.Optional[str] = None,
|
14
|
+
created_after: typing.Optional[datetime.datetime] = None,
|
15
|
+
created_before: typing.Optional[datetime.datetime] = None,
|
16
|
+
limit: int = typer.Option(20, help="Number of results to return per page"),
|
17
|
+
offset: int = typer.Option(
|
18
|
+
0, help="The initial index from which to return the results"
|
19
|
+
),
|
20
|
+
pretty: bool = typer.Option(
|
21
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
22
|
+
),
|
23
|
+
line_numbers: bool = typer.Option(
|
24
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
25
|
+
),
|
26
|
+
):
|
27
|
+
"""
|
28
|
+
List all trackers with optional filters and pagination.
|
29
|
+
|
30
|
+
Examples:
|
31
|
+
```terminal
|
32
|
+
# Get all trackers and display as a table
|
33
|
+
kcli trackers list --limit 10 | jq -r ".results[] | [.id, .tracking_number, .carrier_name, .status] | @tsv" | column -t -s $"\t"
|
34
|
+
```
|
35
|
+
|
36
|
+
```terminal
|
37
|
+
# Get in-transit trackers and extract specific fields
|
38
|
+
kcli trackers list --status in_transit --limit 5 | jq ".results[] | {id, tracking: .tracking_number, carrier: .carrier_name, status}"
|
39
|
+
```
|
40
|
+
|
41
|
+
Example Output:
|
42
|
+
```json
|
43
|
+
{
|
44
|
+
"count": 10,
|
45
|
+
"next": "/v1/trackers?limit=10&offset=10",
|
46
|
+
"previous": null,
|
47
|
+
"results": [
|
48
|
+
{
|
49
|
+
"id": "trk_123456789",
|
50
|
+
"tracking_number": "1Z999AA1234567890",
|
51
|
+
"carrier_name": "ups",
|
52
|
+
"status": "in_transit",
|
53
|
+
"created_at": "2024-03-20T10:30:00Z",
|
54
|
+
"events": [
|
55
|
+
{
|
56
|
+
"date": "2024-03-20T10:30:00Z",
|
57
|
+
"description": "Package picked up",
|
58
|
+
"location": "San Francisco, CA",
|
59
|
+
"code": "PU"
|
60
|
+
}
|
61
|
+
],
|
62
|
+
"metadata": {}
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}
|
66
|
+
```
|
67
|
+
"""
|
68
|
+
params = {
|
69
|
+
"carrier_name": carrier_name,
|
70
|
+
"tracking_number": tracking_number,
|
71
|
+
"status": status,
|
72
|
+
"created_after": created_after.isoformat() if created_after else None,
|
73
|
+
"created_before": created_before.isoformat() if created_before else None,
|
74
|
+
"limit": limit,
|
75
|
+
"offset": offset,
|
76
|
+
}
|
77
|
+
|
78
|
+
# Remove None values from params
|
79
|
+
params = {k: v for k, v in params.items() if v is not None}
|
80
|
+
|
81
|
+
utils.make_get_request(
|
82
|
+
"v1/trackers", params=params, pretty_print=pretty, line_numbers=line_numbers
|
83
|
+
)
|
84
|
+
|
85
|
+
|
86
|
+
@app.command("retrieve")
|
87
|
+
def retrieve_tracker(
|
88
|
+
tracker_id: str,
|
89
|
+
pretty: bool = typer.Option(
|
90
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
91
|
+
),
|
92
|
+
line_numbers: bool = typer.Option(
|
93
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
94
|
+
),
|
95
|
+
):
|
96
|
+
"""
|
97
|
+
Retrieve a tracker by ID.
|
98
|
+
|
99
|
+
Example:
|
100
|
+
```terminal
|
101
|
+
kcli trackers retrieve trk_123456789 | jq "{id, tracking: .tracking_number, carrier: .carrier_name, status, last_event: .events[-1].description}"
|
102
|
+
```
|
103
|
+
|
104
|
+
Example Output:
|
105
|
+
```json
|
106
|
+
{
|
107
|
+
"id": "trk_123456789",
|
108
|
+
"tracking_number": "1Z999AA1234567890",
|
109
|
+
"carrier_name": "ups",
|
110
|
+
"status": "delivered",
|
111
|
+
"created_at": "2024-03-19T15:45:00Z",
|
112
|
+
"events": [
|
113
|
+
{
|
114
|
+
"date": "2024-03-20T14:30:00Z",
|
115
|
+
"description": "Package delivered",
|
116
|
+
"location": "New York, NY",
|
117
|
+
"code": "DL"
|
118
|
+
}
|
119
|
+
],
|
120
|
+
"metadata": {
|
121
|
+
"order_id": "ORD12345"
|
122
|
+
}
|
123
|
+
}
|
124
|
+
```
|
125
|
+
"""
|
126
|
+
utils.make_get_request(
|
127
|
+
f"v1/trackers/{tracker_id}", pretty_print=pretty, line_numbers=line_numbers
|
128
|
+
)
|
129
|
+
|
130
|
+
|
131
|
+
@app.command("create")
|
132
|
+
def create_tracker(
|
133
|
+
tracking_number: str = typer.Option(..., help="The tracking number"),
|
134
|
+
carrier_name: str = typer.Option(..., help="The carrier name"),
|
135
|
+
account_number: typing.Optional[str] = typer.Option(
|
136
|
+
None, help="The account number"
|
137
|
+
),
|
138
|
+
reference: typing.Optional[str] = typer.Option(
|
139
|
+
None, help="A reference for the tracker"
|
140
|
+
),
|
141
|
+
property: typing.List[str] = typer.Option(
|
142
|
+
[],
|
143
|
+
"--property",
|
144
|
+
"-d",
|
145
|
+
help="Set nested properties (e.g. -d info[customer_name]=John Doe)",
|
146
|
+
),
|
147
|
+
pretty: bool = typer.Option(
|
148
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
149
|
+
),
|
150
|
+
line_numbers: bool = typer.Option(
|
151
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
152
|
+
),
|
153
|
+
):
|
154
|
+
"""
|
155
|
+
Create a new tracker.
|
156
|
+
|
157
|
+
Example:
|
158
|
+
```terminal
|
159
|
+
kcli trackers create --tracking-number 1Z999AA1234567890 --carrier-name ups \\
|
160
|
+
-d info[customer_name]="John Doe" \\
|
161
|
+
-d info[order_id]=ORD12345 \\
|
162
|
+
-d metadata[source]=website | jq "{id, tracking: .tracking_number, carrier: .carrier_name, status}"
|
163
|
+
```
|
164
|
+
|
165
|
+
Example Output:
|
166
|
+
```json
|
167
|
+
{
|
168
|
+
"id": "trk_123456789",
|
169
|
+
"tracking_number": "1Z999AA1234567890",
|
170
|
+
"carrier_name": "ups",
|
171
|
+
"status": "unknown",
|
172
|
+
"created_at": "2024-03-20T10:30:00Z",
|
173
|
+
"info": {
|
174
|
+
"customer_name": "John Doe",
|
175
|
+
"order_id": "ORD12345"
|
176
|
+
},
|
177
|
+
"metadata": {
|
178
|
+
"source": "website"
|
179
|
+
}
|
180
|
+
}
|
181
|
+
```
|
182
|
+
"""
|
183
|
+
payload = {
|
184
|
+
"tracking_number": tracking_number,
|
185
|
+
"carrier_name": carrier_name,
|
186
|
+
"account_number": account_number,
|
187
|
+
"reference": reference,
|
188
|
+
}
|
189
|
+
|
190
|
+
try:
|
191
|
+
nested_properties = utils.parse_nested_properties(property)
|
192
|
+
payload.update(nested_properties)
|
193
|
+
except ValueError as e:
|
194
|
+
typer.echo(str(e), err=True)
|
195
|
+
raise typer.Exit(code=1)
|
196
|
+
|
197
|
+
utils.make_post_request(
|
198
|
+
"v1/trackers", payload=payload, pretty_print=pretty, line_numbers=line_numbers
|
199
|
+
)
|
200
|
+
|
201
|
+
|
202
|
+
@app.command("update")
|
203
|
+
def update_tracker(
|
204
|
+
tracker_id: str,
|
205
|
+
property: typing.List[str] = typer.Option(
|
206
|
+
[],
|
207
|
+
"--property",
|
208
|
+
"-d",
|
209
|
+
help="Set nested properties (e.g. -d info[customer_name]=John Doe)",
|
210
|
+
),
|
211
|
+
pretty: bool = typer.Option(
|
212
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
213
|
+
),
|
214
|
+
line_numbers: bool = typer.Option(
|
215
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
216
|
+
),
|
217
|
+
):
|
218
|
+
"""
|
219
|
+
Update an existing tracker.
|
220
|
+
|
221
|
+
Example:
|
222
|
+
```terminal
|
223
|
+
kcli trackers update trk_123456789 \\
|
224
|
+
-d info[note]="Package delayed" \\
|
225
|
+
-d metadata[status]=delayed | jq "{id, tracking: .tracking_number, status, note: .info.note}"
|
226
|
+
```
|
227
|
+
|
228
|
+
Example Output:
|
229
|
+
```json
|
230
|
+
{
|
231
|
+
"id": "trk_123456789",
|
232
|
+
"tracking_number": "1Z999AA1234567890",
|
233
|
+
"status": "in_transit",
|
234
|
+
"info": {
|
235
|
+
"note": "Package delayed"
|
236
|
+
},
|
237
|
+
"metadata": {
|
238
|
+
"status": "delayed"
|
239
|
+
}
|
240
|
+
}
|
241
|
+
```
|
242
|
+
"""
|
243
|
+
payload = {}
|
244
|
+
|
245
|
+
try:
|
246
|
+
nested_properties = utils.parse_nested_properties(property)
|
247
|
+
payload.update(nested_properties)
|
248
|
+
except ValueError as e:
|
249
|
+
typer.echo(str(e), err=True)
|
250
|
+
raise typer.Exit(code=1)
|
251
|
+
|
252
|
+
utils.make_patch_request(
|
253
|
+
f"v1/trackers/{tracker_id}",
|
254
|
+
payload=payload,
|
255
|
+
pretty_print=pretty,
|
256
|
+
line_numbers=line_numbers,
|
257
|
+
)
|
258
|
+
|
259
|
+
|
260
|
+
@app.command("delete")
|
261
|
+
def delete_tracker(
|
262
|
+
tracker_id: str,
|
263
|
+
pretty: bool = typer.Option(
|
264
|
+
False, "--pretty", "-p", help="Pretty print the output"
|
265
|
+
),
|
266
|
+
line_numbers: bool = typer.Option(
|
267
|
+
False, "--line-numbers", "-n", help="Show line numbers in pretty print"
|
268
|
+
),
|
269
|
+
):
|
270
|
+
"""
|
271
|
+
Delete a tracker.
|
272
|
+
|
273
|
+
Example:
|
274
|
+
```terminal
|
275
|
+
kcli trackers delete trk_123456789 | jq "{message: \"Tracker deleted successfully\"}"
|
276
|
+
```
|
277
|
+
|
278
|
+
Example Output:
|
279
|
+
```json
|
280
|
+
{
|
281
|
+
"message": "Tracker deleted successfully"
|
282
|
+
}
|
283
|
+
```
|
284
|
+
"""
|
285
|
+
utils.make_delete_request(
|
286
|
+
f"v1/trackers/{tracker_id}", pretty_print=pretty, line_numbers=line_numbers
|
287
|
+
)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
from karrio_cli.templates.address import *
|
2
|
+
from karrio_cli.templates.docs import *
|
3
|
+
from karrio_cli.templates.documents import *
|
4
|
+
from karrio_cli.templates.manifest import *
|
5
|
+
from karrio_cli.templates.pickup import *
|
6
|
+
from karrio_cli.templates.rates import *
|
7
|
+
from karrio_cli.templates.sdk import *
|
8
|
+
from karrio_cli.templates.shipments import *
|
9
|
+
from karrio_cli.templates.tracking import *
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|