Skip to content
This repository has been archived by the owner on Jun 2, 2020. It is now read-only.

Commit

Permalink
Examples: Add X-Example code snippet tag.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexions committed Jul 9, 2019
1 parent b7c55c8 commit ab32497
Show file tree
Hide file tree
Showing 45 changed files with 180 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/examples/CheckoutAPI/create_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../vendor/autoload.php';

// X-Example: POST /checkout/v3/orders

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -107,3 +109,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /checkout/v3/orders
4 changes: 4 additions & 0 deletions docs/examples/CheckoutAPI/fetch_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../vendor/autoload.php';

// X-Example: GET /checkout/v3/orders/{order_id}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -58,3 +60,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: GET /checkout/v3/orders/{order_id}
4 changes: 4 additions & 0 deletions docs/examples/CheckoutAPI/update_checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../vendor/autoload.php';

// X-Example: POST /checkout/v3/orders/{order_id}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -99,3 +101,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /checkout/v3/orders/{order_id}
4 changes: 4 additions & 0 deletions docs/examples/CustomerTokenAPI/Tokens/create_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /customer-token/v1/tokens/{customerToken}/order

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -102,3 +104,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /customer-token/v1/tokens/{customerToken}/order
4 changes: 4 additions & 0 deletions docs/examples/CustomerTokenAPI/Tokens/read_token_details.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: GET /customer-token/v1/tokens/{customerToken}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -53,3 +55,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: GET /customer-token/v1/tokens/{customerToken}
4 changes: 4 additions & 0 deletions docs/examples/CustomerTokenAPI/Tokens/update_token_status.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: PATCH /customer-token/v1/tokens/{customerToken}/status

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -55,3 +57,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: PATCH /customer-token/v1/tokens/{customerToken}/status
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /hpp/v1/sessions

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -76,3 +78,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /hpp/v1/sessions
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: DELETE /hpp/v1/sessions/{session_id}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -53,3 +55,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: DELETE /hpp/v1/sessions/{session_id}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /hpp/v1/sessions/{session_id}/distribution

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -63,3 +65,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /hpp/v1/sessions/{session_id}/distribution
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: GET /hpp/v1/sessions/{session_id}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -53,3 +55,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: GET /hpp/v1/sessions/{session_id}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /instantshopping/v1/buttons

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -107,3 +109,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /instantshopping/v1/buttons
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: GET /instantshopping/v1/buttons/{button_key}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -53,3 +55,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: GET /instantshopping/v1/buttons/{button_key}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: PUT /instantshopping/v1/buttons/{button_key}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -77,3 +79,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: PUT /instantshopping/v1/buttons/{button_key}
4 changes: 4 additions & 0 deletions docs/examples/InstantShoppingAPI/Orders/approve_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /instantshopping/v1/authorizations/{authorization_token}/orders

/**
* Follow the link to get your credentials => https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -118,3 +120,5 @@
} catch (Exception $e) {
echo 'Caught exception => ' . $e->getMessage() . "\n";
}

// /X-Example: POST /instantshopping/v1/authorizations/{authorization_token}/orders
4 changes: 4 additions & 0 deletions docs/examples/InstantShoppingAPI/Orders/decline_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: DELETE /instantshopping/v1/authorizations/{authorization_token}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -58,3 +60,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: DELETE /instantshopping/v1/authorizations/{authorization_token}
4 changes: 4 additions & 0 deletions docs/examples/InstantShoppingAPI/Orders/retrieve_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: GET /instantshopping/v1/authorizations/{authorization_token}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -53,3 +55,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: GET /instantshopping/v1/authorizations/{authorization_token}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/shipping-info

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -68,3 +70,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/shipping-info
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/trigger-send-out

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -56,3 +58,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /ordermanagement/v1/orders/{order_id}/captures/{capture_id}/trigger-send-out
4 changes: 4 additions & 0 deletions docs/examples/OrderManagementAPI/Orders/acknowledge_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /ordermanagement/v1/orders/{order_id}/acknowledge

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -56,3 +58,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /ordermanagement/v1/orders/{order_id}/acknowledge
4 changes: 4 additions & 0 deletions docs/examples/OrderManagementAPI/Orders/cancel_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /ordermanagement/v1/orders/{order_id}/cancel

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -55,3 +57,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /ordermanagement/v1/orders/{order_id}/cancel
4 changes: 4 additions & 0 deletions docs/examples/OrderManagementAPI/Orders/create_capture.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /ordermanagement/v1/orders/{order_id}/captures

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -83,3 +85,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /ordermanagement/v1/orders/{order_id}/captures
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /ordermanagement/v1/orders/{order_id}/extend-authorization-time

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -53,3 +55,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /ordermanagement/v1/orders/{order_id}/extend-authorization-time
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: GET /ordermanagement/v1/orders/{order_id}/captures

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -54,3 +56,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: GET /ordermanagement/v1/orders/{order_id}/captures
4 changes: 4 additions & 0 deletions docs/examples/OrderManagementAPI/Orders/fetch_capture.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: GET /ordermanagement/v1/orders/{order_id}/captures/{capture_id}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -54,3 +56,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: GET /ordermanagement/v1/orders/{order_id}/captures/{capture_id}
4 changes: 4 additions & 0 deletions docs/examples/OrderManagementAPI/Orders/fetch_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: GET /ordermanagement/v1/orders/{order_id}

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -53,3 +55,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: GET /ordermanagement/v1/orders/{order_id}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

require_once dirname(__DIR__) . '/../../../vendor/autoload.php';

// X-Example: POST /ordermanagement/v1/orders/{order_id}/release-remaining-authorization

/**
* Follow the link to get your credentials: https://github.com/klarna/kco_rest_php/#api-credentials
*
Expand Down Expand Up @@ -55,3 +57,5 @@
} catch (Exception $e) {
echo 'Caught exception: ' . $e->getMessage() . "\n";
}

// /X-Example: POST /ordermanagement/v1/orders/{order_id}/release-remaining-authorization
Loading

0 comments on commit ab32497

Please sign in to comment.