Skip to content

Commit

Permalink
(update) docs to test deployment from monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
danh91 committed Dec 15, 2023
1 parent 2011b01 commit a163e13
Show file tree
Hide file tree
Showing 17 changed files with 612 additions and 700 deletions.
2 changes: 1 addition & 1 deletion apps/www/docs/api/shipments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ curl --request POST \

**Buy the shipment label**

> `POST /v1/shipments/{shipment_id}/purchase`
> `POST` /v1/shipments/[shipment_id]/purchase
Since the shipment object is stored on the karrio server, all you need is to
provide the preferred shipping rate id to buy the label.
Expand Down
70 changes: 70 additions & 0 deletions apps/www/docs/carriers/integrations.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[
{
"name": "Allied Express",
"href": "/carriers/integrations/allied_express",
"status": "beta",
"features": [
"Rating",
"Shipping",
"Tracking"
]
},
{
"name": "Amazon Shipping",
"href": "/carriers/integrations/amazon_shipping",
Expand Down Expand Up @@ -34,6 +44,26 @@
"Tracking"
]
},
{
"name": "BoxKnight",
"href": "/carriers/integrations/boxknight",
"status": "beta",
"features": [
"Rating",
"Shipping",
"Tracking"
]
},
{
"name": "Belgium Post",
"href": "/carriers/integrations/bpost",
"status": "beta",
"features": [
"Rating",
"Shipping",
"Tracking"
]
},
{
"name": "Canada Post",
"href": "/carriers/integrations/canadapost",
Expand Down Expand Up @@ -135,6 +165,34 @@
"Parperless"
]
},
{
"name": "GEODIS",
"href": "/carriers/integrations/geodis",
"status": "beta",
"features": [
"Rating",
"Shipping",
"Tracking"
]
},
{
"name": "La Poste",
"href": "/carriers/integrations/laposte",
"status": "production",
"features": [
"Tracking"
]
},
{
"name": "Nationex",
"href": "/carriers/integrations/nationex",
"status": "beta",
"features": [
"Rating",
"Shipping",
"Tracking"
]
},
{
"name": "Purolator",
"href": "/carriers/integrations/purolator",
Expand All @@ -146,6 +204,16 @@
"Pickup"
]
},
{
"name": "Roadie",
"href": "/carriers/integrations/roadie",
"status": "beta",
"features": [
"Rating",
"Shipping",
"Tracking"
]
},
{
"name": "Royal Mail",
"href": "/carriers/integrations/royalmail",
Expand All @@ -167,6 +235,8 @@
"href": "/carriers/integrations/tnt",
"status": "beta",
"features": [
"Rating",
"Shipping",
"Tracking"
]
},
Expand Down
5 changes: 5 additions & 0 deletions apps/www/docs/carriers/integrations/allied_express.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: allied_express
title: Allied Express
---

5 changes: 5 additions & 0 deletions apps/www/docs/carriers/integrations/boxknight.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: boxknight
title: BoxKnight
---

5 changes: 5 additions & 0 deletions apps/www/docs/carriers/integrations/bpost.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: bpost
title: Belgian Post
---

5 changes: 5 additions & 0 deletions apps/www/docs/carriers/integrations/geodis.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: geodis
title: GEODIS
---

5 changes: 5 additions & 0 deletions apps/www/docs/carriers/integrations/laposte.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: laposte
title: La Poste
---

5 changes: 5 additions & 0 deletions apps/www/docs/carriers/integrations/nationex.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: nationex
title: Nationex
---

5 changes: 5 additions & 0 deletions apps/www/docs/carriers/integrations/roadie.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
id: roadie
title: Roadie
---

68 changes: 37 additions & 31 deletions apps/www/docs/carriers/sdk/extension.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ The package naming convention for extensions is `karrio.[carrier_name]`

#### 1. Create a karrio extension package

Once you have [karrio installed for development](/local-development) on your machine,
Once you have [karrio installed for development](/contributing/development) on your machine,
You can run the following command to scafold a karrio extension for you carrier.

```terminal
python run add-extension
python modules/cli add-extension
```
or
```terminal
./bin/cli add-extension
```

```
Expand All @@ -53,7 +57,7 @@ Version [2023.1]: # The extension initial version
Is XML API? [y/n]: # Specify whether the carrier' API data format is XML. (n - for JSON APIs)
```

