Skip to content

bsgworld/php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BSG One-API PHP Client

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Installation

composer require bsgworld/php-sdk

Requirements

  • PHP 7.4 or later
  • Guzzle HTTP client (installed automatically)

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new BSG\Api\V2\Api\AuthApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$login_request = new \BSG\Api\V2\Model\LoginRequest([
    'api_key' => 'live_XXXXXXXXXXXXXXXXXXXX',
]);
try {
    $result = $apiInstance->login($login_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthApi->login: ', $e->getMessage(), PHP_EOL;
}

$token = $result->getBearer();

// Configure Bearer (JWT) authorization: ExternalAuth
$config = BSG\Api\V2\Configuration::getDefaultConfiguration()->setAccessToken($token);


$apiInstance = new BSG\Api\V2\Api\CampaignSMSApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sms_send_request = new \BSG\Api\V2\Model\SmsSendRequest([
    'phones' => [
        0 => [
            'number' => 380661231231,
        ],
    ],
    'sender' => 'Vet klinika',
    'text' => 'test',
]);
try {
    $result = $apiInstance->smsSend($sms_send_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CampaignSMSApi->smsSend: ', $e->getMessage(), PHP_EOL;
}

Endpoints

All URIs are relative to https://one-api.bsg.world

Class Method HTTP request Description
AccountSettingsApi accountSettingsGet GET /api/settings/address-book-fields/{id} Get settings value
AuthApi login POST /api/auth/login Receive JWT token
AuthApi refreshToken POST /api/auth/refresh Refresh JWT token
BalanceApi accountBalance GET /api/accounts/balance Get balance
BalanceApi accountTariffs GET /api/accounts/tariff Get tariffs
CampaignApi campaign GET /api/campaigns/{id} Get campaign info
CampaignApi campaignDetails GET /api/campaigns/{id}/detail Get campaign details
CampaignApi campaignPrice POST /api/campaigns/price Calculate campaign price
CampaignApi campaignStop PATCH /api/campaigns/{id}/stop Cancel campaign
CampaignApi campaigns GET /api/campaigns List of campaigns
CampaignRCSApi rcsSend POST /api/campaigns/rcs/send Send RCS message
CampaignRCSApi rcsSendGroups POST /api/campaigns/rcs/send-groups Send RCS message to contact list
CampaignRCSApi rcsSingle POST /api/messages/rcs/send Send single RCS message
CampaignSMSApi smsSend POST /api/campaigns/sms/send Send SMS campaign
CampaignSMSApi smsSendGroups POST /api/campaigns/sms/send-groups Send SMS to contact list
CampaignSMSApi smsSendIndividual POST /api/campaigns/sms/send-individual Send SMS with different text
CampaignWhatsAppApi whatsappCampaignSend POST /api/campaigns/whatsapp/send
CampaignWhatsAppApi whatsappSingle POST /api/messages/whatsapp/send Send single WhatsApp message
Class2FAOTPApi cancelOtp POST /api/2fa/authentications/{id}/cancel Cancel the authentication session
Class2FAOTPApi otpList GET /api/2fa/authentications List of authentication sessions
Class2FAOTPApi resendOtp POST /api/2fa/authentications/otp/{id}/resend Resend the one-time code
Class2FAOTPApi sendOtp POST /api/2fa/authentications/otp Send One-time password
Class2FAOTPApi statusOtp GET /api/2fa/authentications/{id} Check authentication status
Class2FAOTPApi verifyOtp POST /api/2fa/authentications/otp/{id}/verify Check one-time Code
Class2FATemplatesApi otpTemplate GET /api/2fa/authentications/templates/{templateId} Get message template
Class2FATemplatesApi otpTemplateCreate POST /api/2fa/authentications/templates Create a message template
Class2FATemplatesApi otpTemplateDelete DELETE /api/2fa/authentications/templates/{templateId} Delete a message template
Class2FATemplatesApi otpTemplateList GET /api/2fa/authentications/templates List of message templates
ContactApi contact GET /api/contacts/{id} Get contact by ID
ContactApi contactCreate POST /api/contacts Create a contact
ContactApi contactDelete DELETE /api/contacts/{id} Delete contact
ContactApi contactUpdate PUT /api/contacts/{id} Update contact
ContactApi contacts GET /api/contacts List of contacts
ContactApi contactsDelete POST /api/contacts/delete Delete multiple contacts
ContactApi contactsSearch GET /api/contacts/search Search contacts
ContactFieldApi contactFieldCreate POST /api/contacts/fields Create contact field
ContactFieldApi contactFieldUpdate PATCH /api/contacts/fields/{id} Update contact field
ContactFieldApi contactFields GET /api/contacts/fields List of contact fields
ContactFieldApi contactFieldsDeleteBatch POST /api/contacts/fields/delete Delete contact fields by ids
ContactListApi contactList GET /api/groups/{id} Get list by id
ContactListApi contactListAttach POST /api/groups/attach Add contacts to the list
ContactListApi contactListCreate POST /api/groups Create list
ContactListApi contactListDelete DELETE /api/groups/{id} Delete list
ContactListApi contactListDetach POST /api/groups/detach Remove contacts from the list
ContactListApi contactListSearch GET /api/groups/search Search list
ContactListApi contactListUpdate PUT /api/groups/{id} Update list
ContactListApi contactLists GET /api/groups List of contact lists
EmailApi emailSend POST /api/email/send-emails Send Email
EmailApi emailTemplateSend POST /api/email/send-template-emails Send Email template
Internal2FAApi internal2faPrice GET /api/internal/2fa/authentications/full-price Show 2FA authentication full price
InternalCorePriceApi internalCorePricesByCountry GET /api/internal/core/prices/{countryCode} Get prices for country
InternalCorePriceApi internalCorePricesList GET /api/internal/core/prices Get price list for each country
InternalCountryApi internalCountriesList GET /api/internal/countries Get countries list
InternalCurrencyApi internalCurrenciesList GET /api/internal/currencies Get currencies list
InternalWstPriceApi internalWstPricesByCountry GET /api/internal/wst/prices/{countryCode} Get prices for country
InternalWstPriceApi internalWstPricesList GET /api/internal/wst/prices Get price list for each country
MessagesSMSApi smsMessagesFind GET /api/messages Find messages
SendersApi senderRequestLegal POST /api/senders/requests/legal Sender registration by a legal entity
SendersApi senderRequestNatural POST /api/senders/requests/natural Sender registration by an individual
SendersApi senderRequests GET /api/senders/requests/sms List of Sender Requests
SendersApi senders GET /api/senders List of Senders
ShortDomainsApi shortUrlsDomain GET /api/short-url/domains/{uuid} Get domain by uuid
ShortDomainsApi shortUrlsDomainCreate POST /api/short-url/domains Add domain
ShortDomainsApi shortUrlsDomainRemove DELETE /api/short-url/domains/{uuid} Remove domain
ShortDomainsApi shortUrlsDomainUpdate PUT /api/short-url/domains/{uuid} Update domain
ShortDomainsApi shortUrlsDomains GET /api/short-url/domains List of domains
ShortLinksApi shortUrlsClicks GET /api/short-url/clicks List of clicks
ShortLinksApi shortUrlsLink GET /api/short-url/links/{uuid}/statistics Get short link statistic
ShortLinksApi shortUrlsLinkCreate POST /api/short-url/links Create short link
ShortLinksApi shortUrlsLinkDelete DELETE /api/short-url/links/{uuid} Remove short link
ShortLinksApi shortUrlsLinkUpdate PUT /api/short-url/links/{uuid} Update short link
ShortLinksApi shortUrlsLinks GET /api/short-url/links List of short links
StopListApi stoplistAdd POST /api/stoplist/attach Add contacts to stop list
StopListApi stoplistItems GET /api/stoplist List the contacts of stop lists
StopListApi stoplistRemove POST /api/stoplist/detach Remove contacts from stop list
StopListApi stoplistSearch GET /api/stoplist/search Search contacts in Stop lists

Models

Authorization

Authentication schemes defined for the API:

ExternalAuth

  • Type: Bearer authentication (JWT)

InternalAuth

  • Type: Bearer authentication (JWT)

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: 2.0
    • Generator version: 7.12.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages