### Start provision Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/customers.md Initiates the provisioning process for a customer with specified attributes. ```APIDOC ## Start provision ### Description Initiates the provisioning process for a customer with specified attributes. ### Method `postProvision(string $reference, ProvisionRequest $payload)` ### Parameters #### Path Parameters - **reference** (string) - Required - The customer reference. #### Request Body - **payload** (ProvisionRequest) - Required - An object containing provisioning details, including program and attributes. ### Request Example ```php 'MSCP', 'attributes' => [ [ 'name' => 'domain', 'value' => 'mydomain.onmicrosoft.com', ], ], ]; $client->postProvision($reference, new ProvisionRequest($payload)); ``` ``` -------------------------------- ### Install Public API Client with Composer Source: https://github.com/arrowsphere/public-api-client/blob/master/README.md Install the latest version of the public-api-client package using Composer. ```bash $ composer require arrowsphere/public-api-client ``` -------------------------------- ### Start migration Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/customers.md Initiates the migration process for a customer with specified attributes. ```APIDOC ## Start migration ### Description Initiates the migration process for a customer with specified attributes. ### Method `postMigration(string $reference, MigrationRequest $payload)` ### Parameters #### Path Parameters - **reference** (string) - Required - The customer reference. #### Request Body - **payload** (MigrationRequest) - Required - An object containing migration details, including program and attributes. ### Request Example ```php 'MSCP', 'attributes' => [ [ 'name' => 'domain', 'value' => 'mydomain.onmicrosoft.com', ], ], ]; $client->postMigration($reference, new MigrationRequest($payload)); ``` ``` -------------------------------- ### Start Provision Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/customers.md Initiate the provisioning process for a customer. Requires the customer reference, program, and specific attributes for the provisioning request. ```php $reference = 'XSP12345'; $payload = [ 'program' => 'MSCP', 'attributes' => [ [ 'name' => 'domain', 'value' => 'mydomain.onmicrosoft.com', ], ], ]; $client->postProvision($reference, new ProvisionRequest($payload)); ``` -------------------------------- ### PHPDoc Example for Method Source: https://github.com/arrowsphere/public-api-client/blob/master/AGENTS.md Example of PHPDoc block for a method, including parameters, return type, and exceptions. ```php /** * Does something useful. * * @param string $bar * * @return string * * @throws PublicApiClientException */ public function doSomething(string $bar): string ``` -------------------------------- ### PHPDoc Example for Property Source: https://github.com/arrowsphere/public-api-client/blob/master/AGENTS.md Example of PHPDoc block for a private string property. ```php /** * @var string */ private string $foo; ``` -------------------------------- ### Start Migration Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/customers.md Begin the migration process for a customer. This method takes the customer reference, program, and migration-specific attributes. ```php $reference = 'XSP12345'; $payload = [ 'program' => 'MSCP', 'attributes' => [ [ 'name' => 'domain', 'value' => 'mydomain.onmicrosoft.com', ], ], ]; $client->postMigration($reference, new MigrationRequest($payload)); ``` -------------------------------- ### Find Licenses (v0.2) Source: https://github.com/arrowsphere/public-api-client/blob/master/UPGRADING.md Example of how to find licenses using the v0.2 version of the client. Note the use of string constants for field names. ```php setUrl(URL) ->setApiKey(API_KEY); $searchResult = $client->find([ LicensesClient::DATA_KEYWORD => 'microsoft 365', LicensesClient::DATA_KEYWORDS => [ License::COLUMN_END_DATE => [ LicensesClient::KEYWORDS_VALUES => [ '2021-03-01T00:00:00.000Z', '2021-03-31T23:59:59.000Z', ], LicensesClient::KEYWORDS_OPERATOR => LicensesClient::OPERATOR_BETWEEN, ] ], LicensesClient::DATA_FILTERS => [ License::COLUMN_IS_ENABLED => true, ], LicensesClient::DATA_SORT => [ License::COLUMN_CUSTOMER_NAME => LicensesClient::SORT_DESCENDING, ], LicensesClient::DATA_HIGHLIGHT => true, ]); ``` -------------------------------- ### Get provision situation Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/customers.md Retrieves the provisioning status for a given customer reference. ```APIDOC ## Get provision situation ### Description Retrieves the provisioning status for a given customer reference and program. ### Method `getProvision(string $reference, string $program)` ### Parameters #### Query Parameters - **reference** (string) - Required - The customer reference. - **program** (string) - Required - The program identifier (e.g., 'MSCP'). ### Request Example ```php getProvision($reference, 'MSCP'); echo "Provision status is: " . $provision->getStatus() . PHP_EOL; ``` ### Response #### Success Response (200) - **provision** (ProvisionResponse) - A ProvisionResponse entity containing the status of the provision. ``` -------------------------------- ### Get Provision Situation Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/customers.md Retrieve the provisioning status for a given customer reference and program. This method returns a ProvisionResponse entity. ```php $reference = 'XSP12345'; $provision = $client->getProvision($reference, 'MSCP'); echo "Provision status is: " . $provision->getStatus() . PHP_EOL; ``` -------------------------------- ### List and Get Offers (Legacy) Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-offer.md These legacy methods allow listing all offers for a given service or retrieving a specific offer using its service reference and SKU. Note that the serviceRef and sku parameters are case-sensitive. ```php setUrl(URL) ->setApiKey(API_KEY); $offers = $client->getOffers('SAAS', 'microsoft', 'MS-0A-O365-BUSINESS'); foreach ($offers as $offer) { echo $offer->getName() . PHP_EOL; } $offer = $client->getOffer('SAAS', 'microsoft', 'MS-0A-O365-BUSINESS', '031C9E47-4802-4248-838E-778FB1D2CC05'); echo $offer->getName() . PHP_EOL; ``` -------------------------------- ### Initialize and Use OrdersClient to Get Orders Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/orders.md Initializes the OrdersClient with URL and API key, then uses it to fetch orders based on provided filters. Handles pagination automatically. ```php setUrl(URL) ->setApiKey(API_KEY); $payload = [ 'program' => 'MSC', 'from' => '2024-12-01', 'sortBy' => 'dateCreation', 'orderBy' => 'asc', ]; $filter = new OrdersFilters($payload); $allOrders = $client->getOrders($filter); foreach ($allOrders as $order){ echo $order->getOrderReference(); } ``` -------------------------------- ### Find Licenses (v0.3) Source: https://github.com/arrowsphere/public-api-client/blob/master/UPGRADING.md Example of how to find licenses using the v0.3 version of the client. This version uses the LicenseFindFieldEnum for prefixed field names. ```php setUrl(URL) ->setApiKey(API_KEY); $searchResult = $client->find([ LicensesClient::DATA_KEYWORD => 'microsoft 365', LicensesClient::DATA_KEYWORDS => [ LicenseFindFieldEnum::LICENSE_END_DATE => [ LicensesClient::KEYWORDS_VALUES => [ '2021-03-01T00:00:00.000Z', '2021-03-31T23:59:59.000Z', ], LicensesClient::KEYWORDS_OPERATOR => LicensesClient::OPERATOR_BETWEEN, ] ], LicensesClient::DATA_FILTERS => [ LicenseFindFieldEnum::LICENSE_IS_ENABLED => true, ], LicensesClient::DATA_SORT => [ LicenseFindFieldEnum::LICENSE_CUSTOMER_NAME => LicensesClient::SORT_DESCENDING, ], LicensesClient::DATA_HIGHLIGHT => true, ]); ``` -------------------------------- ### Get Specific Offer Details Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-offer.md Use this endpoint to retrieve detailed information about a single offer by its classification, program, and SKU. Ensure your API key and URL are correctly configured. ```php setUrl(URL) ->setApiKey(API_KEY); $offer = $client->getOfferDetails('SAAS', 'microsoft', '031C9E47-4802-4248-838E-778FB1D2CC05'); echo $offer->getName() . PHP_EOL; ``` -------------------------------- ### GetConfigs Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/licenses.md Retrieves all configurations for a specific customer's license. This endpoint is used by xSP to get up-to-date information pertaining to a customer's license configuration. It requires the desired license reference and partner reference. ```APIDOC ## GetConfigs ### Description Retrieves all configurations for a specific customer's license. ### Method `LicensesClient::getConfigs(string $licenseReference)` ### Parameters #### Path Parameters - **licenseReference** (string) - Required - The reference of the license. ### Response Returns a `Generator` yielding `Config` entities. - `getScope()`: returns the scope of this configuration - `getName()`: returns the name of the configuration - `getState()`: returns one of the 3 possible states which are `disabled`, `enabled` and `pending` ``` -------------------------------- ### Initialize and Use OrdersClient to Get Orders by Page Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/orders.md Initializes the OrdersClient and retrieves a specific page of orders using filters and a page number. Allows access to pagination details and order data for the requested page. ```php setUrl(URL) ->setApiKey(API_KEY); $payload = [ 'program' => 'MSC', 'from' => '2024-12-01', 'sortBy' => 'dateCreation', 'orderBy' => 'asc', ]; $filter = new OrdersFilters($payload); $ordersResponse = $client->getOrdersPage($filter, 3); echo $ordersResponse->getPagination()->getTotal(); echo $ordersResponse->getPagination()->getTotalPage(); echo $ordersResponse->getPagination()->getCurrentPage(); foreach ($ordersResponse->getOrders() as $order){ echo $order->getOrderReference(); } ``` -------------------------------- ### Initialize PreferencesClient Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/billing-preferences.md Instantiate the PreferencesClient and set the URL and API key. Ensure you replace the placeholder URL and API key with your actual credentials. ```php setUrl(URL) ->setApiKey(API_KEY); ``` -------------------------------- ### Get Order Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/orders.md Retrieves an order based on its reference through the PublicAPI endpoint (GET /orders/{orderReference}). Accepts the order reference and returns the Order object. ```APIDOC ## GET /orders/{orderReference} ### Description Retrieves an order by its reference. ### Method GET ### Endpoint /orders/{orderReference} ### Parameters #### Path Parameters - **orderReference** (string) - Required - The reference of the order to retrieve. ### Request Example ```php $order = $client->getOrder('XSPO12345'); ``` ### Response #### Success Response (200) - **Order** (object) - The retrieved order details. ``` -------------------------------- ### Initialize CustomersClient Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/customers.md Instantiate the CustomersClient and set the URL and API key. Ensure you replace placeholder values with your actual credentials. ```php setUrl(URL) ->setApiKey(API_KEY); ``` -------------------------------- ### LicensesClient - Find, Get Configs, Update Configs, and Get Predictions Source: https://context7.com/arrowsphere/public-api-client/llms.txt The LicensesClient enables searching for active license subscriptions, retrieving and updating license configurations, and fetching consumption predictions. ```APIDOC ## LicensesClient — Search and manage licenses The `LicensesClient` searches active license subscriptions with rich filtering (keywords, date ranges, comparisons, exclusions), retrieves license configs, updates configs, and fetches consumption predictions. The `find()` method returns `LicenseOfferFindResult` objects combining both the license and its associated current offer data. ### Method `find(array $params = [])` ### Description Searches for active license subscriptions with advanced filtering options. ### Parameters #### Query Parameters - **`LicensesClient::DATA_KEYWORD`** (string) - A general keyword to search for. - **`LicensesClient::DATA_KEYWORDS`** (array) - Detailed keyword searches with operators and values. Example: `[LicenseFindFieldEnum::LICENSE_END_DATE => [LicensesClient::KEYWORDS_VALUES => ['2021-03-01T00:00:00.000Z', '2021-03-31T23:59:59.000Z'], LicensesClient::KEYWORDS_OPERATOR => LicensesClient::OPERATOR_BETWEEN]]`. - **`LicensesClient::DATA_FILTERS`** (array) - Filters to apply. Example: `[LicenseFindFieldEnum::LICENSE_IS_ENABLED => true]`. - **`LicensesClient::DATA_EXCLUSION_FILTERS`** (array) - Filters to exclude results. Example: `[LicenseFindFieldEnum::LICENSE_WARNINGS => 'PEC ratio issue']`. - **`LicensesClient::DATA_SORT`** (array) - Sorting criteria. Example: `[LicenseFindFieldEnum::LICENSE_CUSTOMER_NAME => LicensesClient::SORT_DESCENDING]`. - **`LicensesClient::DATA_HIGHLIGHT`** (bool) - Whether to highlight search results. ### Response #### Success Response `LicenseOfferFindResult` objects containing license and associated offer data. ### Method `getConfigs(string $licenseId)` ### Description Retrieves the configurations for a given license ID. ### Parameters #### Path Parameters - **`licenseId`** (string) - The ID of the license. ### Response #### Success Response An array of `Config` objects. ### Method `updateConfig(string $licenseId, Config $config)` ### Description Updates the configuration for a specific license. ### Parameters #### Path Parameters - **`licenseId`** (string) - The ID of the license. #### Request Body - **`config`** (Config) - The configuration object to update. ### Response #### Success Response The updated `Config` object. ### Method `getPredictions(string $licenseId)` ### Description Fetches consumption predictions for a given license ID. ### Parameters #### Path Parameters - **`licenseId`** (string) - The ID of the license. ### Response #### Success Response A `Predictions` object containing currency and other prediction details. ``` -------------------------------- ### Instantiate and Configure Cart Client Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/cart.md Demonstrates how to instantiate the CartClient and configure it with a URL and access token. Ensure you replace 'your-url-to-arrowsphere.example.com' and 'your access token' with your actual credentials. ```php setUrl(URL) ->setIdToken(ACCESS_TOKEN); ``` -------------------------------- ### Get Order History Source: https://context7.com/arrowsphere/public-api-client/llms.txt Retrieves the history of a specific order. ```APIDOC ## GET /orders/{orderReference}/history ### Description Retrieves the event history for a specific order. ### Method GET ### Endpoint /orders/{orderReference}/history ### Parameters #### Path Parameters - **orderReference** (string) - Required - The reference of the order to retrieve history for. ### Request Example ```php foreach ($client->getOrderHistory('XSPO12345') as $event) { echo $event->getDateAction() . ' [' . $event->getUser() . ']: ' . $event->getAction() . ' - ' . $event->getDescription() . PHP_EOL; } ``` ### Response #### Success Response (200) An iterable collection of order history event objects. #### Response Example ```json [ { "dateAction": "2024-01-15T10:00:00Z", "user": "admin@example.com", "action": "created", "description": "Order created successfully." } ] ``` ``` -------------------------------- ### Initialize and Use SupportClient in PHP Source: https://context7.com/arrowsphere/public-api-client/llms.txt Shows how to set up the SupportClient for managing support issues. Remember to replace placeholders with your actual ArrowSphere URL and API key. The client supports listing topics, creating issues, adding comments and attachments, and closing issues. ```php setUrl('https://your-url-to-arrowsphere.example.com') ->setApiKey('your-api-key'); // List available support topics $topics = $client->listTopics(); foreach ($topics as $topic) { echo $topic->getId() . ': ' . $topic->getLabel() . ($topic->getPremium() ? ' [premium]' : '') . PHP_EOL; } // Create a new support issue $issue = $client->createIssue([ 'title' => 'Cannot reset Microsoft password', 'topicId' => 1, 'description' => 'I need to reset the admin password for tenant ABC.', 'endCustomerRef' => 'XSP12345', 'language' => 'en', 'priority' => 2, 'offer' => [ 'sku' => '031C9E47-4802-4248-838E-778FB1D2CC05', 'name' => 'Microsoft 365 Business Premium', 'vendor' => 'Microsoft', ], ]); echo 'Issue created: #' . $issue->getId() . PHP_EOL; // Add a comment and an attachment $commentId = $client->addComment($issue->getId(), [ 'body' => 'Here is the tenant ID for reference: AABBCCDD-1234-5678-ABCD', ]); $attachmentId = $client->addAttachment($issue->getId(), [ 'fileName' => 'screenshot.png', 'mimeType' => 'image/png', 'content' => base64_encode(file_get_contents('/tmp/screenshot.png')), ]); // List all issues and close one $issues = $client->listIssues(); foreach ($issues as $openIssue) { echo '#' . $openIssue->getId() . ' [' . $openIssue->getStatus() . '] ' . $openIssue->getTitle() . PHP_EOL; } $client->closeIssue($issue->getId()); ``` -------------------------------- ### Instantiate and Use Monitoring Client Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/monitoring.md Instantiate the `MonitoringClient` directly, set the URL and API key, and then create a report. Ensure the `Report` entity is correctly populated with its fields. ```php setUrl(URL) ->setApiKey(API_KEY); $report = $client->createReport([new Report([ 'body' => ["blockedURL"=> 'xxx'], 'type' => "csp-violation", 'url' => "xxx/home", 'userAgent' => "chrome" ])]); ``` -------------------------------- ### Initialization Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/customers.md Demonstrates how to initialize the CustomersClient with your ArrowSphere URL and API key. ```APIDOC ## Initialization The "customers" client is simply called `CustomersClient`. You can get it through the main entry point `PublicApiClient` and its method `getCustomersClient()`, or instantiate it directly: ```php setUrl(URL) ->setApiKey(API_KEY); ``` ``` -------------------------------- ### Instantiate and Use Subscription Client Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/subscription.md Instantiate the SubscriptionClient, set the URL and API key, and then validate a subscription using its reference. ```php setUrl(URL) ->setApiKey(API_KEY); $client->validateSubscription('XSPS12345'); ``` -------------------------------- ### Update Order Source: https://context7.com/arrowsphere/public-api-client/llms.txt Updates an existing order, for example, the purchase order number. ```APIDOC ## PUT /orders/{orderReference} ### Description Updates an existing order. Currently supports updating the purchase order number. ### Method PUT ### Endpoint /orders/{orderReference} ### Parameters #### Path Parameters - **orderReference** (string) - Required - The reference of the order to update. #### Request Body - **poNumber** (string) - Required - The new purchase order number. ### Request Example ```php $client->updateOrder('XSPO12345', 'PO-2024-002'); ``` ### Response #### Success Response (200) Indicates successful update. The response body may be empty or contain a success message. #### Response Example ```json { "message": "Order updated successfully." } ``` ``` -------------------------------- ### Get a specific statement Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/billing-statements.md Retrieve a single billing statement by its unique reference. ```APIDOC ## Get a specific statement You can get a specicif statement by calling the `getStatement()` method. This method returns an instance of the `Statement` entity. Example: ```php getStatement($statementReference); echo $statement->getReference() . ': ' . $statement->getStatus() . PHP_EOL; ``` ``` -------------------------------- ### Get Orders Page Source: https://context7.com/arrowsphere/public-api-client/llms.txt Retrieves a specific page of orders along with pagination metadata. ```APIDOC ## GET /orders/page/{pageNumber} ### Description Retrieves a specific page of orders and includes pagination details in the response. ### Method GET ### Endpoint /orders/page/{pageNumber} ### Parameters #### Path Parameters - **pageNumber** (int) - Required - The page number to retrieve. #### Query Parameters - **filter** (OrdersFilters) - Required - An object containing filters such as program, date range, sorting, and ordering. ### Request Example ```php $filter = new OrdersFilters([ 'program' => 'MSC', 'from' => '2024-01-01', ]); $response = $client->getOrdersPage($filter, 2); ``` ### Response #### Success Response (200) An object containing pagination metadata and a list of orders for the requested page. #### Response Example ```php { "pagination": { "total": 100, "totalPage": 10, "currentPage": 2 }, "orders": [ { "orderReference": "XSPO12346", "status": "processing" } ] } ``` ``` -------------------------------- ### Initialize and Use AddonClient Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-addon.md Initializes the AddonClient with your ArrowSphere URL and API key. Demonstrates fetching all add-ons for a specific offer and then retrieving a single add-on by its SKU. ```php setUrl(URL) ->setApiKey(API_KEY); $addons = $client->getAddons( 'SAAS', 'microsoft', 'MS-0A-O365-BUSINESS', '031C9E47-4802-4248-838E-778FB1D2CC05' ); foreach ($addons as $addon) { echo $addon->getName() . PHP_EOL; } $addon = $client->getAddon( 'SAAS', 'microsoft', 'MS-0A-O365-BUSINESS', '031C9E47-4802-4248-838E-778FB1D2CC05', '0AA62437-B86A-48BD-AE51-85C8DCEC5E6D' ); echo $addon->getName() . PHP_EOL; ``` -------------------------------- ### Get Services Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-service.md Retrieves a list of services based on classification and program. The parameters are case-insensitive. ```APIDOC ## getServices ### Description Retrieves a list of services filtered by classification and program. ### Method `getServices(string $classification, string $program)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```php $services = $client->getServices('SAAS', 'microsoft'); ``` ### Response #### Success Response (200) - `Generator`: Yields instances of the `Service` entity. #### Response Example ```php foreach ($services as $service) { echo $service->getName() . PHP_EOL; } ``` ``` -------------------------------- ### Initialize and Use OrdersClient Source: https://context7.com/arrowsphere/public-api-client/llms.txt Initializes the OrdersClient with API credentials and demonstrates listing orders with filters and pagination. ```php setUrl('https://your-url-to-arrowsphere.example.com') ->setApiKey('your-api-key'); // List orders with pagination handled automatically $filter = new OrdersFilters([ 'program' => 'MSC', 'from' => '2024-01-01', 'sortBy' => 'dateCreation', 'orderBy' => 'asc', ]); foreach ($client->getOrders($filter) as $order) { echo $order->getOrderReference() . ': ' . $order->getStatus() . PHP_EOL; } // Get a specific page with pagination metadata $response = $client->getOrdersPage($filter, 2); echo 'Total: ' . $response->getPagination()->getTotal() . PHP_EOL; echo 'Pages: ' . $response->getPagination()->getTotalPage() . PHP_EOL; echo 'Current: ' . $response->getPagination()->getCurrentPage() . PHP_EOL; ``` -------------------------------- ### Initialization Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/billing-preferences.md Instantiate the PreferencesClient by providing your ArrowSphere URL and API key. ```APIDOC ## Initialization You can initialize the `PreferencesClient` by setting the URL and API key. ### Method ```php (new PreferencesClient()) ->setUrl(URL) ->setApiKey(API_KEY); ``` ### Parameters - **URL** (string): Your ArrowSphere URL. - **API_KEY** (string): Your API key from ArrowSphere. ``` -------------------------------- ### Get One Notification Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/notification.md Retrieves a specific notification by its ID. This method returns a single NotificationEntity. ```APIDOC ## GetOneNotification ### Description The "getOneNotification" endpoint allows the user to get a specific notification. ### Method GET (assumed based on operation) ### Endpoint /notifications/{id} (assumed based on operation) ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the notification. ### Response #### Success Response (200) - **NotificationEntity** - An object representing the retrieved notification. ``` -------------------------------- ### Get Whoami Information Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/general-whoami.md This operation retrieves the authenticated user's company and contact details. ```APIDOC ## GET /whoami ### Description Retrieves the authenticated user's company and contact details. ### Method GET ### Endpoint /whoami ### Response #### Success Response (200) - **companyName** (string) - The name of the company. - **addressLine1** (string) - The first line of the company's address. - **addressLine2** (string) - The second line of the company's address. - **zip** (string) - The postal code of the company's address. - **city** (string) - The city of the company's address. - **countryCode** (string) - The country code of the company's address. - **state** (string) - The state of the company's address. - **receptionPhone** (string) - The company's reception phone number. - **websiteUrl** (string) - The company's website URL. - **emailContact** (string) - The company's contact email address. - **headcount** (string) - The number of employees (can be null). - **taxNumber** (string) - The company's tax number. - **reference** (string) - A reference identifier for the company. - **ref** (string) - Another reference identifier for the company. - **billingId** (string) - The billing ID for the company. - **internalReference** (string) - An internal reference for the company. ### Request Example ```php setUrl(URL) ->setApiKey(API_KEY); $whoAmI = $client->getWhoami(); echo $whoAmI->getCompanyName() . PHP_EOL; ``` ``` -------------------------------- ### Initialize PublicApiClient Source: https://context7.com/arrowsphere/public-api-client/llms.txt Instantiate the main entry point for the API client. Set the API URL, API key, and any default headers required for authentication and communication. ```php setUrl('https://your-url-to-arrowsphere.example.com') ->setApiKey('your-api-key') ->setDefaultHeaders(['X-Custom-Header' => 'value']); // Access sub-clients $whoamiClient = $client->getWhoamiClient(); $offerClient = $client->getOfferClient(); $licensesClient = $client->getLicensesClient(); $ordersClient = $client->getOrdersClient(); $customersClient = $client->getCustomersClient(); $cartClient = $client->getCartClient(); $statementsClient = $client->getStatementsClient(); $campaignsClient = $client->getCampaignsClient(); $analyticsClient = $client->getAnalyticsClient(); $supportClient = $client->getSupportClient(); ``` -------------------------------- ### Get Offer Details Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-offer.md Retrieves detailed information about a specific offer using its classification, program, and SKU. ```APIDOC ## Get Offer Details ### Description Retrieves detailed information about a particular offer. ### Method GET (implied by client method) ### Endpoint (Not explicitly defined, inferred from client method) ### Parameters #### Path Parameters - **classification** (string) - Required - The classification of the offer (e.g., 'SAAS'). - **program** (string) - Required - The program the offer belongs to (e.g., 'microsoft'). - **sku** (string) - Required - The unique SKU of the offer (e.g., '031C9E47-4802-4248-838E-778FB1D2CC05'). ### Request Example ```php $offer = $client->getOfferDetails('SAAS', 'microsoft', '031C9E47-4802-4248-838E-778FB1D2CC05'); ``` ### Response #### Success Response (200) Returns an `Offer` entity containing detailed information about the offer. #### Response Example ```php // Assuming $offer is the result of getOfferDetails() echo $offer->getName() . PHP_EOL; ``` ``` -------------------------------- ### Instantiate and Use WhoamiClient Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/general-whoami.md Instantiate the WhoamiClient, set the URL and API key, and then retrieve the 'who am I' information. Access specific details like the company name from the returned object. ```php setUrl(URL) ->setApiKey(API_KEY); $whoAmI = $client->getWhoami(); echo $whoAmI->getCompanyName() . PHP_EOL; ``` -------------------------------- ### Get Classifications Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-classification.md This method retrieves a list of all available classifications. It returns a Generator that yields Classification entities. ```APIDOC ## getClassifications() ### Description Retrieves a list of all available classifications. ### Method `getClassifications()` ### Parameters None ### Response #### Success Response - `Generator`: Yields instances of the `Classification` entity. ### Request Example ```php setUrl(URL) ->setApiKey(API_KEY); $classifications = $client->getClassifications(); foreach ($classifications as $classification) { echo $classification->getName() . PHP_EOL; } ``` ### Response Example ```php // Example output for each classification yielded by the generator: // SAAS // IAAS // PAAS ``` ``` -------------------------------- ### Get a Specific Program Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-program.md Retrieves a single program based on its classification and program identifier. The parameters are case-insensitive. ```APIDOC ## GET /programs/{classification}/{program} ### Description Retrieves a specific program by its classification and program identifier. ### Method GET ### Endpoint /programs/{classification}/{program} ### Parameters #### Path Parameters - **classification** (string) - Required - The classification of the program (e.g., 'SAAS'). This parameter is case-insensitive. - **program** (string) - Required - The identifier of the program (e.g., 'microsoft'). This parameter is case-insensitive. ### Response #### Success Response (200) - **Program** - An instance of the `Program` entity. ``` -------------------------------- ### Instantiate and Use ProgramClient Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-program.md Instantiate the ProgramClient, set the URL and API key, and then retrieve and display program names. This client is used to interact with vendor programs. ```php setUrl(URL) ->setApiKey(API_KEY); $programs = $client->getPrograms('SAAS'); foreach ($programs as $program) { echo $program->getName() . PHP_EOL; } $program = $client->getProgram('SAAS', 'microsoft'); echo $program->getName() . PHP_EOL; ``` -------------------------------- ### Initialize and Use CampaignsClient in PHP Source: https://context7.com/arrowsphere/public-api-client/llms.txt Demonstrates how to initialize the CampaignsClient with API credentials and perform various campaign management operations. Ensure the URL and API key are correctly set for your ArrowSphere instance. ```php setUrl('https://your-url-to-arrowsphere.example.com') ->setApiKey('your-api-key'); // List all campaigns (returns raw JSON string) $allCampaigns = $client->getCampaigns(); // Get a specific campaign entity $campaign = $client->getCampaign('c925ec6e-e029-4146-8400-2867c7761743'); echo $campaign->getName() . ': ' . $campaign->getStartDate() . ' → ' . $campaign->getEndDate() . PHP_EOL; // Get currently active campaign for a location (V2) $active = $client->getActiveCampaignV2('MCP', 'XSP12345'); // Create a new campaign (returns JSON string) $newCampaignJson = $client->createCampaign('Q4 Microsoft Promotion', 'BANNER'); // Save (update) a campaign with full payload $savedJson = $client->saveCampaign('c925ec6e-e029-4146-8400-2867c7761743', $campaignPayloadJson); // Duplicate an existing campaign $duplicateJson = $client->duplicateCampaign('c925ec6e-e029-4146-8400-2867c7761743'); // Get upload URL for a campaign asset image $uploadUrlJson = $client->getCampaignAssetsUploadUrl('c925ec6e-e029-4146-8400-2867c7761743'); // Delete a campaign or a specific asset $client->deleteCampaign('c925ec6e-e029-4146-8400-2867c7761743'); $client->deleteAsset('c925ec6e-e029-4146-8400-2867c7761743', 'd8553daa-1d39-489e-89c0-3731c0d3ad0b'); ``` -------------------------------- ### Get All Families for a Vendor Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-family.md Retrieves a list of all families associated with a specific vendor. The vendor code is case-insensitive. ```APIDOC ## Get Families ### Description Retrieves all families for a given vendor. ### Method GET ### Endpoint /families ### Parameters #### Query Parameters - **vendorCode** (string) - Required - The vendor code (e.g., 'microsoft'). This parameter is case-insensitive. ### Response #### Success Response (200) - **families** (Generator) - A generator yielding `Family` entity instances. ``` -------------------------------- ### Get Addon Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-addon.md Retrieves a specific add-on by its SKU. This method returns a single Offer entity instance. ```APIDOC ## getAddon ### Description Retrieves a specific add-on using its SKU. ### Parameters #### Path Parameters - **classification** (string) - Required - The classification of the offer (e.g., 'SAAS'). - **program** (string) - Required - The program the offer belongs to (e.g., 'microsoft'). - **serviceRef** (string) - Required - The service reference of the offer (e.g., 'MS-0A-O365-BUSINESS'). This parameter is case-sensitive. - **sku** (string) - Required - The SKU of the offer (e.g., '031C9E47-4802-4248-838E-778FB1D2CC05'). This parameter is case-sensitive. - **addonSku** (string) - Required - The SKU of the add-on (e.g., '0AA62437-B86A-48BD-AE51-85C8DCEC5E6D'). This parameter is case-sensitive. ### Returns - An instance of the `Offer` entity. ``` -------------------------------- ### Get Service Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-service.md Retrieves a specific service using its classification, program, and service reference. The service reference is case-sensitive. ```APIDOC ## getService ### Description Retrieves a specific service by its classification, program, and service reference. ### Method `getService(string $classification, string $program, string $serviceRef)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```php $service = $client->getService('SAAS', 'microsoft', 'MS-0A-O365-BUSINESS'); ``` ### Response #### Success Response (200) - `Service`: An instance of the `Service` entity. #### Response Example ```php echo $service->getName() . PHP_EOL; ``` ``` -------------------------------- ### Run Psalm Source: https://github.com/arrowsphere/public-api-client/blob/master/AGENTS.md Execute Psalm for static analysis at level 3. ```bash make static-psalm ``` -------------------------------- ### Basic Public API Client Usage in PHP Source: https://github.com/arrowsphere/public-api-client/blob/master/README.md Initialize the client, set the API URL, API key, and default headers. Then, make a call to the 'Who Am I' endpoint and display the company name. ```php setUrl(URL) ->setApiKey(API_KEY) ->setDefaultHeaders([ 'myHeader' => 'myValue', ]) ; $whoami = $client->getWhoamiClient()->getWhoami(); echo "Hello " . $whoami->getCompanyName(); ``` -------------------------------- ### Get Monthly Consumption Analytics Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/consumption-monthlyAnalytics.md Fetches monthly consumption analytics data based on specified filters. All parameters are case-insensitive. ```APIDOC ## GET /analytics/monthly ### Description Retrieves a monthly summary of consumption data, broken down by vendor, marketplace, and classification. ### Method GET ### Endpoint /analytics/monthly ### Parameters #### Query Parameters - **month** (string) - Required - The dedicated month of the consumption (ex. '2020-05') - **classification** (array) - Optional - The classification (ex. 'SAAS') - **vendor** (array) - Optional - (ex. 'microsoft') - **marketPlace** (array) - Optional - The MarketPlace (ex. 'FR') - **license** (array) - Optional - The license reference (ex. 'XSP43') - **tag** (string) - Optional - The filter tag (ex. 'Pax8') ### Response #### Success Response (200) - **items** (array) - An array of monthly analytics items matching the filter criteria. ### Response Example ```json [ { "marketplace": "FR", "vendor": "Microsoft", "classification": "SAAS", "tag": "Pax8", "month": "2020-05", "localPrice": { "resellerBuyPrice": 1367.67, "arrowBuyPrice": 134.34, "endCustomerBuyPrice": 345.32, "listBuyPrice": 563.34, "currency": "EUR" }, "usdPrice": { "resellerBuyPrice": 1500.00, "arrowBuyPrice": 150.00, "endCustomerBuyPrice": 400.00, "listBuyPrice": 600.00, "currency": "USD" } } ] ``` ``` -------------------------------- ### Instantiate SupportClient Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/support.md Instantiate the SupportClient directly or retrieve it from PublicApiClient. Ensure to set the URL and API key for authentication. ```php setUrl(URL) ->setApiKey(API_KEY); ``` -------------------------------- ### Run Full Test Suite Source: https://github.com/arrowsphere/public-api-client/blob/master/AGENTS.md Execute all tests in the project using PHPUnit. ```bash vendor/bin/phpunit ``` -------------------------------- ### getOrderHistory Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/orders.md Retrieves the order history for a given order reference. This method interacts with the PublicAPI endpoint `get /orders/{orderReference}/history`. ```APIDOC ## GET /orders/{orderReference}/history ### Description Retrieves the order history for a specific order. ### Method GET ### Endpoint `/orders/{orderReference}/history` ### Parameters #### Path Parameters - **orderReference** (string) - Required - The reference of the order for which to retrieve history. ### Request Example (No request body for GET request) ### Response #### Success Response (200) - **OrderHistory** (array) - An array of order history entries. #### Response Example (Example response structure would be detailed here if provided in source) ``` -------------------------------- ### Instantiate and Use ServiceClient Source: https://github.com/arrowsphere/public-api-client/blob/master/doc/catalog-service.md Instantiate the ServiceClient, set the URL and API key, and then retrieve and process services. The getServices method returns a Generator yielding Service entities. ```php setUrl(URL) ->setApiKey(API_KEY); $services = $client->getServices('SAAS', 'microsoft'); foreach ($services as $service) { echo $service->getName() . PHP_EOL; } $service = $client->getService('SAAS', 'microsoft', 'MS-0A-O365-BUSINESS'); echo $service->getName() . PHP_EOL; ```