This command will create a karrio compatible extension folder under `sdk/extensions/[carrier_name]`
This command will create a karrio compatible extension folder under `modules/connectors/[carrier_name]`
with all the boilerplate code required for your integration.
From there, all you have to do is implement the API data mapping from and to karrio unified interface and add API contract tests
to ensure that karrio generates the right requests for your API.
Expand All @@ -71,15 +75,15 @@ the datatypes available and makes maintenance easy.
- Generate Python datatypes for an XML/SOAP API

Karrio uses the `generateDS` project cli to turn XML files and XML schemas from SOAP webservices into Python classes.
Please check the [canadapost schema package](https://github.com/karrioapi/karrio/blob/main/schemas/canadapost/generate.sh) as an example.
Please check the [canadapost schema package](https://github.com/karrioapi/karrio/blob/main/modules/connectors/canadapost/generate) as an example.

> generateDS is installed along with karrio' dev dependencies. So it should already be available.
- Generate Python datatypes for a JSON API

Karrio uses a fork of `quicktype` to generate Python dataclasses from the `jstruct` library to turn JSON request and response
samples.
Please check the [amazon_mws schema scripting](https://github.com/karrioapi/karrio/blob/main/sdk/extensions/amazon_mws/generate.sh) as an example.
Please check the [amazon_mws schema scripting](https://github.com/karrioapi/karrio/blob/main/modules/connectors/amazon_shipping/generate) as an example.


:::info
Expand Down Expand Up @@ -140,16 +144,16 @@ import karrio.providers.[carrier_name].units as units
METADATA = Metadata(
id="[carrier_name]", # e.g: "ddp_uk"
label="[Carrier Name]", # e.g: "DDP UK"
# Integrations
Mapper=Mapper,
Proxy=Proxy,
Settings=Settings,
# Data Units (Optional...)
options=units.OptionCode, # Enum of Shipping options supported by the carrier
options=units.ShippingOption, # Enum of Shipping options supported by the carrier
package_presets=units.PackagePresets, # Enum of parcel presets/templates
services=units.ServiceType, # Enum of Shipping services supported by the carrier
services=units.ShippingService, # Enum of Shipping services supported by the carrier
is_hub=False # True if the carrier is a hub like (EasyPost, Shippo, Postmen...)
)
Expand All @@ -161,32 +165,39 @@ The carrier extension package folder structure looks like this

```text
extensions/[carrier_name]/
├── setup.py
├── generate
├── karrio
│ ├── mappers
│ │ └── [carrier_name]
│ │ ├── __init__.py
│ │ ├── mapper.py
│ │ ├── proxy.py
│ │ └── settings.py
│ └── providers
│ ├── providers
│ │ └── [carrier_name]
│ │ ├── __init__.py
│ │ ├── address.py
│ │ ├── error.py
│ │ ├── pickup
│ │ │ ├── __init__.py
│ │ │ ├── cancel.py
│ │ │ ├── create.py
│ │ │ └── update.py
│ │ ├── rate.py
│ │ ├── shipment
│ │ │ ├── __init__.py
│ │ │ ├── cancel.py
│ │ │ └── create.py
│ │ ├── tracking.py
│ | ├── units.py
│ | └── utils.py
│ └── schemas
│ └── [carrier_name]
│ ├── __init__.py
│ ├── address.py
│ ├── error.py
│ ├── pickup
│ │ ├── __init__.py
│ │ ├── cancel.py
│ │ ├── create.py
│ │ └── update.py
│ ├── rate.py
│ ├── shipment
│ │ ├── __init__.py
│ │ ├── cancel.py
│ │ └── create.py
│ ├── tracking.py
│ ├── units.py
│ └── utils.py
└── setup.py
│ ├── error_response.py
│ └── ....
└── schemas
└── error_response.json
```

:::info
Expand Down Expand Up @@ -339,11 +350,6 @@ are used to generate Python data types based of the schema format definition.
- For `XML` and `SOAP` services, [generateDs](https://pypi.org/project/generateDS/) is used to generate `.xsd` files
into Python data types

:::info
Check the [generate.sh](https://github.com/karrio/karrio/blob/main/schemas/) file
to see how genereDs is used.
:::

- For `JSON` services, [quicktype](https://github.com/karrio/quicktype) is used to generate `.json` files
into Python data types. We then use [jstruct](https://github.com/karrio/jstruct) as a replacement
for python dataclass to add automated nested object instantiation.
Loading

0 comments on commit a163e13

Please sign in to comment.