Api_Server::get_license()

get_license


Return Return

(mixed) false||array


Source Source

File: src/core/classes/class-api-server.php

	public static function get_license() {

		$cached_license = get_transient( 'automator_api_license' );

		if ( false !== $cached_license ) {
			return $cached_license;
		}

		$params = array(
			'endpoint' => 'v2/credits',
			'body'     => array(
				'action' => 'get_credits',
			),
		);

		try {
			$license = self::api_call( $params );
			set_transient( 'automator_api_license', $license['data'], HOUR_IN_SECONDS );
			return $license['data'];
		} catch ( \Exception $e ) {
			throw new \Exception( __( 'Unable to fetch the license: ', 'uncanny-automator' ) . $e->getMessage() );
		}
	}