### Rust Client Example Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt Example usage of the Smaregi API client library in Rust, demonstrating how to fetch customer lists and create new customers. ```APIDOC ## Rust Client Usage Example ### Description This example demonstrates basic API calls using the Rust client library generated from the OpenAPI specification. It covers fetching a list of customers and creating a new customer. ### Language Rust ### Code Example ```rust use smaregi_api::apis::configuration::Configuration; use smaregi_api::apis::default_api::{ GetCustomersParams, CreateCustomersParams, }; use smaregi_api::models::CreateCustomers; #[tokio::main] async fn main() -> Result<(), Box> { // Configuration setup let mut config = Configuration::new(); config.bearer_access_token = Some("YOUR_ACCESS_TOKEN".to_string()); config.base_path = Some("https://api.smaregi.jp".to_string()); let contract_id = "your_contract_id".to_string(); // Fetch customer list let params = GetCustomersParams { contract_id: contract_id.clone(), limit: Some(100), page: Some(1), customer_code: None, }; let customers = smaregi_api::apis::default_api::get_customers(&config, params).await?; for customer in customers { println!("Customer ID: {}", customer.customer_id); println!("Name: {} {}", customer.last_name.unwrap_or_default(), customer.first_name.unwrap_or_default()); } // Create a new customer let new_customer = CreateCustomers { customer_code: "RUST001".to_string(), first_name: "Taro".to_string(), last_name: "Tanaka".to_string(), ..Default::default() }; let create_params = CreateCustomersParams { contract_id: contract_id.clone(), create_customers: Some(new_customer), }; let result = smaregi_api::apis::default_api::create_customers(&config, create_params).await?; println!("Creation successful. Customer ID: {:?}", result.customer_id); Ok(()) } ``` ``` -------------------------------- ### Get Stores List using cURL and PHP Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt This snippet demonstrates how to retrieve a list of stores using the Smaregi Platform API, with an option to include point condition information. Examples are provided for cURL and PHP, showing how to query the /stores endpoint with parameters like limit and with_point_condition. ```bash # cURLでの店舗一覧取得(ポイント条件付き) curl -X GET "https://api.smaregi.jp/{contract_id}/pos/stores?limit=100&with_point_condition=all" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```php getStores( $contract_id, 100, // limit 'all' // with_point_condition ); foreach ($stores as $store) { echo "店舗ID: " . $store->getStoreId() . "\n"; echo "店舗コード: " . $store->getStoreCode() . "\n"; echo "店舗名: " . $store->getStoreName() . "\n"; echo "区分: " . $store->getDivision() . "\n"; // 1:通常店舗, 2:倉庫 echo "住所: " . $store->getAddress() . "\n"; echo "電話: " . $store->getPhoneNumber() . "\n"; if ($pointCondition = $store->getPointCondition()) { echo "ポイント機能: " . $pointCondition->getPointUseDivision() . "\n"; echo "ポイント付与単位: " . $pointCondition->getPointGivingUnit() . "\n"; } echo "---\n"; } } catch (Exception $e) { echo 'エラー: ' . $e->getMessage() . PHP_EOL; } ``` -------------------------------- ### Get Transaction ID Example Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/GetTransactionId.md This example demonstrates how to initialize and use the GetTransactionId class to retrieve transaction details. ```APIDOC ## POST /transactions/id ### Description Retrieves a transaction ID and associated details from the Smaregi platform. ### Method POST ### Endpoint /transactions/id ### Parameters #### Request Body - **transaction_head_id** (string) - Optional - The unique identifier for the transaction head. - **transaction_date_time** (string) - Optional - The date and time of the transaction. - **transaction_head_division** (string) - Optional - Division code for the transaction head. - **cancel_division** (string) - Optional - Division code indicating if the transaction is a cancellation. - **unit_non_discountsubtotal** (number) - Optional - Subtotal before unit discounts. - **unit_discountsubtotal** (number) - Optional - Discount amount at the unit level. - **unit_staff_discountsubtotal** (number) - Optional - Staff discount amount at the unit level. - **unit_bargain_discountsubtotal** (number) - Optional - Bargain discount amount at the unit level. - **subtotal** (number) - Optional - Total subtotal. - **subtotal_for_discount** (number) - Optional - Subtotal used for discount calculations. - **subtotal_discount_price** (number) - Optional - Discount price applied to the subtotal. - **subtotal_discount_rate** (number) - Optional - Discount rate applied to the subtotal. - **subtotal_discount_division** (string) - Optional - Division code for subtotal discounts. - **point_discount** (number) - Optional - Discount amount from points. - **coupon_discount** (number) - Optional - Discount amount from coupons. - **total** (number) - Optional - Total amount including taxes and discounts. - **tax_include** (number) - Optional - Tax amount included in the total. - **tax_exclude** (number) - Optional - Tax amount excluded from the total. - **rounding_division** (string) - Optional - Division code for rounding. - **rounding_price** (number) - Optional - Amount after rounding. - **cash_total** (number) - Optional - Total amount paid in cash. - **credit_total** (number) - Optional - Total amount paid by credit. - **deposit** (number) - Optional - Deposit amount. - **deposit_cash** (number) - Optional - Cash deposit amount. - **deposit_credit** (number) - Optional - Credit deposit amount. - **change** (number) - Optional - Change given. - **tip_cash** (number) - Optional - Cash tip amount. - **tip_credit** (number) - Optional - Credit tip amount. - **amount** (number) - Optional - Net amount. - **return_amount** (number) - Optional - Return amount. - **cost_total** (number) - Optional - Total cost. - **sales_head_division** (string) - Optional - Division code for sales head. - **in_tax_sales_total** (number) - Optional - Total sales including tax. - **out_tax_sales_total** (number) - Optional - Total sales excluding tax. - **non_tax_sales_total** (number) - Optional - Total non-taxable sales. - **non_sales_target_total** (number) - Optional - Total for non-sales targets. - **non_sales_target_out_tax_total** (number) - Optional - Non-sales target total excluding tax. - **non_sales_target_in_tax_total** (number) - Optional - Non-sales target total including tax. - **non_sales_target_tax_free_total** (number) - Optional - Non-sales target tax-free total. - **non_sales_target_cost_total** (number) - Optional - Non-sales target cost total. - **non_sales_target_amount** (number) - Optional - Non-sales target amount. - **non_sales_target_return_amount** (number) - Optional - Non-sales target return amount. - **new_point** (number) - Optional - New points earned. - **spend_point** (number) - Optional - Points spent. - **point** (number) - Optional - Total points. - **total_point** (number) - Optional - Total points including earned and spent. - **current_mile** (number) - Optional - Current mileage. - **earn_mile** (number) - Optional - Mileage earned. - **total_mile** (number) - Optional - Total mileage. - **adjustment_mile** (number) - Optional - Mileage adjustment. - **adjustment_mile_division** (string) - Optional - Division code for mileage adjustment. - **adjustment_mile_value** (number) - Optional - Value of mileage adjustment. - **store_id** (string) - Optional - The ID of the store. - **terminal_id** (string) - Optional - The ID of the terminal. - **customer_id** (string) - Optional - The ID of the customer. - **terminal_tran_id** (string) - Optional - Transaction ID on the terminal. - **terminal_tran_date_time** (string) - Optional - Date and time of the transaction on the terminal. - **sum_division** (string) - Optional - Division code for summation. - **adjustment_date_time** (string) - Optional - Date and time of adjustment. - **sum_date** (string) - Optional - Date of summation. - **customer_rank** (string) - Optional - Customer rank. - **customer_group_id** (string) - Optional - Customer group ID. - **customer_group_id2** (string) - Optional - Customer group ID 2. - **customer_group_id3** (string) - Optional - Customer group ID 3. - **customer_group_id4** (string) - Optional - Customer group ID 4. - **customer_group_id5** (string) - Optional - Customer group ID 5. - **staff_id** (string) - Optional - The ID of the staff member. - **staff_name** (string) - Optional - The name of the staff member. - **credit_division** (string) - Optional - Division code for credit. - **payment_count** (integer) - Optional - Number of payments. - **slip_number** (string) - Optional - Slip number. - **cancel_slip_number** (string) - Optional - Cancellation slip number. - **auth_number** (string) - Optional - Authorization number. - **auth_date** (string) - Optional - Authorization date. - **card_company** (string) - Optional - Card company name. - **denomination** (string) - Optional - Denomination. - **memo** (string) - Optional - Memo field. - **receipt_memo** (string) - Optional - Memo for the receipt. - **carriage** (number) - Optional - Carriage cost. - **commission** (number) - Optional - Commission amount. - **guest_numbers** (integer) - Optional - Total number of guests. - **guest_numbers_male** (integer) - Optional - Number of male guests. - **guest_numbers_female** (integer) - Optional - Number of female guests. - **guest_numbers_unknown** (integer) - Optional - Number of guests with unknown gender. - **enter_date_time** (string) - Optional - Date and time of entry. - **tax_free_sales_division** (string) - Optional - Division code for tax-free sales. - **net_tax_free_general_tax_include** (number) - Optional - Net tax-free general sales including tax. - **net_tax_free_general_tax_exclude** (number) - Optional - Net tax-free general sales excluding tax. - **net_tax_free_consumable_tax_include** (number) - Optional - Net tax-free consumable sales including tax. - **net_tax_free_consumable_tax_exclude** (number) - Optional - Net tax-free consumable sales excluding tax. - **tags** (array) - Optional - Array of tags. - **point_giving_division** (string) - Optional - Division code for point giving. - **point_giving_unit_price** (number) - Optional - Unit price for point giving. - **point_giving_unit** (string) - Optional - Unit for point giving. - **point_spend_division** (string) - Optional - Division code for point spending. - **mileage_division** (string) - Optional - Division code for mileage. - **mileage_label** (string) - Optional - Label for mileage. - **customer_pin_code** (string) - Optional - Customer PIN code. - **return_sales** (boolean) - Optional - Indicates if this is a return sale. - **dispose_division** (string) - Optional - Division code for disposal. - **dispose_server_transaction_head_id** (string) - Optional - Server transaction head ID for disposal. - **cancel_date_time** (string) - Optional - Date and time of cancellation. - **sell_division** (string) - Optional - Division code for selling. - **tax_rate** (number) - Optional - Tax rate. - **tax_rounding** (string) - Optional - Tax rounding method. - **discount_rounding_division** (string) - Optional - Division code for discount rounding. - **transaction_uuid** (string) - Optional - Unique identifier for the transaction. - **exchange_ticket_no** (string) - Optional - Exchange ticket number. - **gift_receipt_valid_days** (integer) - Optional - Number of days a gift receipt is valid. - **barcode** (string) - Optional - Barcode data. - **upd_date_time** (string) - Optional - Date and time of last update. - **details** (array) - Optional - Array of transaction details. - **deposit_others** (number) - Optional - Other deposit amounts. - **coupons** (array) - Optional - Array of coupons applied. - **coupon_items** (array) - Optional - Array of coupon items. - **store** (object) - Optional - Store object. - **customer** (object) - Optional - Customer object. - **customer_groups** (array) - Optional - Array of customer groups. - **staff** (object) - Optional - Staff object. - **layaway** (object) - Optional - Layaway object. - **layaway_pick_up** (object) - Optional - Layaway pickup object. ### Request Example ```ruby { "transaction_head_id": null, "transaction_date_time": null, "transaction_head_division": null, "cancel_division": null, "unit_non_discountsubtotal": null, "unit_discountsubtotal": null, "unit_staff_discountsubtotal": null, "unit_bargain_discountsubtotal": null, "subtotal": null, "subtotal_for_discount": null, "subtotal_discount_price": null, "subtotal_discount_rate": null, "subtotal_discount_division": null, "point_discount": null, "coupon_discount": null, "total": null, "tax_include": null, "tax_exclude": null, "rounding_division": null, "rounding_price": null, "cash_total": null, "credit_total": null, "deposit": null, "deposit_cash": null, "deposit_credit": null, "change": null, "tip_cash": null, "tip_credit": null, "amount": null, "return_amount": null, "cost_total": null, "sales_head_division": null, "in_tax_sales_total": null, "out_tax_sales_total": null, "non_tax_sales_total": null, "non_sales_target_total": null, "non_sales_target_out_tax_total": null, "non_sales_target_in_tax_total": null, "non_sales_target_tax_free_total": null, "non_sales_target_cost_total": null, "non_sales_target_amount": null, "non_sales_target_return_amount": null, "new_point": null, "spend_point": null, "point": null, "total_point": null, "current_mile": null, "earn_mile": null, "total_mile": null, "adjustment_mile": null, "adjustment_mile_division": null, "adjustment_mile_value": null, "store_id": null, "terminal_id": null, "customer_id": null, "terminal_tran_id": null, "terminal_tran_date_time": null, "sum_division": null, "adjustment_date_time": null, "sum_date": null, "customer_rank": null, "customer_group_id": null, "customer_group_id2": null, "customer_group_id3": null, "customer_group_id4": null, "customer_group_id5": null, "staff_id": null, "staff_name": null, "credit_division": null, "payment_count": null, "slip_number": null, "cancel_slip_number": null, "auth_number": null, "auth_date": null, "card_company": null, "denomination": null, "memo": null, "receipt_memo": null, "carriage": null, "commission": null, "guest_numbers": null, "guest_numbers_male": null, "guest_numbers_female": null, "guest_numbers_unknown": null, "enter_date_time": null, "tax_free_sales_division": null, "net_tax_free_general_tax_include": null, "net_tax_free_general_tax_exclude": null, "net_tax_free_consumable_tax_include": null, "net_tax_free_consumable_tax_exclude": null, "tags": null, "point_giving_division": null, "point_giving_unit_price": null, "point_giving_unit": null, "point_spend_division": null, "mileage_division": null, "mileage_label": null, "customer_pin_code": null, "return_sales": false, "dispose_division": null, "dispose_server_transaction_head_id": null, "cancel_date_time": null, "sell_division": null, "tax_rate": null, "tax_rounding": null, "discount_rounding_division": null, "transaction_uuid": null, "exchange_ticket_no": null, "gift_receipt_valid_days": null, "barcode": null, "upd_date_time": null, "details": null, "deposit_others": null, "coupons": null, "coupon_items": null, "store": null, "customer": null, "customer_groups": null, "staff": null, "layaway": null, "layaway_pick_up": null } ``` ### Response #### Success Response (200) - **transaction_head_id** (string) - The unique identifier for the transaction head. - **transaction_date_time** (string) - The date and time of the transaction. - **transaction_head_division** (string) - Division code for the transaction head. - **cancel_division** (string) - Division code indicating if the transaction is a cancellation. #### Response Example ```json { "transaction_head_id": "txn_12345abcde", "transaction_date_time": "2023-10-27T10:00:00Z", "transaction_head_division": "0", "cancel_division": "0" } ``` ``` -------------------------------- ### Rust API Client Example for Customer Management Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt Demonstrates basic API interactions in Rust using the Smaregi API client library. Includes fetching a list of customers and creating a new customer. Requires API configuration with access token and base path. ```rust use smaregi_api::apis::configuration::Configuration; use smaregi_api::apis::default_api::{ GetCustomersParams, CreateCustomersParams, GetTransactionParams }; use smaregi_api::models::CreateCustomers; #[tokio::main] async fn main() -> Result<(), Box> { // 設定 let mut config = Configuration::new(); config.bearer_access_token = Some("YOUR_ACCESS_TOKEN".to_string()); config.base_path = "https://api.smaregi.jp".to_string(); let contract_id = "your_contract_id".to_string(); // 会員情報一覧取得 let params = GetCustomersParams { contract_id: contract_id.clone(), limit: Some(100), page: Some(1), customer_code: None, }; let customers = smaregi_api::apis::default_api::get_customers(&config, params).await?; for customer in customers { println!("会員ID: {}", customer.customer_id); println!("名前: {} {}", customer.last_name.unwrap_or_default(), customer.first_name.unwrap_or_default()); } // 会員登録 let new_customer = CreateCustomers { customer_code: "RUST001".to_string(), first_name: "太郎".to_string(), last_name: "田中".to_string(), ..Default::default() }; let create_params = CreateCustomersParams { contract_id: contract_id.clone(), create_customers: Some(new_customer), }; let result = smaregi_api::apis::default_api::create_customers(&config, create_params).await?; println!("登録完了: {:?}", result.customer_id); Ok(()) } ``` -------------------------------- ### Get Transaction Details - cURL and PHP Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt Fetches detailed information for a specific transaction, including items, coupons, store, and customer data. The PHP example shows how to retrieve and display these details using the API client. ```curl curl -X GET "https://api.smaregi.jp/{contract_id}/pos/transactions/{transaction_id}?with_details=all&with_coupons=all&with_store=all&with_customer=all" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```php getTransactionId( $contract_id, $transaction_id, 'all', // with_coupons 'all', // with_details (all, summary, none) 'all', // with_store 'all' // with_customer ); echo "取引ID: " . $transaction->getTransactionHeadId() . "\n"; echo "取引日時: " . $transaction->getTransactionDateTime() . "\n"; echo "小計: " . $transaction->getSubtotal() . "円\n"; echo "合計: " . $transaction->getTotal() . "円\n"; echo "内税: " . $transaction->getTaxInclude() . "円\n"; echo "付与ポイント: " . $transaction->getNewPoint() . "\n"; echo "使用ポイント: " . $transaction->getSpendPoint() . "\n"; // 取引明細 if ($details = $transaction->getDetails()) { echo "\n--- 取引明細 ---\n"; foreach ($details as $detail) { echo "商品: " . $detail->getProductName() . "\n"; echo "数量: " . $detail->getQuantity() . "\n"; echo "単価: " . $detail->getSalesPrice() . "円\n"; } } // 店舗情報 if ($store = $transaction->getStore()) { echo "\n店舗: " . $store->getStoreName() . "\n"; } // 会員情報 if ($customer = $transaction->getCustomer()) { echo "会員: " . $customer->getLastName() . " " . $customer->getFirstName() . "\n"; } } catch (Exception $e) { echo 'エラー: ' . $e->getMessage() . PHP_EOL; } ``` -------------------------------- ### Get Transaction List - cURL and PHP Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt Retrieves a list of transactions based on specified criteria such as date, store ID, and transaction type. Supports filtering and sorting. The PHP example demonstrates how to use the API client to fetch and display transaction summaries. ```curl curl -X GET "https://api.smaregi.jp/{contract_id}/pos/transactions?limit=50&page=1&sum_date=2024-01-15&store_id=1&transaction_head_division=1&sort=transactionDateTime:desc" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` ```php getTransaction( $contract_id, '2024-01-15', // sum_date 'none', // with_layaway 50, // limit 1, // page null, // upd_date_time_to '2024-01-01T00:00:00+09:00', // upd_date_time_from 'CUST001', // customer_code '1', // transaction_head_division (1:通常) 'transactionDateTime:desc' // sort ); foreach ($transactions as $tx) { echo "取引ID: " . $tx->getTransactionHeadId() . "\n"; echo "取引日時: " . $tx->getTransactionDateTime() . "\n"; echo "合計金額: " . $tx->getTotal() . "円\n"; echo "取引区分: " . $tx->getTransactionHeadDivision() . "\n"; echo "---\n"; } } catch (Exception $e) { echo 'エラー: ' . $e->getMessage() . PHP_EOL; } ``` -------------------------------- ### WithEnum Model Initialization Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/WithEnum.md Demonstrates how to instantiate the WithEnum model using the Ruby client library. ```APIDOC ## WithEnum Model ### Description The WithEnum model represents a data structure within the Smaregi Platform API that utilizes enumerated types for specific fields. ### Properties | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | ### Usage Example ```ruby require 'openapi_client' # Initialize the WithEnum object instance = OpenapiClient::WithEnum.new() ``` ``` -------------------------------- ### Initialize UpdateStoreResponseReceiptPrintInfo in Ruby Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/UpdateStoreResponseReceiptPrintInfo.md Demonstrates how to instantiate the UpdateStoreResponseReceiptPrintInfo class using the Ruby OpenAPI client. All properties are initialized as null, representing the optional nature of the receipt configuration fields. ```ruby require 'openapi_client' instance = OpenapiClient::UpdateStoreResponseReceiptPrintInfo.new( store_id: nil, header: nil, footer: nil, receipt_tax_office_stamp_comment: nil, air_print_logo: nil, advertisement_image: nil, gift_receipt_image: nil, gift_receipt_note: nil, tax_office_name: nil, discount_receipt_header: nil, discount_receipt_footer: nil ) ``` -------------------------------- ### Initialize CouponDivision Instance Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/CouponDivision.md Demonstrates how to instantiate the CouponDivision class using the OpenapiClient library. This is the standard way to create an object for handling coupon division data. ```ruby require 'openapi_client' instance = OpenapiClient::CouponDivision.new() ``` -------------------------------- ### Instantiate GetTransactionId in Ruby Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/GetTransactionId.md This Ruby code snippet shows how to create an instance of the `GetTransactionId` class. It initializes the object with numerous parameters, most of which are set to null in this example, indicating a basic setup or a placeholder for actual data. This is useful for understanding the structure of transaction data within the Smaregi API. ```ruby require 'openapi_client' instance = OpenapiClient::GetTransactionId.new( transaction_head_id: null, transaction_date_time: null, transaction_head_division: null, cancel_division: null, unit_non_discountsubtotal: null, unit_discountsubtotal: null, unit_staff_discountsubtotal: null, unit_bargain_discountsubtotal: null, subtotal: null, subtotal_for_discount: null, subtotal_discount_price: null, subtotal_discount_rate: null, subtotal_discount_division: null, point_discount: null, coupon_discount: null, total: null, tax_include: null, tax_exclude: null, rounding_division: null, rounding_price: null, cash_total: null, credit_total: null, deposit: null, deposit_cash: null, deposit_credit: null, change: null, tip_cash: null, tip_credit: null, amount: null, return_amount: null, cost_total: null, sales_head_division: null, in_tax_sales_total: null, out_tax_sales_total: null, non_tax_sales_total: null, non_sales_target_total: null, non_sales_target_out_tax_total: null, non_sales_target_in_tax_total: null, non_sales_target_tax_free_total: null, non_sales_target_cost_total: null, non_sales_target_amount: null, non_sales_target_return_amount: null, new_point: null, spend_point: null, point: null, total_point: null, current_mile: null, earn_mile: null, total_mile: null, adjustment_mile: null, adjustment_mile_division: null, adjustment_mile_value: null, store_id: null, terminal_id: null, customer_id: null, terminal_tran_id: null, terminal_tran_date_time: null, sum_division: null, adjustment_date_time: null, sum_date: null, customer_rank: null, customer_group_id: null, customer_group_id2: null, customer_group_id3: null, customer_group_id4: null, customer_group_id5: null, staff_id: null, staff_name: null, credit_division: null, payment_count: null, slip_number: null, cancel_slip_number: null, auth_number: null, auth_date: null, card_company: null, denomination: null, memo: null, receipt_memo: null, carriage: null, commission: null, guest_numbers: null, guest_numbers_male: null, guest_numbers_female: null, guest_numbers_unknown: null, enter_date_time: null, tax_free_sales_division: null, net_tax_free_general_tax_include: null, net_tax_free_general_tax_exclude: null, net_tax_free_consumable_tax_include: null, net_tax_free_consumable_tax_exclude: null, tags: null, point_giving_division: null, point_giving_unit_price: null, point_giving_unit: null, point_spend_division: null, mileage_division: null, mileage_label: null, customer_pin_code: null, return_sales: null, dispose_division: null, dispose_server_transaction_head_id: null, cancel_date_time: null, sell_division: null, tax_rate: null, tax_rounding: null, discount_rounding_division: null, transaction_uuid: null, exchange_ticket_no: null, gift_receipt_valid_days: null, barcode: null, upd_date_time: null, details: null, deposit_others: null, coupons: null, coupon_items: null, store: null, customer: null, customer_groups: null, staff: null, layaway: null, layaway_pick_up: null ) ``` -------------------------------- ### Transaction Detail Division Properties and Example Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/TransactionDetailDivision.md This snippet outlines the properties of the Transaction Detail Division and provides a basic Ruby example for instantiation. ```APIDOC ## Transaction Detail Division ### Description Provides details about transaction divisions. ### Properties This object does not have any specific properties defined in the provided documentation. ### Example ```ruby require 'openapi_client' # Initialize the TransactionDetailDivision object instance = OpenapiClient::TransactionDetailDivision.new() ``` ``` -------------------------------- ### Initialize CreateCustomers Object in Ruby Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/CreateCustomers.md Demonstrates how to instantiate the OpenapiClient::CreateCustomers class. This object acts as a data container for customer information when interacting with the Smaregi Platform API. ```ruby require 'openapi_client' instance = OpenapiClient::CreateCustomers.new( customer_code: nil, customer_no: nil, rank: nil, staff_rank: nil, first_name: nil, last_name: nil, first_kana: nil, last_kana: nil, post_code: nil, address: nil, phone_number: nil, fax_number: nil, mobile_number: nil, mail_address: nil, mail_address2: nil, mail_address3: nil, company_name: nil, department_name: nil, managerial_position: nil, sex: nil, birth_date: nil, point_expire_date: nil, entry_date: nil, leave_date: nil, point_giving_unit_price: nil, point_giving_unit: nil, pin_code: nil, passport_no: nil, nationality: nil, alphabet_name: nil, mail_receive_flag: nil, note: nil, note2: nil, favorite_list: nil, browsing_list: nil, status: nil, store_id: nil ) ``` -------------------------------- ### Smaregi Platform API Testing Source: https://github.com/feedforce/smaregi-platform-api/blob/main/php/README.md Instructions on how to set up and run tests for the Smaregi Platform API. ```APIDOC ## Tests To run the tests, use: ```bash composer install vendor/bin/phpunit ``` ``` -------------------------------- ### Get Customer List (GET /customers) Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt Retrieves a list of customers associated with a contract ID. Supports pagination, filtering by customer code, and other parameters. Requires Bearer authentication. ```bash curl -X GET "https://api.smaregi.jp/{contract_id}/pos/customers?limit=100&page=1" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" ``` ```php setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new OpenAPI\Client\Api\DefaultApi( new GuzzleHttp\Client(), $config ); $contract_id = 'your_contract_id'; $limit = 100; $page = 1; $customer_code = 'CUST001'; // オプション:顧客コードでフィルタ try { $result = $apiInstance->getCustomers($contract_id, $limit, $page, $customer_code); foreach ($result as $customer) { echo "会員ID: " . $customer->getCustomerId() . "\n"; echo "名前: " . $customer->getLastName() . " " . $customer->getFirstName() . "\n"; echo "ステータス: " . $customer->getStatus() . "\n"; } } catch (Exception $e) { echo 'エラー: ' . $e->getMessage() . PHP_EOL; } ``` -------------------------------- ### Get Transaction List (GET /transactions) Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt Retrieves transaction history. Supports filtering by date range, store ID, customer code, and transaction type. Requires Bearer authentication. ```bash # cURLでの取引情報一覧取得 curl -X GET "https://api.smaregi.jp/{contract_id}/pos/transactions?limit=100&page=1" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" ``` -------------------------------- ### Create Coupon using PHP Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt This snippet demonstrates how to create a new coupon using the Smaregi Platform API in PHP. It defines coupon details such as name, type, validity period, and discount value. The code handles potential exceptions during the API call. ```php '新春セール10%OFF', 'coupon_division' => '0', // 通常 'serial_number' => 'NEWYEAR2024', 'summary' => '新春セール期間限定の10%割引クーポン', 'award_type' => '2', // 割引(%) 'award_value' => '10', // 10% 'apply_condition_division' => '0', // 全適用 'min_target_price' => '1000', // 最低適用金額 'max_target_price' => '100000', // 最高適用金額 'start_date' => '2024-01-01', 'end_date' => '2024-01-31' ]); try { $result = $apiInstance->postCreateCoupons($contract_id, $coupon); echo "クーポン登録完了\n"; echo "クーポンID: " . $result->getCouponId() . "\n"; } catch (Exception $e) { echo 'エラー: ' . $e->getMessage() . PHP_EOL; } ``` -------------------------------- ### GET /pos/coupons Source: https://github.com/feedforce/smaregi-platform-api/blob/main/rust/docs/DefaultApi.md Retrieve a list of coupons. ```APIDOC ## GET /pos/coupons ### Description Retrieve a list of coupons. ### Method GET ### Endpoint `/{contract_id}/pos/coupons` ### Parameters #### Path Parameters - **contract_id** (String) - Required - The contract ID. ### Response #### Success Response (200) - **Vec** (Vec) - A list of coupons. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Instantiate OpenapiClient::WithEnum Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/WithEnum.md This snippet demonstrates how to initialize an instance of the WithEnum class. It requires the openapi_client library to be loaded first. ```ruby require 'openapi_client' instance = OpenapiClient::WithEnum.new() ``` -------------------------------- ### Instantiate DisposeDivision - Ruby Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/DisposeDivision.md Demonstrates how to create an instance of the DisposeDivision class using the OpenapiClient library in Ruby. This is a basic setup step before utilizing other API functionalities. ```ruby require 'openapi_client' instance = OpenapiClient::DisposeDivision.new() ``` -------------------------------- ### GET /pos/transactions Source: https://github.com/feedforce/smaregi-platform-api/blob/main/rust/docs/DefaultApi.md Retrieve a list of transaction information. ```APIDOC ## GET /pos/transactions ### Description Retrieve a list of transaction information. ### Method GET ### Endpoint `/{contract_id}/pos/transactions` ### Parameters #### Path Parameters - **contract_id** (String) - Required - The contract ID. ### Response #### Success Response (200) - **TransactionList** (TransactionList) - A list of transaction information. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### POST /customers Source: https://context7.com/feedforce/smaregi-platform-api/llms.txt Registers a new customer in the Smaregi POS system. ```APIDOC ## POST /customers ### Description Registers a new customer record. ### Method POST ### Endpoint /{contract_id}/pos/customers ### Parameters #### Path Parameters - **contract_id** (string) - Required - The unique identifier for the contract. #### Request Body - **customerCode** (string) - Required - Unique customer identifier. - **firstName** (string) - Required - Customer first name. - **lastName** (string) - Required - Customer last name. ### Request Example { "customerCode": "CUST002", "firstName": "花子", "lastName": "鈴木" } ### Response #### Success Response (200) - **customerId** (string) - The ID of the created customer. ``` -------------------------------- ### GET /pos/customers Source: https://github.com/feedforce/smaregi-platform-api/blob/main/rust/docs/DefaultApi.md Retrieve a list of customer information. ```APIDOC ## GET /pos/customers ### Description Retrieve a list of customer information. ### Method GET ### Endpoint `/{contract_id}/pos/customers` ### Parameters #### Path Parameters - **contract_id** (String) - Required - The contract ID. ### Response #### Success Response (200) - **CustomersResponse** (CustomersResponse) - A list of customer information. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Instantiate GetStoresResponseItem in Ruby Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/GetStoresResponseItem.md This Ruby code demonstrates how to instantiate the GetStoresResponseItem object. It initializes all properties to null, serving as a template for creating or representing store data. ```ruby require 'openapi_client' instance = OpenapiClient::GetStoresResponseItem.new( store_id: null, store_code: null, store_name: null, store_abbr: null, print_receipt_store_name: null, print_stock_receipt_store_name: null, division: null, post_code: null, address: null, phone_number: null, fax_number: null, mail_address: null, homepage: null, temp_tran_mail_address: null, price_change_flag: null, sell_division: null, sum_proc_division: null, sum_date_change_time: null, sum_ref_column: null, point_not_applicable: null, tax_free_division: null, max_bundle_product_count: null, max_discount_rate: null, carriage_display_flag: null, terminal_adjustment_cash_flag: null, terminal_check_cash_flag: null, waiter_adjustment_division: null, saving_auto_division: null, saving_auto_price: null, cancel_setting_division: null, rounding_division: null, discount_rounding_division: null, card_company_select_division: null, gift_receipt_valid_days: null, tax_label_normal: null, tax_label_reduce: null, pause_flag: null, display_sequence: null, face_payment_use_division: null, ins_date_time: null, upd_date_time: null, point_condition: null, receipt_print_info: null ) ``` -------------------------------- ### GET /pos/customers/point Source: https://github.com/feedforce/smaregi-platform-api/blob/main/rust/docs/DefaultApi.md Retrieve a list of customer points. ```APIDOC ## GET /pos/customers/point ### Description Retrieve a list of customer points. ### Method GET ### Endpoint `/{contract_id}/pos/customers/point` ### Parameters #### Path Parameters - **contract_id** (String) - Required - The contract ID. ### Response #### Success Response (200) - **CustomerPointList** (CustomerPointList) - A list of customer points. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### GET /{contract_id}/pos/stores Source: https://github.com/feedforce/smaregi-platform-api/blob/main/php/docs/Api/DefaultApi.md Retrieve a list of stores. ```APIDOC ## GET /{contract_id}/pos/stores ### Description Retrieve a list of stores. ### Method GET ### Endpoint `/{contract_id}/pos/stores` ### Parameters #### Path Parameters - **contract_id** (string) - Required - The contract ID. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - No specific response body described, typically indicates success. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Instantiate PointGivingDivision in Ruby Source: https://github.com/feedforce/smaregi-platform-api/blob/main/ruby/docs/PointGivingDivision.md Demonstrates how to create an instance of the PointGivingDivision class using the OpenAPI client library in Ruby. This is typically the first step when interacting with this part of the API. ```ruby require 'openapi_client' instance = OpenapiClient::PointGivingDivision.new() ``` -------------------------------- ### GET /{contract_id}/pos/coupons Source: https://github.com/feedforce/smaregi-platform-api/blob/main/php/docs/Api/DefaultApi.md Retrieve a list of coupons. ```APIDOC ## GET /{contract_id}/pos/coupons ### Description Retrieve a list of coupons. ### Method GET ### Endpoint `/{contract_id}/pos/coupons` ### Parameters #### Path Parameters - **contract_id** (string) - Required - The contract ID. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - No specific response body described, typically indicates success. #### Response Example ```json { "example": "response body" } ``` ```